org-remember.el 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089
  1. ;;; org-remember.el --- Fast note taking in Org-mode
  2. ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
  3. ;; Free Software Foundation, Inc.
  4. ;; Author: Carsten Dominik <carsten at orgmode dot org>
  5. ;; Keywords: outlines, hypermedia, calendar, wp
  6. ;; Homepage: http://orgmode.org
  7. ;; Version: 6.28
  8. ;;
  9. ;; This file is part of GNU Emacs.
  10. ;;
  11. ;; GNU Emacs is free software: you can redistribute it and/or modify
  12. ;; it under the terms of the GNU General Public License as published by
  13. ;; the Free Software Foundation, either version 3 of the License, or
  14. ;; (at your option) any later version.
  15. ;; GNU Emacs is distributed in the hope that it will be useful,
  16. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;; GNU General Public License for more details.
  19. ;; You should have received a copy of the GNU General Public License
  20. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  21. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  22. ;;
  23. ;;; Commentary:
  24. ;; This file contains the system to take fast notes with Org-mode.
  25. ;; This system is used together with John Wiegley's `remember.el'.
  26. ;;; Code:
  27. (eval-when-compile
  28. (require 'cl))
  29. (require 'org)
  30. (declare-function remember-mode "remember" ())
  31. (declare-function remember "remember" (&optional initial))
  32. (declare-function remember-buffer-desc "remember" ())
  33. (declare-function remember-finalize "remember" ())
  34. (defvar remember-save-after-remembering)
  35. (defvar remember-register)
  36. (defvar remember-buffer)
  37. (defvar remember-handler-functions)
  38. (defvar remember-annotation-functions)
  39. (defvar org-clock-heading)
  40. (defvar org-clock-heading-for-remember)
  41. (defgroup org-remember nil
  42. "Options concerning interaction with remember.el."
  43. :tag "Org Remember"
  44. :group 'org)
  45. (defcustom org-remember-store-without-prompt t
  46. "Non-nil means, `C-c C-c' stores remember note without further prompts.
  47. It then uses the file and headline specified by the template or (if the
  48. template does not specify them) by the variables `org-default-notes-file'
  49. and `org-remember-default-headline'. To force prompting anyway, use
  50. `C-u C-c C-c' to file the note.
  51. When this variable is nil, `C-c C-c' gives you the prompts, and
  52. `C-u C-c C-c' triggers the fasttrack."
  53. :group 'org-remember
  54. :type 'boolean)
  55. (defcustom org-remember-interactive-interface 'refile
  56. "The interface to be used for interactive filing of remember notes.
  57. This is only used when the interactive mode for selecting a filing
  58. location is used (see the variable `org-remember-store-without-prompt').
  59. Allowed values are:
  60. outline The interface shows an outline of the relevant file
  61. and the correct heading is found by moving through
  62. the outline or by searching with incremental search.
  63. outline-path-completion Headlines in the current buffer are offered via
  64. completion.
  65. refile Use the refile interface, and offer headlines,
  66. possibly from different buffers."
  67. :group 'org-remember
  68. :type '(choice
  69. (const :tag "Refile" refile)
  70. (const :tag "Outline" outline)
  71. (const :tag "Outline-path-completion" outline-path-completion)))
  72. (defcustom org-remember-default-headline ""
  73. "The headline that should be the default location in the notes file.
  74. When filing remember notes, the cursor will start at that position.
  75. You can set this on a per-template basis with the variable
  76. `org-remember-templates'."
  77. :group 'org-remember
  78. :type 'string)
  79. (defcustom org-remember-templates nil
  80. "Templates for the creation of remember buffers.
  81. When nil, just let remember make the buffer.
  82. When non-nil, this is a list of 5-element lists. In each entry, the first
  83. element is the name of the template, which should be a single short word.
  84. The second element is a character, a unique key to select this template.
  85. The third element is the template.
  86. The fourth element is optional and can specify a destination file for
  87. remember items created with this template. The default file is given
  88. by `org-default-notes-file'. If the file name is not an absolute path,
  89. it will be interpreted relative to `org-directory'.
  90. An optional fifth element can specify the headline in that file that should
  91. be offered first when the user is asked to file the entry. The default
  92. headline is given in the variable `org-remember-default-headline'. When
  93. this element is `top' or `bottom', the note will be placed as a level-1
  94. entry at the beginning or end of the file, respectively.
  95. An optional sixth element specifies the contexts in which the template
  96. will be offered to the user. This element can be a list of major modes
  97. or a function, and the template will only be offered if `org-remember'
  98. is called from a mode in the list, or if the function returns t.
  99. Templates that specify t or nil for the context will be always be added
  100. to the list of selectable templates.
  101. The template specifies the structure of the remember buffer. It should have
  102. a first line starting with a star, to act as the org-mode headline.
  103. Furthermore, the following %-escapes will be replaced with content:
  104. %^{prompt} Prompt the user for a string and replace this sequence with it.
  105. A default value and a completion table ca be specified like this:
  106. %^{prompt|default|completion2|completion3|...}
  107. %t time stamp, date only
  108. %T time stamp with date and time
  109. %u, %U like the above, but inactive time stamps
  110. %^t like %t, but prompt for date. Similarly %^T, %^u, %^U.
  111. You may define a prompt like %^{Please specify birthday
  112. %n user name (taken from `user-full-name')
  113. %a annotation, normally the link created with org-store-link
  114. %i initial content, the region active. If %i is indented,
  115. the entire inserted text will be indented as well.
  116. %c current kill ring head
  117. %x content of the X clipboard
  118. %^C Interactive selection of which kill or clip to use
  119. %^L Like %^C, but insert as link
  120. %k title of currently clocked task
  121. %K link to currently clocked task
  122. %^g prompt for tags, with completion on tags in target file
  123. %^G prompt for tags, with completion all tags in all agenda files
  124. %^{prop}p Prompt the user for a value for property `prop'
  125. %:keyword specific information for certain link types, see below
  126. %[pathname] insert the contents of the file given by `pathname'
  127. %(sexp) evaluate elisp `(sexp)' and replace with the result
  128. %! Store this note immediately after filling the template
  129. %& Visit note immediately after storing it
  130. %? After completing the template, position cursor here.
  131. Apart from these general escapes, you can access information specific to the
  132. link type that is created. For example, calling `remember' in emails or gnus
  133. will record the author and the subject of the message, which you can access
  134. with %:author and %:subject, respectively. Here is a complete list of what
  135. is recorded for each link type.
  136. Link type | Available information
  137. -------------------+------------------------------------------------------
  138. bbdb | %:type %:name %:company
  139. vm, wl, mh, rmail | %:type %:subject %:message-id
  140. | %:from %:fromname %:fromaddress
  141. | %:to %:toname %:toaddress
  142. | %:fromto (either \"to NAME\" or \"from NAME\")
  143. gnus | %:group, for messages also all email fields
  144. w3, w3m | %:type %:url
  145. info | %:type %:file %:node
  146. calendar | %:type %:date"
  147. :group 'org-remember
  148. :get (lambda (var) ; Make sure all entries have at least 5 elements
  149. (mapcar (lambda (x)
  150. (if (not (stringp (car x))) (setq x (cons "" x)))
  151. (cond ((= (length x) 4) (append x '(nil)))
  152. ((= (length x) 3) (append x '(nil nil)))
  153. (t x)))
  154. (default-value var)))
  155. :type '(repeat
  156. :tag "enabled"
  157. (list :value ("" ?a "\n" nil nil nil)
  158. (string :tag "Name")
  159. (character :tag "Selection Key")
  160. (string :tag "Template")
  161. (choice :tag "Destination file"
  162. (file :tag "Specify")
  163. (function :tag "Function")
  164. (const :tag "Use `org-default-notes-file'" nil))
  165. (choice :tag "Destin. headline"
  166. (string :tag "Specify")
  167. (function :tag "Function")
  168. (const :tag "Use `org-remember-default-headline'" nil)
  169. (const :tag "At beginning of file" top)
  170. (const :tag "At end of file" bottom))
  171. (choice :tag "Context"
  172. (const :tag "Use in all contexts" nil)
  173. (const :tag "Use in all contexts" t)
  174. (repeat :tag "Use only if in major mode"
  175. (symbol :tag "Major mode"))
  176. (function :tag "Perform a check against function")))))
  177. (defcustom org-remember-before-finalize-hook nil
  178. "Hook that is run right before a remember process is finalized.
  179. The remember buffer is still current when this hook runs."
  180. :group 'org-remember
  181. :type 'hook)
  182. (defvar org-remember-mode-map (make-sparse-keymap)
  183. "Keymap for org-remember-mode, a minor mode.
  184. Use this map to set additional keybindings for when Org-mode is used
  185. for a Remember buffer.")
  186. (defvar org-remember-mode-hook nil
  187. "Hook for the minor `org-remember-mode'.")
  188. (define-minor-mode org-remember-mode
  189. "Minor mode for special key bindings in a remember buffer."
  190. nil " Rem" org-remember-mode-map
  191. (run-hooks 'org-remember-mode-hook))
  192. (define-key org-remember-mode-map "\C-c\C-c" 'org-remember-finalize)
  193. (define-key org-remember-mode-map "\C-c\C-k" 'org-remember-kill)
  194. (defcustom org-remember-clock-out-on-exit 'query
  195. "Non-nil means, stop the clock when exiting a clocking remember buffer.
  196. This only applies if the clock is running in the remember buffer. If the
  197. clock is not stopped, it continues to run in the storage location.
  198. Instead of nil or t, this may also be the symbol `query' to prompt the
  199. user each time a remember buffer with a running clock is filed away. "
  200. :group 'org-remember
  201. :type '(choice
  202. (const :tag "Never" nil)
  203. (const :tag "Always" t)
  204. (const :tag "Query user" query)))
  205. (defcustom org-remember-backup-directory nil
  206. "Directory where to store all remember buffers, for backup purposes.
  207. After a remember buffer has been stored successfully, the backup file
  208. will be removed. However, if you forget to finish the remember process,
  209. the file will remain there.
  210. See also `org-remember-auto-remove-backup-files'."
  211. :group 'org-remember
  212. :type '(choice
  213. (const :tag "No backups" nil)
  214. (directory :tag "Directory")))
  215. (defcustom org-remember-auto-remove-backup-files t
  216. "Non-nil means, remove remember backup files after successfully storage.
  217. When remember is finished successfully, with storing the note at the
  218. desired target, remove the backup files related to this remember process
  219. and show a message about remaining backup files, from previous, unfinished
  220. remember sessions.
  221. Backup files will only be made at all, when `org-remember-backup-directory'
  222. is set."
  223. :group 'org-remember
  224. :type 'boolean)
  225. (defvar annotation) ; from remember.el, dynamically scoped in `remember-mode'
  226. (defvar initial) ; from remember.el, dynamically scoped in `remember-mode'
  227. ;;;###autoload
  228. (defun org-remember-insinuate ()
  229. "Setup remember.el for use with Org-mode."
  230. (org-require-remember)
  231. (setq remember-annotation-functions '(org-remember-annotation))
  232. (setq remember-handler-functions '(org-remember-handler))
  233. (add-hook 'remember-mode-hook 'org-remember-apply-template))
  234. ;;;###autoload
  235. (defun org-remember-annotation ()
  236. "Return a link to the current location as an annotation for remember.el.
  237. If you are using Org-mode files as target for data storage with
  238. remember.el, then the annotations should include a link compatible with the
  239. conventions in Org-mode. This function returns such a link."
  240. (org-store-link nil))
  241. (defconst org-remember-help
  242. "Select a destination location for the note.
  243. UP/DOWN=headline TAB=cycle visibility [Q]uit RET/<left>/<right>=Store
  244. RET on headline -> Store as sublevel entry to current headline
  245. RET at beg-of-buf -> Append to file as level 2 headline
  246. <left>/<right> -> before/after current headline, same headings level")
  247. (defvar org-jump-to-target-location nil)
  248. (defvar org-remember-previous-location nil)
  249. (defvar org-force-remember-template-char) ;; dynamically scoped
  250. ;; Save the major mode of the buffer we called remember from
  251. (defvar org-select-template-temp-major-mode nil)
  252. ;; Temporary store the buffer where remember was called from
  253. (defvar org-select-template-original-buffer nil)
  254. (defun org-select-remember-template (&optional use-char)
  255. (when org-remember-templates
  256. (let* ((pre-selected-templates
  257. (mapcar
  258. (lambda (tpl)
  259. (let ((ctxt (nth 5 tpl))
  260. (mode org-select-template-temp-major-mode)
  261. (buf org-select-template-original-buffer))
  262. (and (or (not ctxt) (eq ctxt t)
  263. (and (listp ctxt) (memq mode ctxt))
  264. (and (functionp ctxt)
  265. (with-current-buffer buf
  266. ;; Protect the user-defined function from error
  267. (condition-case nil (funcall ctxt) (error nil)))))
  268. tpl)))
  269. org-remember-templates))
  270. ;; If no template at this point, add the default templates:
  271. (pre-selected-templates1
  272. (if (not (delq nil pre-selected-templates))
  273. (mapcar (lambda(x) (if (not (nth 5 x)) x))
  274. org-remember-templates)
  275. pre-selected-templates))
  276. ;; Then unconditionally add template for any contexts
  277. (pre-selected-templates2
  278. (append (mapcar (lambda(x) (if (eq (nth 5 x) t) x))
  279. org-remember-templates)
  280. (delq nil pre-selected-templates1)))
  281. (templates (mapcar (lambda (x)
  282. (if (stringp (car x))
  283. (append (list (nth 1 x) (car x)) (cddr x))
  284. (append (list (car x) "") (cdr x))))
  285. (delq nil pre-selected-templates2)))
  286. msg
  287. (char (or use-char
  288. (cond
  289. ((= (length templates) 1)
  290. (caar templates))
  291. ((and (boundp 'org-force-remember-template-char)
  292. org-force-remember-template-char)
  293. (if (stringp org-force-remember-template-char)
  294. (string-to-char org-force-remember-template-char)
  295. org-force-remember-template-char))
  296. (t
  297. (setq msg (format
  298. "Select template: %s"
  299. (mapconcat
  300. (lambda (x)
  301. (cond
  302. ((not (string-match "\\S-" (nth 1 x)))
  303. (format "[%c]" (car x)))
  304. ((equal (downcase (car x))
  305. (downcase (aref (nth 1 x) 0)))
  306. (format "[%c]%s" (car x)
  307. (substring (nth 1 x) 1)))
  308. (t (format "[%c]%s" (car x) (nth 1 x)))))
  309. templates " ")))
  310. (let ((inhibit-quit t) char0)
  311. (while (not char0)
  312. (message msg)
  313. (setq char0 (read-char-exclusive))
  314. (when (and (not (assoc char0 templates))
  315. (not (equal char0 ?\C-g)))
  316. (message "No suche template \"%c\"" char0)
  317. (ding) (sit-for 1)
  318. (setq char0 nil)))
  319. (when (equal char0 ?\C-g)
  320. (jump-to-register remember-register)
  321. (kill-buffer remember-buffer)
  322. (error "Abort"))
  323. char0))))))
  324. (cddr (assoc char templates)))))
  325. (defun org-get-x-clipboard (value)
  326. "Get the value of the x clipboard, compatible with XEmacs, and GNU Emacs 21."
  327. (if (eq window-system 'x)
  328. (let ((x (org-get-x-clipboard-compat value)))
  329. (if x (org-no-properties x)))))
  330. ;;;###autoload
  331. (defun org-remember-apply-template (&optional use-char skip-interactive)
  332. "Initialize *remember* buffer with template, invoke `org-mode'.
  333. This function should be placed into `remember-mode-hook' and in fact requires
  334. to be run from that hook to function properly."
  335. (when (and (boundp 'initial) (stringp initial))
  336. (setq initial (org-no-properties initial))
  337. (remove-text-properties 0 (length initial) '(read-only t) initial))
  338. (if org-remember-templates
  339. (let* ((entry (org-select-remember-template use-char))
  340. (ct (or org-overriding-default-time (org-current-time)))
  341. (dct (decode-time ct))
  342. (ct1
  343. (if (< (nth 2 dct) org-extend-today-until)
  344. (encode-time 0 59 23 (1- (nth 3 dct)) (nth 4 dct) (nth 5 dct))
  345. ct))
  346. (tpl (car entry))
  347. (plist-p (if org-store-link-plist t nil))
  348. (file (if (and (nth 1 entry)
  349. (or (and (stringp (nth 1 entry))
  350. (string-match "\\S-" (nth 1 entry)))
  351. (functionp (nth 1 entry))))
  352. (nth 1 entry)
  353. org-default-notes-file))
  354. (headline (nth 2 entry))
  355. (v-c (and (> (length kill-ring) 0) (current-kill 0)))
  356. (v-x (or (org-get-x-clipboard 'PRIMARY)
  357. (org-get-x-clipboard 'CLIPBOARD)
  358. (org-get-x-clipboard 'SECONDARY)))
  359. (v-t (format-time-string (car org-time-stamp-formats) ct))
  360. (v-T (format-time-string (cdr org-time-stamp-formats) ct))
  361. (v-u (concat "[" (substring v-t 1 -1) "]"))
  362. (v-U (concat "[" (substring v-T 1 -1) "]"))
  363. ;; `initial' and `annotation' are bound in `remember'.
  364. ;; But if the property list has them, we prefer those values
  365. (v-i (or (plist-get org-store-link-plist :initial)
  366. (and (boundp 'initial) initial)
  367. ""))
  368. (v-a (or (plist-get org-store-link-plist :annotation)
  369. (and (boundp 'annotation) annotation)
  370. ""))
  371. ;; Is the link empty? Then we do not want it...
  372. (v-a (if (equal v-a "[[]]") "" v-a))
  373. (clipboards (remove nil (list v-i
  374. (org-get-x-clipboard 'PRIMARY)
  375. (org-get-x-clipboard 'CLIPBOARD)
  376. (org-get-x-clipboard 'SECONDARY)
  377. v-c)))
  378. (v-A (if (and v-a
  379. (string-match "\\[\\(\\[.*?\\]\\)\\(\\[.*?\\]\\)?\\]" v-a))
  380. (replace-match "[\\1[%^{Link description}]]" nil nil v-a)
  381. v-a))
  382. (v-n user-full-name)
  383. (v-k (if (marker-buffer org-clock-marker)
  384. (org-substring-no-properties org-clock-heading)))
  385. (v-K (if (marker-buffer org-clock-marker)
  386. (org-make-link-string
  387. (buffer-file-name (marker-buffer org-clock-marker))
  388. org-clock-heading)))
  389. v-I
  390. (org-startup-folded nil)
  391. (org-inhibit-startup t)
  392. org-time-was-given org-end-time-was-given x
  393. prompt completions char time pos default histvar)
  394. (when (functionp file)
  395. (setq file (funcall file)))
  396. (when (functionp headline)
  397. (setq headline (funcall headline)))
  398. (when (and file (not (file-name-absolute-p file)))
  399. (setq file (expand-file-name file org-directory)))
  400. (setq org-store-link-plist
  401. (plist-put org-store-link-plist :annotation v-a)
  402. org-store-link-plist
  403. (plist-put org-store-link-plist :initial v-i))
  404. (unless tpl (setq tpl "") (message "No template") (ding) (sit-for 1))
  405. (erase-buffer)
  406. (insert (substitute-command-keys
  407. (format
  408. "## %s \"%s\" -> \"* %s\"
  409. ## C-u C-c C-c like C-c C-c, and immediately visit note at target location
  410. ## C-0 C-c C-c \"%s\" -> \"* %s\"
  411. ## %s to select file and header location interactively.
  412. ## C-2 C-c C-c as child of the currently clocked item
  413. ## To switch templates, use `\\[org-remember]'. To abort use `C-c C-k'.\n\n"
  414. (if org-remember-store-without-prompt " C-c C-c" " C-1 C-c C-c")
  415. (abbreviate-file-name (or file org-default-notes-file))
  416. (or headline "")
  417. (or (car org-remember-previous-location) "???")
  418. (or (cdr org-remember-previous-location) "???")
  419. (if org-remember-store-without-prompt "C-1 C-c C-c" " C-c C-c"))))
  420. (insert tpl)
  421. (goto-char (point-min))
  422. ;; Simple %-escapes
  423. (while (re-search-forward "%\\([tTuUaiAcxkKI]\\)" nil t)
  424. (when (and initial (equal (match-string 0) "%i"))
  425. (save-match-data
  426. (let* ((lead (buffer-substring
  427. (point-at-bol) (match-beginning 0))))
  428. (setq v-i (mapconcat 'identity
  429. (org-split-string initial "\n")
  430. (concat "\n" lead))))))
  431. (replace-match
  432. (or (eval (intern (concat "v-" (match-string 1)))) "")
  433. t t))
  434. ;; %[] Insert contents of a file.
  435. (goto-char (point-min))
  436. (while (re-search-forward "%\\[\\(.+\\)\\]" nil t)
  437. (let ((start (match-beginning 0))
  438. (end (match-end 0))
  439. (filename (expand-file-name (match-string 1))))
  440. (goto-char start)
  441. (delete-region start end)
  442. (condition-case error
  443. (insert-file-contents filename)
  444. (error (insert (format "%%![Couldn't insert %s: %s]"
  445. filename error))))))
  446. ;; %() embedded elisp
  447. (goto-char (point-min))
  448. (while (re-search-forward "%\\((.+)\\)" nil t)
  449. (goto-char (match-beginning 0))
  450. (let ((template-start (point)))
  451. (forward-char 1)
  452. (let ((result
  453. (condition-case error
  454. (eval (read (current-buffer)))
  455. (error (format "%%![Error: %s]" error)))))
  456. (delete-region template-start (point))
  457. (insert result))))
  458. ;; From the property list
  459. (when plist-p
  460. (goto-char (point-min))
  461. (while (re-search-forward "%\\(:[-a-zA-Z]+\\)" nil t)
  462. (and (setq x (or (plist-get org-store-link-plist
  463. (intern (match-string 1))) ""))
  464. (replace-match x t t))))
  465. ;; Turn on org-mode in the remember buffer, set local variables
  466. (let ((org-inhibit-startup t)) (org-mode) (org-remember-mode 1))
  467. (if (and file (string-match "\\S-" file) (not (file-directory-p file)))
  468. (org-set-local 'org-default-notes-file file))
  469. (if headline
  470. (org-set-local 'org-remember-default-headline headline))
  471. ;; Interactive template entries
  472. (goto-char (point-min))
  473. (while (re-search-forward "%^\\({\\([^}]*\\)}\\)?\\([gGtTuUCLp]\\)?" nil t)
  474. (setq char (if (match-end 3) (match-string 3))
  475. prompt (if (match-end 2) (match-string 2)))
  476. (goto-char (match-beginning 0))
  477. (replace-match "")
  478. (setq completions nil default nil)
  479. (when prompt
  480. (setq completions (org-split-string prompt "|")
  481. prompt (pop completions)
  482. default (car completions)
  483. histvar (intern (concat
  484. "org-remember-template-prompt-history::"
  485. (or prompt "")))
  486. completions (mapcar 'list completions)))
  487. (cond
  488. ((member char '("G" "g"))
  489. (let* ((org-last-tags-completion-table
  490. (org-global-tags-completion-table
  491. (if (equal char "G") (org-agenda-files) (and file (list file)))))
  492. (org-add-colon-after-tag-completion t)
  493. (ins (org-ido-completing-read
  494. (if prompt (concat prompt ": ") "Tags: ")
  495. 'org-tags-completion-function nil nil nil
  496. 'org-tags-history)))
  497. (setq ins (mapconcat 'identity
  498. (org-split-string ins (org-re "[^[:alnum:]_@]+"))
  499. ":"))
  500. (when (string-match "\\S-" ins)
  501. (or (equal (char-before) ?:) (insert ":"))
  502. (insert ins)
  503. (or (equal (char-after) ?:) (insert ":")))))
  504. ((equal char "C")
  505. (cond ((= (length clipboards) 1) (insert (car clipboards)))
  506. ((> (length clipboards) 1)
  507. (insert (read-string "Clipboard/kill value: "
  508. (car clipboards) '(clipboards . 1)
  509. (car clipboards))))))
  510. ((equal char "L")
  511. (cond ((= (length clipboards) 1)
  512. (org-insert-link 0 (car clipboards)))
  513. ((> (length clipboards) 1)
  514. (org-insert-link 0 (read-string "Clipboard/kill value: "
  515. (car clipboards)
  516. '(clipboards . 1)
  517. (car clipboards))))))
  518. ((equal char "p")
  519. (let*
  520. ((prop (org-substring-no-properties prompt))
  521. (pall (concat prop "_ALL"))
  522. (allowed
  523. (with-current-buffer
  524. (get-buffer (file-name-nondirectory file))
  525. (or (cdr (assoc pall org-file-properties))
  526. (cdr (assoc pall org-global-properties))
  527. (cdr (assoc pall org-global-properties-fixed)))))
  528. (existing (with-current-buffer
  529. (get-buffer (file-name-nondirectory file))
  530. (mapcar 'list (org-property-values prop))))
  531. (propprompt (concat "Value for " prop ": "))
  532. (val (if allowed
  533. (org-completing-read
  534. propprompt
  535. (mapcar 'list (org-split-string allowed "[ \t]+"))
  536. nil 'req-match)
  537. (org-completing-read-no-ido propprompt existing nil nil
  538. "" nil ""))))
  539. (org-set-property prop val)))
  540. (char
  541. ;; These are the date/time related ones
  542. (setq org-time-was-given (equal (upcase char) char))
  543. (setq time (org-read-date (equal (upcase char) "U") t nil
  544. prompt))
  545. (org-insert-time-stamp time org-time-was-given
  546. (member char '("u" "U"))
  547. nil nil (list org-end-time-was-given)))
  548. (t
  549. (let (org-completion-use-ido)
  550. (insert (org-completing-read-no-ido
  551. (concat (if prompt prompt "Enter string")
  552. (if default (concat " [" default "]"))
  553. ": ")
  554. completions nil nil nil histvar default))))))
  555. (goto-char (point-min))
  556. (if (re-search-forward "%\\?" nil t)
  557. (replace-match "")
  558. (and (re-search-forward "^[^#\n]" nil t) (backward-char 1))))
  559. (let ((org-inhibit-startup t)) (org-mode) (org-remember-mode 1)))
  560. (when (save-excursion
  561. (goto-char (point-min))
  562. (re-search-forward "%&" nil t))
  563. (replace-match "")
  564. (org-set-local 'org-jump-to-target-location t))
  565. (when org-remember-backup-directory
  566. (unless (file-directory-p org-remember-backup-directory)
  567. (make-directory org-remember-backup-directory))
  568. (org-set-local 'auto-save-file-name-transforms nil)
  569. (setq buffer-file-name
  570. (expand-file-name
  571. (format-time-string "remember-%Y-%m-%d-%H-%M-%S")
  572. org-remember-backup-directory))
  573. (save-buffer)
  574. (org-set-local 'auto-save-visited-file-name t)
  575. (auto-save-mode 1))
  576. (when (save-excursion
  577. (goto-char (point-min))
  578. (re-search-forward "%!" nil t))
  579. (replace-match "")
  580. (add-hook 'post-command-hook 'org-remember-finish-immediately 'append)))
  581. (defun org-remember-finish-immediately ()
  582. "File remember note immediately.
  583. This should be run in `post-command-hook' and will remove itself
  584. from that hook."
  585. (remove-hook 'post-command-hook 'org-remember-finish-immediately)
  586. (org-remember-finalize))
  587. (defun org-remember-visit-immediately ()
  588. "File remember note immediately.
  589. This should be run in `post-command-hook' and will remove itself
  590. from that hook."
  591. (org-remember '(16))
  592. (goto-char (or (text-property-any
  593. (point) (save-excursion (org-end-of-subtree t t))
  594. 'org-position-cursor t)
  595. (point)))
  596. (message "%s"
  597. (format
  598. (substitute-command-keys
  599. "Restore window configuration with \\[jump-to-register] %c")
  600. remember-register)))
  601. (defvar org-clock-marker) ; Defined in org.el
  602. (defun org-remember-finalize ()
  603. "Finalize the remember process."
  604. (interactive)
  605. (unless org-remember-mode
  606. (error "This does not seem to be a remember buffer for Org-mode"))
  607. (run-hooks 'org-remember-before-finalize-hook)
  608. (unless (fboundp 'remember-finalize)
  609. (defalias 'remember-finalize 'remember-buffer))
  610. (when (and org-clock-marker
  611. (equal (marker-buffer org-clock-marker) (current-buffer)))
  612. ;; the clock is running in this buffer.
  613. (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
  614. (or (eq org-remember-clock-out-on-exit t)
  615. (and org-remember-clock-out-on-exit
  616. (y-or-n-p "The clock is running in this buffer. Clock out now? "))))
  617. (let (org-log-note-clock-out) (org-clock-out))))
  618. (when buffer-file-name
  619. (save-buffer))
  620. (remember-finalize))
  621. (defun org-remember-kill ()
  622. "Abort the current remember process."
  623. (interactive)
  624. (let ((org-note-abort t))
  625. (org-remember-finalize)))
  626. ;;;###autoload
  627. (defun org-remember (&optional goto org-force-remember-template-char)
  628. "Call `remember'. If this is already a remember buffer, re-apply template.
  629. If there is an active region, make sure remember uses it as initial content
  630. of the remember buffer.
  631. When called interactively with a `C-u' prefix argument GOTO, don't remember
  632. anything, just go to the file/headline where the selected template usually
  633. stores its notes. With a double prefix arg `C-u C-u', go to the last
  634. note stored by remember.
  635. Lisp programs can set ORG-FORCE-REMEMBER-TEMPLATE-CHAR to a character
  636. associated with a template in `org-remember-templates'."
  637. (interactive "P")
  638. (org-require-remember)
  639. (cond
  640. ((equal goto '(4)) (org-go-to-remember-target))
  641. ((equal goto '(16)) (org-remember-goto-last-stored))
  642. (t
  643. ;; set temporary variables that will be needed in
  644. ;; `org-select-remember-template'
  645. (setq org-select-template-temp-major-mode major-mode)
  646. (setq org-select-template-original-buffer (current-buffer))
  647. (if org-remember-mode
  648. (progn
  649. (when (< (length org-remember-templates) 2)
  650. (error "No other template available"))
  651. (erase-buffer)
  652. (let ((annotation (plist-get org-store-link-plist :annotation))
  653. (initial (plist-get org-store-link-plist :initial)))
  654. (org-remember-apply-template))
  655. (message "Press C-c C-c to remember data"))
  656. (if (org-region-active-p)
  657. (org-do-remember (buffer-substring (point) (mark)))
  658. (org-do-remember))))))
  659. (defvar org-remember-last-stored-marker (make-marker)
  660. "Marker pointing to the entry most recently stored with `org-remember'.")
  661. (defun org-remember-goto-last-stored ()
  662. "Go to the location where the last remember note was stored."
  663. (interactive)
  664. (org-goto-marker-or-bmk org-remember-last-stored-marker
  665. "org-remember-last-stored")
  666. (message "This is the last note stored by remember"))
  667. (defun org-go-to-remember-target (&optional template-key)
  668. "Go to the target location of a remember template.
  669. The user is queried for the template."
  670. (interactive)
  671. (let* (org-select-template-temp-major-mode
  672. (entry (org-select-remember-template template-key))
  673. (file (nth 1 entry))
  674. (heading (nth 2 entry))
  675. visiting)
  676. (unless (and file (stringp file) (string-match "\\S-" file))
  677. (setq file org-default-notes-file))
  678. (when (and file (not (file-name-absolute-p file)))
  679. (setq file (expand-file-name file org-directory)))
  680. (unless (and heading (stringp heading) (string-match "\\S-" heading))
  681. (setq heading org-remember-default-headline))
  682. (setq visiting (org-find-base-buffer-visiting file))
  683. (if (not visiting) (find-file-noselect file))
  684. (switch-to-buffer (or visiting (get-file-buffer file)))
  685. (widen)
  686. (goto-char (point-min))
  687. (if (re-search-forward
  688. (concat "^\\*+[ \t]+" (regexp-quote heading)
  689. (org-re "\\([ \t]+:[[:alnum:]@_:]*\\)?[ \t]*$"))
  690. nil t)
  691. (goto-char (match-beginning 0))
  692. (error "Target headline not found: %s" heading))))
  693. ;;;###autoload
  694. (defun org-remember-handler ()
  695. "Store stuff from remember.el into an org file.
  696. When the template has specified a file and a headline, the entry is filed
  697. there, or in the location defined by `org-default-notes-file' and
  698. `org-remember-default-headline'.
  699. If no defaults have been defined, or if the current prefix argument
  700. is 1 (so you must use `C-1 C-c C-c' to exit remember), an interactive
  701. process is used to select the target location.
  702. When the prefix is 0 (i.e. when remember is exited with `C-0 C-c C-c'),
  703. the entry is filed to the same location as the previous note.
  704. When the prefix is 2 (i.e. when remember is exited with `C-2 C-c C-c'),
  705. the entry is filed as a subentry of the entry where the clock is
  706. currently running.
  707. When `C-u' has been used as prefix argument, the note is stored and emacs
  708. moves point to the new location of the note, so that editing can be
  709. continued there (similar to inserting \"%&\" into the template).
  710. Before storing the note, the function ensures that the text has an
  711. org-mode-style headline, i.e. a first line that starts with
  712. a \"*\". If not, a headline is constructed from the current date and
  713. some additional data.
  714. If the variable `org-adapt-indentation' is non-nil, the entire text is
  715. also indented so that it starts in the same column as the headline
  716. \(i.e. after the stars).
  717. See also the variable `org-reverse-note-order'."
  718. (when (and (equal current-prefix-arg 2)
  719. (not (marker-buffer org-clock-marker)))
  720. (error "No running clock"))
  721. (when (org-bound-and-true-p org-jump-to-target-location)
  722. (let* ((end (min (point-max) (1+ (point))))
  723. (beg (point)))
  724. (if (= end beg) (setq beg (1- beg)))
  725. (put-text-property beg end 'org-position-cursor t)))
  726. (goto-char (point-min))
  727. (while (looking-at "^[ \t]*\n\\|^##.*\n")
  728. (replace-match ""))
  729. (goto-char (point-max))
  730. (beginning-of-line 1)
  731. (while (and (looking-at "[ \t]*$\\|##.*") (> (point) 1))
  732. (delete-region (1- (point)) (point-max))
  733. (beginning-of-line 1))
  734. (catch 'quit
  735. (if org-note-abort (throw 'quit t))
  736. (let* ((visitp (org-bound-and-true-p org-jump-to-target-location))
  737. (backup-file
  738. (and buffer-file-name
  739. (equal (file-name-directory buffer-file-name)
  740. (file-name-as-directory
  741. (expand-file-name org-remember-backup-directory)))
  742. (string-match "^remember-[0-9]\\{4\\}"
  743. (file-name-nondirectory buffer-file-name))
  744. buffer-file-name))
  745. (dummy
  746. (unless (string-match "\\S-" (buffer-string))
  747. (message "Nothing to remember")
  748. (and backup-file
  749. (ignore-errors
  750. (delete-file backup-file)
  751. (delete-file (concat backup-file "~"))))
  752. (set-buffer-modified-p nil)
  753. (throw 'quit t)))
  754. (previousp (and (member current-prefix-arg '((16) 0))
  755. org-remember-previous-location))
  756. (clockp (equal current-prefix-arg 2))
  757. (fastp (org-xor (equal current-prefix-arg 1)
  758. org-remember-store-without-prompt))
  759. (file (cond
  760. (fastp org-default-notes-file)
  761. ((and (eq org-remember-interactive-interface 'refile)
  762. org-refile-targets)
  763. org-default-notes-file)
  764. ((not previousp)
  765. (org-get-org-file))))
  766. (heading org-remember-default-headline)
  767. (visiting (and file (org-find-base-buffer-visiting file)))
  768. (org-startup-folded nil)
  769. (org-startup-align-all-tables nil)
  770. (org-goto-start-pos 1)
  771. spos exitcmd level reversed txt text-before-node-creation)
  772. (when (equal current-prefix-arg '(4))
  773. (setq visitp t))
  774. (when previousp
  775. (setq file (car org-remember-previous-location)
  776. visiting (and file (org-find-base-buffer-visiting file))
  777. heading (cdr org-remember-previous-location)
  778. fastp t))
  779. (when clockp
  780. (setq file (buffer-file-name (marker-buffer org-clock-marker))
  781. visiting (and file (org-find-base-buffer-visiting file))
  782. heading org-clock-heading-for-remember
  783. fastp t))
  784. (setq current-prefix-arg nil)
  785. ;; Modify text so that it becomes a nice subtree which can be inserted
  786. ;; into an org tree.
  787. (goto-char (point-min))
  788. (if (re-search-forward "[ \t\n]+\\'" nil t)
  789. ;; remove empty lines at end
  790. (replace-match ""))
  791. (goto-char (point-min))
  792. (unless (looking-at org-outline-regexp)
  793. ;; add a headline
  794. (setq text-before-node-creation (buffer-string))
  795. (insert (concat "* " (current-time-string)
  796. " (" (remember-buffer-desc) ")\n"))
  797. (backward-char 1)
  798. (when org-adapt-indentation
  799. (while (re-search-forward "^" nil t)
  800. (insert " "))))
  801. (goto-char (point-min))
  802. (if (re-search-forward "\n[ \t]*\n[ \t\n]*\\'" nil t)
  803. (replace-match "\n\n")
  804. (if (re-search-forward "[ \t\n]*\\'")
  805. (replace-match "\n")))
  806. (goto-char (point-min))
  807. (setq txt (buffer-string))
  808. (org-save-markers-in-region (point-min) (point-max))
  809. (set-buffer-modified-p nil)
  810. (when (and (eq org-remember-interactive-interface 'refile)
  811. (not fastp))
  812. (org-refile nil (or visiting (find-file-noselect file)))
  813. (and visitp (run-with-idle-timer 0.01 nil 'org-remember-visit-immediately))
  814. (save-excursion
  815. (bookmark-jump "org-refile-last-stored")
  816. (bookmark-set "org-remember-last-stored")
  817. (move-marker org-remember-last-stored-marker (point)))
  818. (throw 'quit t))
  819. ;; Find the file
  820. (with-current-buffer (or visiting (find-file-noselect file))
  821. (unless (or (org-mode-p) (member heading '(top bottom)))
  822. (error "Target files for notes must be in Org-mode if not filing to top/bottom"))
  823. (save-excursion
  824. (save-restriction
  825. (widen)
  826. (setq reversed (org-notes-order-reversed-p))
  827. ;; Find the default location
  828. (when heading
  829. (cond
  830. ((not (org-mode-p))
  831. (if (eq heading 'top)
  832. (goto-char (point-min))
  833. (goto-char (point-max))
  834. (or (bolp) (newline)))
  835. (insert text-before-node-creation)
  836. (when remember-save-after-remembering
  837. (save-buffer)
  838. (if (not visiting) (kill-buffer (current-buffer))))
  839. (throw 'quit t))
  840. ((eq heading 'top)
  841. (goto-char (point-min))
  842. (or (looking-at org-outline-regexp)
  843. (re-search-forward org-outline-regexp nil t))
  844. (setq org-goto-start-pos (or (match-beginning 0) (point-min))))
  845. ((eq heading 'bottom)
  846. (goto-char (point-max))
  847. (or (bolp) (newline))
  848. (setq org-goto-start-pos (point)))
  849. ((and (stringp heading) (string-match "\\S-" heading))
  850. (goto-char (point-min))
  851. (if (re-search-forward
  852. (concat "^\\*+[ \t]+" (regexp-quote heading)
  853. (org-re "\\([ \t]+:[[:alnum:]@_:]*\\)?[ \t]*$"))
  854. nil t)
  855. (setq org-goto-start-pos (match-beginning 0))
  856. (when fastp
  857. (goto-char (point-max))
  858. (unless (bolp) (newline))
  859. (insert "* " heading "\n")
  860. (setq org-goto-start-pos (point-at-bol 0)))))
  861. (t (goto-char (point-min)) (setq org-goto-start-pos (point)
  862. heading 'top))))
  863. ;; Ask the User for a location, using the appropriate interface
  864. (cond
  865. ((and fastp (memq heading '(top bottom)))
  866. (setq spos org-goto-start-pos
  867. exitcmd (if (eq heading 'top) 'left nil)))
  868. (fastp (setq spos org-goto-start-pos
  869. exitcmd 'return))
  870. ((eq org-remember-interactive-interface 'outline)
  871. (setq spos (org-get-location (current-buffer)
  872. org-remember-help)
  873. exitcmd (cdr spos)
  874. spos (car spos)))
  875. ((eq org-remember-interactive-interface 'outline-path-completion)
  876. (let ((org-refile-targets '((nil . (:maxlevel . 10))))
  877. (org-refile-use-outline-path t))
  878. (setq spos (org-refile-get-location "Heading: ")
  879. exitcmd 'return
  880. spos (nth 3 spos))))
  881. (t (error "This should not happen")))
  882. (if (not spos) (throw 'quit nil)) ; return nil to show we did
  883. ; not handle this note
  884. (and visitp (run-with-idle-timer 0.01 nil 'org-remember-visit-immediately))
  885. (goto-char spos)
  886. (cond ((org-on-heading-p t)
  887. (org-back-to-heading t)
  888. (setq level (funcall outline-level))
  889. (cond
  890. ((eq exitcmd 'return)
  891. ;; sublevel of current
  892. (setq org-remember-previous-location
  893. (cons (abbreviate-file-name file)
  894. (org-get-heading 'notags)))
  895. (if reversed
  896. (outline-next-heading)
  897. (org-end-of-subtree t)
  898. (if (not (bolp))
  899. (if (looking-at "[ \t]*\n")
  900. (beginning-of-line 2)
  901. (end-of-line 1)
  902. (insert "\n"))))
  903. (org-paste-subtree (org-get-valid-level level 1) txt)
  904. (and org-auto-align-tags (org-set-tags nil t))
  905. (bookmark-set "org-remember-last-stored")
  906. (move-marker org-remember-last-stored-marker (point)))
  907. ((eq exitcmd 'left)
  908. ;; before current
  909. (org-paste-subtree level txt)
  910. (and org-auto-align-tags (org-set-tags nil t))
  911. (bookmark-set "org-remember-last-stored")
  912. (move-marker org-remember-last-stored-marker (point)))
  913. ((eq exitcmd 'right)
  914. ;; after current
  915. (org-end-of-subtree t)
  916. (org-paste-subtree level txt)
  917. (and org-auto-align-tags (org-set-tags nil t))
  918. (bookmark-set "org-remember-last-stored")
  919. (move-marker org-remember-last-stored-marker (point)))
  920. (t (error "This should not happen"))))
  921. ((eq heading 'bottom)
  922. (org-paste-subtree 1 txt)
  923. (and org-auto-align-tags (org-set-tags nil t))
  924. (bookmark-set "org-remember-last-stored")
  925. (move-marker org-remember-last-stored-marker (point)))
  926. ((and (bobp) (not reversed))
  927. ;; Put it at the end, one level below level 1
  928. (save-restriction
  929. (widen)
  930. (goto-char (point-max))
  931. (if (not (bolp)) (newline))
  932. (org-paste-subtree (org-get-valid-level 1 1) txt)
  933. (and org-auto-align-tags (org-set-tags nil t))
  934. (bookmark-set "org-remember-last-stored")
  935. (move-marker org-remember-last-stored-marker (point))))
  936. ((and (bobp) reversed)
  937. ;; Put it at the start, as level 1
  938. (save-restriction
  939. (widen)
  940. (goto-char (point-min))
  941. (re-search-forward "^\\*+ " nil t)
  942. (beginning-of-line 1)
  943. (org-paste-subtree 1 txt)
  944. (and org-auto-align-tags (org-set-tags nil t))
  945. (bookmark-set "org-remember-last-stored")
  946. (move-marker org-remember-last-stored-marker (point))))
  947. (t
  948. ;; Put it right there, with automatic level determined by
  949. ;; org-paste-subtree or from prefix arg
  950. (org-paste-subtree
  951. (if (numberp current-prefix-arg) current-prefix-arg)
  952. txt)
  953. (and org-auto-align-tags (org-set-tags nil t))
  954. (bookmark-set "org-remember-last-stored")
  955. (move-marker org-remember-last-stored-marker (point))))
  956. (when remember-save-after-remembering
  957. (save-buffer)
  958. (if (and (not visiting)
  959. (not (equal (marker-buffer org-clock-marker)
  960. (current-buffer))))
  961. (kill-buffer (current-buffer))))
  962. (when org-remember-auto-remove-backup-files
  963. (when backup-file
  964. (ignore-errors
  965. (delete-file backup-file)
  966. (delete-file (concat backup-file "~"))))
  967. (when org-remember-backup-directory
  968. (let ((n (length
  969. (directory-files
  970. org-remember-backup-directory nil
  971. "^remember-.*[0-9]$"))))
  972. (when (> n 0)
  973. (message
  974. "%d backup files (unfinished remember calls) in %s"
  975. n org-remember-backup-directory))))))))))
  976. t) ;; return t to indicate that we took care of this note.
  977. (defun org-do-remember (&optional initial)
  978. "Call remember."
  979. (remember initial))
  980. (defun org-require-remember ()
  981. "Make sure remember is loaded, or install our own emergency version of it."
  982. (condition-case nil
  983. (require 'remember)
  984. (error
  985. ;; Lets install our own micro version of remember
  986. (defvar remember-register ?R)
  987. (defvar remember-mode-hook nil)
  988. (defvar remember-handler-functions nil)
  989. (defvar remember-buffer "*Remember*")
  990. (defvar remember-save-after-remembering t)
  991. (defvar remember-annotation-functions '(buffer-file-name))
  992. (defun remember-finalize ()
  993. (run-hook-with-args-until-success 'remember-handler-functions)
  994. (when (equal remember-buffer (buffer-name))
  995. (kill-buffer (current-buffer))
  996. (jump-to-register remember-register)))
  997. (defun remember-mode ()
  998. (fundamental-mode)
  999. (setq mode-name "Remember")
  1000. (run-hooks 'remember-mode-hook))
  1001. (defun remember (&optional initial)
  1002. (window-configuration-to-register remember-register)
  1003. (let* ((annotation (run-hook-with-args-until-success
  1004. 'remember-annotation-functions)))
  1005. (switch-to-buffer-other-window (get-buffer-create remember-buffer))
  1006. (remember-mode)))
  1007. (defun remember-buffer-desc ()
  1008. (buffer-substring (point-min) (save-excursion (goto-char (point-min))
  1009. (point-at-eol)))))))
  1010. (provide 'org-remember)
  1011. ;; arch-tag: 497f30d0-4bc3-4097-8622-2d27ac5f2698
  1012. ;;; org-remember.el ends here