Nicolas Goaziou <m...@nicolasgoaziou.fr> writes: > Hello, > > Eric Abrahamsen <e...@ericabrahamsen.net> writes: > >> How does this look? > > Thank you! I have some questions and remarks. > >> * etc/ORG-NEWS: Mention in news. > > This doesn't need to be added to the commit message. > >> +Do not be put off by having to remember the source block syntax. Org mode >> +offers two ways of speeding up the creation of @samp{src} code blocks: > > src code blocks > > is enough, IMO. There are may of them across the manual, and it just > makes reading more tedious. > >> +@findex org-insert-structure-template > > I would also add > > @kindex C-c C-x t > >> + (let ((s (copy-marker (if (use-region-p) >> + (region-beginning) >> + (point)))) > > Does it really need to be a marker? AFAICT, nothing really changes this > position. > >> + (back-to-indentation) n>> + (insert (format "#+BEGIN_%s\n" >> + type)) >> + (indent-to column) > > What about > > (beginning-of-line) > (indent-to column) > (insert (format "#+BEGIN_%s\n" type)) > > ? > > It avoids `back-to-indentation'.
Cool, I will make all of the above changes, thanks for the notes. >> + (if (bolp) >> + (progn >> + (skip-chars-backward " \n\t") >> + (forward-char)) >> + (end-of-line) >> + (insert "\n")) > > I don't understand this part. In particular, the `forward-char' looks > wrong. Do you mean `forward-line' ? If so, do you handle the case where > buffer doesn't end with a newline character? This was a bit of finicky code mostly for aesthetic purposes. It has to do with this case (the second clause in the test I added): #+BEGIN_SRC org This is a paragraph This is another paragraph #+END_SRC If point is on the first paragraph and the region is not active, `org-mark-element' will mark the paragraph and all following whitespace, which means we end up with: #+BEGIN_SRC org #+BEGIN_FOO This is a paragraph. #+END_FOO This is another paragraph. #+END_SRC Which just looked bad to me (even though it probably behaves perfectly correctly). So if point is at bol, it skips back over the whitespace and then moves forward one char, presumably leaving point right after the marked element. Maybe it should only skip back over newlines (though then indentation will confuse it). Or maybe I should just not be so picky about appearances... Eric