Gnus development mailing list
 help / color / mirror / Atom feed
From: Stephen Berman <Stephen.Berman@gmx.net>
To: ding@gnus.org
Subject: Wrapping a region of an article
Date: Wed, 04 Jul 2007 22:48:11 +0200	[thread overview]
Message-ID: <871wfnki9g.fsf@escher.local.home> (raw)

[-- Attachment #1: Type: text/plain, Size: 936 bytes --]

Not infrequently I would like to apply word wrapping to a region of
the article buffer, rather than to the whole buffer, for example, when
the buffer contains a mix of overlong text lines and formatted text
(inlined code, tables, etc.).  In such cases
gnus-article-fill-cited-article (bound to `W w') munges the formatted
text, making it all but unreadable.  Is there a way to do this that I
have overlooked?  (I know I can do 'W w' to read the text with
overlong lines, then do `g' to redisplay the formatted text, but
that's not so nice.)  If not, then I would like to propose the
attached change to gnus-article-fill-cited-article, which wraps an
explicitly selected region of the article buffer, and if there isn't
one, then wraps the whole buffer just as it currently does.  My patch
is against the current Emacs CVS trunk, i.e., Gnus 5.11.  If such a
feature is available in No Gnus, I would like to hear about it.

Steve Berman


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Wrap a region of an article --]
[-- Type: text/x-patch, Size: 1270 bytes --]

*** gnus-cite.el.~1.22.~	2007-01-21 23:44:37.000000000 +0100
--- gnus-cite.el	2007-07-04 21:39:28.000000000 +0200
***************
*** 493,498 ****
--- 493,500 ----
  
  (defun gnus-article-fill-cited-article (&optional force width)
    "Do word wrapping in the current article.
+ If a region of the article buffer is selected, wrap only that region,
+ otherwise, do wrapping in the entire article buffer.
  If WIDTH (the numerical prefix), use that text width when filling."
    (interactive (list t current-prefix-arg))
    (save-excursion
***************
*** 511,518 ****
  		(fill-prefix
  		 (if (string= (cdar marks) "") ""
  		   (concat (cdar marks) " ")))
  		use-hard-newlines)
! 	    (fill-region (point-min) (point-max)))
  	  (set-marker (caar marks) nil)
  	  (setq marks (cdr marks)))
  	(when marks
--- 513,526 ----
  		(fill-prefix
  		 (if (string= (cdar marks) "") ""
  		   (concat (cdar marks) " ")))
+ 		(beg (if mark-active
+ 			 (max (region-beginning) (point-min))
+ 		       (point-min)))
+ 		(end (if (and mark-active (> (region-end) (point-min)))
+ 			 (min (region-end) (point-max))
+ 		       (point-max)))
  		use-hard-newlines)
! 	    (fill-region beg end))
  	  (set-marker (caar marks) nil)
  	  (setq marks (cdr marks)))
  	(when marks

                 reply	other threads:[~2007-07-04 20:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=871wfnki9g.fsf@escher.local.home \
    --to=stephen.berman@gmx.net \
    --cc=ding@gnus.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).