1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-28 07:44:49 +00:00

New command `org-capture-string'

* org-capture.el (org-capture-string): New command to prompt
for the interactive text interactively.  This can also be used
in Elisp programs to use ̀org-capture' with some initial text.
(org-capture-initial): New variable to store the initial text.
(org-capture): Use `org-capture-initial'.
This commit is contained in:
Bastien Guerry 2012-08-11 11:17:35 +02:00
parent 777ee3a4f9
commit 1737d3c4ee

View File

@ -430,6 +430,14 @@ for a capture buffer.")
;;; The main commands
;;;###autoload
(defvar org-capture-initial nil)
(defun org-capture-string (string &optional keys)
(interactive "sInitial text: \n")
(let ((org-capture-initial string)
(entry (org-capture-select-template keys)))
(org-capture)))
;;;###autoload
(defun org-capture (&optional goto keys)
"Capture something.
@ -462,9 +470,11 @@ bypassed."
org-capture-link-is-already-stored)
(plist-get org-store-link-plist :annotation)
(ignore-errors (org-store-link nil))))
(initial (and (org-region-active-p)
(buffer-substring (point) (mark))))
(entry (org-capture-select-template keys)))
(entry (or entry (org-capture-select-template keys)))
initial)
(setq initial (or org-capture-initial
(and (org-region-active-p)
(buffer-substring (point) (mark)))))
(when (stringp initial)
(remove-text-properties 0 (length initial) '(read-only t) initial))
(when (stringp annotation)