From: Ihor Radchenko <yantar92@gmail.com>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: org-attach a directory?
Date: Wed, 09 Jun 2021 09:38:49 +0800 [thread overview]
Message-ID: <87im2nn7fa.fsf@localhost> (raw)
In-Reply-To: <CAJ51ETontEv61oDu-37yp0RNoeaV8dYNqOh_7oz58z6evWa+mQ@mail.gmail.com>
John Kitchin <jkitchin@andrew.cmu.edu> writes:
> Is it possible to attach a directory to an org heading?
>
> I have only seen how to attach a file so far.
I use the code below to attach directories and allow multiple selection
while attaching files. Also, if more people are interested in this kind
of functionality, I can write a simple patch. It's just a matter of
applying #'directory-file-name to the selected file name in the
interactive spec of the org-attach-attach.
(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
next prev parent reply other threads:[~2021-06-09 1:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 15:49 org-attach a directory? John Kitchin
2021-06-08 16:21 ` Henrik Frisk
2021-06-08 20:41 ` John Kitchin
2021-06-09 1:38 ` [patch] " Juan Manuel Macías
2021-06-09 1:38 ` Ihor Radchenko [this message]
2021-06-11 1:43 ` stardiviner
2021-06-11 16:35 ` John Kitchin
2021-06-11 17:10 ` Juan Manuel Macías
2021-06-15 12:45 ` stardiviner
2021-06-15 20:22 ` Henrik Frisk
-- strict thread matches above, loose matches on Subject: below --
2021-06-09 19:35 Ypo
2021-06-09 23:39 ` John Kitchin
2021-06-10 3:54 ` Ypo
2021-06-10 3:56 ` Ypo
2021-06-10 12:37 ` Christian Barthel
2021-06-10 12:39 ` John Kitchin
2021-06-10 12:54 ` Christian Barthel
2021-06-10 14:01 ` Juan Manuel Macías
2021-06-10 16:13 ` Juan Manuel Macías
2021-06-10 16:50 Ypo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87im2nn7fa.fsf@localhost \
--to=yantar92@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=jkitchin@andrew.cmu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).