* Modification to `org-attach' allowing attaching from URL
@ 2017-03-11 1:07 Wojciech Gac
2017-03-11 10:06 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Wojciech Gac @ 2017-03-11 1:07 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 237 bytes --]
Hello,
I wrote a tiny change of the `org-attach' function that allows to attach a
file from a URL (downloading it in the process). I chose a binding of 'C-c
C-a u' for this. I've updated the Texi documentation as well.
Regards,
Wojtek
[-- Attachment #1.2: Type: text/html, Size: 333 bytes --]
[-- Attachment #2: 0001-org-attach.el-Add-functionality-to-attach-from-URL.patch --]
[-- Type: text/x-patch, Size: 3428 bytes --]
From 1477e86e1721d7a3db4bf871032c970d9f3259ac Mon Sep 17 00:00:00 2001
From: Wojciech Gac <wojciech.s.gac@gmail.com>
Date: Sat, 11 Mar 2017 01:54:05 +0100
Subject: [PATCH] org-attach.el: Add functionality to attach from URL
* lisp/org-attach.el (org-attach): Create a binding under 'u' to
attach a file from URL
(org-attach-url): Prompt user for URL
(org-attach-attach): Update method list
* doc/org.texi (Attachments): Document attaching from URL
---
doc/org.texi | 3 +++
lisp/org-attach.el | 12 ++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/doc/org.texi b/doc/org.texi
index ccb469f20..90a3921d6 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -7411,6 +7411,9 @@ Note that hard links are not supported on all systems.
Attach a file using the copy/move/link method.
Note that hard links are not supported on all systems.
+@orgcmdtkc{u,C-c C-a u,org-attach-url}
+Attach a file from URL
+
@orgcmdtkc{n,C-c C-a n,org-attach-new}
Create a new attachment as an Emacs buffer.
diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 75157a1ee..da2bd0e99 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -173,6 +173,7 @@ Shows a list of commands and prompts for another key to execute a command."
a Select a file and attach it to the task, using `org-attach-method'.
c/m/l/y Attach a file using copy/move/link/symbolic-link method.
+u Attach a file from URL (downloading it).
n Create a new attachment, as an Emacs buffer.
z Synchronize the current task with its attachment
directory, in case you added attachments yourself.
@@ -202,6 +203,8 @@ i Make children of the current entry inherit its attachment directory.")))
(let ((org-attach-method 'ln)) (call-interactively 'org-attach-attach)))
((memq c '(?y ?\C-y))
(let ((org-attach-method 'lns)) (call-interactively 'org-attach-attach)))
+ ((memq c '(?u ?\C-u))
+ (let ((org-attach-method 'url)) (call-interactively 'org-attach-url)))
((memq c '(?n ?\C-n)) (call-interactively 'org-attach-new))
((memq c '(?z ?\C-z)) (call-interactively 'org-attach-sync))
((memq c '(?o ?\C-o)) (call-interactively 'org-attach-open))
@@ -363,10 +366,14 @@ Only do this when `org-attach-store-link-p' is non-nil."
(file-name-nondirectory file))
org-stored-links)))
+(defun org-attach-url (url)
+ (interactive "MURL of the file to attach: \n")
+ (org-attach-attach url))
+
(defun org-attach-attach (file &optional visit-dir method)
"Move/copy/link FILE into the attachment directory of the current task.
If VISIT-DIR is non-nil, visit the directory with dired.
-METHOD may be `cp', `mv', `ln', or `lns' default taken from
+METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
`org-attach-method'."
(interactive "fFile to keep as an attachment: \nP")
(setq method (or method org-attach-method))
@@ -380,7 +387,8 @@ METHOD may be `cp', `mv', `ln', or `lns' default taken from
((eq method 'mv) (rename-file file fname))
((eq method 'cp) (copy-file file fname))
((eq method 'ln) (add-name-to-file file fname))
- ((eq method 'lns) (make-symbolic-link file fname)))
+ ((eq method 'lns) (make-symbolic-link file fname))
+ ((eq method 'url) (url-copy-file file fname)))
(when org-attach-commit
(org-attach-commit))
(org-attach-tag)
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: Modification to `org-attach' allowing attaching from URL
2017-03-11 1:07 Modification to `org-attach' allowing attaching from URL Wojciech Gac
@ 2017-03-11 10:06 ` Nicolas Goaziou
2017-03-11 10:11 ` Wojciech Gac
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2017-03-11 10:06 UTC (permalink / raw)
To: Wojciech Gac; +Cc: emacs-orgmode
Hello,
Wojciech Gac <wojciech.s.gac@gmail.com> writes:
> I wrote a tiny change of the `org-attach' function that allows to attach a
> file from a URL (downloading it in the process). I chose a binding of 'C-c
> C-a u' for this. I've updated the Texi documentation as well.
Nice. Did you sign FSF papers already? Otherwise, I'll add a TINYPATCH
cookie at the end of your commit message before applying it.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Modification to `org-attach' allowing attaching from URL
2017-03-11 10:06 ` Nicolas Goaziou
@ 2017-03-11 10:11 ` Wojciech Gac
2017-03-11 12:42 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Wojciech Gac @ 2017-03-11 10:11 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
HI Nicolas,
No, I haven't signed the papers.
Regards,
Wojtek
2017-03-11 11:06 GMT+01:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:
> Hello,
>
> Wojciech Gac <wojciech.s.gac@gmail.com> writes:
>
> > I wrote a tiny change of the `org-attach' function that allows to attach
> a
> > file from a URL (downloading it in the process). I chose a binding of
> 'C-c
> > C-a u' for this. I've updated the Texi documentation as well.
>
> Nice. Did you sign FSF papers already? Otherwise, I'll add a TINYPATCH
> cookie at the end of your commit message before applying it.
>
> Regards,
>
> --
> Nicolas Goaziou
>
[-- Attachment #2: Type: text/html, Size: 1166 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Modification to `org-attach' allowing attaching from URL
2017-03-11 10:11 ` Wojciech Gac
@ 2017-03-11 12:42 ` Nicolas Goaziou
2017-03-11 13:10 ` Wojciech Gac
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2017-03-11 12:42 UTC (permalink / raw)
To: Wojciech Gac; +Cc: emacs-orgmode
Hello,
Wojciech Gac <wojciech.s.gac@gmail.com> writes:
> No, I haven't signed the papers.
OK. I applied your patch. I suggest to consider signing them if you plan
to provide more patches.
Would you mind providing an ORG-NEWS entry for the feature you added?
Thank you.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Modification to `org-attach' allowing attaching from URL
2017-03-11 12:42 ` Nicolas Goaziou
@ 2017-03-11 13:10 ` Wojciech Gac
2017-03-11 14:31 ` Nicolas Goaziou
0 siblings, 1 reply; 10+ messages in thread
From: Wojciech Gac @ 2017-03-11 13:10 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 521 bytes --]
Hi,
I'm attaching a patch with a note in ORG-NEWS. I'll have a look at the FSF
papers.
Thank you.
Regards,
Wojtek
2017-03-11 13:42 GMT+01:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:
> Hello,
>
> Wojciech Gac <wojciech.s.gac@gmail.com> writes:
>
> > No, I haven't signed the papers.
>
> OK. I applied your patch. I suggest to consider signing them if you plan
> to provide more patches.
>
> Would you mind providing an ORG-NEWS entry for the feature you added?
>
> Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>
[-- Attachment #1.2: Type: text/html, Size: 1124 bytes --]
[-- Attachment #2: 0001-ORG-NEWS-Add-a-note-about-attaching-from-URL.patch --]
[-- Type: text/x-patch, Size: 775 bytes --]
From 0da5881e4eac42e00d9759e77b105adb325db39b Mon Sep 17 00:00:00 2001
From: Wojciech Gac <wojciech.s.gac@gmail.com>
Date: Sat, 11 Mar 2017 14:04:44 +0100
Subject: [PATCH] ORG-NEWS: Add a note about attaching from URL
---
etc/ORG-NEWS | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index aa0c7dcd6..3518bc7d7 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -193,6 +193,11 @@ changed by configuring ~org-src-lang-modes~.
*** New variable : ~org-bibtex-headline-format-function~
This allow to use a different title than entry title.
+*** ~org-attach~ supports attaching files from URLs
+
+Using ~C-c C-a u~ prompts for a URL pointing to a file to be attached
+to the document.
+
** Removed functions
*** Org Timeline
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: Modification to `org-attach' allowing attaching from URL
2017-03-11 13:10 ` Wojciech Gac
@ 2017-03-11 14:31 ` Nicolas Goaziou
2017-03-11 15:24 ` Wojciech Gac
2017-05-03 0:29 ` Eric Abrahamsen
0 siblings, 2 replies; 10+ messages in thread
From: Nicolas Goaziou @ 2017-03-11 14:31 UTC (permalink / raw)
To: Wojciech Gac; +Cc: emacs-orgmode
Wojciech Gac <wojciech.s.gac@gmail.com> writes:
> I'm attaching a patch with a note in ORG-NEWS.
Applied. Thank you.
> I'll have a look at the FSF papers.
Great !
Regards,
--
Nicolas Goaziou 0x80A93738
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Modification to `org-attach' allowing attaching from URL
2017-03-11 14:31 ` Nicolas Goaziou
@ 2017-03-11 15:24 ` Wojciech Gac
2017-05-03 0:29 ` Eric Abrahamsen
1 sibling, 0 replies; 10+ messages in thread
From: Wojciech Gac @ 2017-03-11 15:24 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 360 bytes --]
Thank you
2017-03-11 15:31 GMT+01:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:
> Wojciech Gac <wojciech.s.gac@gmail.com> writes:
>
> > I'm attaching a patch with a note in ORG-NEWS.
>
> Applied. Thank you.
>
> > I'll have a look at the FSF papers.
>
> Great !
>
> Regards,
>
> --
> Nicolas Goaziou 0x80A93738
>
[-- Attachment #2: Type: text/html, Size: 894 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Modification to `org-attach' allowing attaching from URL
2017-03-11 14:31 ` Nicolas Goaziou
2017-03-11 15:24 ` Wojciech Gac
@ 2017-05-03 0:29 ` Eric Abrahamsen
2017-05-03 11:50 ` Nicolas Goaziou
1 sibling, 1 reply; 10+ messages in thread
From: Eric Abrahamsen @ 2017-05-03 0:29 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Wojciech Gac <wojciech.s.gac@gmail.com> writes:
>
>> I'm attaching a patch with a note in ORG-NEWS.
>
> Applied. Thank you.
Hey I am running org-plus-contrib from the package repos, and I still
haven't seen this patch come down. Is it in the pipeline somewhere? I'd
really like to use this!
Eric
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Modification to `org-attach' allowing attaching from URL
2017-05-03 0:29 ` Eric Abrahamsen
@ 2017-05-03 11:50 ` Nicolas Goaziou
2017-05-03 15:19 ` Eric Abrahamsen
0 siblings, 1 reply; 10+ messages in thread
From: Nicolas Goaziou @ 2017-05-03 11:50 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-orgmode
Hello,
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> Wojciech Gac <wojciech.s.gac@gmail.com> writes:
>>
>>> I'm attaching a patch with a note in ORG-NEWS.
>>
>> Applied. Thank you.
>
> Hey I am running org-plus-contrib from the package repos, and I still
> haven't seen this patch come down. Is it in the pipeline somewhere? I'd
> really like to use this!
This is included in Org 9.1 branch whereas "org-plus-contrib" is from
the Org 9.0 branch. You need to wait or use development version.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Modification to `org-attach' allowing attaching from URL
2017-05-03 11:50 ` Nicolas Goaziou
@ 2017-05-03 15:19 ` Eric Abrahamsen
0 siblings, 0 replies; 10+ messages in thread
From: Eric Abrahamsen @ 2017-05-03 15:19 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>>
>>> Wojciech Gac <wojciech.s.gac@gmail.com> writes:
>>>
>>>> I'm attaching a patch with a note in ORG-NEWS.
>>>
>>> Applied. Thank you.
>>
>> Hey I am running org-plus-contrib from the package repos, and I still
>> haven't seen this patch come down. Is it in the pipeline somewhere? I'd
>> really like to use this!
>
> This is included in Org 9.1 branch whereas "org-plus-contrib" is from
> the Org 9.0 branch. You need to wait or use development version.
Thanks! So long as it's on the way, all is well.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-05-03 15:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-11 1:07 Modification to `org-attach' allowing attaching from URL Wojciech Gac
2017-03-11 10:06 ` Nicolas Goaziou
2017-03-11 10:11 ` Wojciech Gac
2017-03-11 12:42 ` Nicolas Goaziou
2017-03-11 13:10 ` Wojciech Gac
2017-03-11 14:31 ` Nicolas Goaziou
2017-03-11 15:24 ` Wojciech Gac
2017-05-03 0:29 ` Eric Abrahamsen
2017-05-03 11:50 ` Nicolas Goaziou
2017-05-03 15:19 ` Eric Abrahamsen
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).