[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-contacts bdf172eab8 129/154: Merge branch 'complete
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-contacts bdf172eab8 129/154: Merge branch 'complete-contact' |
Date: |
Fri, 9 Sep 2022 15:58:54 -0400 (EDT) |
branch: externals/org-contacts
commit bdf172eab8f55916ccd11680282db26e56f17fa8
Merge: 3e075cdee4 aaf9ce8bd0
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
Merge branch 'complete-contact'
---
org-contacts.el | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/org-contacts.el b/org-contacts.el
index cce21e3961..2df65e011f 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -626,6 +626,66 @@ description."
(run-hook-with-args-until-success
'org-contacts-complete-functions string))))))))
+(defun org-contacts-org-complete--annotation-function (candidate)
+ "Return org-contacts tags of contact candidate."
+ ;; TODO
+ "Tags: ")
+
+(defun org-contacts-org-complete--doc-function (candidate)
+ "Return org-contacts content of contact candidate."
+ (let ((name (plist-get candidate :name))
+ (file (plist-get candidate :file))
+ (position (plist-get candidate :position)))
+ (company-doc-buffer
+ ;; get org-contact headline and property drawer.
+ (with-current-buffer (find-file-noselect file)
+ (goto-char position)
+ (when (derived-mode-p 'org-mode)
+ ;; `org-edit-src-code' is not a real narrowing command.
+ ;; Remove this first conditional if you don't want it.
+ (cond ((ignore-errors (org-edit-src-code))
+ (delete-other-windows))
+ ((org-at-block-p)
+ (org-narrow-to-block))
+ (t (org-narrow-to-subtree)))
+ (buffer-substring (point-min) (point-max)))))))
+
+(defun org-contacts-org-complete--location-function (candidate)
+ "Return org-contacts location of contact candidate."
+ (let ((name (plist-get candidate :name))
+ (file (plist-get candidate :file))
+ (position (plist-get candidate :position)))
+ (with-current-buffer (find-file-noselect file)
+ (goto-char position)
+ (cons (current-buffer) position))))
+
+(defun org-contacts-org-complete-function ()
+ "Function used in `completion-at-point-functions' in `org-mode' to complete
@name.
+Usage: (add-hook 'completion-at-point-functions
'org-contacts-org-complete-function nil 'local)"
+ (when-let* ((end (point))
+ (begin (save-excursion (skip-chars-backward "[:alnum:]@")
(point)))
+ (symbol (buffer-substring-no-properties begin end))
+ (org-contacts-prefix-p (string-prefix-p "@" symbol)))
+ (when org-contacts-prefix-p
+ (list begin
+ end
+ (completion-table-dynamic
+ (lambda (_)
+ (mapcar
+ (lambda (contact) (concat "@" (plist-get contact :name)))
+ (org-contacts--all-contacts))))
+
+ :predicate 'stringp
+ :exclusive 'no
+ ;; properties check out `completion-extra-properties'
+ :annotation-function
#'org-contacts-org-complete--annotation-function
+ ;; :exit-function ; TODO change completion candidate inserted
contact name into org-contact link??
+
+ ;; :company-docsig #'identity ;
metadata
+ ;; :company-doc-buffer #'org-contacts-org-complete--doc-function ;
doc popup
+ ;; :company-location #'org-contacts-org-complete--location-function
+ ))))
+
(defun org-contacts-gnus-get-name-email ()
"Get name and email address from Gnus message."
(if (gnus-alive-p)
- [elpa] externals/org-contacts fe466ab2ae 139/154: Add org-mode mailto: link type :complete supporting, (continued)
- [elpa] externals/org-contacts fe466ab2ae 139/154: Add org-mode mailto: link type :complete supporting, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 03a563b471 135/154: Add autoload cookies for org-link functions, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 3e075cdee4 123/154: Fix most of the compiler wanrings and add `Version:', ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 919511eb86 154/154: Adding org-contacts to GNU ELPA, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 2916aae933 144/154: Fix warning: Invalid face reference: quote. Invalid face attribute :inherit 'org-link, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 84436fd7bc 136/154: Fix org-contacts file narrowed not widen recovered bug., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts e64df72db4 094/154: Rationalize `org-link-(un)escape', ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 478dfcc9b7 096/154: org-contacts.el: Add new link type "contact:", ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 2f8b3f024c 108/154: Prefer HTTPS to HTTP for links to gnu.org, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts f64d6edcd0 121/154: Update source code metadata keywords and usage description, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts bdf172eab8 129/154: Merge branch 'complete-contact',
ELPA Syncer <=
- [elpa] externals/org-contacts dba21b4895 153/154: Decrease emacs and cl-lib version requirements., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts f5394bc0b6 147/154: Warning user that the custom variable `org-contacts-files' is nil., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 3a24177c3a 070/154: un-hexify TEL links in vCard export, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 58edab6f69 134/154: Add autoload cookirs for completing functions, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 7ed94bcf72 140/154: Fix can't get-buffer when file is not opened which caused `buf` is nil., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 05522de61d 146/154: Setting package require versions list, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts cf8ae48b37 142/154: Add if logic on function erc-nicknames-list, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts bd83216f38 079/154: contrib/lisp/org-contacts.el: Complete contacts using tags and properties, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 2e77024e89 017/154: Copyright year fixes for contrib/., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 4170ea25f3 090/154: Deprecate `org-find-if' in favor of `cl-find-if', ELPA Syncer, 2022/09/09