[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-contacts 1b028de47c 124/154: Fix contacts complete
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-contacts 1b028de47c 124/154: Fix contacts complete not working problem |
Date: |
Fri, 9 Sep 2022 15:58:54 -0400 (EDT) |
branch: externals/org-contacts
commit 1b028de47ceb15fba79132d5cb8f77b1d1b8dd49
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
Fix contacts complete not working problem
> I found ~org-contacts-org-complete-function~ returned a special value:
>
> #+begin_example
> #f(compiled-function (string pred action) #<bytecode -0x9e1a398d61d3acb>)
> #+end_example
I can't see any way M-: (org-contacts-org-complete-function) RET
can return the above value. So I suspect a "pilot error".
This looks like the 3rd value in the returned list (i.e. the value
returned by `completion-table-dynamic`).
> #+begin_src emacs-lisp
> (defun org-contacts-org-complete-function ()
> "Function used in `completion-at-point-functions' in `org-mode' to
complete @name."
> (when-let* ((bounds (bounds-of-thing-at-point 'symbol))
> (begin (1- (car bounds)))
> (end (cdr bounds))
> (symbol (buffer-substring-no-properties begin end))
> (org-contacts-prefix-p (string-prefix-p "@" symbol))
> ;; (prefix (substring-no-properties symbol 1 nil))
> )
> (when org-contacts-prefix-p
> (list begin
> end
> (completion-table-dynamic
> (lambda (_)
> (mapcar
> (lambda (contact) (plist-get contact :name))
> (org-contacts--all-contacts))))))))
> #+end_src
This gives a `begin..end` region which presumably includes `@`.
Does (plist-get contact :name) return names that start with `@`?
If not, the completion will never match.
> And test with execute following ~add-hook~ in org-mode buffer or
> emacs-lisp-mode buffer:
In emacs-lisp-mode, `@` has symbol syntax, so
(bounds-of-thing-at-point 'symbol)
will include `@` in the returned region, whereas in Org mode
`@` seems to have punctuation syntax so the `@` will not be included in
the returned region.
Maybe instead of `bounds-of-thing-at-point` you want to use something
less "magic", like (skip-chars-backward "[:alnum:]@").
> #+begin_src emacs-lisp
> (add-hook 'completion-at-point-functions
'org-contacts-org-complete-function nil 'local)
> #+end_src
---
org-contacts.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/org-contacts.el b/org-contacts.el
index 945435e0e4..ec26017323 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -698,7 +698,7 @@ description."
(completion-table-dynamic
(lambda (_)
(mapcar
- (lambda (contact) (plist-get contact :name))
+ (lambda (contact) (concat "@" (plist-get contact :name)))
(org-contacts--all-contacts))))
;; :predicate 'stringp
- [elpa] externals/org-contacts bd83216f38 079/154: contrib/lisp/org-contacts.el: Complete contacts using tags and properties, (continued)
- [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
- [elpa] externals/org-contacts c1a17bf632 076/154: Merge branch 'maint', ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 2de057e423 145/154: Make org-link-set-parameters <- org-add-link-type API compatible., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 21d4ae5367 141/154: Improve the alternative org-contacts headline goto., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts c1c4cadf3f 151/154: Fix Warning: Unused lexical argument, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts a50ced61ef 093/154: Update tel link definition, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts f02da8b4de 088/154: org-contacts: Register "tel" link, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 80ab4708b7 114/154: Change how completion is done, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 1b028de47c 124/154: Fix contacts complete not working problem,
ELPA Syncer <=
- [elpa] externals/org-contacts b1032119a3 152/154: Fix package-lint warnings., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts d1298f4599 083/154: org-contacts.el: Catch `nextfile' in `org-contacts-db', ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 0a91557ef9 115/154: Tidy up whitespace, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 00560d5f4f 117/154: Try to support different type of AVATAR property., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 81d9ed977d 138/154: Ensure font-lock after org-mode in company-mode doc-buffer, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 8f008e1b70 131/154: Fix company-mode doc-buffer support with reverse query contact element in all contacts list., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts c8408cf44e 118/154: replace gnus-rescale-image with create-image property :height, ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 5d0ecac118 143/154: Update package description., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 8078958995 082/154: contrib: Fix error messages., ELPA Syncer, 2022/09/09
- [elpa] externals/org-contacts 60339bd55f 087/154: Make `org-make-tags-matcher' lexical binding friendly, ELPA Syncer, 2022/09/09