0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 18:36:26 +00:00

New minor org-remember-mode, for extra keybindings.

This patch defines a new minor mode, `org-remember-mode', which is
turned on when Org-mode is used to handle a remember buffer.  This
provides a safe way to modify keybindings (in
`org-remember-mode-map'), without overwriting keys in `org-mode-map'.
Since Org put remember buffers into Org-mode, remember-mode-map will
be entirely ignored.
This commit is contained in:
Carsten Dominik 2008-11-18 20:32:01 +01:00
parent 68d15e53cc
commit e51d317a21
5 changed files with 36 additions and 4 deletions

View file

@ -1,3 +1,7 @@
2008-11-18 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Setting up Remember): Document `org-remember-mode'.
2008-11-14 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (External links): Document that bbdb links can use a

View file

@ -4988,6 +4988,12 @@ stored: Just call @code{org-remember} with a prefix argument. If you
use two prefix arguments, Org jumps to the location where the last
remember note was stored.
The remember buffer will actually use @code{org-mode} as its major mode, so
that all editing features of Org-mode are available. In addition to this, a
minor mode @code{org-remember-mode} is turned on, for the single purpose that
you can use its keymap @code{org-remember-mode-map} to overwrite some of
Org-mode's key bindings.
You can also call @code{org-remember} in a special way from the agenda,
using the @kbd{k r} key combination. With this access, any time stamps
inserted by the selected remember template (see below) will default to

View file

@ -1,7 +1,10 @@
2008-11-18 Carsten Dominik <carsten.dominik@gmail.com>
* org-remember.el (org-remember-apply-template): No ido
completion for free prompts in remember templates.
* org-remember.el (org-remember-apply-template): No ido completion
for free prompts in remember templates.
(org-remember-before-finalize-hook): New hook.
(org-remember-mode): New minor mode.
(org-remember-apply-template): Turn on `org-remember-mode'.
* org-id.el (org-id-add-location): Avoid error when no file is
given.

View file

@ -153,6 +153,9 @@ D Delete all of a task's attachments. A safer way is
"Return the directory associated with the current entry.
If the directory does not exist and CREATE-IF-NOT-EXISTS-P is non-nil,
the directory and the corresponding ID will be created."
(when (and (not (buffer-file-name (buffer-base-buffer)))
(not (file-name-absolute-p org-attach-directory)))
(error "Need absolute `org-attach-directory' to attach in bufers without filename."))
(let ((uuid (org-id-get (point) create-if-not-exists-p)))
(when (or uuid create-if-not-exists-p)
(unless uuid

View file

@ -195,6 +195,21 @@ calendar | %:type %:date"
(symbol :tag "Major mode"))
(function :tag "Perform a check against function")))))
(defcustom org-remember-before-finalize-hook nil
"Hook that is run right before a remember process is finalized.
The remember buffer is still current when this hook runs."
:group 'org-remember
:type 'hook)
(defvar org-remember-mode-map (make-sparse-keymap)
"Keymap for org-remember-mode, a minor mode.
Use this map to set additional keybindings for when Org-mode is used
for a Remember buffer.")
(define-minor-mode org-remember-mode
"Minor mode for special key bindings in a remember buffer."
nil "Rem" org-remember-mode-map)
(defcustom org-remember-clock-out-on-exit 'query
"Non-nil means, stop the clock when exiting a clocking remember buffer.
This only applies if the clock is running in the remember buffer. If the
@ -446,7 +461,7 @@ to be run from that hook to function properly."
(replace-match x t t))))
;; Turn on org-mode in the remember buffer, set local variables
(let ((org-inhibit-startup t)) (org-mode))
(let ((org-inhibit-startup t)) (org-mode) (org-remember-mode 1))
(org-set-local 'org-finish-function 'org-remember-finalize)
(if (and file (string-match "\\S-" file) (not (file-directory-p file)))
(org-set-local 'org-default-notes-file file))
@ -540,7 +555,7 @@ to be run from that hook to function properly."
(if (re-search-forward "%\\?" nil t)
(replace-match "")
(and (re-search-forward "^[^#\n]" nil t) (backward-char 1))))
(let ((org-inhibit-startup t)) (org-mode))
(let ((org-inhibit-startup t)) (org-mode) (org-remember-mode 1))
(org-set-local 'org-finish-function 'org-remember-finalize))
(when (save-excursion
(goto-char (point-min))
@ -579,6 +594,7 @@ from that hook."
(defvar org-clock-marker) ; Defined in org.el
(defun org-remember-finalize ()
"Finalize the remember process."
(run-hooks 'org-remember-before-finalize-hook)
(unless (fboundp 'remember-finalize)
(defalias 'remember-finalize 'remember-buffer))
(when (and org-clock-marker