all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ralf Angeli <dev.null@iwi.uni-sb.de>
Subject: Re: fill-paragraph / fill region in latex (auctex) buffer
Date: Thu, 24 Nov 2005 12:27:05 +0100	[thread overview]
Message-ID: <4385a37f$0$41149$14726298@news.sunsite.dk> (raw)
In-Reply-To: 87hda3bzmk.fsf-monnier+gnu.emacs.help@gnu.org

* Stefan Monnier (2005-11-23) writes:

>> In which sense?  That you cannot hook specialized filling functions
>> into `fill-region'?
>
> Either that, or that fill-region doesn't understand the fact that blocks of
> comments are paragraphs (actually fill-paragraph doesn't quite understand
> it either: it only works when you're inside the comment, and even then only
> in some cases).

`fill-region' should probably call a comment-aware function for
filling paragraphs.  I managed to improve this a bit by using
	    (if (and fill-paragraph-handle-comment
		     comment-start (equal comment-end "")
		     (setq fill-pfx (fill-comment-paragraph)))
		(goto-char end)
	      (setq fill-pfx (fill-region-as-paragraph (point) end justify
						       nosqueeze)))
instead of the simple `fill-region-as-paragraph' call (in the else
part of the above form) currently in `fill-region' and making `end' a
marker.  But it would probably make more sense to make
`fill-region-as-paragraph' aware of comments.

Anyway, AUCTeX provides specialized filling functions using
specialized functions for moving forward and backward over paragraphs
and these functions as well as their key bindings are documented in
AUCTeX's manual.  The functions are able to fill paragraphs and
regions with comments correctly and are even capable of doing
syntax-aware indentation inside of comments.

So for the problem at hand the OP should simply use the functions
provided by AUCTeX instead of `fill-region'.  Of course it would be
nice if the specialized function(s) could be hooked into `fill-region'
because then the menu entry `Edit --> Fill' would work as well.

-- 
Ralf

  reply	other threads:[~2005-11-24 11:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.15243.1131996330.20277.help-gnu-emacs@gnu.org>
2005-11-22 20:17 ` fill-paragraph / fill region in latex (auctex) buffer Stefan Monnier
2005-11-22 21:14   ` Ralf Angeli
2005-11-23  7:20     ` Stefan Monnier
2005-11-24 11:27       ` Ralf Angeli [this message]
2005-11-25  4:20         ` Stefan Monnier
2005-11-14 19:25 David Reitter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='4385a37f$0$41149$14726298@news.sunsite.dk' \
    --to=dev.null@iwi.uni-sb.de \
    --cc=angeli@iwi.uni-sb.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.