lisp/org-attach.el (org-attach-attach): Add dired-dwim-target-directory
Use case: have two windows open side-by-side. One has an Org-mode file, the other - a Dired buffer with a file we want to attach. With this change, and user's `dired-dwim-target' setting, the prompt for file to attach will start in the Dired buffer's directory.
This commit is contained in:
parent
c801ef0328
commit
e23b806bd8
|
@ -375,7 +375,15 @@ Only do this when `org-attach-store-link-p' is non-nil."
|
||||||
If VISIT-DIR is non-nil, visit the directory with dired.
|
If VISIT-DIR is non-nil, visit the directory with dired.
|
||||||
METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
|
METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
|
||||||
`org-attach-method'."
|
`org-attach-method'."
|
||||||
(interactive "fFile to keep as an attachment: \nP")
|
(interactive
|
||||||
|
(list
|
||||||
|
(read-file-name "File to keep as an attachment:"
|
||||||
|
(or (progn
|
||||||
|
(require 'dired-aux)
|
||||||
|
(dired-dwim-target-directory))
|
||||||
|
default-directory))
|
||||||
|
current-prefix-arg
|
||||||
|
nil))
|
||||||
(setq method (or method org-attach-method))
|
(setq method (or method org-attach-method))
|
||||||
(let ((basename (file-name-nondirectory file)))
|
(let ((basename (file-name-nondirectory file)))
|
||||||
(when (and org-attach-file-list-property (not org-attach-inherited))
|
(when (and org-attach-file-list-property (not org-attach-inherited))
|
||||||
|
|
Loading…
Reference in New Issue