From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Campese Subject: feature request: modify org-attach to also create new (non-text) attachments Date: Sat, 20 Jul 2019 23:56:13 +0200 Message-ID: <86a7d89xqa.fsf@tu-dortmund.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:40992) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hoxL6-0000SR-37 for emacs-orgmode@gnu.org; Sat, 20 Jul 2019 17:56:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hoxL4-0003Zl-U5 for emacs-orgmode@gnu.org; Sat, 20 Jul 2019 17:56:23 -0400 Received: from mail.worldserver.net ([217.13.200.37]:59258) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hoxL4-0003Xr-9e for emacs-orgmode@gnu.org; Sat, 20 Jul 2019 17:56:22 -0400 Received: from mailer.rman (x4dbdb80f.dyn.telefonica.de [77.189.184.15]) (Authenticated sender: mailer@campese.de) by mail.worldserver.net (Postfix) with ESMTPSA id D345D30010A for ; Sat, 20 Jul 2019 23:56:13 +0200 (CEST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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