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

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]+\\):") (concat "Property"
(null (string= (match-string 1) "END")) (if default-prop (concat " [" default-prop "]") "")
(match-string 1)))) ": ")
org-last-set-property)) (mapcar #'list (org-buffer-property-keys nil t t))
(property (org-icompleting-read nil nil nil nil default-prop)))
(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))))
(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.