Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-04-17 14:19:12 +02:00
commit ea3754f168
1 changed files with 25 additions and 24 deletions

View File

@ -1580,6 +1580,9 @@ Lisp programs can force the template by setting KEYS to a string."
'(("C" "Customize org-capture-templates")
("q" "Abort"))))))
(defvar org-capture--clipboards nil
"List various clipboards values.")
(defun org-capture-fill-template (&optional template initial annotation)
"Fill a template and return the filled template as a string.
The template may still contain \"%?\" for cursor positioning."
@ -1628,7 +1631,8 @@ The template may still contain \"%?\" for cursor positioning."
org-clock-heading)))
(v-f (or (org-capture-get :original-file-nondirectory) ""))
(v-F (or (org-capture-get :original-file) ""))
(clipboards (delq nil
(org-capture--clipboards
(delq nil
(list v-i
(org-get-x-clipboard 'PRIMARY)
(org-get-x-clipboard 'CLIPBOARD)
@ -1773,24 +1777,21 @@ The template may still contain \"%?\" for cursor positioning."
(and (org-at-heading-p)
(let ((org-ignore-region t))
(org-set-tags nil 'align))))))
("C"
(cond
((= (length clipboards) 1) (insert (car clipboards)))
((> (length clipboards) 1)
(insert (read-string "Clipboard/kill value: "
(car clipboards)
'(clipboards . 1)
(car clipboards))))))
("L"
(cond ((= (length clipboards) 1)
(org-insert-link 0 (car clipboards)))
((> (length clipboards) 1)
(org-insert-link
0
((or "C" "L")
(let ((insert-fun (if (equal key "C") #'insert
(lambda (s) (org-insert-link 0 s))))
(first-value (car org-capture--clipboards)))
(pcase (length org-capture--clipboards)
(nil nil)
(`(,value) (funcall insert-fun value))
(`(,first-value . ,_)
(funcall insert-fun
(read-string "Clipboard/kill value: "
(car clipboards)
'(clipboards . 1)
(car clipboards))))))
first-value
'org-capture--clipboards
first-value)))
(_ (error "Invalid `org-capture--clipboards' value: %S"
org-capture--clipboards)))))
("p" (org-set-property prompt nil))
((guard key)
;; These are the date/time related ones.