all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25546: Org Mode - attach file from URL
@ 2017-01-26 18:04 Wojciech Gac
  2017-02-23 14:00 ` bug#25546: Wrong mailing list Wojciech Gac
  0 siblings, 1 reply; 3+ messages in thread
From: Wojciech Gac @ 2017-01-26 18:04 UTC (permalink / raw
  To: 25546


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

Hello,
I modified the Org Mode function `org-attach' to handle one additional way
of attaching a file, namely by specifying a download URL. Now, when calling
`org-attach', you can use the `u' key to specify this URL.
Regards,
Wojtek

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

[-- Attachment #2: 0001-Extend-org-attach-to-allow-attaching-files-from-URLs.patch --]
[-- Type: text/x-patch, Size: 2567 bytes --]

From bf3657f3d45ed9882c6d76469a6c6446da62841d Mon Sep 17 00:00:00 2001
From: Wojciech Gac <wojciech.s.gac@gmail.com>
Date: Thu, 26 Jan 2017 18:58:33 +0100
Subject: [PATCH] Extend `org-attach' to allow attaching files from URLs

---
 lisp/org/org-attach.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index 7d25437d9f..45af805839 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -144,6 +144,7 @@ org-attach
 
 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.
@@ -173,6 +174,8 @@ org-attach
 	(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))
@@ -310,10 +313,14 @@ org-attach-store-link
 		    (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))
@@ -327,7 +334,8 @@ org-attach-attach
        ((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)))
       (org-attach-commit)
       (org-attach-tag)
       (cond ((eq org-attach-store-link-p 'attached)
-- 
2.11.0


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

* bug#25546: Wrong mailing list
  2017-01-26 18:04 bug#25546: Org Mode - attach file from URL Wojciech Gac
@ 2017-02-23 14:00 ` Wojciech Gac
  2017-07-03  6:18   ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Wojciech Gac @ 2017-02-23 14:00 UTC (permalink / raw
  To: 25546

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

I just realized I sent this patch to the wrong mailing list. Could you
please close this issue? I'll post it to the Org mode list where it
belongs. Sorry for the confusion.
Regards,
Wojtek

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

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

* bug#25546: Wrong mailing list
  2017-02-23 14:00 ` bug#25546: Wrong mailing list Wojciech Gac
@ 2017-07-03  6:18   ` Bastien
  0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2017-07-03  6:18 UTC (permalink / raw
  To: Wojciech Gac; +Cc: 25546-done

Hi Wojciech,

Wojciech Gac <wojciech.s.gac@gmail.com> writes:

> I just realized I sent this patch to the wrong mailing list. Could
> you please close this issue? I'll post it to the Org mode list where
> it belongs. Sorry for the confusion.

Closed, thanks.

-- 
 Bastien

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

end of thread, other threads:[~2017-07-03  7:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-26 18:04 bug#25546: Org Mode - attach file from URL Wojciech Gac
2017-02-23 14:00 ` bug#25546: Wrong mailing list Wojciech Gac
2017-07-03  6:18   ` 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.