forked from mirrors/org-mode
Updated the documentation for the template pre-selection.
Also update the Changes.org file. Cleaned the code in `org-select-remember-template'.
This commit is contained in:
parent
559c25e34c
commit
06fb98f1e2
|
@ -1,5 +1,7 @@
|
||||||
2008-03-10 Bastien Guerry <bzg@altern.org>
|
2008-03-10 Bastien Guerry <bzg@altern.org>
|
||||||
|
|
||||||
|
* org.el (org-select-remember-template): Cleaned the code.
|
||||||
|
|
||||||
* org-publish.el (org-publish-before-export-hook)
|
* org-publish.el (org-publish-before-export-hook)
|
||||||
(org-publish-after-export-hook): New hooks.
|
(org-publish-after-export-hook): New hooks.
|
||||||
(org-publish-org-to): Use new hooks and kill buffers.
|
(org-publish-org-to): Use new hooks and kill buffers.
|
||||||
|
|
27
org.el
27
org.el
|
@ -1547,13 +1547,11 @@ element can specify the headline in that file that should be offered
|
||||||
first when the user is asked to file the entry. The default headline is
|
first when the user is asked to file the entry. The default headline is
|
||||||
given in the variable `org-remember-default-headline'.
|
given in the variable `org-remember-default-headline'.
|
||||||
|
|
||||||
An optional sixth element can specify the context in which the user should
|
An optional sixth element specifies the contexts in which the user can
|
||||||
be able to select this template. If this element is a list of major modes,
|
select the template. This element can be either a list of major modes
|
||||||
the template will only be available while invoking `org-remember' from a
|
or a function. `org-remember' will first check whether the function
|
||||||
buffer in one of these modes. If it is a function, the template will only
|
returns `t' or if we are in any of the listed major mode, and select
|
||||||
be selected if the function returns `t'. A value of `t' means select
|
the template accordingly.
|
||||||
this template in any context. When the element is `nil', the template
|
|
||||||
will be selected by default, i.e. when all contextual checks failed.
|
|
||||||
|
|
||||||
The template specifies the structure of the remember buffer. It should have
|
The template specifies the structure of the remember buffer. It should have
|
||||||
a first line starting with a star, to act as the org-mode headline.
|
a first line starting with a star, to act as the org-mode headline.
|
||||||
|
@ -13695,14 +13693,13 @@ RET at beg-of-buf -> Append to file as level 2 headline
|
||||||
(let ((ctxt (nth 5 tpl))
|
(let ((ctxt (nth 5 tpl))
|
||||||
(mode org-select-template-temp-major-mode)
|
(mode org-select-template-temp-major-mode)
|
||||||
(buf org-select-template-original-buffer))
|
(buf org-select-template-original-buffer))
|
||||||
(if (or (and (functionp ctxt)
|
(and (or (not ctxt) (eq ctxt t)
|
||||||
(save-excursion
|
(and (listp ctxt) (memq mode ctxt))
|
||||||
(set-buffer buf)
|
(and (functionp ctxt)
|
||||||
;; Protect the user-defined function from error
|
(if (with-current-buffer buf
|
||||||
(condition-case nil (funcall ctxt) (error nil))))
|
;; Protect the user-defined function from error
|
||||||
(and ctxt (listp ctxt)
|
(condition-case nil (funcall ctxt) (error nil))))))
|
||||||
(delq nil (mapcar (lambda(x) (eq mode x)) ctxt))))
|
tpl)))
|
||||||
tpl)))
|
|
||||||
org-remember-templates))
|
org-remember-templates))
|
||||||
;; If no template at this point, add the default templates:
|
;; If no template at this point, add the default templates:
|
||||||
(pre-selected-templates1
|
(pre-selected-templates1
|
||||||
|
|
15
org.texi
15
org.texi
|
@ -4611,14 +4611,11 @@ file (if not present or @code{nil}) defaults to
|
||||||
@code{org-default-notes-file}, the heading to
|
@code{org-default-notes-file}, the heading to
|
||||||
@code{org-remember-default-headline}.
|
@code{org-remember-default-headline}.
|
||||||
|
|
||||||
An optional sixth element can specify the context in which the user
|
An optional sixth element specifies the contexts in which the user can
|
||||||
wants to be able to select this template. This element can be a list
|
select the template. This element can be either a list of major modes
|
||||||
of major modes, in case the template will be available while invoking
|
or a function. @code{org-remember} will first check whether the function
|
||||||
@code{org-remember} from a buffer in one of these modes. If it is a
|
returns @code{t} or if we are in any of the listed major mode, and select
|
||||||
function, the template will only be selected if the function returns
|
the template accordingly.
|
||||||
@code{t}. If this element is @code{t}, then the template will be
|
|
||||||
selected in any context and if it is @code{nil} the template will
|
|
||||||
be selected by default -- i.e. when all contextual checks failed.
|
|
||||||
|
|
||||||
So for example:
|
So for example:
|
||||||
|
|
||||||
|
@ -4626,7 +4623,7 @@ So for example:
|
||||||
(setq org-remember-templates
|
(setq org-remember-templates
|
||||||
'(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks" (emacs-lisp-mode))
|
'(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks" (emacs-lisp-mode))
|
||||||
("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" my-check)
|
("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" my-check)
|
||||||
("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas" t)))
|
("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
The first template will only be available when invoking @code{org-remember}
|
The first template will only be available when invoking @code{org-remember}
|
||||||
|
|
Loading…
Reference in New Issue