emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [PATCH 8/9] Add a % expansion for inserting properties in reme


From: James TD Smith
Subject: [Orgmode] [PATCH 8/9] Add a % expansion for inserting properties in remember buffers.
Date: Sat, 20 Sep 2008 22:09:22 +0100
User-agent: StGIT/0.14.2

---

 lisp/ChangeLog       |    3 +++
 lisp/org-remember.el |   19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0b40a6e..07872eb 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
 2008-09-20  James TD Smith  <address@hidden>
 
+       * org-remember.el (org-remember-apply-template): Add a new
+       expansion for adding properties to remember items.
+
        * org-remember.el (org-remember-apply-template): Add new
        expansions: %k, %K for currently clocked task and a link to the
        currently clocked task, and %< to file notes in the currently
diff --git a/lisp/org-remember.el b/lisp/org-remember.el
index 5a2c69b..0b435e0 100644
--- a/lisp/org-remember.el
+++ b/lisp/org-remember.el
@@ -137,7 +137,7 @@ Furthermore, the following %-escapes will be replaced with 
content:
   %^G         prompt for tags, with completion all tags in all agenda files
   %k          currently clocked task
   %K          link to currently clocked task
-
+  %^{prop}p   Prompt the user for a value for property `prop'
   %:keyword   specific information for certain link types, see below
   %[pathname] insert the contents of the file given by `pathname'
   %(sexp)     evaluate elisp `(sexp)' and replace with the result
@@ -468,7 +468,7 @@ to be run from that hook to function properly."
            (org-set-local 'org-remember-default-headline headline))
        ;; Interactive template entries
        (goto-char (point-min))
-       (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCL]\\)?" nil 
t)
+       (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" 
nil t)
          (setq char (if (match-end 3) (match-string 3))
                prompt (if (match-end 2) (match-string 2)))
          (goto-char (match-beginning 0))
@@ -513,6 +513,21 @@ to be run from that hook to function properly."
                                                   (car clipboards)
                                                   '(clipboards . 1)
                                                   (car clipboards))))))
+          ((equal char "p")
+           (let* ((prop (substring-no-properties prompt))
+                  (allowed (with-current-buffer
+                               (get-buffer (file-name-nondirectory file))
+                             (org-property-get-allowed-values nil prop 
'table)))
+                  (existing (with-current-buffer
+                                (get-buffer (file-name-nondirectory file))
+                              (mapcar 'list (org-property-values prop))))
+                  (propprompt (concat "Value for " prop ": "))
+                  (val (if allowed
+                           (org-completing-read propprompt allowed nil
+                                                'req-match)
+                         (org-completing-read propprompt existing nil nil
+                                              "" nil ""))))
+                  (org-set-property prop val)))
           (char
            ;; These are the date/time related ones
            (setq org-time-was-given (equal (upcase char) char))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]