emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: James TD Smith <ahktenzero@mohorovi.cc>
To: emacs-orgmode@gnu.org
Subject: [PATCH 8/9] Add a % expansion for inserting properties in remember buffers.
Date: Sat, 20 Sep 2008 22:09:22 +0100	[thread overview]
Message-ID: <20080920210922.19759.5084.stgit@nyarlathotep.internal.mohorovi.cc> (raw)
In-Reply-To: <20080920210101.19759.15959.stgit@nyarlathotep.internal.mohorovi.cc>


---

 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  <ahktenzero@mohorovi.cc>
 
+	* 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))

  parent reply	other threads:[~2008-09-20 21:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-20 21:08 [PATCH 0/9] Update my last patchset James TD Smith
2008-09-20 21:08 ` [PATCH 1/9] Some improvements to the modeline clock display James TD Smith
2008-09-20 21:08 ` [PATCH 2/9] Fix X clipboard handling in emacs21 James TD Smith
2008-09-20 21:08 ` [PATCH 3/9] Show durations of clocked times in timeline James TD Smith
2008-09-20 21:09 ` [PATCH 4/9] Fix link display in imenus and the refile interface James TD Smith
2008-09-21  6:25   ` Carsten Dominik
2008-09-21 14:31     ` [PATCH] " James TD Smith
2008-09-21 19:40       ` Carsten Dominik
2008-09-20 21:09 ` [PATCH 5/9] Fix note insertion in entries with drawers James TD Smith
2008-10-16  4:50   ` Carsten Dominik
2008-09-20 21:09 ` [PATCH 6/9] Add some functions for handling checklists James TD Smith
2008-09-20 21:09 ` [PATCH 7/9] Add some new interaction between remember and clocked tasks James TD Smith
2008-09-20 21:09 ` James TD Smith [this message]
2008-09-20 21:09 ` [PATCH 9/9] Some bugfixes for org-plot James TD Smith
2008-09-21  4:48 ` [PATCH 0/9] Update my last patchset Carsten Dominik
2008-09-21 12:21   ` James TD Smith
2008-09-21 12:43     ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080920210922.19759.5084.stgit@nyarlathotep.internal.mohorovi.cc \
    --to=ahktenzero@mohorovi.cc \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).