Gnus development mailing list
 help / color / mirror / Atom feed
* [patch] deuglify.el
@ 2003-01-02 21:59 Raymond Scholz
  2003-01-02 22:05 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Raymond Scholz @ 2003-01-02 21:59 UTC (permalink / raw)


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

This patch adds the ability to shorten cited block attributions too
(Niklas Morberg suggested this erm... months ago) and tries to
"emulate" `gnus-article-prepare-display' without calling it :-)
(thanks to Niels Olof Bouvin for pointing me to a problem in
combination with gnus-propfont.el).  Calling
`gnus-article-prepare-display' on an already prepared article removes
all MIME parts.  I'm unsure whether this is a bug or not.

Anyway, suggested ChangeLog entry:

2003-01-02  Raymond Scholz  <ray-2003@zonix.de>

	* deuglify.el (gnus-article-outlook-deuglify-article):
	Rehighlight, reapply treatments and call
	`gnus-article-prepare-hook'.  Suggested by Niels Olof Bouvin.
	(gnus-outlook-repair-attribution-block): Recognize cited
	attributions.  Suggested by Niklas Morberg.

Ah, could someone correct my little accident with the last ChangeLog
entry:

--- ChangeLog	2003/01/02 19:56:50	6.1770
+++ ChangeLog	2003/01/02 21:49:30
@@ -149,7 +149,7 @@
 	* gnus-sum.el (gnus-summary-display-while-building): New
 	variable.
 
-2002-01-01  Raymond Scholz  <ray-2003@zonix.de>
+2003-01-01  Raymond Scholz  <ray-2003@zonix.de>

Cheers, Ray
-- 
Gnus is already huge.  Maybe it doesn't need all of this kind of stuff. -
I think you mean "Gnus is huge, so adding more stuff won't make it
noticeably bigger".               (Chris Beggy and LMI on gnu.emacs.gnus)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: deuglify.el.patch --]
[-- Type: text/x-patch, Size: 2707 bytes --]

Index: deuglify.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/deuglify.el,v
retrieving revision 6.6
diff -u -r6.6 deuglify.el
--- deuglify.el	2003/01/01 19:15:06	6.6
+++ deuglify.el	2003/01/02 21:52:21
@@ -310,18 +310,26 @@
 		  (replace-match "\\1\\2 \\3")
 		  (goto-char (match-beginning 0))))))))))
 
-(defun gnus-outlook-rearrange-article (from-where)
-  "Put the text from `from-where' to the end of buffer at the top of the article buffer."
+(defun gnus-outlook-rearrange-article (attr-start)
+  "Put the text from `attr-start' to the end of buffer at the top of the article buffer."
   (save-excursion
     (let ((inhibit-read-only t)
 	  (cite-marks gnus-outlook-deuglify-cite-marks))
       (gnus-with-article-buffer
 	(article-goto-body)
-	;; attribution out of place?
-	(unless (= (point) from-where)
+	;; article does not start with attribution
+	(unless (= (point) attr-start)
 	  (gnus-kill-all-overlays)
-	  (transpose-regions (point) (+ from-where 1)
-			     (+ from-where 1) (point-max)))))))
+	  (let ((cur (point))
+		;; before signature or end of buffer
+		(to (if (gnus-article-search-signature)
+			(point)
+		      (point-max))))
+	    ;; handle the case where the full quote is below the
+	    ;; signature
+	    (if (< to attr-start)
+		(setq to (point-max)))
+	    (transpose-regions cur attr-start attr-start to)))))))
 
 ;; John Doe <john.doe@some.domain> wrote in message
 ;; news:a87usw8$dklsssa$2@some.news.server...
@@ -361,15 +369,13 @@
       (gnus-with-article-buffer
 	(article-goto-body)
 	(if (re-search-forward
-	     (concat "^----* ?[^-]+ ?----*\n"
-		     "[^\n]+: \\([^\n]+\\)\n"
-		     "[^\n]+: [^\n]+\n"
-		     "[^\n]+: [^\n]+\n"
-		     "[^\n]+: [^\n]+$")
+	     (concat "^[" cite-marks " \t]*----* ?[^-]+ [^-]+ ?----*\n"
+		     "[^\n:]+:[ \t]*\\([^\n]+\\)\n"
+		     "\\([^\n:]+:[ \t]*[^\n]+\n\\)+")
 	     nil t)
 	    (progn
 	      (gnus-kill-all-overlays)
-	      (replace-match "\\1 wrote:")
+	      (replace-match "\\1 wrote:\n")
 	      (match-beginning 0)))))))
 
 ;; On Wed, 16 Jan 2002 23:23:30 +0100, John Doe <john.doe@some.domain> wrote:
@@ -426,7 +432,13 @@
   (interactive)
   (gnus-outlook-deuglify-article)
   (with-current-buffer (or gnus-article-buffer (current-buffer))
-    (gnus-article-highlight t)))
+    ;; "Emulate" `gnus-article-prepare-display' without calling
+    ;; it. Calling `gnus-article-prepare-display' on an already
+    ;; prepared article removes all MIME parts.  I'm unsure whether
+    ;; this is a bug or not.
+    (gnus-article-highlight t)
+    (gnus-treat-article nil)
+    (gnus-run-hooks 'gnus-article-prepare-hook)))
 
 (provide 'deuglify)
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] deuglify.el
  2003-01-02 21:59 [patch] deuglify.el Raymond Scholz
@ 2003-01-02 22:05 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-01-02 22:05 UTC (permalink / raw)


Raymond Scholz <ray-2003@zonix.de> writes:

> 	* deuglify.el (gnus-article-outlook-deuglify-article):
> 	Rehighlight, reapply treatments and call
> 	`gnus-article-prepare-hook'.  Suggested by Niels Olof Bouvin.
> 	(gnus-outlook-repair-attribution-block): Recognize cited
> 	attributions.  Suggested by Niklas Morberg.

Thanks for the patch; I've applied it to Oort Gnus v0.08 (i. e., CVS).

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-02 22:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-02 21:59 [patch] deuglify.el Raymond Scholz
2003-01-02 22:05 ` Lars Magne Ingebrigtsen

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