mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-24 07:20:29 +00:00
org-attach: Refactor. Replace self made with available function.
* lisp/org-attach.el (org-attach-dired-marked-files-or-file-at-cursor-in-dired) (org-attach-dired-marked-files-in-dired): Removed. Use `dired-get-marked-files' instead.
This commit is contained in:
parent
615b147031
commit
a49ac98f3f
@ -599,27 +599,12 @@ METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
|
||||
(setq method (or method org-attach-method))
|
||||
(mapc (lambda (file) (org-attach-attach file nil method)) files))
|
||||
|
||||
(defun org-attach-dired-marked-files-in-dired ()
|
||||
"Return list of marked files in dired."
|
||||
(cl-assert (eq 'dired-mode major-mode))
|
||||
(delq nil
|
||||
(mapcar
|
||||
(lambda (f) (if (file-directory-p f) nil f)) ;; don't attach directories
|
||||
(nreverse (dired-map-over-marks (dired-get-filename) nil)))))
|
||||
|
||||
(defun org-attach-dired-marked-files-or-file-at-cursor-in-dired ()
|
||||
"Return list of marked files in dired or file at cursor as one
|
||||
element list. Else return nil."
|
||||
(cl-assert (eq 'dired-mode major-mode))
|
||||
(or (org-attach-dired-marked-files-in-dired)
|
||||
(list (dired-get-filename 'no-dir t))))
|
||||
|
||||
(defun org-attach-dired-attach-to-next-best-subtree (files)
|
||||
"Attach FILES marked or current file in dired to subtree in other window.
|
||||
Precondition: Point must be in a dired buffer.
|
||||
Idea taken from `gnus-dired-attach'."
|
||||
(interactive
|
||||
(list (org-attach-dired-marked-files-or-file-at-cursor-in-dired)))
|
||||
(list (dired-get-marked-files)))
|
||||
(unless (eq major-mode 'dired-mode)
|
||||
(user-error "This command must be triggered in a dired buffer."))
|
||||
(let ((start-win (selected-window))
|
||||
|
Loading…
Reference in New Issue
Block a user