org-pcomplete: Fix completion inside bracketed link

* lisp/org-pcomplete.el (pcomplete/org-mode/searchhead): Drop closing
brackets when completing inside bracketed link [[*head<point>]].

Reported-by: Carlos Pita <carlosjosepita2@gmail.com>
Link: https://orgmode.org/list/87r1cfvvd0.fsf@localhost
This commit is contained in:
Ihor Radchenko 2022-10-07 15:49:46 +08:00
parent fc8e375b9b
commit 1a62cd94cf
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 1 deletions

View File

@ -364,7 +364,11 @@ This needs more work, to handle headings with lots of spaces in them."
(pcomplete-uniquify-list tbl)))
;; When completing a bracketed link, i.e., "[[*", argument
;; starts at the star, so remove this character.
(substring pcomplete-stub 1))))
;; Also, if the completion is done inside [[*head<point>]],
;; drop the closing parentheses.
(replace-regexp-in-string
"\\]+$" ""
(substring pcomplete-stub 1)))))
(defun pcomplete/org-mode/tag ()
"Complete a tag name. Omit tags already set."