Commit graph

163 commits

Author SHA1 Message Date
stardiviner
7231f8b2b8 Clean nil and empty string "" from result 2023-07-10 19:47:58 +08:00
stardiviner
3f62975e74 Handle property "EMAIL" value in some cases:
- `mailto:` link
- multiple emails, multiple `mailto:` links

e.g. "[[mailto:yantar92@posteo.net]]", "[[mailto:yantar92@posteo.net][yantar92@posteo.net]]"
2023-07-10 19:39:06 +08:00
stardiviner
ae45b9413e Add autoload cookie for `org-contacts-setup-completion-at-point' 2023-02-27 22:17:30 +08:00
stardiviner
bb4032eb12 Add `if' condition on (org-find-exact-headline-in-buffer query) return nil. 2022-12-21 12:31:08 +08:00
stardiviner
b7d176dcfb Refactor duplicated open org-contacts file and create buffer 2022-12-21 12:27:53 +08:00
stardiviner
bd5093e46b org-contacts is now on MELPA and NonGNU. 2022-10-10 10:50:37 +08:00
stardiviner
9db2e7d28c Add Features section in README.org 2022-10-08 20:39:17 +08:00
stardiviner
217ba04c9d Bump version to v1.1 2022-09-10 12:36:54 +08:00
Stefan Monnier
4a592d90f3 Cosmetic fixes for org-contacts
BTW, here's another cosmetic patch.  It fixes the following:
- Remove some redundant dependencies (already satisfied by Emacs-27.1).
- Fix a too-wide docstring.
- Use `;;` for comments because `;;;` is for section headers.

        Stefan
2022-09-10 12:36:22 +08:00
Stefan Monnier
919511eb86 Adding org-contacts to GNU ELPA
Hi Miles,

AFAICT the copyright status of org-contacts is now cleared (Michael
Strey's paperwork is done), so we could add it to GNU ELPA.

The only thing missing AFAIK is to change the `copyright` line as in the
patch below which also fixes the output of `git status` after installing
the package.

        Stefan
2022-08-27 09:35:26 +08:00
stardiviner
dba21b4895 Decrease emacs and cl-lib version requirements. 2022-06-09 09:26:53 +08:00
stardiviner
b1032119a3 Fix package-lint warnings.
9:67: error: Package gnus is not installable.
9:80: warning: An explicit dependency on cl-lib <= 1.0 is not needed on Emacs >= 24.3.
634:0: warning: Private functions generally should not be autoloaded.
641:0: warning: Private functions generally should not be autoloaded.
645:19: error: You should depend on (emacs "25.1") or the seq package if you need `seq-find'.
673:9: error: You should depend on (emacs "27.1") if you need `org-show-all'.
674:9: error: You should depend on (emacs "25.1") if you need `font-lock-ensure'.
680:0: warning: Private functions generally should not be autoloaded.
684:19: error: You should depend on (emacs "25.1") or the seq package if you need `seq-find'.
699:3: error: You should depend on (emacs "26.1") if you need `when-let*'.
766:8: warning: Closing parens should not be wrapped onto new lines.
788:0: error: "org-completing-read-date" doesn't start with package's prefix "org-contacts".
988:13: error: You should depend on (emacs "25.1") if you need `if-let'.
1060:0: error: "erc-nicknames-list" doesn't start with package's prefix "org-contacts".
1290:0: warning: Private functions generally should not be autoloaded.
2022-06-09 09:26:47 +08:00
stardiviner
c1c4cadf3f Fix Warning: Unused lexical argument 2022-06-04 09:02:12 +08:00
stardiviner
02ac3ed9d0 Fix Warning: ‘org-show-context’ is an obsolete function (as of 9.6); use ‘org-fold-show-context’ instead. 2022-06-04 08:58:26 +08:00
stardiviner
0501463909 Also detect whether org API function `org-add-link-type' available. 2022-06-03 11:29:47 +08:00
stardiviner
e52d4eed74 Drop the "v" prefix in "gnus" version. 2022-06-03 10:19:05 +08:00
stardiviner
f5394bc0b6 Warning user that the custom variable `org-contacts-files' is nil.
If `org-contacts-files' is nil, will revert to `org-agenda-files'.
2022-06-01 22:55:50 +08:00
stardiviner
05522de61d Setting package require versions list 2022-06-01 14:09:12 +08:00
stardiviner
2de057e423 Make org-link-set-parameters <- org-add-link-type API compatible. 2022-06-01 13:55:24 +08:00
stardiviner
2916aae933 Fix warning: Invalid face reference: quote. Invalid face attribute :inherit 'org-link 2022-05-29 02:10:21 +08:00
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