Gnus development mailing list
 help / color / mirror / Atom feed
* [patch] gnus-start-date-timer vs. picons and single-article-buffer
@ 1999-01-11 22:16 Colin Rafferty
  1999-01-11 22:18 ` Colin Rafferty
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Rafferty @ 1999-01-11 22:16 UTC (permalink / raw)


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

This patch mostly deals with the fact that I read multiple newsgroups
at once (setq gnus-single-article-buffer nil).  In fact, I don't
understand how anyone can survive with the default.

Three changes in one patch:

1. Using picons sets the mode of *Article* to 'gnus-picons-mode.
   However, `article-update-date-lapsed' only checks for for
   'gnus-article-mode.

2. The variable gnus-current-header is only set for gnus-summary-mode.
   Therefore, all *Article* buffers are getting the X-Sent of
   whichever article I last hit SPC in.

3. `walk-windows' only walks in the current frame.  We really want to
   walk in all visible frames.  Otherwise, side-by-side newsgroup
   reading loses.


[-- Attachment #2: patch to make date-timers work with picons --]
[-- Type: text/plain, Size: 3690 bytes --]

1999-01-11  Colin Rafferty  <colin@xemacs.org>

	* gnus-art.el (article-update-date-lapsed): Made it work with
	picons, and make it update on all visible frames.
	(article-date-ut): Get summary-buffer's current-headers.

--- lisp/gnus-art.el~	Sun Jan  3 08:36:04 1999
+++ lisp/gnus-art.el	Mon Jan 11 16:48:46 1999
@@ -1451,7 +1451,9 @@
 how much time has lapsed since DATE."
   (interactive (list 'ut t))
   (let* ((header (or header
-		     (mail-header-date gnus-current-headers)
+		     (mail-header-date (save-excursion
+					 (set-buffer gnus-summary-buffer)
+					 gnus-current-headers))
 		     (message-fetch-field "date")
 		     ""))
 	 (date (if (vectorp header) (mail-header-date header)
@@ -1601,7 +1603,7 @@
 	(walk-windows
 	 (lambda (w)
 	   (set-buffer (window-buffer w))
-	   (when (eq major-mode 'gnus-article-mode)
+	   (when (memq major-mode '(gnus-article-mode gnus-picons-mode))
 	     (goto-char (point-min))
 	     (when (re-search-forward "^X-Sent:" nil t)
 	       (article-date-lapsed t)))))))))
--- lisp/gnus-art.el~	Sun Jan  3 08:36:04 1999
+++ lisp/gnus-art.el	Mon Jan 11 16:55:05 1999
@@ -1451,7 +1451,9 @@
 how much time has lapsed since DATE."
   (interactive (list 'ut t))
   (let* ((header (or header
-		     (mail-header-date gnus-current-headers)
+		     (mail-header-date (save-excursion
+					 (set-buffer gnus-summary-buffer)
+					 gnus-current-headers))
 		     (message-fetch-field "date")
 		     ""))
 	 (date (if (vectorp header) (mail-header-date header)
@@ -1601,10 +1603,11 @@
 	(walk-windows
 	 (lambda (w)
 	   (set-buffer (window-buffer w))
-	   (when (eq major-mode 'gnus-article-mode)
+	   (when (memq major-mode '(gnus-article-mode gnus-picons-mode))
 	     (goto-char (point-min))
 	     (when (re-search-forward "^X-Sent:" nil t)
-	       (article-date-lapsed t)))))))))
+	       (article-date-lapsed t))))
+	 nil 'visible)))))
 
 (defun gnus-start-date-timer (&optional n)
   "Start a timer to update the X-Sent header in the article buffers.
--- lisp/gnus-art.el~	Sun Jan  3 08:36:04 1999
+++ lisp/gnus-art.el	Mon Jan 11 16:55:05 1999
@@ -1446,17 +1446,19 @@
   "Mapping from time units to seconds.")
 
 (defun article-date-ut (&optional type highlight header)
   "Convert DATE date to universal time in the current article.
 If TYPE is `local', convert to local time; if it is `lapsed', output
 how much time has lapsed since DATE."
   (interactive (list 'ut t))
   (let* ((header (or header
-		     (mail-header-date gnus-current-headers)
+		     (mail-header-date (save-excursion
+					 (set-buffer gnus-summary-buffer)
+					 gnus-current-headers))
 		     (message-fetch-field "date")
 		     ""))
 	 (date (if (vectorp header) (mail-header-date header)
 		 header))
 	 (date-regexp "^Date:[ \t]\\|^X-Sent:[ \t]")
 	 (inhibit-point-motion-hooks t)
 	 bface eface newline)
     (when (and date (not (string= date "")))
@@ -1596,20 +1598,21 @@
 (defun article-update-date-lapsed ()
   "Function to be run from a timer to update the lapsed time line."
   (let (deactivate-mark)
     (save-excursion
       (ignore-errors
 	(walk-windows
 	 (lambda (w)
 	   (set-buffer (window-buffer w))
-	   (when (eq major-mode 'gnus-article-mode)
+	   (when (memq major-mode '(gnus-article-mode gnus-picons-mode))
 	     (goto-char (point-min))
 	     (when (re-search-forward "^X-Sent:" nil t)
-	       (article-date-lapsed t)))))))))
+	       (article-date-lapsed t))))
+	 nil 'visible)))))
 
 (defun gnus-start-date-timer (&optional n)
   "Start a timer to update the X-Sent header in the article buffers.
 The numerical prefix says how frequently (in seconds) the function
 is to run."
   (interactive "p")
   (unless n
     (setq n 1))

[-- Attachment #3: Type: text/plain, Size: 10 bytes --]


;; Colin

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

* [patch] gnus-start-date-timer vs. picons and single-article-buffer
  1999-01-11 22:16 [patch] gnus-start-date-timer vs. picons and single-article-buffer Colin Rafferty
@ 1999-01-11 22:18 ` Colin Rafferty
  0 siblings, 0 replies; 2+ messages in thread
From: Colin Rafferty @ 1999-01-11 22:18 UTC (permalink / raw)


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

Colin Rafferty writes:

> [bad patch deleted]

I am a moron.  I hit C-c C-a on a file that I hadn't saved.

Here is the correct patch.


[-- Attachment #2: correct patch to make date-timers work with picons --]
[-- Type: text/plain, Size: 1909 bytes --]

1999-01-11  Colin Rafferty  <colin@xemacs.org>

	* gnus-art.el (article-update-date-lapsed): Made it work with
	picons, and make it update on all visible frames.
	(article-date-ut): Get summary-buffer's current-headers.

--- lisp/gnus-art.el~	Sun Jan  3 08:36:04 1999
+++ lisp/gnus-art.el	Mon Jan 11 16:55:05 1999
@@ -1446,17 +1446,19 @@
   "Mapping from time units to seconds.")
 
 (defun article-date-ut (&optional type highlight header)
   "Convert DATE date to universal time in the current article.
 If TYPE is `local', convert to local time; if it is `lapsed', output
 how much time has lapsed since DATE."
   (interactive (list 'ut t))
   (let* ((header (or header
-		     (mail-header-date gnus-current-headers)
+		     (mail-header-date (save-excursion
+					 (set-buffer gnus-summary-buffer)
+					 gnus-current-headers))
 		     (message-fetch-field "date")
 		     ""))
 	 (date (if (vectorp header) (mail-header-date header)
 		 header))
 	 (date-regexp "^Date:[ \t]\\|^X-Sent:[ \t]")
 	 (inhibit-point-motion-hooks t)
 	 bface eface newline)
     (when (and date (not (string= date "")))
@@ -1596,20 +1598,21 @@
 (defun article-update-date-lapsed ()
   "Function to be run from a timer to update the lapsed time line."
   (let (deactivate-mark)
     (save-excursion
       (ignore-errors
 	(walk-windows
 	 (lambda (w)
 	   (set-buffer (window-buffer w))
-	   (when (eq major-mode 'gnus-article-mode)
+	   (when (memq major-mode '(gnus-article-mode gnus-picons-mode))
 	     (goto-char (point-min))
 	     (when (re-search-forward "^X-Sent:" nil t)
-	       (article-date-lapsed t)))))))))
+	       (article-date-lapsed t))))
+	 nil 'visible)))))
 
 (defun gnus-start-date-timer (&optional n)
   "Start a timer to update the X-Sent header in the article buffers.
 The numerical prefix says how frequently (in seconds) the function
 is to run."
   (interactive "p")
   (unless n
     (setq n 1))

[-- Attachment #3: Type: text/plain, Size: 10 bytes --]


;; Colin

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

end of thread, other threads:[~1999-01-11 22:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-11 22:16 [patch] gnus-start-date-timer vs. picons and single-article-buffer Colin Rafferty
1999-01-11 22:18 ` Colin Rafferty

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