Support completion boundaries when completing olp, tags, and agenda filter
* lisp/org-agenda.el (org-agenda-filter-completion-function): * lisp/org-refile.el (org-olpath-completing-read): * lisp/org-tags.el (org-tags-completion-function): Add support for orderless/flex completion styles that require boundaries operation.
This commit is contained in:
parent
01cc01fc13
commit
5fa0f0c6fe
|
@ -8194,10 +8194,12 @@ which see."
|
|||
(confirm (lambda (x) (stringp x)))
|
||||
(prefix "")
|
||||
(operator "")
|
||||
table)
|
||||
table
|
||||
begin)
|
||||
(when (string-match "^\\(.*\\([-+<>=]\\)\\)\\([^-+<>=]*\\)$" string)
|
||||
(setq prefix (match-string 1 string)
|
||||
operator (match-string 2 string)
|
||||
begin (match-beginning 3)
|
||||
string (match-string 3 string)))
|
||||
(cond
|
||||
((member operator '("+" "-" "" nil))
|
||||
|
@ -8214,6 +8216,11 @@ which see."
|
|||
(pcase flag
|
||||
(`t (all-completions string table confirm))
|
||||
(`lambda (assoc string table)) ;exact match?
|
||||
(`(boundaries . ,suffix)
|
||||
(let ((end (if (string-match "[-+<>=]" suffix)
|
||||
(match-string 0 suffix)
|
||||
(length suffix))))
|
||||
`(boundaries ,(or begin 0) . ,end)))
|
||||
(`nil
|
||||
(pcase (try-completion string table confirm)
|
||||
((and completion (pred stringp))
|
||||
|
|
|
@ -775,6 +775,14 @@ this function appends the default value from
|
|||
(concat string (substring r 0 (match-end 0)) f)
|
||||
x)))
|
||||
(all-completions string thetable predicate))))
|
||||
((eq (car-safe action) 'boundaries)
|
||||
;; See `completion-file-name-table'.
|
||||
(let ((start (or (and (string-match "/" string)
|
||||
(match-beginning 0 string))
|
||||
(length string)))
|
||||
(end (and (string-match "/" (cdr action))
|
||||
(match-beginning 0 (cdr action)))))
|
||||
`(boundaries ,start . ,end)))
|
||||
;; Exact match?
|
||||
((eq flag 'lambda) (assoc string thetable))))
|
||||
args)))
|
||||
|
|
|
@ -12020,13 +12020,20 @@ function is passed as a collection function to `completing-read',
|
|||
which see."
|
||||
(let ((completion-ignore-case nil) ;tags are case-sensitive
|
||||
(confirm (lambda (x) (stringp (car x))))
|
||||
(prefix ""))
|
||||
(prefix "")
|
||||
begin)
|
||||
(when (string-match "^\\(.*[-+:&,|]\\)\\([^-+:&,|]*\\)$" string)
|
||||
(setq prefix (match-string 1 string))
|
||||
(setq begin (match-beginning 2))
|
||||
(setq string (match-string 2 string)))
|
||||
(pcase flag
|
||||
(`t (all-completions string org-last-tags-completion-table confirm))
|
||||
(`lambda (assoc string org-last-tags-completion-table)) ;exact match?
|
||||
(`(boundaries . ,suffix)
|
||||
(let ((end (if (string-match "[-+:&,|]" suffix)
|
||||
(match-string 0 suffix)
|
||||
(length suffix))))
|
||||
`(boundaries ,(or begin 0) . ,end)))
|
||||
(`nil
|
||||
(pcase (try-completion string org-last-tags-completion-table confirm)
|
||||
((and completion (pred stringp))
|
||||
|
|
Loading…
Reference in New Issue