Commit graph

143 commits

Author SHA1 Message Date
stardiviner
5d0ecac118 Update package description. 2022-03-20 07:38:06 +08:00
stardiviner
cf8ae48b37 Add if logic on function erc-nicknames-list 2022-03-06 22:23:58 +08:00
stardiviner
21d4ae5367 Improve the alternative org-contacts headline goto. 2022-02-26 01:06:48 +08:00
stardiviner
7ed94bcf72 Fix can't get-buffer when file is not opened which caused buf is nil. 2022-02-26 00:49:34 +08:00
stardiviner
fe466ab2ae Add org-mode mailto: link type :complete supporting 2021-12-28 22:14:13 +08:00
stardiviner
81d9ed977d Ensure font-lock after org-mode in company-mode doc-buffer 2021-11-26 10:38:16 +08:00
stardiviner
abe24d6f34 Display company-mode doc buffer bellow current window 2021-11-24 11:35:41 +08:00
stardiviner
84436fd7bc Fix org-contacts file narrowed not widen recovered bug. 2021-11-19 22:31:55 +08:00
stardiviner
03a563b471 Add autoload cookies for org-link functions 2021-11-18 22:24:49 +08:00
stardiviner
58edab6f69 Add autoload cookirs for completing functions 2021-11-18 22:23:23 +08:00
stardiviner
8a074f2a41 company-mode doc-buffer return customized buffer which support customization 2021-11-18 16:53:06 +08:00
stardiviner
18d4945fcc Fix company-mode `company-show-location' support 2021-11-18 15:57:22 +08:00
stardiviner
8f008e1b70 Fix company-mode doc-buffer support with reverse query contact element in all contacts list. 2021-11-18 15:52:08 +08:00
stardiviner
3ea7298670 Enable company-mode support 2021-11-18 15:51:37 +08:00
stardiviner
bdf172eab8 Merge branch 'complete-contact' 2021-11-18 15:33:29 +08:00
stardiviner
aaf9ce8bd0 Add capf completion properties 2021-11-18 15:09:58 +08:00
stardiviner
39c7aba7dc Remove all-completions code logic 2021-11-18 15:08:38 +08:00
stardiviner
85dd965906 Remove testing code 2021-11-18 15:08:05 +08:00
stardiviner
f3fa9fc0b8 use less magic symbol extract code
> #+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:]@").
2021-11-18 15:06:23 +08:00
stardiviner
1b028de47c 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
2021-11-18 15:05:11 +08:00
Stefan Monnier
3e075cdee4 Fix most of the compiler wanrings and add `Version:'
> I have get response from Strey, he said he has requested FSF for
> signing paperwork, should be ready in days.

In the mean time, here's a patch which addresses most of the compiler
warnings I got.  It also adds a `Version:` since that'll be necessary
for the package to be released on GNU ELPA.  And it furthermore adds
a few FIXMEs which you might want to look at.

        Stefan
2021-11-18 14:36:19 +08:00
stardiviner
c1d2b6dfbc prototype of org-contacts contact complete 2021-11-18 14:26:22 +08:00
stardiviner
f64d6edcd0 Update source code metadata keywords and usage description 2021-11-13 16:32:19 +08:00
stardiviner
3fa6b4c36b Add package introduction in README 2021-11-13 16:32:19 +08:00
stardiviner
038a608e79 Fix AVATAR property value not exist problem 2021-11-13 16:32:19 +08:00
stardiviner
c8408cf44e replace gnus-rescale-image with create-image property :height 2021-11-13 16:32:19 +08:00
stardiviner
00560d5f4f Try to support different type of AVATAR property.
- Support [[file:dir/filename.png]] link
- Support empty value
- Support default value
2021-11-13 16:32:19 +08:00
stardiviner
507e48cbd1 add README.org 2021-11-13 16:32:00 +08:00
Morgan Smith
0a91557ef9 Tidy up whitespace 2021-11-13 16:30:06 +08:00
Morgan Smith
80ab4708b7 Change how completion is done 2021-11-13 16:29:16 +08:00
Morgan Smith
c98281fcfe Remove compatibility code 2021-11-13 16:27:52 +08:00
Morgan Smith
46726d2637 Don't use deprecated functions 2021-11-13 16:27:38 +08:00
Bastien Guerry
4540f987ec Clean up some more headers 2021-05-05 09:02:22 +02:00
Bastien Guerry
74019274c0 Update copyright years 2021-05-03 23:04:40 +02:00
Stefan Kangas
986a5b3280 Prefer HTTPS to HTTP in most links 2021-03-21 15:21:22 -04:00
Stefan Kangas
2f8b3f024c Prefer HTTPS to HTTP for links to gnu.org 2021-03-21 14:29:13 -04:00
stardiviner
0af8ca84b4 org-contacts.el: Display contacts buffer result.
* contrib/lisp/org-contacts.el (org-contacts-link-open): Display the
searched contacts file buffer.
2021-01-25 10:04:40 +08:00
Ihor Radchenko
1991ef0ecd Fix typo in 304fd01fe 2021-01-10 17:13:38 -05:00
stardiviner
0e33f05c4e org-contacts.el: Fix store link function does not return link.
* contrib/lisp/org-contacts.el (org-contacts-link-store): Fix
org-store-link return incorrect link without link type prefix.
2021-01-05 19:30:36 +08:00
David Florness
3d9181c0c4 org-contacts.el: Use `bound-and-true-p' to check (unbound) var
* org-contacts.el (org-contacts-link-store): Use `bound-and-true-p' to
check the truthiness of org-id-link-to-org-use-id, which may or may
not be bound depending on whether org-id has been loaded.  This
simplifies the code.
2021-01-05 19:28:11 +08:00
David Florness
eedaff3498 org-contacts.el: Only use org-id-store-link if org-id is loaded
Fixes bug introduced in c8ceb5290 that made org-contacts-anniversaries
error if org-id was not loaded.
2021-01-05 01:33:20 +08:00
stardiviner
af3a5cb6fa org-contacts.el: replace obsolete alias loop' with cl-loop'
* contrib/lisp/org-contacts.el (org-contacts-get-icon): replace obsolete
alias `loop' with `cl-loop'.
2021-01-03 20:17:37 +08:00
stardiviner
304fd01fe3 org-contacts.el: Add usage comments
* contrib/lisp/org-contacts.el: Add usage comments.
2021-01-03 20:16:41 +08:00
stardiviner
0107e8ecdb org-contacts.el: Inherit face from org-link
* contrib/lisp/org-contacts.el (org-contacts-link-face): Don't use a
color for org-contacts line, inherit from face org-link directly.
2020-12-20 20:43:23 +08:00
stardiviner
c8ceb5290e org-contacts.el: Add support for org-id generated link.
* contrib/lisp/org-contacts.el (org-contacts-link-store): Use org-id
store link if org-id-link-to-org-use-id is t.
2020-12-17 14:38:15 +08:00
stardiviner
ca3b10d5a8 org-contacts.el: Fix org-store-link error caused by org-contacts
* contrib/lisp/org-contacts.el (org-contacts-link-store): Fix Org store
link by adding missing condition for org-contacts.
2020-12-17 14:38:11 +08:00
Bastien
2c0bb90259 contrib/lisp/org-contacts.el: Add stardiviner as the maintainer 2020-12-15 15:26:35 +01:00
stardiviner
478dfcc9b7 org-contacts.el: Add new link type "contact:"
* contrib/lisp/org-contacts.el (org-contacts-link-store): Store a link
of org-contacts in Org file.

* contrib/lisp/org-contacts.el (org-contacts-link-open): Open contact:
link in Org file.

* contrib/lisp/org-contacts.el (org-contacts-link-complete): Insert a
contact: link with completion of contacts.

* contrib/lisp/org-contacts.el (org-contacts-link-face): Set different
face for contact: link.
2020-11-11 09:35:01 +01:00
Nicolas Goaziou
4e3f139857 Fix function declarations 2019-03-10 18:00:36 +01:00
Nicolas Goaziou
e64df72db4 Rationalize `org-link-(un)escape'
* contrib/lisp/org-contacts.el (org-contacts-vcard-format):
* contrib/lisp/org-link-edit.el (org-link-edit--link-data):
* contrib/lisp/org-notmuch.el (org-notmuch-search-store-link):
(org-notmuch-search-follow-link):
(org-notmuch-tree-follow-link):
* lisp/org-docview.el (org-docview-export):
* lisp/org-element.el (org-element-link-parser):
* lisp/org-lint.el (org-lint-link-to-local-file):
* lisp/org-protocol.el (org-protocol-split-data):
(org-protocol-parse-parameters):
* lisp/org.el (org-open-at-point):
(org-display-inline-images):
* lisp/ox-ascii.el (org-ascii-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex--inline-image):
(org-latex-link):
* lisp/ox-publish.el (org-publish-resolve-external-link):
* lisp/ox.el (org-export-custom-protocol-maybe):
(org-export-resolve-fuzzy-link): Do not call `org-link-unescape' when
the link is obtained through the parser or as a user input.
* doc/org-manual.org (Link Format): Document escape syntax.

See <http://lists.gnu.org/r/emacs-orgmode/2019-02/msg00320.html>
2019-02-27 20:22:51 +01:00