Gnus development mailing list
 help / color / mirror / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: ding@gnus.org
Subject: Re: Sticky article buffers
Date: Tue, 14 Aug 2007 09:34:20 +0200	[thread overview]
Message-ID: <87ps1qbmdf.fsf@baldur.tsdh.de> (raw)
In-Reply-To: <b4mps1qitio.fsf@jpl.org>

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

Katsumi Yamaoka <yamaoka@jpl.org> writes:

Hi Katsumi,

> Thank you for contributing a good feature.  I tried it today and
> realized it is really useful.

Thanks for the compliments!

> Though I have no plan for the moment, people might want a browser
> function for many sticky articles. :)

Currently I use `ibuffer' and `s m' which sorts buffers by mode.  But it
might be useful to switch between sticky article buffers with something
like `switch-to-buffer' which tab-completes only sticky articles.  Or do
you have another suggestion?

Anyway, I applied your patch and tested it.

> Please let me write about a few problems in `gnus-sticky-article'.
>
> 1. (gnus-configure-windows 'article) makes an empty article
>    buffer and leads creating of an empty sticky article if there
>    is no article buffer initially, but is not necessary because
>    `gnus-summary-select-article' runs it by way of
>    `gnus-summary-display-article' and `gnus-article-prepare'
>    after preparing an article.

Seems to work now.

> 2. It seems to be useless that this command always makes a new
>    sticky article buffer.  I mean, performing of the `A S'
>    command repeatedly on an article creates "*Sticky Article*",
>    "*Sticky Article*<2>", "*Sticky Article*<3>"...

Yes, that's indeed useless.  With your patch it's fixed.

> 3. The value of the `gnus-article-buffer' variable in the summary
>    buffer is not updated when I select another (normal) article.
>    Because of this, a non-ASCII article or a QP-encoded article
>    is not decoded when I type `P' or `N' in the summary buffer.

Seems to be fixed, too.

> 4. I wish you to leave the value of the `indent-tabs-mode'
>    variable the default if there is no good reason.  Now some
>    lines are indented with tabs but others aren't.

Oh, sorry.  I've put file local variables into the files I modified, but
maybe I inserted the spaces before I did that.

Is there a mechanism to set variables based on the directory a file
resides?  If not I'll do something home-brewed and hook it into
find-file-hook.

> I tried improving these problems.

Thanks.  As far as I can see all problems are fixed.  Here's a patch
that incorporates all your changes plus a changelog entry.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix sticky articles --]
[-- Type: text/x-patch, Size: 5304 bytes --]

Index: lisp/gnus-sum.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-sum.el,v
retrieving revision 7.194
diff -u -r7.194 gnus-sum.el
--- lisp/gnus-sum.el	12 Aug 2007 11:02:19 -0000	7.194
+++ lisp/gnus-sum.el	14 Aug 2007 07:31:43 -0000
@@ -7413,15 +7413,15 @@
 
 (defun gnus-summary-display-article (article &optional all-header)
   "Display ARTICLE in article buffer."
-  (when (gnus-buffer-live-p gnus-article-buffer)
-    (with-current-buffer gnus-article-buffer
-      (mm-enable-multibyte)))
+  (unless (and (gnus-buffer-live-p gnus-article-buffer)
+	       (with-current-buffer gnus-article-buffer
+		 (eq major-mode 'gnus-article-mode)))
+    (gnus-article-setup-buffer))
   (gnus-set-global-variables)
-  (when (gnus-buffer-live-p gnus-article-buffer)
-    (with-current-buffer gnus-article-buffer
-      (setq gnus-article-charset gnus-newsgroup-charset)
-      (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
-      (mm-enable-multibyte)))
+  (with-current-buffer gnus-article-buffer
+    (setq gnus-article-charset gnus-newsgroup-charset)
+    (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
+    (mm-enable-multibyte))
   (if (null article)
       nil
     (prog1
Index: lisp/gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 7.225
diff -u -r7.225 gnus-art.el
--- lisp/gnus-art.el	12 Aug 2007 11:02:19 -0000	7.225
+++ lisp/gnus-art.el	14 Aug 2007 07:31:57 -0000
@@ -4371,46 +4371,46 @@
 
 (defun gnus-sticky-article (arg)
   "Make the current article sticky.
-If a prefix ARG is given, ask for a name for this sticky article
-buffer."
+If a prefix ARG is given, ask for a name for this sticky article buffer."
   (interactive "P")
-  (gnus-configure-windows 'article)
   (gnus-summary-show-thread)
   (gnus-summary-select-article nil nil 'pseudo)
   (let (new-art-buf-name)
     (gnus-eval-in-buffer-window gnus-article-buffer
       (setq new-art-buf-name
-            (rename-buffer
-             (concat
-              "*Sticky Article: "
-              (if arg
-                  (read-from-minibuffer "Sticky article buffer name: ")
-                (gnus-with-article-headers
-                  (gnus-article-goto-header "subject")
-                  (setq new-art-buf-name
-                        (buffer-substring-no-properties
-                         (line-beginning-position) (line-end-position)))
-                  (goto-char (point-min))
-                  (gnus-article-goto-header "from")
-                  (setq new-art-buf-name
-                        (concat
-                         new-art-buf-name ", "
-                         (buffer-substring-no-properties
-                          (line-beginning-position) (line-end-position))))
-                  (goto-char (point-min))
-                  (gnus-article-goto-header "date")
-                  (setq new-art-buf-name
-                        (concat
-                         new-art-buf-name ", "
-                         (buffer-substring-no-properties
-                          (line-beginning-position) (line-end-position))))))
-              "*")
-             t)))
+	    (concat
+	     "*Sticky Article: "
+	     (if arg
+		 (read-from-minibuffer "Sticky article buffer name: ")
+	       (gnus-with-article-headers
+		 (gnus-article-goto-header "subject")
+		 (setq new-art-buf-name
+		       (buffer-substring-no-properties
+			(line-beginning-position) (line-end-position)))
+		 (goto-char (point-min))
+		 (gnus-article-goto-header "from")
+		 (setq new-art-buf-name
+		       (concat
+			new-art-buf-name ", "
+			(buffer-substring-no-properties
+			 (line-beginning-position) (line-end-position))))
+		 (goto-char (point-min))
+		 (gnus-article-goto-header "date")
+		 (setq new-art-buf-name
+		       (concat
+			new-art-buf-name ", "
+			(buffer-substring-no-properties
+			 (line-beginning-position) (line-end-position))))))
+	     "*"))
+      (if (and (gnus-buffer-live-p new-art-buf-name)
+	       (with-current-buffer new-art-buf-name
+		 (eq major-mode 'gnus-sticky-article-mode)))
+	  (switch-to-buffer new-art-buf-name)
+	(rename-buffer new-art-buf-name t))
+      (gnus-sticky-article-mode))
     (setq gnus-article-buffer new-art-buf-name))
   (gnus-summary-recenter)
-  (gnus-summary-position-point)
-  (set-buffer gnus-article-buffer)
-  (gnus-sticky-article-mode))
+  (gnus-summary-position-point))
 
 (defun gnus-kill-sticky-article-buffer (&optional buffer)
   "Kill the given sticky article BUFFER.
Index: lisp/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v
retrieving revision 7.1601
diff -u -r7.1601 ChangeLog
--- lisp/ChangeLog	13 Aug 2007 13:52:52 -0000	7.1601
+++ lisp/ChangeLog	14 Aug 2007 07:32:15 -0000
@@ -1,3 +1,10 @@
+2007-08-14  Tassilo Horn  <tassilo@member.fsf.org>
+
+	* gnus-art.el (gnus-sticky-article): Fixed problems described in
+	<b4mps1qitio.fsf@jpl.org> on ding.  Thanks to Katsumi.
+
+	* gnus-sum.el (gnus-summary-display-article): Likewise.
+
 2007-08-13  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus-agent.el (gnus-agent-decoded-group-names): New variable.

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


Bye,
Tassilo

  reply	other threads:[~2007-08-14  7:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 15:32 Tassilo Horn
2007-07-25 18:36 ` Reiner Steib
2007-07-25 19:32   ` Tassilo Horn
2007-07-25 20:17   ` Tassilo Horn
2007-08-12 11:15     ` Reiner Steib
2007-08-12 11:59       ` Tassilo Horn
2007-08-12 12:43         ` Reiner Steib
2007-08-13 13:03           ` Tassilo Horn
2007-08-13 14:04             ` Tassilo Horn
2007-08-14  5:18               ` Katsumi Yamaoka
2007-08-14  7:34                 ` Tassilo Horn [this message]
2007-08-14  9:02                   ` Katsumi Yamaoka
2007-08-14 10:41                     ` Tassilo Horn
2007-08-14  6:12               ` Katsumi Yamaoka

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=87ps1qbmdf.fsf@baldur.tsdh.de \
    --to=tassilo@member.fsf.org \
    --cc=ding@gnus.org \
    /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).