From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: [PATCH] `org-set-property' to use the last set property as default prompt Date: Mon, 11 Jul 2011 12:12:21 +0200 Message-ID: <87box19ldm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:54611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgDT7-0002na-8L for emacs-orgmode@gnu.org; Mon, 11 Jul 2011 06:12:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QgDT5-0005jq-O8 for emacs-orgmode@gnu.org; Mon, 11 Jul 2011 06:12:00 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:64933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgDT5-0005jm-Bm for emacs-orgmode@gnu.org; Mon, 11 Jul 2011 06:11:59 -0400 Received: by wwf22 with SMTP id 22so2940433wwf.30 for ; Mon, 11 Jul 2011 03:11:58 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain I'm testing whether patchwork catches the patches again. You are free to test the feature as well :) --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Make-org-set-property-defaults-to-the-last-set-prope.patch >From 2064e28c44ffc6f4020c8a5ec46e0d6bcf559c01 Mon Sep 17 00:00:00 2001 From: Bastien Guerry 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 --=-=-= Content-Type: text/plain -- Bastien --=-=-=--