From mboxrd@z Thu Jan 1 00:00:00 1970 From: James TD Smith Subject: [PATCH 8/9] Add a % expansion for inserting properties in remember buffers. Date: Sat, 20 Sep 2008 22:09:22 +0100 Message-ID: <20080920210922.19759.5084.stgit@nyarlathotep.internal.mohorovi.cc> References: <20080920210101.19759.15959.stgit@nyarlathotep.internal.mohorovi.cc> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kh9hl-0004Hd-NG for emacs-orgmode@gnu.org; Sat, 20 Sep 2008 17:09:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kh9hk-0004HC-Ur for emacs-orgmode@gnu.org; Sat, 20 Sep 2008 17:09:25 -0400 Received: from [199.232.76.173] (port=60174 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kh9hk-0004H8-Qh for emacs-orgmode@gnu.org; Sat, 20 Sep 2008 17:09:24 -0400 Received: from 81-86-40-42.dsl.pipex.com ([81.86.40.42]:57660 helo=yog-sothoth.mohorovi.cc) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kh9hk-0002Cb-4e for emacs-orgmode@gnu.org; Sat, 20 Sep 2008 17:09:24 -0400 Received: from nyarlathotep.internal.mohorovi.cc (Debian-exim@nyarlathotep.internal.mohorovi.cc [10.0.0.5]) by yog-sothoth.mohorovi.cc (8.14.2/8.14.2) with ESMTP id m8KL9MsN017680 for ; Sat, 20 Sep 2008 22:09:22 +0100 (BST) (envelope-from ahktenzero@mohorovi.cc) Received: from [127.0.0.1] (helo=nyarlathotep.internal.mohorovi.cc ident=ahktenzero) by nyarlathotep.internal.mohorovi.cc with esmtp (Exim 4.69) (envelope-from ) id 1Kh9hi-0005rY-2S for emacs-orgmode@gnu.org; Sat, 20 Sep 2008 22:09:22 +0100 In-Reply-To: <20080920210101.19759.15959.stgit@nyarlathotep.internal.mohorovi.cc> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --- 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 + * 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))