Hi List, 

sometimes it make more sense to append a new value to a
multivalued-property than putting it in front of the old values, so here
is a patch that enables this:

>From ca1c5585fd7e57b559d360d3cbcc69b1deb18c98 Mon Sep 17 00:00:00 2001
From: tj <t...@data-driven.de>
Date: Mon, 18 Mar 2013 10:40:54 +0100
Subject: [PATCH 2/2] Org: enable appending to multivalued property

* org.el (org-entry-add-to-multivalued-property): Add optional argument APPEND
  to enable insertion of added value at the end of the multivalued property
  list.

As an example, adding a new year to a property :copyright-years: should result
in something like '2012 2013' and not '2013 2012'.
---
 lisp/org.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index a1fa315..33ade96 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15089,13 +15089,17 @@ an empty drawer to delete."
 
 ;; Multi-values properties are properties that contain multiple values
 ;; These values are assumed to be single words, separated by whitespace.
-(defun org-entry-add-to-multivalued-property (pom property value)
+(defun org-entry-add-to-multivalued-property
+  (pom property value &optional APPEND)
   "Add VALUE to the words in the PROPERTY in entry at point-or-marker POM."
   (let* ((old (org-entry-get pom property))
 	 (values (and old (org-split-string old "[ \t]"))))
     (setq value (org-entry-protect-space value))
     (unless (member value values)
-      (setq values (cons value values))
+      (setq values
+	    (if APPEND
+		(add-to-list 'values value 'APPEND)
+	      (cons value values)))
       (org-entry-put pom property
 		     (mapconcat 'identity values " ")))))
 
-- 
1.8.2

-- 
cheers,
Thorsten

Reply via email to