emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] function for inserting a block


From: Eric Abrahamsen
Subject: Re: [O] function for inserting a block
Date: Fri, 20 Oct 2017 14:15:14 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Kaushal Modi <address@hidden> writes:

> Also, if the type is "src", shouldn't the point end up after "#+BEGIN_SRC"? 
> Because the user will anyways need to type something there.

My original version did that. It might be nice to still do that
selectively if the user adds a SRC or EXPORT block.

> Finally, I am trying to understand what this does:
>
> (if (bolp)
>     (progn
>       (skip-chars-backward " \n\t")
>       (forward-line))
>   ;; snip
>   )
>
> If the point is at BOL, wouldn't that progn bring the point exactly to where 
> it was, as the same BOL? Also isn't that progn equivalent to (forward-line 0)?
>
> I am probably missing something.. but seems to work the same with 
>
> (unless (bolp)
>       (end-of-line)
>       (insert "\n"))
>
> replacing that whole (if ..) form.

The case this is addressing is if there are multiple newlines after the
org element we're wrapping (one of the clauses in the test shows this).
The skip-chars-backward is there to go back over multiple newlines, so
that the #+END_FOO string always comes right after the end of the text.

Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]