emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-contacts.el: Only use org-id-store-link if org-id is loaded
@ 2021-01-03 23:09 David Florness
  2021-01-04  3:44 ` miles christopher
  2021-01-05  3:09 ` [PATCH v2] " David Florness
  0 siblings, 2 replies; 12+ messages in thread
From: David Florness @ 2021-01-03 23:09 UTC (permalink / raw)
  To: emacs-orgmode

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

Fixes bug introduced in 6b83c6e4e that made org-contacts-anniversaries
error if org-id was not loaded.
---
Alternatively, we could autoload org-id-link-to-org-use-id.  If you all
would prefer this, let me know and I can send a v2 patch.

6b83c6e4e was found using git-blame.

 contrib/lisp/org-contacts.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index 82881ecd0..7ad425519 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -1166,7 +1166,7 @@ are effectively trimmed).  If nil, all zero-length substrings are retained."
   "Store the contact in `org-contacts-files' with a link."
   (when (and (eq major-mode 'org-mode)
 	     (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files)))
-    (if org-id-link-to-org-use-id
+    (if (and (featurep 'org-id) org-id-link-to-org-use-id)
 	(org-id-store-link)
       (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
 	(org-store-link-props
-- 
2.30.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

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

* Re: [PATCH] org-contacts.el: Only use org-id-store-link if org-id is loaded
  2021-01-03 23:09 [PATCH] org-contacts.el: Only use org-id-store-link if org-id is loaded David Florness
@ 2021-01-04  3:44 ` miles christopher
  2021-01-04  4:15   ` David Florness
  2021-01-05  3:09 ` [PATCH v2] " David Florness
  1 sibling, 1 reply; 12+ messages in thread
From: miles christopher @ 2021-01-04  3:44 UTC (permalink / raw)
  To: David Florness; +Cc: emacs-orgmode@gnu.org


Thanks for your patch. :smile:

Can you send patch file as attachment? I don't know how to apply patch in email body.

David Florness <david@florness.com> writes:

> Fixes bug introduced in 6b83c6e4e that made org-contacts-anniversaries
> error if org-id was not loaded.
> ---
> Alternatively, we could autoload org-id-link-to-org-use-id.  If you all
> would prefer this, let me know and I can send a v2 patch.
>
> 6b83c6e4e was found using git-blame.
>
>  contrib/lisp/org-contacts.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
> index 82881ecd0..7ad425519 100644
> --- a/contrib/lisp/org-contacts.el
> +++ b/contrib/lisp/org-contacts.el
> @@ -1166,7 +1166,7 @@ are effectively trimmed).  If nil, all zero-length substrings are retained."
>    "Store the contact in `org-contacts-files' with a link."
>    (when (and (eq major-mode 'org-mode)
>  	     (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files)))
> -    (if org-id-link-to-org-use-id
> +    (if (and (featurep 'org-id) org-id-link-to-org-use-id)
>  	(org-id-store-link)
>        (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
>  	(org-store-link-props


-- 
[ 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] 12+ messages in thread

* Re: [PATCH] org-contacts.el: Only use org-id-store-link if org-id is loaded
  2021-01-04  3:44 ` miles christopher
@ 2021-01-04  4:15   ` David Florness
  2021-01-04 17:33     ` miles christopher
  0 siblings, 1 reply; 12+ messages in thread
From: David Florness @ 2021-01-04  4:15 UTC (permalink / raw)
  To: miles christopher; +Cc: emacs-orgmode

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

miles christopher <numbchild@gmail.com> writes:

> Thanks for your patch. :smile:
>
> Can you send patch file as attachment? I don't know how to apply patch in email body.

Hi Miles,

If you download the raw email message (which you should be able to do in
the Gmail UI) you can apply the patch like so:

    git am < /path/to/download.eml

Alternatively, you can download the email from the orgmode list archives
and apply the patch using this one-line command:

    curl -s https://orgmode.org/list/874kjxpqht.fsf@florness.com/raw | git am

Let me know if you run into any trouble.

-- 
David

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

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

* Re: [PATCH] org-contacts.el: Only use org-id-store-link if org-id is loaded
  2021-01-04  4:15   ` David Florness
@ 2021-01-04 17:33     ` miles christopher
  2021-01-04 18:13       ` David Florness
  0 siblings, 1 reply; 12+ messages in thread
From: miles christopher @ 2021-01-04 17:33 UTC (permalink / raw)
  To: David Florness; +Cc: emacs-orgmode@gnu.org


I applied your patch, thanks. I don't want to use Gmail web UI or find out email
URL in mailing list archive. I'm using mu4e. Is there a convenient simple way
for mu4e user?

David Florness <david@florness.com> writes:

> miles christopher <numbchild@gmail.com> writes:
>
>> Thanks for your patch. :smile:
>>
>> Can you send patch file as attachment? I don't know how to apply patch in email body.
>
> Hi Miles,
>
> If you download the raw email message (which you should be able to do in
> the Gmail UI) you can apply the patch like so:
>
>     git am < /path/to/download.eml
>
> Alternatively, you can download the email from the orgmode list archives
> and apply the patch using this one-line command:
>
>     curl -s https://orgmode.org/list/874kjxpqht.fsf@florness.com/raw | git am
>
> Let me know if you run into any trouble.


-- 
[ 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] 12+ messages in thread

* Re: [PATCH] org-contacts.el: Only use org-id-store-link if org-id is loaded
  2021-01-04 17:33     ` miles christopher
@ 2021-01-04 18:13       ` David Florness
  2021-01-04 18:21         ` David Florness
  0 siblings, 1 reply; 12+ messages in thread
From: David Florness @ 2021-01-04 18:13 UTC (permalink / raw)
  To: miles christopher; +Cc: emacs-orgmode

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

miles christopher <numbchild@gmail.com> writes:

> I applied your patch, thanks. I don't want to use Gmail web UI or find
> out email URL in mailing list archive. I'm using mu4e. Is there a
> convenient simple way for mu4e user?

Oh cool, I use mu4e also :) I guessed you were using the Gmail UI since
you have a Gmail address.

Anyways, mu4e has an action function called
`mu4e-action-git-apply-patch' [0] for this.  If you setup this action with

    (add-to-list 'mu4e-view-actions
                 '("git am" . mu4e-action-git-apply-mbox))

and then type `a g` (`g` may be a different key that should display in
the message buffer) when viewing a PATCH email, Emacs should prompt you
for the repo's directory and the patch will be applied.

Hope this helps,

-- 
David

[0]: https://github.com/djcb/mu/blob/1.4.14/mu4e/mu4e-actions.el#L251

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

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

* Re: [PATCH] org-contacts.el: Only use org-id-store-link if org-id is loaded
  2021-01-04 18:13       ` David Florness
@ 2021-01-04 18:21         ` David Florness
  0 siblings, 0 replies; 12+ messages in thread
From: David Florness @ 2021-01-04 18:21 UTC (permalink / raw)
  To: miles christopher; +Cc: emacs-orgmode

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

David Florness <david@florness.com> writes:

> Anyways, mu4e has an action function called
> `mu4e-action-git-apply-patch' [0] for this.  If you setup this action with

I meant `mu4e-action-git-apply-mbox' here.

-- 
David

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

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

* [PATCH v2] org-contacts.el: Only use org-id-store-link if org-id is loaded
  2021-01-03 23:09 [PATCH] org-contacts.el: Only use org-id-store-link if org-id is loaded David Florness
  2021-01-04  3:44 ` miles christopher
@ 2021-01-05  3:09 ` David Florness
  2021-01-05  3:56   ` Kyle Meyer
  1 sibling, 1 reply; 12+ messages in thread
From: David Florness @ 2021-01-05  3:09 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Stefan Monnier

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

Fixes bug introduced in 6b83c6e4e that made org-contacts-anniversaries
error if org-id was not loaded.
---
v1 -> v2: Stefan Monnier made a good suggestion to use bound-and-true-p
instead here: https://lists.gnu.org/r/emacs-devel/2021-01/msg00257.html

Alternatively, we could autoload org-id-link-to-org-use-id.  If you all
would prefer this, let me know and I can send a v3 patch.

6b83c6e4e was found using git-blame.

 contrib/lisp/org-contacts.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index 82881ecd0..3df1b52dd 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -1166,7 +1166,7 @@ are effectively trimmed).  If nil, all zero-length substrings are retained."
   "Store the contact in `org-contacts-files' with a link."
   (when (and (eq major-mode 'org-mode)
 	     (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files)))
-    (if org-id-link-to-org-use-id
+    (if (bound-and-true-p org-id-link-to-org-use-id)
 	(org-id-store-link)
       (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
 	(org-store-link-props
-- 
2.30.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

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

* Re: [PATCH v2] org-contacts.el: Only use org-id-store-link if org-id is loaded
  2021-01-05  3:09 ` [PATCH v2] " David Florness
@ 2021-01-05  3:56   ` Kyle Meyer
  2021-01-05  4:20     ` [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var David Florness
  0 siblings, 1 reply; 12+ messages in thread
From: Kyle Meyer @ 2021-01-05  3:56 UTC (permalink / raw)
  To: David Florness; +Cc: emacs-orgmode, Stefan Monnier

David Florness writes:

> Fixes bug introduced in 6b83c6e4e that made org-contacts-anniversaries
> error if org-id was not loaded.
> ---
> v1 -> v2: Stefan Monnier made a good suggestion to use bound-and-true-p
> instead here: https://lists.gnu.org/r/emacs-devel/2021-01/msg00257.html

stardiviner already applied/pushed v1 to master, so please reposition
the patch on top of the previous commit (e6e1c0811).  Also, while we're
less strict about the commit message format for contrib/ files, it'd
still be good to follow the changelog entry convention.

Thanks.


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

* [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var
  2021-01-05  3:56   ` Kyle Meyer
@ 2021-01-05  4:20     ` David Florness
  2021-01-05  5:06       ` Kyle Meyer
  2021-01-05 11:33       ` miles christopher
  0 siblings, 2 replies; 12+ messages in thread
From: David Florness @ 2021-01-05  4:20 UTC (permalink / raw)
  To: Kyle Meyer, stardiviner; +Cc: emacs-orgmode

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

* 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.
---
Thank you, Kyle.  This patch should do the trick.  I'm always happy to
send another revision so feel free to nitpick.

 contrib/lisp/org-contacts.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index 7ad425519..3df1b52dd 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -1166,7 +1166,7 @@ are effectively trimmed).  If nil, all zero-length substrings are retained."
   "Store the contact in `org-contacts-files' with a link."
   (when (and (eq major-mode 'org-mode)
 	     (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files)))
-    (if (and (featurep 'org-id) org-id-link-to-org-use-id)
+    (if (bound-and-true-p org-id-link-to-org-use-id)
 	(org-id-store-link)
       (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
 	(org-store-link-props
-- 
2.30.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

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

* Re: [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var
  2021-01-05  4:20     ` [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var David Florness
@ 2021-01-05  5:06       ` Kyle Meyer
  2021-01-05 11:33       ` miles christopher
  1 sibling, 0 replies; 12+ messages in thread
From: Kyle Meyer @ 2021-01-05  5:06 UTC (permalink / raw)
  To: David Florness; +Cc: emacs-orgmode

David Florness writes:

> Thank you, Kyle.  This patch should do the trick.  I'm always happy to
> send another revision so feel free to nitpick.

Thank you.  Looks good to me, but I'll leave the final review/apply up
to stardiviner.


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

* Re: [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var
  2021-01-05  4:20     ` [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var David Florness
  2021-01-05  5:06       ` Kyle Meyer
@ 2021-01-05 11:33       ` miles christopher
  2021-04-25  3:41         ` Timothy
  1 sibling, 1 reply; 12+ messages in thread
From: miles christopher @ 2021-01-05 11:33 UTC (permalink / raw)
  To: David Florness; +Cc: Kyle Meyer, emacs-orgmode@gnu.org


Applied, I think this should be the final version.

I also fixed a problem in org-contacts-store-link.

David Florness <david@florness.com> writes:

> * 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.
> ---
> Thank you, Kyle.  This patch should do the trick.  I'm always happy to
> send another revision so feel free to nitpick.
>
>  contrib/lisp/org-contacts.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
> index 7ad425519..3df1b52dd 100644
> --- a/contrib/lisp/org-contacts.el
> +++ b/contrib/lisp/org-contacts.el
> @@ -1166,7 +1166,7 @@ are effectively trimmed).  If nil, all zero-length substrings are retained."
>    "Store the contact in `org-contacts-files' with a link."
>    (when (and (eq major-mode 'org-mode)
>  	     (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files)))
> -    (if (and (featurep 'org-id) org-id-link-to-org-use-id)
> +    (if (bound-and-true-p org-id-link-to-org-use-id)
>  	(org-id-store-link)
>        (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
>  	(org-store-link-props


-- 
[ 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] 12+ messages in thread

* Re: [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var
  2021-01-05 11:33       ` miles christopher
@ 2021-04-25  3:41         ` Timothy
  0 siblings, 0 replies; 12+ messages in thread
From: Timothy @ 2021-04-25  3:41 UTC (permalink / raw)
  To: emacs-orgmode


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

miles christopher <numbchild@gmail.com> writes:

> Applied, I think this should be the final version.


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

end of thread, other threads:[~2021-04-25  3:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-03 23:09 [PATCH] org-contacts.el: Only use org-id-store-link if org-id is loaded David Florness
2021-01-04  3:44 ` miles christopher
2021-01-04  4:15   ` David Florness
2021-01-04 17:33     ` miles christopher
2021-01-04 18:13       ` David Florness
2021-01-04 18:21         ` David Florness
2021-01-05  3:09 ` [PATCH v2] " David Florness
2021-01-05  3:56   ` Kyle Meyer
2021-01-05  4:20     ` [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var David Florness
2021-01-05  5:06       ` Kyle Meyer
2021-01-05 11:33       ` miles christopher
2021-04-25  3:41         ` Timothy

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).