emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org-contacts eb1055828c 1/3: Setup org-contacts complet


From: ELPA Syncer
Subject: [elpa] externals/org-contacts eb1055828c 1/3: Setup org-contacts completing automatically in package built-in.
Date: Fri, 2 Aug 2024 06:58:40 -0400 (EDT)

branch: externals/org-contacts
commit eb1055828c6d7bd5cbe4107c78c24cc5d3eb258c
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>

    Setup org-contacts completing automatically in package built-in.
    
    Setup org-contacts completing in org-mode, message-mode, mu4e-compose-mode.
---
 org-contacts.el | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/org-contacts.el b/org-contacts.el
index aa5694ab7b..8051171b9d 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -730,6 +730,13 @@ Usage: (add-hook \\='completion-at-point-functions
             :company-doc-buffer #'org-contacts-org-complete--doc-function ; 
doc popup
             :company-location 
#'org-contacts-org-complete--location-function))))
 
+;;;###autoload
+(defun org-contacts-org-complete-setup ()
+  "Setup `completion-at-point-functions' with `org-contacts' in buffer local."
+  (add-hook 'completion-at-point-functions 'org-contacts-org-complete-function 
nil 'local))
+;;;###autoload
+(add-hook 'org-mode-hook #'org-contacts-org-complete-setup)
+
 (defun org-contacts-gnus-get-name-email ()
   "Get name and email address from Gnus message."
   (if (gnus-alive-p)
@@ -1049,17 +1056,14 @@ This adds `org-contacts-gnus-check-mail-address' and
 
 ;;;###autoload
 (defun org-contacts-setup-completion-at-point ()
-  "Add `org-contacts-message-complete-function' as a new function
-to complete the thing at point."
-  (add-to-list 'completion-at-point-functions
-               'org-contacts-message-complete-function))
+  "Add `org-contacts-message-complete-function' to capf for completing contact 
at point."
+  (add-to-list 'completion-at-point-functions 
'org-contacts-message-complete-function nil 'local))
 
-(defun org-contacts-unload-hook ()
-  (remove-hook 'message-mode-hook #'org-contacts-setup-completion-at-point))
-
-(when (and org-contacts-enable-completion
-           (boundp 'completion-at-point-functions))
-  (add-hook 'message-mode-hook #'org-contacts-setup-completion-at-point))
+;;;###autoload
+(when (and org-contacts-enable-completion (boundp 
'completion-at-point-functions))
+  (add-hook 'message-mode-hook #'org-contacts-setup-completion-at-point)
+  (when (featurep 'mu4e)
+    (add-hook 'mu4e-compose-mode-hook 
'org-contacts-setup-completion-at-point)))
 
 (defun org-contacts-wl-get-from-header-content ()
   "Retrieve the content of the `From' header of an email.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]