emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: set source directory for org-attach


From: Gyro Funch
Subject: Re[2]: set source directory for org-attach
Date: Mon, 30 Nov 2020 14:14:09 +0000
User-agent: eM_Client/7.2.40748.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]