Hi

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
files.

The issue has been discussed for example in
http://stackoverflow.com/questions/539984/how-do-i-get-emacs-to-fill-sentences-but-not-paragraphs

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

http://pleasefindattached.blogspot.de/2011/12/emacsauctex-sentence-fill-greatly.html

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)))
        tmp-end)
    (while (< from (marker-position to-marker))
      (forward-sentence)
      ;; might have gone beyond to-marker --- use whichever is smaller:
      (ad-set-arg 1 (setq tmp-end (min (point) (marker-position to-marker))))
      ad-do-it
      (ad-set-arg 0 (setq from (point)))
      (unless (or
               (bolp)
               (looking-at "\\s *$"))
        (LaTeX-newline)))
    (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
       included.

Regards

Uwe Brauer 

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


_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to