all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] add new link type "contact:" for org-contacts.el
@ 2020-10-30  7:35 stardiviner
  2020-10-30  7:44 ` stardiviner
  0 siblings, 1 reply; 21+ messages in thread
From: stardiviner @ 2020-10-30  7:35 UTC (permalink / raw)
  To: Org-mode


[-- Attachment #1.1: Type: text/plain, Size: 243 bytes --]

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

[-- Attachment #1.2: Type: text/html, Size: 696 bytes --]

[-- Attachment #2: 0001-org-contacts.el-Add-new-link-type-contact.patch --]
[-- Type: text/x-patch, Size: 3690 bytes --]

From 18b12dac615085e4c55029568b65c30b17ec5189 Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Fri, 30 Oct 2020 15:11:53 +0800
Subject: [PATCH] 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.
---
 contrib/lisp/org-contacts.el | 66 ++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index 4b3693a0e..851802916 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -1146,6 +1146,72 @@ (defun org-contacts-split-property (string &optional separators omit-nulls)
         (setq proplist (cons bufferstring proplist))))
     (cdr (reverse proplist))))
 
+;;; Add an Org link type `contact:' for easy jump to or searching org-contacts headline.
+;;; link spec: [[contact:query][desc]]
+(org-link-set-parameters "contact"
+			 :follow 'org-contacts-link-open
+			 :complete 'org-contacts-link-complete
+			 :store 'org-contacts-link-store
+			 :face 'org-contacts-link-face)
+
+(defun org-contacts-link-store ()
+  "Store the contact in `org-contacts-files' with a link."
+  (when (eq major-mode 'org-mode)
+    ;; (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files))
+    (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
+      (org-store-link-props
+       :type "contact"
+       :link headline-str
+       :description headline-str))))
+
+(defun org-contacts--all-contacts ()
+  "Return an alist (name . (file . position)) of all contacts in `org-contacts-files'."
+  (car (mapcar
+	(lambda (file)
+	  (unless (buffer-live-p (get-buffer (file-name-nondirectory file)))
+	    (find-file file))
+	  (with-current-buffer (get-buffer (file-name-nondirectory file))
+	    (org-map-entries
+	     (lambda ()
+	       (let ((name (substring-no-properties (org-get-heading t t t t)))
+		     (file (buffer-file-name))
+		     (position (point)))
+		 `(:name ,name :file ,file :position ,position))))))
+	org-contacts-files)))
+
+(defun org-contacts-link-open (path)
+  "Open contacts: link type with jumping or searching."
+  (let ((query path))
+    (cond
+     ((string-match "/.*/" query)
+      (let* ((f (car org-contacts-files))
+	     (buf (get-buffer (file-name-nondirectory f))))
+	(unless (buffer-live-p buf) (find-file f))
+	(with-current-buffer buf
+	  (string-match "/\\(.*\\)/" query)
+	  (occur (match-string 1 query)))))
+     (t
+      (let* ((f (car org-contacts-files))
+	     (buf (get-buffer (file-name-nondirectory f))))
+	(unless (buffer-live-p buf) (find-file f))
+	(with-current-buffer buf
+	  (goto-char (marker-position (org-find-exact-headline-in-buffer query)))))))))
+
+(defun org-contacts-link-complete (&optional arg)
+  "Create a org-contacts link using completion."
+  (let ((name (completing-read "Contact Name: "
+			       (mapcar
+				(lambda (plist) (plist-get plist :name))
+				(org-contacts--all-contacts)))))
+    (concat "contact:" name)))
+
+(defun org-contacts-link-face (path)
+  "Different face color for different org-contacts link query."
+  (cond
+   ((string-match "/.*/" path)
+    '(:background "sky blue" :overline t :slant 'italic))
+   (t '(:background "green yellow" :underline t))))
+
 (provide 'org-contacts)
 
 ;;; org-contacts.el ends here
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH] add new link type "contact:" for org-contacts.el
  2020-10-30  7:35 [PATCH] add new link type "contact:" for org-contacts.el stardiviner
@ 2020-10-30  7:44 ` stardiviner
  2020-11-09  0:24   ` stardiviner
  0 siblings, 1 reply; 21+ messages in thread
From: stardiviner @ 2020-10-30  7:44 UTC (permalink / raw)
  To: Org-mode; +Cc: julien

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

Accidentally pressed send button without email body.
Hope org-contacts.el author can review this patch.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Fri, Oct 30, 2020 at 3:35 PM stardiviner <numbchild@gmail.com> wrote:

>
>
> [stardiviner]           <Hack this world!>      GPG key ID: 47C32433
> IRC(freeenode): stardiviner                     Twitter:  @numbchild
> Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
> Blog: http://stardiviner.github.io/
>

[-- Attachment #2: Type: text/html, Size: 1823 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] add new link type "contact:" for org-contacts.el
  2020-10-30  7:44 ` stardiviner
@ 2020-11-09  0:24   ` stardiviner
  2020-11-09  6:14     ` Jean Louis
  2020-11-11  8:33     ` [PATCH] " Bastien
  0 siblings, 2 replies; 21+ messages in thread
From: stardiviner @ 2020-11-09  0:24 UTC (permalink / raw)
  To: Org-mode; +Cc: julien

[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]

After waited some days, still no reponse, so I popup this email.
Can some Org maintainer review my patch? Thanks.
It does not changed org-contacts.el core logic. Just added a new link type.
Should be easy to review.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Fri, Oct 30, 2020 at 3:44 PM stardiviner <numbchild@gmail.com> wrote:

> Accidentally pressed send button without email body.
> Hope org-contacts.el author can review this patch.
>
> [stardiviner]           <Hack this world!>      GPG key ID: 47C32433
> IRC(freeenode): stardiviner                     Twitter:  @numbchild
> Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
> Blog: http://stardiviner.github.io/
>
>
> On Fri, Oct 30, 2020 at 3:35 PM stardiviner <numbchild@gmail.com> wrote:
>
>>
>>
>> [stardiviner]           <Hack this world!>      GPG key ID: 47C32433
>> IRC(freeenode): stardiviner                     Twitter:  @numbchild
>> Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
>> Blog: http://stardiviner.github.io/
>>
>

[-- Attachment #2: Type: text/html, Size: 3185 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] add new link type "contact:" for org-contacts.el
  2020-11-09  0:24   ` stardiviner
@ 2020-11-09  6:14     ` Jean Louis
  2020-11-10  1:15       ` [UPDATED PATCH] " stardiviner
  2020-11-11  8:33     ` [PATCH] " Bastien
  1 sibling, 1 reply; 21+ messages in thread
From: Jean Louis @ 2020-11-09  6:14 UTC (permalink / raw)
  To: stardiviner; +Cc: julien, Org-mode

* stardiviner <numbchild@gmail.com> [2020-11-09 03:25]:
> After waited some days, still no reponse, so I popup this email.
> Can some Org maintainer review my patch? Thanks.
> It does not changed org-contacts.el core logic. Just added a new link type.
> Should be easy to review.

If I may say, many people manage their contacts and it can be by
various ways, I am managing my contacts and by default use "contact:"

I find it useful for people to leave "contact:" link free and not bind
it to org-contact package.

Instead it is more pointful to make "org-contact:" link that
specificaly points to contacts for org-contact package.

Just "org-contact:" instead of "contact:"



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2020-11-09  6:14     ` Jean Louis
@ 2020-11-10  1:15       ` stardiviner
  2020-11-11  8:37         ` Bastien
  0 siblings, 1 reply; 21+ messages in thread
From: stardiviner @ 2020-11-10  1:15 UTC (permalink / raw)
  To: Jean Louis; +Cc: julien, Org-mode


[-- Attachment #1.1: Type: text/plain, Size: 1088 bytes --]

You're right. Thanks for suggestion.
I attached new patch now.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Mon, Nov 9, 2020 at 7:05 PM Jean Louis <bugs@gnu.support> wrote:

> * stardiviner <numbchild@gmail.com> [2020-11-09 03:25]:
> > After waited some days, still no reponse, so I popup this email.
> > Can some Org maintainer review my patch? Thanks.
> > It does not changed org-contacts.el core logic. Just added a new link
> type.
> > Should be easy to review.
>
> If I may say, many people manage their contacts and it can be by
> various ways, I am managing my contacts and by default use "contact:"
>
> I find it useful for people to leave "contact:" link free and not bind
> it to org-contact package.
>
> Instead it is more pointful to make "org-contact:" link that
> specificaly points to contacts for org-contact package.
>
> Just "org-contact:" instead of "contact:"
>
>

[-- Attachment #1.2: Type: text/html, Size: 2040 bytes --]

[-- Attachment #2: 0001-org-contacts.el-Add-new-link-type-contact.patch --]
[-- Type: text/x-patch, Size: 4181 bytes --]

From 7446c0dda49554db0af18401984d20b9b460d408 Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Fri, 30 Oct 2020 15:11:53 +0800
Subject: [PATCH] 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.
---
 contrib/lisp/org-contacts.el | 75 ++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index 4b3693a0e..d8d498425 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -1146,6 +1146,81 @@ (defun org-contacts-split-property (string &optional separators omit-nulls)
         (setq proplist (cons bufferstring proplist))))
     (cdr (reverse proplist))))
 
+;;; Add an Org link type `org-contact:' for easy jump to or searching org-contacts headline.
+;;; link spec: [[org-contact:query][desc]]
+(org-link-set-parameters "org-contact"
+			 :follow 'org-contacts-link-open
+			 :complete 'org-contacts-link-complete
+			 :store 'org-contacts-link-store
+			 :face 'org-contacts-link-face)
+
+(defun org-contacts-link-store ()
+  "Store the contact in `org-contacts-files' with a link."
+  (when (eq major-mode 'org-mode)
+    ;; (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files))
+    (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
+      (org-store-link-props
+       :type "org-contact"
+       :link headline-str
+       :description headline-str))))
+
+(defun org-contacts--all-contacts ()
+  "Return an alist (name . (file . position)) of all contacts in `org-contacts-files'."
+  (car (mapcar
+	(lambda (file)
+	  (unless (buffer-live-p (get-buffer (file-name-nondirectory file)))
+	    (find-file file))
+	  (with-current-buffer (get-buffer (file-name-nondirectory file))
+	    (org-map-entries
+	     (lambda ()
+	       (let ((name (substring-no-properties (org-get-heading t t t t)))
+		     (file (buffer-file-name))
+		     (position (point)))
+		 `(:name ,name :file ,file :position ,position))))))
+	org-contacts-files)))
+
+(defun org-contacts-link-open (path)
+  "Open contacts: link type with jumping or searching."
+  (let ((query path))
+    (cond
+     ((string-match "/.*/" query)
+      (let* ((f (car org-contacts-files))
+	     (buf (get-buffer (file-name-nondirectory f))))
+	(unless (buffer-live-p buf) (find-file f))
+	(with-current-buffer buf
+	  (string-match "/\\(.*\\)/" query)
+	  (occur (match-string 1 query)))))
+     (t
+      (let* ((f (car org-contacts-files))
+	     (buf (get-buffer (file-name-nondirectory f))))
+	(unless (buffer-live-p buf) (find-file f))
+	(with-current-buffer buf
+	  (goto-char (marker-position (org-find-exact-headline-in-buffer query)))))
+      ;; FIXME
+      ;; (let* ((contact-entry (plist-get (org-contacts--all-contacts) query))
+      ;; 	     (contact-name (plist-get contact-entry :name))
+      ;; 	     (file (plist-get contact-entry :file))
+      ;; 	     (position (plist-get contact-entry :position))
+      ;; 	     (buf (get-buffer (file-name-nondirectory file))))
+      ;; 	(unless (buffer-live-p buf) (find-file file))
+      ;; 	(with-current-buffer buf (goto-char position)))
+      ))))
+
+(defun org-contacts-link-complete (&optional arg)
+  "Create a org-contacts link using completion."
+  (let ((name (completing-read "org-contact Name: "
+			       (mapcar
+				(lambda (plist) (plist-get plist :name))
+				(org-contacts--all-contacts)))))
+    (concat "org-contact:" name)))
+
+(defun org-contacts-link-face (path)
+  "Different face color for different org-contacts link query."
+  (cond
+   ((string-match "/.*/" path)
+    '(:background "sky blue" :overline t :slant 'italic))
+   (t '(:background "green yellow" :underline t))))
+
 (provide 'org-contacts)
 
 ;;; org-contacts.el ends here
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH] add new link type "contact:" for org-contacts.el
  2020-11-09  0:24   ` stardiviner
  2020-11-09  6:14     ` Jean Louis
@ 2020-11-11  8:33     ` Bastien
  1 sibling, 0 replies; 21+ messages in thread
From: Bastien @ 2020-11-11  8:33 UTC (permalink / raw)
  To: stardiviner; +Cc: julien, Org-mode

Hi Stardiviner,

stardiviner <numbchild@gmail.com> writes:

> After waited some days, still no reponse, so I popup this email.

I suggest we collectively adopt a convention of waiting at least 
*one month* before bumping up threads.

It might seem long, especially if you initiated the thread with a
patch or a bug report, but given the activity on this list, I think
it's reasonable.

I've documented this suggested policy on Worg, see the section "What
to do if you don't receive an answer" :

  https://orgmode.org/worg/org-mailing-list.html#org3a98a57

Thanks,

-- 
 Bastien


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2020-11-10  1:15       ` [UPDATED PATCH] " stardiviner
@ 2020-11-11  8:37         ` Bastien
  2020-11-11 12:04           ` stardiviner
  0 siblings, 1 reply; 21+ messages in thread
From: Bastien @ 2020-11-11  8:37 UTC (permalink / raw)
  To: stardiviner; +Cc: julien, Org-mode, Jean Louis

Hi Stardiviner,

stardiviner <numbchild@gmail.com> writes:

> You're right. Thanks for suggestion.
> I attached new patch now.

Applied, thanks.

Would you like to be org-contacts.el maintainer?

Beware that, since it is in contrib/, it will soon be extracted from
org-mode.git and temporarily live in a org-contrib.git repository.

Files in this org-contrib.git will wait for maintainers to take over
and maintain the file elsewhere, so you'd be free to maintain it where
you see fit.

-- 
 Bastien


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2020-11-11  8:37         ` Bastien
@ 2020-11-11 12:04           ` stardiviner
  2020-11-11 13:57             ` More on design of org-contacts.el - " Jean Louis
  0 siblings, 1 reply; 21+ messages in thread
From: stardiviner @ 2020-11-11 12:04 UTC (permalink / raw)
  To: Bastien; +Cc: julien, Org-mode, Jean Louis

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

Thank you too.
I indeed want to extend org-contacts.el. So I would like to be it's
maintainer.

Currently how many org-mode maintainer(mailing list manager)?
If patch need to wait a month. Because I spend less time on org-mode too
comparing before time. I agree with that, I might will add multiple PATCHes
together.


[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Wed, Nov 11, 2020 at 4:37 PM Bastien <bzg@gnu.org> wrote:

> Hi Stardiviner,
>
> stardiviner <numbchild@gmail.com> writes:
>
> > You're right. Thanks for suggestion.
> > I attached new patch now.
>
> Applied, thanks.
>
> Would you like to be org-contacts.el maintainer?
>
> Beware that, since it is in contrib/, it will soon be extracted from
> org-mode.git and temporarily live in a org-contrib.git repository.
>
> Files in this org-contrib.git will wait for maintainers to take over
> and maintain the file elsewhere, so you'd be free to maintain it where
> you see fit.
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 2472 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* More on design of org-contacts.el - Re: [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2020-11-11 12:04           ` stardiviner
@ 2020-11-11 13:57             ` Jean Louis
  2020-11-16  9:26               ` stardiviner
  0 siblings, 1 reply; 21+ messages in thread
From: Jean Louis @ 2020-11-11 13:57 UTC (permalink / raw)
  To: stardiviner; +Cc: Bastien, julien, Org-mode, Jean Louis

* stardiviner <numbchild@gmail.com> [2020-11-11 15:05]:
  :PROPERTIES:
  :CREATED:  [2020-11-11 Wed 16:57]
  :ID:       17d463d2-ff0c-4614-93da-06e3de8e6035
  :END:
> Thank you too.
> I indeed want to extend org-contacts.el. So I would like to be it's
> maintainer.
> 
> Currently how many org-mode maintainer(mailing list manager)?
> If patch need to wait a month. Because I spend less time on org-mode too
> comparing before time. I agree with that, I might will add multiple PATCHes
> together.

Side notes:

I have looked into contacts. It relies on a query to find a contact. I
hope that I am right.

Text based Org mode anyway may rely on built-in text searches like
incremental Emacs's search.

org-contact wishes to pin point to specific contact. It wants to
create a hyperlink to one specific contact. It does not want to find 2
contacts with the same query or more of them. 

As I have 195000 contacts in PostgreSQL database I know from browsing
them that many of them have same unique names. To reference to a
specific contact by using name query would be useless as I could miss
it and take other contact. Thus search involves narrowing contacts by
maybe state, location and other filters. Each contact has its own
uniquely assigned ID number. An integer assigned by the database
automatically.

By using the ID number I can easily capture the reference link to th
contact from the database and insert such link into the Org file. As
long as I do not change the ID number even if contact name is changed
I would be able to pin point the specific number.

Thus for org-contacts I recommend creation of unique IDs in the
properties for headings for each contact so that contact may be
referenced by the unique ID.

Additional proposals:

Each hyperdocument (within or without Emacs) that allows back linking
to its specifical parts should have a function or key binding to
quickly obtain the link reference.

For example if user browses heading for *** John Doe anywhere within
such heading user should be able to press a key to capture the link to
the contact automatically.

In the file my-contacts.org:

*** John Doe
    :PROPERTIES:
    :ID:       cc400d57-2adf-47af-90d9-c4d9fdd70d2b
    :CREATED:  [2020-11-11 Wed 16:57]
    :END:

DATA

**** DATA
     :PROPERTIES:
     :CREATED:  [2020-11-11 Wed 16:57]
     :ID:       19781b53-211b-4291-af48-5f3655dd7cec
     :END:

**** DATA
     :PROPERTIES:
     :CREATED:  [2020-11-11 Wed 16:57]
     :ID:       e8eb6647-8d8e-4ec6-b759-43dcfd60d17b
     :END:

Anywhere within the subtree for John Doe user should be able to obtain
the reference to the contact. For example by clicking `C-x w'.

Upon key press following link could then be stored into memory, or
register, whatever is better design:

[[org-contact:~/file/my-contacts.org#cc400d57-2adf-47af-90d9-c4d9fdd70d2b][John Doe]]

Then user would go to other Org file and use `C-y' to yank the contact
into the new file.

One shall consider that obtaining the object reference should be
on the fly customizable. As maybe I wish to have in the link:

- Contact's first name only like when addressing friends

- Contact's full name, with or without middle names

- Contact's name plus city and country

Having several ways to obtain quickly reference to the contact (to
generate link in memory) is useful feature that shortens the time and
makes it less error prone for the user. If only query is used with
simple typo contact link will not work. What will follow is tedious
browsing and opening of files to find the right contact.

User can have many Org contact files and file reference should be
included into the file. This assumes that files should be fixed in
file system.

This proposal follows the Doug Engelbart's Technology Template Project
for Open Hyperdocument Systems (OHS) in relation to addressing:
https://www.dougengelbart.org/content/view/110/460/#2b1

Global, Human-Understandable, Object Addresses

Every object that someone might validly want/need to cite or otherwise
access should have an unambiguous address, capable of being portrayed
in a human readable and interpretable manner. Most common existing
spreadsheet programs have provisions similar to this for cell
addressibility

And:

Link Addresses That Are Readable and Interpretable by Humans
https://www.dougengelbart.org/content/view/110/460/#2b1b

It should be possible to display and specify the complete link address
of any object in the global domain of the OHS. This human-readable
description of the "address path" leading to the cited object should
permit a transparent possibility for human understanding of the path
including the possibility of reading, interpretation, and conceptually
following the specification

As Emacs already supports remote files, contact path can be
automatically obtained. If I am editing contacts on remote VPS server,
maybe users on the remote server and their details, then my local Org
file should be able to point to remote server. Such link would look
like:

[[org-contact:/ssh:example.com/home/me/my-contacts.org#cc400d57-2adf-47af-90d9-c4d9fdd70d2b][John Doe]]

That way the object to cite or access has:

- unambiguious address by having unique ID

- by showing literal links user can see WHERE the object is located,
  is it on localhost, remote server, could be even on https or various
  other locations.

- contact's name remain very human readable

Additionally I have been looking into contacts and have seen the
structure and I think I did not see the group reference. Contact may
belong to one or more groups which I call accounts:

Contact may in in "My family" group, working in the "ABC Company"
group and being member of "Heidelberger Sportverein" group. And each
of those groups can be also a contact with or without individual
names. Every contact management requires groups to satisfy basics of
off-line contact management. People contact hospitals, network
providers, government offices and need not have specific individual
name.

Thus Org contact need a switch or designation to say if the contact is
a group or just individual. And for individuals it should ask in which
group it belongs, while remembering that one contact may belong to
multiple groups.

Text is alright for contact management until it reaches certain size
when it becomes unmanageable. Then it requires GNU GDBM database or
other type of database which we sadly do not have as built-in.

Jean



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: More on design of org-contacts.el - Re: [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2020-11-11 13:57             ` More on design of org-contacts.el - " Jean Louis
@ 2020-11-16  9:26               ` stardiviner
  2020-11-17  6:34                 ` Jean Louis
  2020-12-14  6:06                 ` Bastien
  0 siblings, 2 replies; 21+ messages in thread
From: stardiviner @ 2020-11-16  9:26 UTC (permalink / raw)
  To: Jean Louis; +Cc: Bastien, julien, Org-mode


First, thank your very much for suggestion.

What really I have not found your email in my Gmail (in web browser), I found it
in mu4e (Emacs). Which I can't reply because I'm in China, sendmail to Gmail
SMTP server is blocked. So I'm replying you in mu4e. Don't know whether you can
receive my message.

Jean Louis <bugs@gnu.support> writes:

> * stardiviner <numbchild@gmail.com> [2020-11-11 15:05]:
>   :PROPERTIES:
>   :CREATED:  [2020-11-11 Wed 16:57]
>   :ID:       17d463d2-ff0c-4614-93da-06e3de8e6035
>   :END:
>> Thank you too.
>> I indeed want to extend org-contacts.el. So I would like to be it's
>> maintainer.
>> 
>> Currently how many org-mode maintainer(mailing list manager)?
>> If patch need to wait a month. Because I spend less time on org-mode too
>> comparing before time. I agree with that, I might will add multiple PATCHes
>> together.
>
> Side notes:
>
> I have looked into contacts. It relies on a query to find a contact. I
> hope that I am right.
>
> Text based Org mode anyway may rely on built-in text searches like
> incremental Emacs's search.
>
> org-contact wishes to pin point to specific contact. It wants to
> create a hyperlink to one specific contact. It does not want to find 2
> contacts with the same query or more of them. 
>
> As I have 195000 contacts in PostgreSQL database I know from browsing
> them that many of them have same unique names. To reference to a
> specific contact by using name query would be useless as I could miss
> it and take other contact. Thus search involves narrowing contacts by
> maybe state, location and other filters. Each contact has its own
> uniquely assigned ID number. An integer assigned by the database
> automatically.
>
> By using the ID number I can easily capture the reference link to th
> contact from the database and insert such link into the Org file. As
> long as I do not change the ID number even if contact name is changed
> I would be able to pin point the specific number.
>
> Thus for org-contacts I recommend creation of unique IDs in the
> properties for headings for each contact so that contact may be
> referenced by the unique ID.

Using unique ID is the only solution to identity contact. I already thought
about this. But integrating org-id is hard for me. Have not spent that time on
it yet. But I will, if I want to improve this org-contacts.

>
> Additional proposals:
>
> Each hyperdocument (within or without Emacs) that allows back linking
> to its specifical parts should have a function or key binding to
> quickly obtain the link reference.
>
> For example if user browses heading for *** John Doe anywhere within
> such heading user should be able to press a key to capture the link to
> the contact automatically.
>
> In the file my-contacts.org:
>
> *** John Doe
>     :PROPERTIES:
>     :ID:       cc400d57-2adf-47af-90d9-c4d9fdd70d2b
>     :CREATED:  [2020-11-11 Wed 16:57]
>     :END:
>
> DATA
>
> **** DATA
>      :PROPERTIES:
>      :CREATED:  [2020-11-11 Wed 16:57]
>      :ID:       19781b53-211b-4291-af48-5f3655dd7cec
>      :END:
>
> **** DATA
>      :PROPERTIES:
>      :CREATED:  [2020-11-11 Wed 16:57]
>      :ID:       e8eb6647-8d8e-4ec6-b759-43dcfd60d17b
>      :END:
>
> Anywhere within the subtree for John Doe user should be able to obtain
> the reference to the contact. For example by clicking `C-x w'.
>
> Upon key press following link could then be stored into memory, or
> register, whatever is better design:
>
> [[org-contact:~/file/my-contacts.org#cc400d57-2adf-47af-90d9-c4d9fdd70d2b][John Doe]]
>
> Then user would go to other Org file and use `C-y' to yank the contact
> into the new file.
>
> One shall consider that obtaining the object reference should be
> on the fly customizable. As maybe I wish to have in the link:
>
> - Contact's first name only like when addressing friends
>
> - Contact's full name, with or without middle names
>
> - Contact's name plus city and country
>
> Having several ways to obtain quickly reference to the contact (to
> generate link in memory) is useful feature that shortens the time and
> makes it less error prone for the user. If only query is used with
> simple typo contact link will not work. What will follow is tedious
> browsing and opening of files to find the right contact.
>
> User can have many Org contact files and file reference should be
> included into the file. This assumes that files should be fixed in
> file system.
>
> This proposal follows the Doug Engelbart's Technology Template Project
> for Open Hyperdocument Systems (OHS) in relation to addressing:
> https://www.dougengelbart.org/content/view/110/460/#2b1
>
> Global, Human-Understandable, Object Addresses
>
> Every object that someone might validly want/need to cite or otherwise
> access should have an unambiguous address, capable of being portrayed
> in a human readable and interpretable manner. Most common existing
> spreadsheet programs have provisions similar to this for cell
> addressibility
>
> And:
>
> Link Addresses That Are Readable and Interpretable by Humans
> https://www.dougengelbart.org/content/view/110/460/#2b1b
>
> It should be possible to display and specify the complete link address
> of any object in the global domain of the OHS. This human-readable
> description of the "address path" leading to the cited object should
> permit a transparent possibility for human understanding of the path
> including the possibility of reading, interpretation, and conceptually
> following the specification

This proposal is useful. Do you want to contribute on it too?

>
> As Emacs already supports remote files, contact path can be
> automatically obtained. If I am editing contacts on remote VPS server,
> maybe users on the remote server and their details, then my local Org
> file should be able to point to remote server. Such link would look
> like:
>
> [[org-contact:/ssh:example.com/home/me/my-contacts.org#cc400d57-2adf-47af-90d9-c4d9fdd70d2b][John Doe]]
>
> That way the object to cite or access has:
>
> - unambiguious address by having unique ID
>
> - by showing literal links user can see WHERE the object is located,
>   is it on localhost, remote server, could be even on https or various
>   other locations.
>
> - contact's name remain very human readable
>
> Additionally I have been looking into contacts and have seen the
> structure and I think I did not see the group reference. Contact may
> belong to one or more groups which I call accounts:
>
> Contact may in in "My family" group, working in the "ABC Company"
> group and being member of "Heidelberger Sportverein" group. And each
> of those groups can be also a contact with or without individual
> names. Every contact management requires groups to satisfy basics of
> off-line contact management. People contact hospitals, network
> providers, government offices and need not have specific individual
> name.
>
> Thus Org contact need a switch or designation to say if the contact is
> a group or just individual. And for individuals it should ask in which
> group it belongs, while remembering that one contact may belong to
> multiple groups.
>
> Text is alright for contact management until it reaches certain size
> when it becomes unmanageable. Then it requires GNU GDBM database or
> other type of database which we sadly do not have as built-in.
>
> Jean

After watching your proposal, I found it's indeed complex....

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: More on design of org-contacts.el - Re: [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2020-11-16  9:26               ` stardiviner
@ 2020-11-17  6:34                 ` Jean Louis
  2020-12-15  8:46                   ` stardiviner
  2020-12-14  6:06                 ` Bastien
  1 sibling, 1 reply; 21+ messages in thread
From: Jean Louis @ 2020-11-17  6:34 UTC (permalink / raw)
  To: stardiviner; +Cc: Bastien, julien, Org-mode

* stardiviner <numbchild@gmail.com> [2020-11-16 13:21]:
:PROPERTIES:
:ID:       e2c30814-b983-4391-869a-3c700d041467
:END:
> 
> First, thank your very much for suggestion.
> 
> What really I have not found your email in my Gmail (in web
> browser),

Maybe because it went to Spam/Junk folder. For privacy and safety
reasons I do not recommend using Gmail at all.

I may recommend using your own email address, requires some money, or
https://posteo.de/ https://tutanota.de/ or https://protonmail.ch/

> I found it in mu4e (Emacs). Which I can't reply because I'm in
> China, sendmail to Gmail SMTP server is blocked. So I'm replying you
> in mu4e. Don't know whether you can receive my message.

I wish I could understand, mu4e is only local system that searches
emails on your computer. How you send emails depends on your email
provider. Maybe you fetch mailing list to search for emails?

> Using unique ID is the only solution to identity contact. I already thought
> about this. But integrating org-id is hard for me. Have not spent that time on
> it yet. But I will, if I want to improve this org-contacts.

If I may just give idea. I am using this below function to
automatically get ID numbers for headings. Normally it is by
saving. Maybe you can do something to automatically insert such
number. I do not know if heading is contact, but if it is, it becomes
all easier.

(defun rcd-org-add-ids-to-headlines-in-file ()
  "Add ID properties to all headlines in the current file which
do not already have one."
  (interactive)
  (org-map-entries 'org-id-get-create))

> > Each hyperdocument (within or without Emacs) that allows back linking
> > to its specifical parts should have a function or key binding to
> > quickly obtain the link reference.

Once you have decided how is contact referenced as now is referenced
by query, I could maybe figure how to obtain the reference.

It should not be that hard:

- find the current heading

- find current ID number

- how link should look like could be customizable, maybe heading as
  visible part. That requires discussion.

- prepare link into memory for pasting in other window or document.

- it should also be possible to insert such into register.

- the option to obtain link by query should be kept intact

Maybe two keybindings or functions can be made:

** Proposal
:PROPERTIES:
:ID:       a566d476-f478-44d8-8d91-53f6eccca10b
:END:

1. One that finds the current heading and obtains the link

(defun capture-contact-by-query-to-heading ()
  (let* ((heading (org-get-heading))
         (link (format "[[org-contact:query#%s][%s]]" heading heading)))
    (kill-new link)))

(capture-contact-by-query-to-heading)

=> [[org-contact:query#Proposal][Proposal]]

And such function should be expanded and be customizable:

- maybe user wish to provide format string as maybe user wish to know
  visually that link leads to contact like:

=> [[org-contact:query#John Doe][Contact: John Doe]]

2. One that finds currentheading by its ID and obtains the link:

(defun capture-contact-by-id-to-heading-1 ()
  (let* ((heading (org-get-heading))
         (id (org-id-get))
         (link (format "[[org-contact:id#%s][%s]]" id heading)))
    link))

(defun capture-contact-by-id-to-heading ()
  (kill-new (capture-contact-by-id-to-heading-1)))

(capture-contact-by-id-to-heading)

=> [[org-contact:id#a566d476-f478-44d8-8d91-53f6eccca10b][Proposal]]

These are design ideas only. You may expand and make checks on these
functions that such work properly.

Additional functions that may be very usable is to quickly send links
to other window. User is collecting the database of contacts in one
file and one window and wishes to insert links into other window that
references such contacts. In that file where you need a link you would
arrive with cursor. Then you go to database of contacts and invoke a
key that sends the yanked org link into other window.

(defun contact-yank-link-in-other-window ()
  (let ((link (capture-contact-by-id-to-heading-1)))
    (kill-new link)
    (other-window 1)
    (yank)
    (other-window 1)
    (message "Yanked link: %s to other window" link)))

It is up to you to expand or think on this as it is design
proposal. Not finalized function or feature. When we wish to
reference things we need it quick and fast.

Org mode in general needs these types of functions:

- to automatically obtain ANY link from Org mode to the heading
  and not just for users to write the link by hand. Examples are:

  - link to specific line
    
  - link to query, when text is marked, that link may be constructed,
    and also if necessary quickly inserted in other window (we use
    links to reference from same buffer to same buffer or from other
    buffer and file to other files). Such query could be automatically
    minimized that it does not carry all the marked words. Few words
    could be enough.

  - link to any heading or subheading by its name

  - link to any heading by its ID or CUSTOM_ID

  - and so on, there shall be various lists of links that can be
    quickly constructed and killed into memory or yanked into other
    window.

- to automatically yank the link from one window to other window
  as that helps to user to construct references.

Then in general, ALL programs that allow any kind of referencing such
as opening PDF file by specific query, specific page, playing video at
specific time, or for specific short period of time, should provide
automated way of obtaining such structures to create hyperlinks.







^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: More on design of org-contacts.el - Re: [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2020-11-16  9:26               ` stardiviner
  2020-11-17  6:34                 ` Jean Louis
@ 2020-12-14  6:06                 ` Bastien
  2020-12-15  8:53                   ` [final patch] " stardiviner
  2021-11-03  1:55                   ` More on design of org-contacts.el - Re: [UPDATED PATCH] " stardiviner
  1 sibling, 2 replies; 21+ messages in thread
From: Bastien @ 2020-12-14  6:06 UTC (permalink / raw)
  To: stardiviner; +Cc: julien, Org-mode, Jean Louis

Hi stardiviner,

what is the last state of your patch?  Feel free to resend it,
I will apply it.

Also, do you want to become the maintainer for org-contacts.el?

Remember, elisp files in contrib/ will soon be extracted from
the repository: https://orgmode.org/list/87wnzfy60h.fsf@bzg.fr

Still, it's useful to already know who will be in charge.

Thanks,

-- 
 Bastien


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: More on design of org-contacts.el - Re: [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2020-11-17  6:34                 ` Jean Louis
@ 2020-12-15  8:46                   ` stardiviner
  0 siblings, 0 replies; 21+ messages in thread
From: stardiviner @ 2020-12-15  8:46 UTC (permalink / raw)
  To: Jean Louis; +Cc: Bastien, julien, Org-mode

[-- Attachment #1: Type: text/plain, Size: 6357 bytes --]

Change an email is hard word for me. I use gmail address for many places.
I started to use new email for new accounts recently.
But switch email need to be later when I have time and desire.
And thanks for your suggestion of mail services. :smile:

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Tue, Nov 17, 2020 at 2:50 PM Jean Louis <bugs@gnu.support> wrote:

> * stardiviner <numbchild@gmail.com> [2020-11-16 13:21]:
> :PROPERTIES:
> :ID:       e2c30814-b983-4391-869a-3c700d041467
> :END:
> >
> > First, thank your very much for suggestion.
> >
> > What really I have not found your email in my Gmail (in web
> > browser),
>
> Maybe because it went to Spam/Junk folder. For privacy and safety
> reasons I do not recommend using Gmail at all.
>
> I may recommend using your own email address, requires some money, or
> https://posteo.de/ https://tutanota.de/ or https://protonmail.ch/
>
> > I found it in mu4e (Emacs). Which I can't reply because I'm in
> > China, sendmail to Gmail SMTP server is blocked. So I'm replying you
> > in mu4e. Don't know whether you can receive my message.
>
> I wish I could understand, mu4e is only local system that searches
> emails on your computer. How you send emails depends on your email
> provider. Maybe you fetch mailing list to search for emails?
>
> > Using unique ID is the only solution to identity contact. I already
> thought
> > about this. But integrating org-id is hard for me. Have not spent that
> time on
> > it yet. But I will, if I want to improve this org-contacts.
>
> If I may just give idea. I am using this below function to
> automatically get ID numbers for headings. Normally it is by
> saving. Maybe you can do something to automatically insert such
> number. I do not know if heading is contact, but if it is, it becomes
> all easier.
>
> (defun rcd-org-add-ids-to-headlines-in-file ()
>   "Add ID properties to all headlines in the current file which
> do not already have one."
>   (interactive)
>   (org-map-entries 'org-id-get-create))
>
> > > Each hyperdocument (within or without Emacs) that allows back linking
> > > to its specifical parts should have a function or key binding to
> > > quickly obtain the link reference.
>
> Once you have decided how is contact referenced as now is referenced
> by query, I could maybe figure how to obtain the reference.
>
> It should not be that hard:
>
> - find the current heading
>
> - find current ID number
>
> - how link should look like could be customizable, maybe heading as
>   visible part. That requires discussion.
>
> - prepare link into memory for pasting in other window or document.
>
> - it should also be possible to insert such into register.
>
> - the option to obtain link by query should be kept intact
>
> Maybe two keybindings or functions can be made:
>
> ** Proposal
> :PROPERTIES:
> :ID:       a566d476-f478-44d8-8d91-53f6eccca10b
> :END:
>
> 1. One that finds the current heading and obtains the link
>
> (defun capture-contact-by-query-to-heading ()
>   (let* ((heading (org-get-heading))
>          (link (format "[[org-contact:query#%s][%s]]" heading heading)))
>     (kill-new link)))
>
> (capture-contact-by-query-to-heading)
>
> => [[org-contact:query#Proposal][Proposal]]
>
> And such function should be expanded and be customizable:
>
> - maybe user wish to provide format string as maybe user wish to know
>   visually that link leads to contact like:
>
> => [[org-contact:query#John Doe][Contact: John Doe]]
>
> 2. One that finds currentheading by its ID and obtains the link:
>
> (defun capture-contact-by-id-to-heading-1 ()
>   (let* ((heading (org-get-heading))
>          (id (org-id-get))
>          (link (format "[[org-contact:id#%s][%s]]" id heading)))
>     link))
>
> (defun capture-contact-by-id-to-heading ()
>   (kill-new (capture-contact-by-id-to-heading-1)))
>
> (capture-contact-by-id-to-heading)
>
> => [[org-contact:id#a566d476-f478-44d8-8d91-53f6eccca10b][Proposal]]
>
> These are design ideas only. You may expand and make checks on these
> functions that such work properly.
>
> Additional functions that may be very usable is to quickly send links
> to other window. User is collecting the database of contacts in one
> file and one window and wishes to insert links into other window that
> references such contacts. In that file where you need a link you would
> arrive with cursor. Then you go to database of contacts and invoke a
> key that sends the yanked org link into other window.
>
> (defun contact-yank-link-in-other-window ()
>   (let ((link (capture-contact-by-id-to-heading-1)))
>     (kill-new link)
>     (other-window 1)
>     (yank)
>     (other-window 1)
>     (message "Yanked link: %s to other window" link)))
>
> It is up to you to expand or think on this as it is design
> proposal. Not finalized function or feature. When we wish to
> reference things we need it quick and fast.
>
> Org mode in general needs these types of functions:
>
> - to automatically obtain ANY link from Org mode to the heading
>   and not just for users to write the link by hand. Examples are:
>
>   - link to specific line
>
>   - link to query, when text is marked, that link may be constructed,
>     and also if necessary quickly inserted in other window (we use
>     links to reference from same buffer to same buffer or from other
>     buffer and file to other files). Such query could be automatically
>     minimized that it does not carry all the marked words. Few words
>     could be enough.
>
>   - link to any heading or subheading by its name
>
>   - link to any heading by its ID or CUSTOM_ID
>
>   - and so on, there shall be various lists of links that can be
>     quickly constructed and killed into memory or yanked into other
>     window.
>
> - to automatically yank the link from one window to other window
>   as that helps to user to construct references.
>
> Then in general, ALL programs that allow any kind of referencing such
> as opening PDF file by specific query, specific page, playing video at
> specific time, or for specific short period of time, should provide
> automated way of obtaining such structures to create hyperlinks.
>
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 8227 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [final patch] Re: add new link type "contact:" for org-contacts.el
  2020-12-14  6:06                 ` Bastien
@ 2020-12-15  8:53                   ` stardiviner
  2020-12-15  9:56                     ` Bastien
  2021-11-03  1:55                   ` More on design of org-contacts.el - Re: [UPDATED PATCH] " stardiviner
  1 sibling, 1 reply; 21+ messages in thread
From: stardiviner @ 2020-12-15  8:53 UTC (permalink / raw)
  To: Bastien; +Cc: julien, Org-mode, Jean Louis


[-- Attachment #1.1: Type: text/plain, Size: 927 bytes --]

My patch still in the previous "[UPDATED PATCH]" state. (I attached in this
email)

I can take a try to be the maintainer for org-contacts.el
Seems it's not very frequently mentioned. So I don't spend too much time on
it.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Mon, Dec 14, 2020 at 2:06 PM Bastien <bzg@gnu.org> wrote:

> Hi stardiviner,
>
> what is the last state of your patch?  Feel free to resend it,
> I will apply it.
>
> Also, do you want to become the maintainer for org-contacts.el?
>
> Remember, elisp files in contrib/ will soon be extracted from
> the repository: https://orgmode.org/list/87wnzfy60h.fsf@bzg.fr
>
> Still, it's useful to already know who will be in charge.
>
> Thanks,
>
> --
>  Bastien
>

[-- Attachment #1.2: Type: text/html, Size: 2050 bytes --]

[-- Attachment #2: 0001-org-contacts.el-Add-new-link-type-contact.patch --]
[-- Type: text/x-patch, Size: 4181 bytes --]

From 7446c0dda49554db0af18401984d20b9b460d408 Mon Sep 17 00:00:00 2001
From: stardiviner <numbchild@gmail.com>
Date: Fri, 30 Oct 2020 15:11:53 +0800
Subject: [PATCH] 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.
---
 contrib/lisp/org-contacts.el | 75 ++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index 4b3693a0e..d8d498425 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -1146,6 +1146,81 @@ (defun org-contacts-split-property (string &optional separators omit-nulls)
         (setq proplist (cons bufferstring proplist))))
     (cdr (reverse proplist))))
 
+;;; Add an Org link type `org-contact:' for easy jump to or searching org-contacts headline.
+;;; link spec: [[org-contact:query][desc]]
+(org-link-set-parameters "org-contact"
+			 :follow 'org-contacts-link-open
+			 :complete 'org-contacts-link-complete
+			 :store 'org-contacts-link-store
+			 :face 'org-contacts-link-face)
+
+(defun org-contacts-link-store ()
+  "Store the contact in `org-contacts-files' with a link."
+  (when (eq major-mode 'org-mode)
+    ;; (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files))
+    (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
+      (org-store-link-props
+       :type "org-contact"
+       :link headline-str
+       :description headline-str))))
+
+(defun org-contacts--all-contacts ()
+  "Return an alist (name . (file . position)) of all contacts in `org-contacts-files'."
+  (car (mapcar
+	(lambda (file)
+	  (unless (buffer-live-p (get-buffer (file-name-nondirectory file)))
+	    (find-file file))
+	  (with-current-buffer (get-buffer (file-name-nondirectory file))
+	    (org-map-entries
+	     (lambda ()
+	       (let ((name (substring-no-properties (org-get-heading t t t t)))
+		     (file (buffer-file-name))
+		     (position (point)))
+		 `(:name ,name :file ,file :position ,position))))))
+	org-contacts-files)))
+
+(defun org-contacts-link-open (path)
+  "Open contacts: link type with jumping or searching."
+  (let ((query path))
+    (cond
+     ((string-match "/.*/" query)
+      (let* ((f (car org-contacts-files))
+	     (buf (get-buffer (file-name-nondirectory f))))
+	(unless (buffer-live-p buf) (find-file f))
+	(with-current-buffer buf
+	  (string-match "/\\(.*\\)/" query)
+	  (occur (match-string 1 query)))))
+     (t
+      (let* ((f (car org-contacts-files))
+	     (buf (get-buffer (file-name-nondirectory f))))
+	(unless (buffer-live-p buf) (find-file f))
+	(with-current-buffer buf
+	  (goto-char (marker-position (org-find-exact-headline-in-buffer query)))))
+      ;; FIXME
+      ;; (let* ((contact-entry (plist-get (org-contacts--all-contacts) query))
+      ;; 	     (contact-name (plist-get contact-entry :name))
+      ;; 	     (file (plist-get contact-entry :file))
+      ;; 	     (position (plist-get contact-entry :position))
+      ;; 	     (buf (get-buffer (file-name-nondirectory file))))
+      ;; 	(unless (buffer-live-p buf) (find-file file))
+      ;; 	(with-current-buffer buf (goto-char position)))
+      ))))
+
+(defun org-contacts-link-complete (&optional arg)
+  "Create a org-contacts link using completion."
+  (let ((name (completing-read "org-contact Name: "
+			       (mapcar
+				(lambda (plist) (plist-get plist :name))
+				(org-contacts--all-contacts)))))
+    (concat "org-contact:" name)))
+
+(defun org-contacts-link-face (path)
+  "Different face color for different org-contacts link query."
+  (cond
+   ((string-match "/.*/" path)
+    '(:background "sky blue" :overline t :slant 'italic))
+   (t '(:background "green yellow" :underline t))))
+
 (provide 'org-contacts)
 
 ;;; org-contacts.el ends here
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [final patch] Re: add new link type "contact:" for org-contacts.el
  2020-12-15  8:53                   ` [final patch] " stardiviner
@ 2020-12-15  9:56                     ` Bastien
  2020-12-15 14:13                       ` stardiviner
  0 siblings, 1 reply; 21+ messages in thread
From: Bastien @ 2020-12-15  9:56 UTC (permalink / raw)
  To: stardiviner; +Cc: julien, Org-mode, Jean Louis

stardiviner <numbchild@gmail.com> writes:

> My patch still in the previous "[UPDATED PATCH]" state. (I attached
> in this email)

Thanks.  It applies correctly on the maint branch but I'd rather apply
it againt the master branch, where it fails to apply.

Can you replay your changes on top of the main branch, and also add
your name as the maintainer?

Thanks a lot!

-- 
 Bastien


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [final patch] Re: add new link type "contact:" for org-contacts.el
  2020-12-15  9:56                     ` Bastien
@ 2020-12-15 14:13                       ` stardiviner
  2020-12-15 14:27                         ` Bastien
  0 siblings, 1 reply; 21+ messages in thread
From: stardiviner @ 2020-12-15 14:13 UTC (permalink / raw)
  To: Bastien; +Cc: julien, Org-mode, Jean Louis

[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]

Thanks for reviewing.

Don't know why, it's been applied in the "master" branch already by you. (I
did git pull from upstream)
Here is the commit:
e9c3993ee * | org-contacts.el: Add new link type "contact:"

If this is confirmed, I might don't need to add a new patch to add my name
to maintainer. Can you add it directly? That will be more simple.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Tue, Dec 15, 2020 at 5:56 PM Bastien <bzg@gnu.org> wrote:

> stardiviner <numbchild@gmail.com> writes:
>
> > My patch still in the previous "[UPDATED PATCH]" state. (I attached
> > in this email)
>
> Thanks.  It applies correctly on the maint branch but I'd rather apply
> it againt the master branch, where it fails to apply.
>
> Can you replay your changes on top of the main branch, and also add
> your name as the maintainer?
>
> Thanks a lot!
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 2407 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [final patch] Re: add new link type "contact:" for org-contacts.el
  2020-12-15 14:13                       ` stardiviner
@ 2020-12-15 14:27                         ` Bastien
  2021-04-25  3:31                           ` Timothy
  0 siblings, 1 reply; 21+ messages in thread
From: Bastien @ 2020-12-15 14:27 UTC (permalink / raw)
  To: stardiviner; +Cc: julien, Org-mode, Jean Louis

stardiviner <numbchild@gmail.com> writes:

> If this is confirmed, I might don't need to add a new patch to add my
> name to maintainer. Can you add it directly? That will be more
> simple.

Of course, done (c822c80ef).

Sorry I forgot about this patch, and thanks for your reply.

-- 
 Bastien


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [final patch] Re: add new link type "contact:" for org-contacts.el
  2020-12-15 14:27                         ` Bastien
@ 2021-04-25  3:31                           ` Timothy
  2021-04-25  3:59                             ` Timothy
  0 siblings, 1 reply; 21+ messages in thread
From: Timothy @ 2021-04-25  3:31 UTC (permalink / raw)
  To: emacs-orgmode


This was not marked as applied on updates.orgmode.org.
Doing so with the X-Woof-Patch header.

Bastien <bzg@gnu.org> writes:

> Of course, done (c822c80ef).
>
> Sorry I forgot about this patch, and thanks for your reply.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [final patch] Re: add new link type "contact:" for org-contacts.el
  2021-04-25  3:31                           ` Timothy
@ 2021-04-25  3:59                             ` Timothy
  0 siblings, 0 replies; 21+ messages in thread
From: Timothy @ 2021-04-25  3:59 UTC (permalink / raw)
  To: emacs-orgmode


I'm afraid it looks like I either made a typo while doing this, or
something odd happened. Regardless it didn't work correctly.

Take 2, sorry for the noise --- but at least the patch section on
updates.orgmode.org should be more useful now as it only shows pending
patches again.

Timothy <tecosaur@gmail.com> writes:

> This was not marked as applied on updates.orgmode.org.
> Doing so with the X-Woof-Patch header.
>
> Bastien <bzg@gnu.org> writes:
>
>> Of course, done (c822c80ef).
>>
>> Sorry I forgot about this patch, and thanks for your reply.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: More on design of org-contacts.el - Re: [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2020-12-14  6:06                 ` Bastien
  2020-12-15  8:53                   ` [final patch] " stardiviner
@ 2021-11-03  1:55                   ` stardiviner
  2021-11-03 16:45                     ` Bastien
  1 sibling, 1 reply; 21+ messages in thread
From: stardiviner @ 2021-11-03  1:55 UTC (permalink / raw)
  To: Bastien; +Cc: julien, Org-mode, Jean Louis

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

I would like to be the maintainer of org-contacts.el. (I might already
replied this message? Sorry if duplicated.)
I have separated and put org-contacts on GitHub
https://github.com/stardiviner/org-contacts.el.
And I'm in the progress to put it on NonGNU ELPA or MELPA.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Mon, Dec 14, 2020 at 2:06 PM Bastien <bzg@gnu.org> wrote:

> Hi stardiviner,
>
> what is the last state of your patch?  Feel free to resend it,
> I will apply it.
>
> Also, do you want to become the maintainer for org-contacts.el?
>
> Remember, elisp files in contrib/ will soon be extracted from
> the repository: https://orgmode.org/list/87wnzfy60h.fsf@bzg.fr
>
> Still, it's useful to already know who will be in charge.
>
> Thanks,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 2033 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: More on design of org-contacts.el - Re: [UPDATED PATCH] Re: add new link type "contact:" for org-contacts.el
  2021-11-03  1:55                   ` More on design of org-contacts.el - Re: [UPDATED PATCH] " stardiviner
@ 2021-11-03 16:45                     ` Bastien
  0 siblings, 0 replies; 21+ messages in thread
From: Bastien @ 2021-11-03 16:45 UTC (permalink / raw)
  To: stardiviner; +Cc: julien, Org-mode, Jean Louis

Hi,

stardiviner <numbchild@gmail.com> writes:

> I would like to be the maintainer of org-contacts.el. (I might
> already replied this message? Sorry if duplicated.)

You are already org-contacts.org's maintainer:

https://git.sr.ht/~bzg/org-contrib/tree/master/item/lisp/org-contacts.el#L6

> I have separated and put org-contacts on
> GitHub https://github.com/stardiviner/org-contacts.el.

I've added this as the new homepage for org-contacts.el and listed
org-contacts.el in the library to remove from next versions of
org-contrib.

> And I'm in the progress to put it on NonGNU ELPA or MELPA.

Great, thank you very much!

-- 
 Bastien


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2021-11-03 16:49 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-30  7:35 [PATCH] add new link type "contact:" for org-contacts.el stardiviner
2020-10-30  7:44 ` stardiviner
2020-11-09  0:24   ` stardiviner
2020-11-09  6:14     ` Jean Louis
2020-11-10  1:15       ` [UPDATED PATCH] " stardiviner
2020-11-11  8:37         ` Bastien
2020-11-11 12:04           ` stardiviner
2020-11-11 13:57             ` More on design of org-contacts.el - " Jean Louis
2020-11-16  9:26               ` stardiviner
2020-11-17  6:34                 ` Jean Louis
2020-12-15  8:46                   ` stardiviner
2020-12-14  6:06                 ` Bastien
2020-12-15  8:53                   ` [final patch] " stardiviner
2020-12-15  9:56                     ` Bastien
2020-12-15 14:13                       ` stardiviner
2020-12-15 14:27                         ` Bastien
2021-04-25  3:31                           ` Timothy
2021-04-25  3:59                             ` Timothy
2021-11-03  1:55                   ` More on design of org-contacts.el - Re: [UPDATED PATCH] " stardiviner
2021-11-03 16:45                     ` Bastien
2020-11-11  8:33     ` [PATCH] " Bastien

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.