diff options
author | Bastien <bzg@altern.org> | 2011-07-11 12:12:21 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2011-07-11 12:25:57 +0200 |
commit | 9a2bf023467ad97fd171422c06541651c24b6014 (patch) | |
tree | 2e97377df16c214c48722037af12bee662bf3064 | |
parent | badec64cbf29fa3e0736f062cfbb05228858eba5 (diff) | |
download | org-mode-9a2bf023467ad97fd171422c06541651c24b6014.tar.gz |
`org-set-property' to use the last set property as default prompt
I'm testing whether patchwork catches the patches again.
You are free to test the feature as well :)
>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.
-rw-r--r-- | lisp/org.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el index cc7085c..b5a2d69 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -14116,12 +14116,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 "]") "") @@ -14137,6 +14138,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 @@ -14147,6 +14149,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)))) |