Function: rst-imenu-convert-cell

rst-imenu-convert-cell is a byte-compiled function defined in rst.el.gz.

Signature

(rst-imenu-convert-cell STN)

Documentation

Convert a STN to an Imenu index node and return it.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Imenu support

;; FIXME: Consider a key binding. A key binding needs to definitely switch on
;;        `which-func-mode' - i.e. `which-func-modes' must be set properly.

;; Based on ideas from Masatake YAMATO <yamato@redhat.com>.

(defun rst-imenu-convert-cell (stn)
  "Convert a STN to an Imenu index node and return it."
  (let ((ttl (rst-Stn-ttl stn))
	(children (rst-Stn-children stn))
	(pos (rst-Stn-get-title-beginning stn))
	(txt (rst-Stn-get-text stn ""))
	(pfx " ")
	(sfx "")
	name)
    (when ttl
      (let ((hdr (rst-Ttl-hdr ttl)))
	(setq pfx (char-to-string (rst-Hdr-get-char hdr)))
	(when (rst-Hdr-is-over-and-under hdr)
	  (setq sfx pfx))))
    ;; FIXME: Overline adornment characters need to be in front so they
    ;;        become visible even for long title lines. May be an additional
    ;;        level number is also useful.
    (setq name (format "%s%s%s" pfx txt sfx))
    (cons name ; The name of the entry.
	  (if children
	      (cons ; The entry has a submenu.
	       (cons name pos) ; The entry itself.
	       (mapcar #'rst-imenu-convert-cell children)) ; The children.
	    pos)))) ; The position of a plain entry.