[Top][All Lists]

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

[AUCTeX-devel] LaTeX-fill-region-as-paragraph: each sentence starts in a

From: Uwe Brauer
Subject: [AUCTeX-devel] LaTeX-fill-region-as-paragraph: each sentence starts in a new line
Date: Thu, 08 Sep 2016 08:13:26 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)


One of the few things I miss in vanilla auctex, is a generalisation of
LaTeX-fill-region-as-paragraph: each sentence starts in a new line.

That is very helpful if one uses a version-control system for ones LaTeX

The issue has been discussed for example in

I tested all the proposed solutions and must say the best one is the one
found in

It uses defadvice:

(defadvice LaTeX-fill-region-as-paragraph (around LaTeX-sentence-filling)
  "Start each sentence on a new line."
  (let ((from (ad-get-arg 0))
        (to-marker (set-marker (make-marker) (ad-get-arg 1)))
    (while (< from (marker-position to-marker))
      ;; might have gone beyond to-marker --- use whichever is smaller:
      (ad-set-arg 1 (setq tmp-end (min (point) (marker-position to-marker))))
      (ad-set-arg 0 (setq from (point)))
      (unless (or
               (looking-at "\\s *$"))
    (set-marker to-marker nil)))
(ad-activate 'LaTeX-fill-region-as-paragraph)

A couple of questions and suggestions:

    -  could anyone with knowledge of the original
       LaTeX-fill-region-as-paragraph try to implement  this feature
       without using defadvice.

    -  if not, could that code be included, although it uses defadvice.
       Of course if would then be necessary to ask for permission and to
       convince the author to sign the relevant FSF papers [1], which I
       could try to do, if the maintainer think the code should be


Uwe Brauer 

[1]  which can take some time as I recently learnt.

reply via email to

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