Remember: Allow filing to non org-mode files.

If the heading field in the remember template entry is either `top' or
`bottom', it is now OK to file to a file that is not in org mode, and
the content of the remember buffer is inserted without forcing an
Org-style header.
This commit is contained in:
Carsten Dominik 2009-04-15 18:22:53 +02:00
parent 139dbfcd20
commit cb302b1715
2 changed files with 19 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2009-04-15 Carsten Dominik <carsten.dominik@gmail.com>
* org-remember.el (org-remember-handler): Allow filing to non-org
files.
2009-04-15 Magnus Henoch <magnus.henoch@gmail.com>
* org-feed.el (org-feed-alist): New keyword options.

View File

@ -806,7 +806,7 @@ See also the variable `org-reverse-note-order'."
(org-startup-folded nil)
(org-startup-align-all-tables nil)
(org-goto-start-pos 1)
spos exitcmd level reversed txt)
spos exitcmd level reversed txt text-before-node-creation)
(when (equal current-prefix-arg '(4))
(setq visitp t))
(when previousp
@ -829,6 +829,7 @@ See also the variable `org-reverse-note-order'."
(goto-char (point-min))
(unless (looking-at org-outline-regexp)
;; add a headline
(setq text-before-node-creation (buffer-string))
(insert (concat "* " (current-time-string)
" (" (remember-buffer-desc) ")\n"))
(backward-char 1)
@ -855,8 +856,8 @@ See also the variable `org-reverse-note-order'."
(throw 'quit t))
;; Find the file
(with-current-buffer (or visiting (find-file-noselect file))
(unless (org-mode-p)
(error "Target files for remember notes must be in Org-mode"))
(unless (or (org-mode-p) (member heading '(top bottom)))
(error "Target files for notes must be in Org-mode if not filing to top/bottom"))
(save-excursion
(save-restriction
(widen)
@ -865,6 +866,16 @@ See also the variable `org-reverse-note-order'."
;; Find the default location
(when heading
(cond
((not (org-mode-p))
(if (eq heading 'top)
(goto-char (point-min))
(goto-char (point-max))
(or (bolp) (newline)))
(insert text-before-node-creation)
(when remember-save-after-remembering
(save-buffer)
(if (not visiting) (kill-buffer (current-buffer))))
(throw 'quit t))
((eq heading 'top)
(goto-char (point-min))
(or (looking-at org-outline-regexp)