[Top][All Lists]

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

[O] feature request: modify org-attach to also create new (non-text) att

From: Simon Campese
Subject: [O] feature request: modify org-attach to also create new (non-text) attachments
Date: Sat, 20 Jul 2019 23:56:13 +0200


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))
     (point) org-attach-file-list-property file))
  (let ((attach-dir (org-attach-dir t)))
    (call-process "~/bin/myscript.sh" nil nil nil (expand-file-name file 
    (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,


reply via email to

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