emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* %i indentation in capture templates
@ 2010-08-05 13:35 Thomas Jack
  2010-08-06  8:23 ` Sébastien Vauban
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Jack @ 2010-08-05 13:35 UTC (permalink / raw)
  To: emacs-orgmode

I have the following capture template:

("t" "Todo" entry (file+headline (concat org-directory "/inbox.org") "inbox")
             "* TODO %?\n    %i\n    %a")

Yet, with "foo\nbar\nbaz" in the region, this expands to:

...
*** TODO
    foo
bar
baz
...

The manual says of %i that "The entire text will be indented like %i
itself." Is this a bug, or am I misunderstanding? To be specific, the
output I expect is:

...
*** TODO
    foo
    bar
    baz
...

I'm on 7.01g.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: %i indentation in capture templates
  2010-08-05 13:35 %i indentation in capture templates Thomas Jack
@ 2010-08-06  8:23 ` Sébastien Vauban
  2010-08-06 10:11   ` Thomas Jack
  0 siblings, 1 reply; 4+ messages in thread
From: Sébastien Vauban @ 2010-08-06  8:23 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Thomas,

Thomas Jack wrote:
> I have the following capture template:
>
> ("t" "Todo" entry (file+headline (concat org-directory "/inbox.org") "inbox")
>              "* TODO %?\n    %i\n    %a")
>
> The manual says of %i that "The entire text will be indented like %i
> itself." Is this a bug, or am I misunderstanding? To be specific, the
> output I expect is:
>
> ...
> *** TODO
>     foo
>     bar
>     baz
> ...

I've been using similar templates, with indented %i. I wasn't aware of what
the doc said about it, but I never had the text indented. Always only the
first line of text (with git versions taken every week or so).

Now, I don't mind anymore, as I've switched my way of writing, and stick to
beginning writing text at column 0, whatever the heading level.

But just wanted to confirm you this seems, then, a bug to me (regarding what
the doc promises).

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: %i indentation in capture templates
  2010-08-06  8:23 ` Sébastien Vauban
@ 2010-08-06 10:11   ` Thomas Jack
  2010-08-11  9:11     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Jack @ 2010-08-06 10:11 UTC (permalink / raw)
  To: emacs-orgmode

2010/8/6 Sébastien Vauban <wxhgmqzgwmuf@spammotel.com>:
> But just wanted to confirm you this seems, then, a bug to me (regarding what
> the doc promises).

Thanks for the confirmation.

The following patch seems to fix the problem:

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 111f7f7..1e407f1 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1045,6 +1045,7 @@ Lisp programs can force the template by setting
KEYS to a string."
   "Fill a template and return the filled template as a string.
 The template may still contain \"%?\" for cursor positioning."
   (setq template (or template (org-capture-get :template)))
+  (setq initial (or initial (org-capture-get :initial)))
   (when (stringp initial)
     (setq initial (org-no-properties initial))
     (remove-text-properties 0 (length initial) '(read-only t) initial))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: %i indentation in capture templates
  2010-08-06 10:11   ` Thomas Jack
@ 2010-08-11  9:11     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2010-08-11  9:11 UTC (permalink / raw)
  To: Thomas Jack; +Cc: emacs-orgmode


On Aug 6, 2010, at 12:11 PM, Thomas Jack wrote:

> 2010/8/6 Sébastien Vauban <wxhgmqzgwmuf@spammotel.com>:
>> But just wanted to confirm you this seems, then, a bug to me  
>> (regarding what
>> the doc promises).
>
> Thanks for the confirmation.
>
> The following patch seems to fix the problem:
>
> diff --git a/lisp/org-capture.el b/lisp/org-capture.el
> index 111f7f7..1e407f1 100644
> --- a/lisp/org-capture.el
> +++ b/lisp/org-capture.el
> @@ -1045,6 +1045,7 @@ Lisp programs can force the template by setting
> KEYS to a string."
>   "Fill a template and return the filled template as a string.
> The template may still contain \"%?\" for cursor positioning."
>   (setq template (or template (org-capture-get :template)))
> +  (setq initial (or initial (org-capture-get :initial)))
>   (when (stringp initial)
>     (setq initial (org-no-properties initial))
>     (remove-text-properties 0 (length initial) '(read-only t)  
> initial))

Applied, at a slightly different place in that function.

Thanks!

- Carsten

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-11  9:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 13:35 %i indentation in capture templates Thomas Jack
2010-08-06  8:23 ` Sébastien Vauban
2010-08-06 10:11   ` Thomas Jack
2010-08-11  9:11     ` Carsten Dominik

Code repositories for project(s) associated with this 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).