[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-devel] Re: Insertion of leading new line with C-c C-s
From: |
Christian Schlauer |
Subject: |
[AUCTeX-devel] Re: Insertion of leading new line with C-c C-s |
Date: |
Tue, 05 Apr 2005 08:54:13 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) |
Ralf Angeli <address@hidden> writes:
> * Christian Schlauer (2005-04-03) writes:
>
>> [This is a follow-up to a thread from last december, see
>> <URL:http://article.gmane.org/gmane.emacs.auc-tex/5093>]
> [...]
>> I attach a patch that does the right thing: it inserts a new line only
>> if the previous line is not empty or does not start with `[possible
>> whitespace]\begin'. The latter is to avoid things like
>>
>> \begin{some-environment}
>>
>> \section{blah}
>>
>> where a blank line between the beginning of the environment and the
>> section is not wanted.
>
> Why isn't it wanted in this case?
Many of my documents don't use \title{}, \maketitle{} and so on. I
start with a \section right after \begin{document}. There, I prefer
\begin{document}
\section{...}
instead of a blank line in between. I think the same applies to most
other environments as well, like the multicols- or
minipage-environment: I can't see a need for a blank line between the
\begin{} and the first section. It is just ugly, IMHO.
[...]
> The code fails to insert a newline in the following case:
>
> text text text
>
> text text text-!-
Ouch. I used M-x re-builder RET to build the regexp, but that one
escaped me.
> Here is a version using `skip-chars-backward' which dos not fail:
>
> (unless (and (eq (save-excursion
> (skip-chars-backward " \t\n\f" (line-end-position -1))
> (point))
> (line-end-position -1))
> (save-excursion
> (re-search-backward
> (concat "^\\s-*" (regexp-quote TeX-esc) "begin")
> (line-beginning-position 0) t)))
> (LaTeX-newline))
But that code does the thing I am trying to get rid of: inserting a
new line in this case:
--8<---------------cut here---------------start------------->8---
text text text
text text text
-!-
--8<---------------cut here---------------end--------------->8---
You get an additional new line although there is a blank line before
point. But I solved the problem that you found in my code with an
extra `\=' in the regexp. I think it is okay now.
The ChangeLog entry got a little longer, I corrected small typos that
I stumbled across.
2005-04-05 Christian Schlauer <address@hidden>
* tex.el (TeX-submit-bug-report): Fix typo in doc string, fill doc
string.
* latex.el: Change maintainer address.
(LaTeX-section): Fix typo in doc string. Remove code that almost
always inserts a new line.
(LaTeX-section-section): Fix doc string. Add code that
conditionally inserts a new line (which also bundles the
modification of the buffer in this function).
(LaTeX-section-hook): Fix typo in doc string.
(LaTeX-default-position): Use `do not' instead of `don't' in doc
string and customize value menu (as in `LaTeX-float).
(LaTeX-item-list): Fix typo in doc string.
Concerning the change to `LaTeX-default-position': in one of my last
patches you applied, you changed `don't' to `do not'. So the current
change is just a sync so that the doc strings and customize value
menus are uniform, at least in `LaTeX-default-position' and
`LaTeX-float'.
latex.el.diff
Description: Text Data
tex.el.diff
Description: Text Data
--
Christian Schlauer