emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] `org-set-property' to use the last set property as default prompt
@ 2011-07-11 10:12 Bastien
  2011-07-11 10:25 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Bastien @ 2011-07-11 10:12 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 103 bytes --]

I'm testing whether patchwork catches the patches again.

You are free to test the feature as well :)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-org-set-property-defaults-to-the-last-set-prope.patch --]
[-- Type: text/x-patch, Size: 2082 bytes --]

From 2064e28c44ffc6f4020c8a5ec46e0d6bcf559c01 Mon Sep 17 00:00:00 2001
From: Bastien Guerry <bzg@altern.org>
Date: Mon, 11 Jul 2011 12:10:32 +0200
Subject: [PATCH] Make `org-set-property' defaults to the last set property.

* org.el (org-last-set-property): New variable.
(org-read-property-name): Use the new variable: the prompt
defaults to the last property set, unless there is a property
in the line at point.
---
 lisp/org.el |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 9cf48f0..00db4d5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14115,12 +14115,13 @@ This is computed according to `org-property-set-functions-alist'."
   "Read a property name."
   (let* ((completion-ignore-case t)
 	 (keys (org-buffer-property-keys nil t t))
-	 (default-prop (save-excursion
-	 		 (save-match-data
-	 		   (beginning-of-line)
-	 		   (and (looking-at "^\\s-*:\\([^:\n]+\\):")
-	 			(null (string= (match-string 1) "END"))
-	 			(match-string 1)))))
+	 (default-prop (or (save-excursion
+			     (save-match-data
+			       (beginning-of-line)
+			       (and (looking-at "^\\s-*:\\([^:\n]+\\):")
+				    (null (string= (match-string 1) "END"))
+				    (match-string 1))))
+			   org-last-set-property))
 	 (property (org-icompleting-read
 		    (concat "Property"
 			    (if default-prop (concat " [" default-prop "]") "")
@@ -14136,6 +14137,7 @@ This is computed according to `org-property-set-functions-alist'."
 			      keys)))
 	  property))))
 
+(defvar org-last-set-property nil)
 (defun org-set-property (property value)
   "In the current entry, set PROPERTY to VALUE.
 When called interactively, this will prompt for a property name, offering
@@ -14146,6 +14148,7 @@ in the current file."
   (interactive (list nil nil))
   (let* ((property (or property (org-read-property-name)))
 	 (value (or value (org-read-property-value property))))
+    (setq org-last-set-property property)
     (unless (equal (org-entry-get nil property) value)
       (org-entry-put nil property value))))
 
-- 
1.7.5.2


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] `org-set-property' to use the last set property as default prompt
  2011-07-11 10:12 [PATCH] `org-set-property' to use the last set property as default prompt Bastien
@ 2011-07-11 10:25 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2011-07-11 10:25 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: John Wiegley

Bastien <bzg@altern.org> writes:

> I'm testing whether patchwork catches the patches again.

This works fine:

  http://patchwork.newartisans.com/patch/824/

Guys, the patchwork is back usable.

Thanks to John for the time he spent fixing this issue!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-11 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11 10:12 [PATCH] `org-set-property' to use the last set property as default prompt Bastien
2011-07-11 10:25 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).