Function: org-goto-location

org-goto-location is an autoloaded and byte-compiled function defined in org-goto.el.gz.

Signature

(org-goto-location &optional BUF HELP)

Documentation

Let the user select a location in current buffer.

This function uses a recursive edit. It returns the selected position or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-goto.el.gz
;;; Public API

;;;###autoload
(defun org-goto-location (&optional _buf help)
  "Let the user select a location in current buffer.
This function uses a recursive edit.  It returns the selected
position or nil."
  (let ((isearch-mode-map org-goto-local-auto-isearch-map)
	(isearch-hide-immediately nil)
	(isearch-search-fun-function
	 (lambda () #'org-goto--local-search-headings))
	(help (or help org-goto-help)))
    (save-excursion
      (save-window-excursion
	(and (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
        (pop-to-buffer
         (condition-case nil
	     (make-indirect-buffer (current-buffer) "*org-goto*" t)
	   (error (make-indirect-buffer (current-buffer) "*org-goto*" t)))
         '(org-display-buffer-full-frame))
	(let (temp-buffer-show-function temp-buffer-show-hook)
	  (with-output-to-temp-buffer "*Org Help*"
	    (princ (format help (if org-goto-auto-isearch
				    "  Just type for auto-isearch."
				  "  n/p/f/b/u to navigate, q to quit.")))))
	(org-fit-window-to-buffer (get-buffer-window "*Org Help*"))
	(org-cycle-overview)
	(setq buffer-read-only t)
	(if (and (boundp 'org-goto-start-pos)
		 (integer-or-marker-p org-goto-start-pos))
	    (progn (goto-char org-goto-start-pos)
		   (when (org-invisible-p)
		     (org-fold-show-set-visibility 'lineage)))
	  (goto-char (point-min)))
	(let (org-special-ctrl-a/e) (org-beginning-of-line))
	(message "Select location and press RET")
	(use-local-map org-goto-map)
	(unwind-protect (recursive-edit)
          (when-let* ((window (get-buffer-window "*Org Help*" t)))
            (quit-window 'kill window)))))
    (when (get-buffer "*org-goto*") (kill-buffer "*org-goto*"))
    (cons org-goto-selected-point org-goto-exit-command)))