Gnus development mailing list
 help / color / mirror / Atom feed
* Wrapping a region of an article
@ 2007-07-04 20:48 Stephen Berman
  0 siblings, 0 replies; only message in thread
From: Stephen Berman @ 2007-07-04 20:48 UTC (permalink / raw)
  To: ding

[-- 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-04 20:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-04 20:48 Wrapping a region of an article Stephen Berman

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