contrib/lisp/org-contacts.el: Add a hook to allow users to plug completion functions
* contrib/lisp/org-contacts.el (org-contacts-complete-functions): A hook that contains the list of functions used to complete contacts. (org-contacts-message-complete-function): Use the new hook. Suggested by John Kitchin.
This commit is contained in:
parent
c1a17bf632
commit
36c6b30ec2
1 changed files with 8 additions and 3 deletions
|
@ -183,6 +183,12 @@ This overrides `org-email-link-description-format' if set."
|
||||||
:group 'org-contacts
|
:group 'org-contacts
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
|
(defcustom org-contacts-complete-functions
|
||||||
|
'(org-contacts-complete-group org-contacts-complete-name)
|
||||||
|
"List of functions used to complete contacts in `message-mode'."
|
||||||
|
:group 'org-contacts
|
||||||
|
:type 'hook)
|
||||||
|
|
||||||
;; Decalre external functions and variables
|
;; Decalre external functions and variables
|
||||||
(declare-function org-reverse-string "org")
|
(declare-function org-reverse-string "org")
|
||||||
(declare-function diary-ordinal-suffix "ext:diary-lib")
|
(declare-function diary-ordinal-suffix "ext:diary-lib")
|
||||||
|
@ -512,7 +518,6 @@ A group FOO is composed of contacts with the tag FOO."
|
||||||
(completion-table-case-fold completion-list
|
(completion-table-case-fold completion-list
|
||||||
(not org-contacts-completion-ignore-case))))))))
|
(not org-contacts-completion-ignore-case))))))))
|
||||||
|
|
||||||
|
|
||||||
(defun org-contacts-remove-ignored-property-values (ignore-list list)
|
(defun org-contacts-remove-ignored-property-values (ignore-list list)
|
||||||
"Remove all ignore-list's elements from list and you can use
|
"Remove all ignore-list's elements from list and you can use
|
||||||
regular expressions in the ignore list."
|
regular expressions in the ignore list."
|
||||||
|
@ -570,8 +575,8 @@ A group FOO is composed of contacts with the tag FOO."
|
||||||
(goto-char (match-end 0))
|
(goto-char (match-end 0))
|
||||||
(point))))
|
(point))))
|
||||||
(string (buffer-substring start end)))
|
(string (buffer-substring start end)))
|
||||||
(or (org-contacts-complete-group start end string)
|
(run-hook-with-args-until-success
|
||||||
(org-contacts-complete-name start end string))))))
|
'org-contacts-complete-functions start end string)))))
|
||||||
|
|
||||||
(defun org-contacts-gnus-get-name-email ()
|
(defun org-contacts-gnus-get-name-email ()
|
||||||
"Get name and email address from Gnus message."
|
"Get name and email address from Gnus message."
|
||||||
|
|
Loading…
Reference in a new issue