Small refactoring

* lisp/org.el (org-read-property-name): Small refactoring.
This commit is contained in:
Nicolas Goaziou 2015-04-07 00:02:54 +02:00
parent cff54cd127
commit 94c7619579
1 changed files with 10 additions and 22 deletions

View File

@ -16256,28 +16256,16 @@ This is computed according to `org-property-set-functions-alist'."
(defvar org-last-set-property-value nil) (defvar org-last-set-property-value nil)
(defun org-read-property-name () (defun org-read-property-name ()
"Read a property name." "Read a property name."
(let* ((completion-ignore-case t) (let ((completion-ignore-case t)
(keys (org-buffer-property-keys nil t t)) (default-prop (or (and (org-at-property-p)
(default-prop (or (save-excursion (org-match-string-no-properties 2))
(save-match-data org-last-set-property)))
(beginning-of-line) (org-completing-read
(and (looking-at "^\\s-*:\\([^:\n]+\\):")
(null (string= (match-string 1) "END"))
(match-string 1))))
org-last-set-property))
(property (org-icompleting-read
(concat "Property" (concat "Property"
(if default-prop (concat " [" default-prop "]") "") (if default-prop (concat " [" default-prop "]") "")
": ") ": ")
(mapcar 'list keys) (mapcar #'list (org-buffer-property-keys nil t t))
nil nil nil nil nil nil nil nil default-prop)))
default-prop)))
(if (member property keys)
property
(or (cdr (assoc (downcase property)
(mapcar (lambda (x) (cons (downcase x) x))
keys)))
property))))
(defun org-set-property-and-value (use-last) (defun org-set-property-and-value (use-last)
"Allow to set [PROPERTY]: [value] direction from prompt. "Allow to set [PROPERTY]: [value] direction from prompt.