Commit graph

137 commits

Author SHA1 Message Date
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
Robert Klein
a50ced61ef Update tel link definition
* contrib/lisp/org-contacts.el ("contacts"):

Update to use org-link-set-parameters.
2016-08-08 11:10:04 +02:00
Nicolas Goaziou
f07048b75d Use string-match-p' instead of org-string-match-p'
* contrib/lisp/org-contacts.el (org-contacts-filter):
(org-contacts-complete-group):
(org-contacts-complete-tags-props):
* contrib/lisp/org-wl.el (org-wl-open):
* contrib/lisp/ox-bibtex.el (org-bibtex-merge-contiguous-citations):
* lisp/ob-core.el (org-babel-demarcate-block):
* lisp/ob-processing.el (org-babel-processing-view-sketch):
* lisp/ob-stan.el (org-babel-execute:stan):
* lisp/org-agenda.el (org-agenda-get-category-icon):
* lisp/org-clock.el (org-clock-into-drawer):
* lisp/org-element.el (org-element-link-parser):
* lisp/org-lint.el (org-lint-orphaned-affiliated-keywords):
(org-lint-invalid-babel-call-block):
(org-lint-colon-in-name):
* lisp/org-list.el (org-list-item-body-column):
* lisp/org-macro.el (org-macro-replace-all):
* lisp/org-plot.el (org-plot/gnuplot-script):
* lisp/org-table.el (org-table-export):
(org-table-align):
(org-table-get-range):
(org-table-recalculate):
(org-table-expand-lhs-ranges):
(org-table-formula-substitute-names):
(org-table-show-reference):
(orgtbl-to-texinfo):
(org-table-remote-reference-indirection):
* lisp/org.el (org-make-link-string):
(org--open-elisp-link):
(org-open-at-point):
(org-store-log-note):
(org-cached-entry-get):
(org--valid-property-p):
(org-entry-properties):
(org-buffer-property-keys):
(org-insert-drawer):
(org-display-inline-images):
(org-in-commented-heading-p):
* lisp/ox-ascii.el (org-ascii-keyword):
* lisp/ox-beamer.el (org-beamer--format-frame):
* lisp/ox-html.el (org-html-keyword):
* lisp/ox-latex.el (org-latex--label):
(org-latex-headline):
(org-latex-item):
(org-latex-keyword):
(org-latex--inline-image):
(org-latex-src-block):
* lisp/ox-odt.el (org-odt-styles-dir):
(org-odt-keyword):
(org-odt--translate-latex-fragments):
* lisp/ox-texinfo.el (org-texinfo-template):
(org-texinfo-keyword):
(org-texinfo-src-block):
* lisp/ox.el (org-export-inline-image-p):
(org-export-file-uri):
* testing/lisp/test-org-table.el (test-org-table/to-generic):
(test-org-table/to-latex):
(test-org-table/to-html):
(test-org-table/named-field):
(test-org-table/named-column):
(test-org-table/tab-indent):
(test-org-table/first-rc):
(test-org-table/last-rc): Use `string-match-p' instead of
`org-string-match-p'.
2016-07-25 15:21:12 +02:00
Nicolas Goaziou
0ec6917ed8 Deprecate org-no-warnings' in favor of with-no-warnings'
* lisp/org-macs.el (org-no-warnings): Rewove macro.
* lisp/org-compat.el (org-no-warnings): Mark `org-no-warnings' as
  obsolete.
* contrib/lisp/org-contacts.el (defvar):
* contrib/lisp/org-wl.el (org-wl-open):
* lisp/org-agenda.el (defvar):
(org-anniversary):
(org-cyclic):
(org-block):
(org-date):
* lisp/org-bbdb.el (defvar):
* lisp/org-clock.el (org-clock-out):
(org-clock-cancel):
* lisp/org-mouse.el (org-mouse-show-context-menu):
* lisp/org.el (org-modify-ts-extra):
(org-order-calendar-date-args): Small refactoring.
* lisp/ox-odt.el (org-odt-htmlfontify-string):
2016-06-23 15:20:32 +02:00
Nicolas Goaziou
4170ea25f3 Deprecate org-find-if' in favor of cl-find-if'
* lisp/org.el (org-find-if): Remove function.
(org-key):
* contrib/lisp/org-contacts.el (org-contacts-db-need-update-p):
(org-contacts-filter):
(org-contacts-test-completion-prefix):
(org-contacts-remove-ignored-property-values): Use `cl-find-if'
* lisp/org-compat.el (org-find-if): Mark function as an obsolete alias
  for `cl-find-if'.
2016-06-23 09:22:49 +02:00
Nicolas Goaziou
27bec00a60 org-agenda: Remove unnecessary visibility modification
* lisp/org.el (org-show-context-detail): Change default visibility span
  for agenda context.

* lisp/org-agenda.el (org-agenda-goto):
(org-agenda-todo):
(org-agenda-add-note):
(org-agenda-priority):
(org-agenda-set-tags):
(org-agenda-set-property):
(org-agenda-set-effort):
(org-agenda-toggle-archive-tag):
(org-agenda-clock-in): Special visibility is taken care of by
`org-show-context'.  Do not hard-code anything else.

* contrib/lisp/org-contacts.el (org-contacts-gnus-article-from-goto):
Special visibility is taken care of by `org-show-context'.  Do not
hard-code anything else.
2016-04-29 11:35:49 +02:00
Simon Thum
f02da8b4de org-contacts: Register "tel" link
This has the added benefit of not screwing up the exporter.

Signed-off-by: Simon Thum <simon.thum@gmx.de>
2016-02-25 10:14:25 +01:00