* org-capture: Avoid inserting a new line when the template is empty
@ 2018-06-03 23:13 xristos
2018-06-19 14:40 ` Nicolas Goaziou
0 siblings, 1 reply; 2+ messages in thread
From: xristos @ 2018-06-03 23:13 UTC (permalink / raw)
To: emacs-orgmode
Hello,
An example of a capture workflow that I am using all the time
is the following:
("bbp" "Preview book" plain
(file+function "~/org/books.org.gpg" xristos/org-capture-preview-find-location)
"" :immediate-finish t :jump-to-captured t :empty-lines 0)
The idea is that the function I provide is fully responsible for cursor positioning
and entry manipulation. To that end, I pass an empty template ("") and
set :immediate-finish to t. This has been working fine with an older Org
version but since I recently updated to Org 9.1.13, org-capture-fill-template will
insert a new line every single time which is not what I want to happen.
The relevant code is at org-capture.el, line 1843. I think that having a way
to tell Org not to change the user-provided template at all and just use
it verbatim would be useful in the general sense.
For my own needs, I've added an extra property (:verbatim-template) which I
check for inside org-capture-fill-template:
@@ -1840,7 +1840,8 @@ The template may still contain \"%?\" for cursor positioning."
(goto-char (point-max))
(skip-chars-backward " \t\n")
(delete-region (point) (point-max))
- (insert "\n")
+ (unless (org-capture-get :verbatim-template)
+ (insert "\n"))
Chris
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: org-capture: Avoid inserting a new line when the template is empty
2018-06-03 23:13 org-capture: Avoid inserting a new line when the template is empty xristos
@ 2018-06-19 14:40 ` Nicolas Goaziou
0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2018-06-19 14:40 UTC (permalink / raw)
To: xristos; +Cc: emacs-orgmode
Hello,
xristos <xristos@sdf.org> writes:
> An example of a capture workflow that I am using all the time
> is the following:
>
> ("bbp" "Preview book" plain
> (file+function "~/org/books.org.gpg" xristos/org-capture-preview-find-location)
> "" :immediate-finish t :jump-to-captured t :empty-lines 0)
>
> The idea is that the function I provide is fully responsible for cursor positioning
> and entry manipulation. To that end, I pass an empty template ("") and
> set :immediate-finish to t. This has been working fine with an older Org
> version but since I recently updated to Org 9.1.13, org-capture-fill-template will
> insert a new line every single time which is not what I want to happen.
>
> The relevant code is at org-capture.el, line 1843. I think that having a way
> to tell Org not to change the user-provided template at all and just use
> it verbatim would be useful in the general sense.
>
> For my own needs, I've added an extra property (:verbatim-template) which I
> check for inside org-capture-fill-template:
>
> @@ -1840,7 +1840,8 @@ The template may still contain \"%?\" for cursor positioning."
> (goto-char (point-max))
> (skip-chars-backward " \t\n")
> (delete-region (point) (point-max))
> - (insert "\n")
> + (unless (org-capture-get :verbatim-template)
> + (insert "\n"))
IMO, :verbatim-template is not generally useful. In any case, I pushed
a fix in master. Does it fix your issue?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-19 14:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-03 23:13 org-capture: Avoid inserting a new line when the template is empty xristos
2018-06-19 14:40 ` Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).