emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Vincent Belaïche" <vincent.b.1@hotmail.fr>
To: Org mode <emacs-orgmode@gnu.org>
Cc: "Vincent Belaïche" <vincent.b.1@hotmail.fr>
Subject: Patch on org-read-property-name
Date: Wed, 22 Jun 2011 22:01:10 +0200	[thread overview]
Message-ID: <80hb7h7i0p.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

Hello,

Please find a patch for setting properties. A name is proposed when the
pointer is on a property line, the name in that line is set as default.


Changelog:

-----------------------------------------------------------------------
2011-06-22  Vincent Belaïche  <vincentb1@users.sourceforge.net>

	* org.el (org-read-property-name): Propose default proerty name value
	by looking at whether current line is already some property setting.
-----------------------------------------------------------------------


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org.el.diff --]
[-- Type: text/x-patch, Size: 1968 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index b1edfa3..8318968 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6591,7 +6591,7 @@ in an indirect buffer, in overview mode.  You can dive into the tree in
 that copy, use org-occur and incremental search to find a location.
 When pressing RET or `Q', the command returns to the original buffer in
 which the visibility is still unchanged.  After RET is will also jump to
-the location selected in the indirect buffer and expose the headline 
+the location selected in the indirect buffer and expose the headline
 hierarchy above."
   (interactive "P")
   (let* ((org-refile-targets `((nil . (:maxlevel . ,org-goto-max-level))))
@@ -14095,7 +14095,20 @@ 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))
-	 (property (org-icompleting-read "Property: " (mapcar 'list keys))))
+	 (default-prop (save-excursion
+			 (save-match-data
+			   (beginning-of-line)
+			   (and (looking-at "^\\s-*:\\([^:\n]+\\):")
+				(null (string= (match-string 1) "END"))
+				(match-string 1)))))
+	 (property (org-icompleting-read
+		    (concat "Property"
+			    (if default-prop (concat " [" default-prop "]") "")
+			    ": ")
+		    (mapcar 'list keys)
+		    nil nil nil nil
+		    default-prop
+		    )))
     (if (member property keys)
 	property
       (or (cdr (assoc (downcase property)
@@ -16120,7 +16133,7 @@ sequence appearing also before point.
 Even though the matchers for math are configurable, this function assumes
 that \\begin, \\(, \\[, and $$ are always used.  Only the single dollar
 delimiters are skipped when they have been removed by customization.
-The return value is nil, or a cons cell with the delimiter and the 
+The return value is nil, or a cons cell with the delimiter and the
 position of this delimiter.
 
 This function does a reasonably good job, but can locally be fooled by

             reply	other threads:[~2011-06-22 20:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22 20:01 Vincent Belaïche [this message]
2011-06-27 10:36 ` Patch on org-read-property-name Bastien
2011-06-27 19:25   ` Vincent Belaïche

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=80hb7h7i0p.fsf@gmail.com \
    --to=vincent.b.1@hotmail.fr \
    --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).