emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Simon Campese <emacs-orgmode@campese.de>
To: emacs-orgmode@gnu.org
Subject: feature request: modify org-attach to also create new (non-text) attachments
Date: Sat, 20 Jul 2019 23:56:13 +0200	[thread overview]
Message-ID: <86a7d89xqa.fsf@tu-dortmund.de> (raw)

Hello,

while in orgmode, I frequently create some handwritten notes (using
a wacom tablet and xournalpp) and attach it to the current
headline. My ad-hoc solution is the following trivial modification of
org-attach-new (only the second to last line has changed):

(defun org-attach-new-external (file)
  "Create a new attachment FILE for the current task.
The attachment is created as an Emacs buffer."
  (interactive "sCreate attachment named: ")
  (when (and org-attach-file-list-property (not org-attach-inherited))
    (org-entry-add-to-multivalued-property
     (point) org-attach-file-list-property file))
  (let ((attach-dir (org-attach-dir t)))
    (org-attach-tag)
    (call-process "~/bin/myscript.sh" nil nil nil (expand-file-name file attach-dir))
    (message "New attachment %s" file)))

Here, ~/bin/myscript.sh $FILE creates a new xopp-file $FILE by copying from
an empty template and then opens it in xournalpp. Another use case could
be audio/video recordings, for example during a meeting.

It would be nice to add this functionality directly to
org-attach by generalizing the above function
'org-attach-new-external' and associating it to the key 'N'. This
function would

1. ask the user for a filename and a program, taken from some variable,
say 'org-attach-new-external-programs-alist' which contains entries of
the form ("short_name" . "program"). Each program of this list should,
when called via 'program $filename', create a file $filename in some way
(by copying from a template and then letting the user edit, starting an
audio recording etc.) 

2. build the filename, optionally using some function stored in
'org-attach-new-create-filename-function' which takes the user input as an
argument (to for example automatically insert the date, the name of the
org-headline etc.)

3. call 'program $filename' and exit


What do you think?


Best regards,

Simon

             reply	other threads:[~2019-07-20 21:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-20 21:56 Simon Campese [this message]
2020-02-04  8:09 ` feature request: modify org-attach to also create new (non-text) attachments Bastien
2020-02-05  5:10   ` stardiviner

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=86a7d89xqa.fsf@tu-dortmund.de \
    --to=emacs-orgmode@campese.de \
    --cc=emacs-orgmode@gnu.org \
    /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).