From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: [RFC] [patch] open/delete attachment with inherited directory Date: Mon, 16 Dec 2013 00:02:07 -0500 Message-ID: <874n69fkxc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsQJv-0004sD-66 for emacs-orgmode@gnu.org; Mon, 16 Dec 2013 00:02:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsQJm-0007lJ-Jo for emacs-orgmode@gnu.org; Mon, 16 Dec 2013 00:02:19 -0500 Received: from mail-qc0-x229.google.com ([2607:f8b0:400d:c01::229]:63488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsQJm-0007lF-FL for emacs-orgmode@gnu.org; Mon, 16 Dec 2013 00:02:10 -0500 Received: by mail-qc0-f169.google.com with SMTP id r5so3424454qcx.0 for ; Sun, 15 Dec 2013 21:02:10 -0800 (PST) Received: from localhost (c-68-81-204-26.hsd1.pa.comcast.net. [68.81.204.26]) by mx.google.com with ESMTPSA id r5sm40795301qaj.13.2013.12.15.21.02.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Dec 2013 21:02:08 -0800 (PST) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hello, I have some org files where each headline corresponds to an entry in a bibliography. The headlines each have attached to them a pdf file of the corresponding document. The attachment directory is set as a file-level property and inherited by the children (this is so that I can access the files easily also outside of org). In the current implementation of org-attach-{open,delete-one}, I am prompted to choose among all files in the attachment directory (i.e. all the pdfs of entries in the bibliography), not just the (usually single) file attached to the headline at point. I think the latter behavior makes more sense. The attached (heh) patch implements this change. Are there any comments? Thanks, --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-org-attach-only-offer-to-delete-open-attachments-of-.patch Content-Transfer-Encoding: quoted-printable >From 4681055651950bdd66090745dcd2cc9f2b90a0f2 Mon Sep 17 00:00:00 2001 From: Aaron Ecay Date: Sun, 15 Dec 2013 23:52:02 -0500 Subject: [PATCH] org-attach: only offer to delete/open attachments of the current headline MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * lisp/org-attach.el (org-attach-open): Only get the files pertaining to the present headline This change is useful in cases where the attachment directory is inherited =E2=80=93 in such cases, the we don=E2=80=99t want to see all the= files in the directory, but rather only those associated to the present headline. --- lisp/org-attach.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 58ec2d1..6ec5da8 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -374,7 +374,8 @@ The attachment is created as an Emacs buffer." "Delete a single attachment." (interactive) (let* ((attach-dir (org-attach-dir t)) - (files (org-attach-file-list attach-dir)) + (files (org-entry-get-multivalued-property + nil org-attach-file-list-property)) (file (or file (org-icompleting-read "Delete attachment: " @@ -449,7 +450,8 @@ and in the system-specific variants of this variable. If IN-EMACS is non-nil, force opening in Emacs." (interactive "P") (let* ((attach-dir (org-attach-dir t)) - (files (org-attach-file-list attach-dir)) + (files (org-entry-get-multivalued-property + nil org-attach-file-list-property)) (file (if (=3D (length files) 1) (car files) (org-icompleting-read "Open attachment: " --=20 1.8.5.1 --=-=-= Content-Type: text/plain -- Aaron Ecay --=-=-=--