Function: reftex-select-item

reftex-select-item is an autoloaded and byte-compiled function defined in reftex-sel.el.gz.

Signature

(reftex-select-item PROMPT HELP-STRING KEYMAP &optional OFFSET CALL-BACK CB-FLAG)

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-sel.el.gz
;;;###autoload
(defun reftex-select-item ( prompt help-string keymap
                            &optional offset call-back cb-flag)
  ;; Select an item, using PROMPT.
  ;; The function returns a key indicating an exit status, along with a
  ;; data structure indicating which item was selected.
  ;; HELP-STRING contains help.  KEYMAP is a keymap with the available
  ;; selection commands.
  ;; OFFSET can be a label list item which will be selected at start.
  ;; When it is t, point will start out at the beginning of the buffer.
  ;; Any other value will cause restart where last selection left off.
  ;; When CALL-BACK is given, it is a function which is called with the index
  ;; of the element.
  ;; CB-FLAG is the initial value of that flag.
  (let ((reftex-select-prompt prompt)
        (reftex--help-string help-string)
        (reftex--call-back call-back)
        (reftex--cb-flag cb-flag)
        ev reftex-select-data reftex--last-data
        (selection-buffer (current-buffer)))

    (setq reftex-select-marked nil)

    (setq ev
          (catch 'myexit
            (save-window-excursion
              (setq truncate-lines t)

              ;; Find a good starting point
              (reftex-find-start-point
               (point-min) offset reftex-last-data reftex-last-line)
              (beginning-of-line 1)
              (setq-local reftex-last-follow-point (point))

      (unwind-protect
          (progn
            (use-local-map keymap)
            (add-hook 'pre-command-hook #'reftex-select-pre-command-hook nil t)
            (add-hook 'post-command-hook #'reftex-select-post-command-hook nil t)
            (princ reftex-select-prompt)
            (set-marker reftex-recursive-edit-marker (point))
            (recursive-edit))

        (set-marker reftex-recursive-edit-marker nil)
        (with-current-buffer selection-buffer
          (use-local-map nil)
          (remove-hook 'pre-command-hook #'reftex-select-pre-command-hook t)
          (remove-hook 'post-command-hook
                       #'reftex-select-post-command-hook t))
        ;; Kill the mark overlays
        (mapc (lambda (c) (delete-overlay (nth 1 c)))
              reftex-select-marked)))))

    (setq-local reftex-last-line
                (+ (count-lines (point-min) (point)) (if (bolp) 1 0)))
    (setq-local reftex-last-data reftex--last-data)
    (reftex-kill-buffer "*RefTeX Help*")
    (setq reftex-callback-fwd (not reftex-callback-fwd)) ;; ;-)))
    (message "")
    (list ev reftex-select-data reftex--last-data)))