From 94c7619579d6b9bb4a34ee1e7e27c80e28512838 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 7 Apr 2015 00:02:54 +0200 Subject: [PATCH] Small refactoring * lisp/org.el (org-read-property-name): Small refactoring. --- lisp/org.el | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index e9dc187b3..5ea06b2ee 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -16256,28 +16256,16 @@ This is computed according to `org-property-set-functions-alist'." (defvar org-last-set-property-value nil) (defun org-read-property-name () "Read a property name." - (let* ((completion-ignore-case t) - (keys (org-buffer-property-keys nil t t)) - (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 "]") "") - ": ") - (mapcar 'list keys) - nil nil nil nil - default-prop))) - (if (member property keys) - property - (or (cdr (assoc (downcase property) - (mapcar (lambda (x) (cons (downcase x) x)) - keys))) - property)))) + (let ((completion-ignore-case t) + (default-prop (or (and (org-at-property-p) + (org-match-string-no-properties 2)) + org-last-set-property))) + (org-completing-read + (concat "Property" + (if default-prop (concat " [" default-prop "]") "") + ": ") + (mapcar #'list (org-buffer-property-keys nil t t)) + nil nil nil nil default-prop))) (defun org-set-property-and-value (use-last) "Allow to set [PROPERTY]: [value] direction from prompt.