Gnus development mailing list
 help / color / mirror / Atom feed
From: Colin Rafferty <craffert@ms.com>
Subject: [patch] gnus-start-date-timer vs. picons and single-article-buffer
Date: 11 Jan 1999 17:16:01 -0500	[thread overview]
Message-ID: <vgvaezptpzy.fsf@ms.com> (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

             reply	other threads:[~1999-01-11 22:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-11 22:16 Colin Rafferty [this message]
1999-01-11 22:18 ` Colin Rafferty

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=vgvaezptpzy.fsf@ms.com \
    --to=craffert@ms.com \
    /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).