Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
To: Ami Fischman <ami@fischman.org>
Cc: emacs-jabber-general@lists.sourceforge.net, ding@gnus.org,
	emacs-devel@gnu.org
Subject: Re: gnus shouldn't be making general-purpose variables buffer-local
Date: Mon, 22 Dec 2008 19:55:23 +0100	[thread overview]
Message-ID: <87bpv4ca5g.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <b4mr647ksqa.fsf@jpl.org> (Katsumi Yamaoka's message of "Wed, 17 Dec 2008 19:21:01 +0900")

[ Adding Ami Fischman, emacs-devel and emacs-jabber (again).
  (See
  <http://thread.gmane.org/gmane.emacs.gnus.general/67886/focus=67943>,
  <http://thread.gmane.org/gmane.emacs.devel/105256> also for the
  complete threads.) ]

On Wed, Dec 17 2008, Katsumi Yamaoka wrote:

> At least for `timestamp', the attached patch will solve (note
> that you need to reload the patched gnus-group.elc because of
> `defsubst').  At the first time you enter to a group, the buffer-
> local variable `timestamp' is still alive, but it will be renamed
> to `gnus-timestamp' when exiting the group.  Maybe the change
> will not slow Gnus.
[...]
> --- gnus-group.el~	2008-10-03 05:47:11 +0000
> +++ gnus-group.el	2008-12-17 10:18:31 +0000
> @@ -4608,11 +4608,13 @@
>    (when gnus-newsgroup-name
>      (let ((time (current-time)))
>        (setcdr (cdr time) nil)
> -      (gnus-group-set-parameter gnus-newsgroup-name 'timestamp time))))
> +      (gnus-group-set-parameter gnus-newsgroup-name 'gnus-timestamp time)
> +      (gnus-group-remove-parameter gnus-newsgroup-name 'timestamp))))
>
>  (defsubst gnus-group-timestamp (group)
>    "Return the timestamp for GROUP."
> -  (gnus-group-get-parameter group 'timestamp t))
> +  (or (gnus-group-get-parameter group 'gnus-timestamp t)
> +      (gnus-group-get-parameter group 'timestamp t)))

After the initial report on emacs-devel, I wrote this quite similar
patch:

--8<---------------cut here---------------start------------->8---
--- gnus-group.el	10 Sep 2008 03:28:52 +0200	1.77
+++ gnus-group.el	03 Nov 2008 00:17:44 +0100	
@@ -4608,11 +4608,17 @@
   (when gnus-newsgroup-name
     (let ((time (current-time)))
       (setcdr (cdr time) nil)
-      (gnus-group-set-parameter gnus-newsgroup-name 'timestamp time))))
+      ;; Remove obsolete `timestamp' (used until 2008-11-03) if present.
+      ;; Note: This breaks down-grading.
+      (when (gnus-group-get-parameter group 'timestamp t)
+	(gnus-group-remove-parameter  group 'timestamp))
+      (gnus-group-set-parameter gnus-newsgroup-name 'gnus-group-timestamp time))))
 
 (defsubst gnus-group-timestamp (group)
   "Return the timestamp for GROUP."
-  (gnus-group-get-parameter group 'timestamp t))
+  (or (gnus-group-get-parameter group 'gnus-group-timestamp t)
+      ;; For compatibility, check `timestamp' (used until 2008-11-03) as well.
+      (gnus-group-get-parameter group 'timestamp t)))
 
 (defun gnus-group-timestamp-delta (group)
   "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
--8<---------------cut here---------------end--------------->8---

Beside the other name, it removes the old parameter `timestamp'.

However, I wonder if the more general patch suggested by David Engster
is better.  Does anyone see a problem with it?

Ami, does David's patch solve your problem?

--8<---------------cut here---------------start------------->8---
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -3831,6 +3831,7 @@ This function is intended to be used in
       (and (consp elem)			; Has to be a cons.
 	   (consp (cdr elem))		; The cdr has to be a list.
 	   (symbolp (car elem))		; Has to be a symbol in there.
+	   (boundp (car elem))		; Has to be already bound
 	   (not (memq (car elem) vars))
 	   (ignore-errors		; So we set it.
 	     (push (car elem) vars)
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




  parent reply	other threads:[~2008-12-22 18:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12  6:42 Ami Fischman
2008-12-16 17:22 ` Ted Zlatanov
2008-12-16 22:54   ` Katsumi Yamaoka
2008-12-17  8:46     ` David Engster
2008-12-17  9:20       ` Katsumi Yamaoka
2008-12-17 10:21         ` Katsumi Yamaoka
2008-12-22 17:36           ` Ted Zlatanov
2008-12-22 18:55           ` Reiner Steib [this message]
2008-12-22 20:53             ` Ami Fischman
2008-12-24  2:32             ` Katsumi Yamaoka
2008-12-17 11:10         ` David Engster
2008-12-17 12:26           ` Katsumi Yamaoka
2008-12-17 13:38             ` David Engster
2008-12-17 14:28               ` David Engster
2008-12-17 23:22                 ` Katsumi Yamaoka
2008-12-18  0:19                   ` David Engster
  -- strict thread matches above, loose matches on Subject: below --
2008-11-02 17:47 Ami Fischman
2008-12-10  7:02 ` Xavier Maillard

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=87bpv4ca5g.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    --cc=ami@fischman.org \
    --cc=ding@gnus.org \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-jabber-general@lists.sourceforge.net \
    /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).