Просмотр исходного кода

org-pcomplete: Fix search string completion

* lisp/org-pcomplete.el (pcomplete/org-mode/tag): Use
  `org-get-heading'.
Nicolas Goaziou 7 лет назад
Родитель
Сommit
c25ac5ecd4
1 измененных файлов с 12 добавлено и 12 удалено
  1. 12 12
      lisp/org-pcomplete.el

+ 12 - 12
lisp/org-pcomplete.el

@@ -323,18 +323,18 @@ When completing for #+STARTUP, for example, this function returns
 (defun pcomplete/org-mode/searchhead ()
 (defun pcomplete/org-mode/searchhead ()
   "Complete against all headings.
   "Complete against all headings.
 This needs more work, to handle headings with lots of spaces in them."
 This needs more work, to handle headings with lots of spaces in them."
-  (while
-      (pcomplete-here
-       (save-excursion
-	 (goto-char (point-min))
-	 (let (tbl)
-	   (let ((case-fold-search nil))
-	     (while (re-search-forward org-todo-line-regexp nil t)
-	       (push (org-make-org-heading-search-string
-		      (match-string-no-properties 3))
-		     tbl)))
-	   (pcomplete-uniquify-list tbl)))
-       (substring pcomplete-stub 1))))
+  (while (pcomplete-here
+	  (save-excursion
+	    (goto-char (point-min))
+	    (let (tbl)
+	      (while (re-search-forward org-outline-regexp nil t)
+		(push (org-make-org-heading-search-string
+		       (org-get-heading t t t t))
+		      tbl))
+	      (pcomplete-uniquify-list tbl)))
+	  ;; When completing a bracketed link, i.e., "[[*", argument
+	  ;; starts at the star, so remove this character.
+	  (substring pcomplete-stub 1))))
 
 
 (defun pcomplete/org-mode/tag ()
 (defun pcomplete/org-mode/tag ()
   "Complete a tag name.  Omit tags already set."
   "Complete a tag name.  Omit tags already set."