Re: [O] [PATCH] Enable appending to multivalued-property

2013-03-19 Thread Bastien
Hi Thorsten,

Thorsten Jolitz tjol...@gmail.com writes:

 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:

I actually think this should be the default, it feels more natural.
I applied this change.

Also, I don't want to change the signature of this function as it is
the same than other related functions (see the section in the manual
about it.)

Thanks for the patch anyway!

-- 
 Bastien




[O] [PATCH] Enable appending to multivalued-property

2013-03-18 Thread Thorsten Jolitz

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