emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* set source directory for org-attach
@ 2020-11-28 17:04 gyro funch
  2020-11-30  0:40 ` David Rogers
  2020-11-30  1:21 ` Ihor Radchenko
  0 siblings, 2 replies; 4+ messages in thread
From: gyro funch @ 2020-11-28 17:04 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I'm relatively new to org-mode.

I am tending to use org-attach quite a bit as part of my workflow.

Instead of having to navigate from default-directory to the source of
the attachment, it would be great if I could set a better default.

I am probably missing something obvious, but is there a way to set the
default source directory for attachments?

Any advice is greatly appreciated.

Thank you for your help.

-gyro



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

* Re: set source directory for org-attach
  2020-11-28 17:04 set source directory for org-attach gyro funch
@ 2020-11-30  0:40 ` David Rogers
  2020-11-30  1:21 ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: David Rogers @ 2020-11-30  0:40 UTC (permalink / raw)
  To: emacs-orgmode

gyro funch <gyromagnetic@gmail.com> writes:

> Hi,
>
> I'm relatively new to org-mode.
>
> I am tending to use org-attach quite a bit as part of my 
> workflow.
>
> Instead of having to navigate from default-directory to the 
> source of
> the attachment, it would be great if I could set a better 
> default.
>
> I am probably missing something obvious, but is there a way to 
> set the
> default source directory for attachments?
>
> Any advice is greatly appreciated.
>
> Thank you for your help.As far as I’m aware, the attachments 
> need to be kept in a directory that is special and separate, 
> because *every item* in the directory is treated as an 
> attachment. If you set this to a different directory, and then 
> from within your document tried to delete all attachments, then 
> *everything* in the whole directory would be lost. Wouldn’t it?

I think your particular workflow might possibly be better served 
by creating file: links to all those files instead of attaching 
them - that way, you can keep your files wherever you wish. It 
might be safer to treat the attachment function as being a way to 
manage finished permanent files that no longer need editing, to be 
included as-is.

Section 4 of the Org-mode manual, titled “Hyperlinks”, shows 
everything about links including links to your own files. You may 
use Org-mode functions to help you create links, or you can type 
them out by hand - the result is exactly the same, as long as 
there are no typos of course.




-- 
David Rogers


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

* Re: set source directory for org-attach
  2020-11-28 17:04 set source directory for org-attach gyro funch
  2020-11-30  0:40 ` David Rogers
@ 2020-11-30  1:21 ` Ihor Radchenko
  2020-11-30 14:14   ` Re[2]: " Gyro Funch
  1 sibling, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2020-11-30  1:21 UTC (permalink / raw)
  To: gyro funch, emacs-orgmode

gyro funch <gyromagnetic@gmail.com> writes:
> I am probably missing something obvious, but is there a way to set the
> default source directory for attachments?

Not by default. I am using the following advice (requires helm and f.el): 

(defvar yant/org-attach-default-source "~/Downloads/"
  "Default directory to attach the files from.")

(define-advice org-attach-attach (:around (oldfun files &rest args) start-from-default-directory)
  "Look for new attachments from `yant/org-attach-default-source' directory instead of `default-directory'."
  (interactive
   (list
    (mapcar #'directory-file-name (helm-read-file-name "File to keep as an attachment:"
						       :initial-input (or (progn
									    (require 'dired-aux)
									    (dired-dwim-target-directory))
									  (and yant/org-attach-default-source
									       (f-slash yant/org-attach-default-source))
									  default-directory)
						       :marked-candidates t))
    current-prefix-arg
    nil))
  (unless (listp files) (setq files (list files)))
  (mapc (lambda (file) (apply oldfun file args)) files))

Best,
Ihor


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

* Re[2]: set source directory for org-attach
  2020-11-30  1:21 ` Ihor Radchenko
@ 2020-11-30 14:14   ` Gyro Funch
  0 siblings, 0 replies; 4+ messages in thread
From: Gyro Funch @ 2020-11-30 14:14 UTC (permalink / raw)
  To: emacs-orgmode

Thank you, Ihor.

That is very helpful.

Kind regards,
gyro


------ Original Message ------
From: "Ihor Radchenko" <yantar92@gmail.com>
To: "gyro funch" <gyromagnetic@gmail.com>; emacs-orgmode@gnu.org
Sent: 11/29/2020 6:21:27 PM
Subject: Re: set source directory for org-attach

>gyro funch <gyromagnetic@gmail.com> writes:
>>  I am probably missing something obvious, but is there a way to set the
>>  default source directory for attachments?
>
>Not by default. I am using the following advice (requires helm and f.el):
>
>(defvar yant/org-attach-default-source "~/Downloads/"
>   "Default directory to attach the files from.")
>
>(define-advice org-attach-attach (:around (oldfun files &rest args) start-from-default-directory)
>   "Look for new attachments from `yant/org-attach-default-source' directory instead of `default-directory'."
>   (interactive
>    (list
>     (mapcar #'directory-file-name (helm-read-file-name "File to keep as an attachment:"
>						       :initial-input (or (progn
>									    (require 'dired-aux)
>									    (dired-dwim-target-directory))
>									  (and yant/org-attach-default-source
>									       (f-slash yant/org-attach-default-source))
>									  default-directory)
>						       :marked-candidates t))
>     current-prefix-arg
>     nil))
>   (unless (listp files) (setq files (list files)))
>   (mapc (lambda (file) (apply oldfun file args)) files))
>
>Best,
>Ihor



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

end of thread, other threads:[~2020-11-30 14:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28 17:04 set source directory for org-attach gyro funch
2020-11-30  0:40 ` David Rogers
2020-11-30  1:21 ` Ihor Radchenko
2020-11-30 14:14   ` Re[2]: " Gyro Funch

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).