Function: pcomplete/org-mode/searchhead

pcomplete/org-mode/searchhead is a byte-compiled function defined in org-pcomplete.el.gz.

Signature

(pcomplete/org-mode/searchhead)

Documentation

Complete against all headings.

This needs more work, to handle headings with lots of spaces in them.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-pcomplete.el.gz
(defun pcomplete/org-mode/searchhead ()
  "Complete against all headings.
This needs more work, to handle headings with lots of spaces in them."
  (while (pcomplete-here
	  (save-excursion
	    (goto-char (point-min))
	    (let (tbl)
	      (while (re-search-forward org-outline-regexp nil t)
		;; Remove the leading asterisk from
		;; `org-link-heading-search-string' result.
		(push (substring (org-link-heading-search-string) 1) tbl))
	      (pcomplete-uniquify-list tbl)))
	  ;; When completing a bracketed link, i.e., "[[*", argument
	  ;; starts at the star, so remove this character.
          ;; Also, if the completion is done inside [[*head<point>]],
          ;; drop the closing parentheses.
          (replace-regexp-in-string
           "\\]+$" ""
	   (substring pcomplete-stub 1)))))