Gnus development mailing list
 help / color / mirror / Atom feed
* Sticky article buffers
@ 2007-07-25 15:32 Tassilo Horn
  2007-07-25 18:36 ` Reiner Steib
  0 siblings, 1 reply; 14+ messages in thread
From: Tassilo Horn @ 2007-07-25 15:32 UTC (permalink / raw)
  To: ding

Hi,

my assignment papers have arrived at the FSF. Here's my patch, created
with a CVS checkout half an hour old. Please feel free to comment on it.

One thing that I'm aware of it that the binding `C-c s' is not too good,
because bindings with `C-c' should be reserved for the user. But what
other free binding could be used?

Bye,
Tassilo

--8<---------------cut here---------------start------------->8---
Index: lisp/gnus.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus.el,v
retrieving revision 7.66
diff -r7.66 gnus.el
911a912,923
> (defun gnus-kill-all-sticky-article-buffers (confirm)
>   "Kills all sticky article buffers. If a prefix arg is given,
> it'll ask for confirmation."
>   (interactive "P")
>   (dolist (buf (gnus-buffers))
>     (with-current-buffer buf
>       (when (eq major-mode 'gnus-sticky-article-mode)
> 	(if (not confirm)
> 	    (gnus-kill-buffer buf)
> 	  (when (yes-or-no-p (concat "Kill buffer " (buffer-name buf)))
> 	    (gnus-kill-buffer buf)))))))
> 
4360a4373,4378
> 
> ;; Local Variables:
> ;; coding: iso-8859-1
> ;; indent-tabs-mode: t
> ;; tab-width: 8
> ;; End:
Index: lisp/gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 7.222
diff -r7.222 gnus-art.el
4354a4355,4383
> ;;; Gnus Sticky Article Mode
> ;;;
> 
> (define-derived-mode gnus-sticky-article-mode gnus-article-mode "StickyArticle"
>   "Mode for sticky articles."
>   ;; Release bindings that won't work.
>   (substitute-key-definition 'gnus-article-read-summary-keys 'undefined
> 			     gnus-sticky-article-mode-map)
>   (substitute-key-definition 'gnus-article-refer-article 'undefined
> 			     gnus-sticky-article-mode-map)
>   (dolist (k '("e" "h" "s" "F" "R"))
>     (define-key gnus-sticky-article-mode-map k nil))
>   (define-key gnus-sticky-article-mode-map "q" 'gnus-sticky-article-kill-buffer)
>   (define-key gnus-sticky-article-mode-map "\C-hc" 'describe-key-briefly)
>   (define-key gnus-sticky-article-mode-map "\C-hk" 'describe-key))
> 
> 
> (defun gnus-sticky-article-kill-buffer (&optional buffer)
>   "Kills the given sticky article buffer. If none is given, it'll
> assume the current buffer and kill it if it has
> `gnus-sticky-article-mode'."
>   (interactive)
>   (unless buffer
>     (setq buffer (current-buffer)))
>   (with-current-buffer buffer
>     (when (eq major-mode 'gnus-sticky-article-mode)
>       (gnus-kill-buffer buffer))))
> 
> ;;;
8089a8119,8124
> 
> ;; Local Variables:
> ;; coding: iso-8859-1
> ;; indent-tabs-mode: t
> ;; tab-width: 8
> ;; End:
Index: lisp/gnus-sum.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-sum.el,v
retrieving revision 7.191
diff -r7.191 gnus-sum.el
1770a1771
>   "\C-cs" gnus-summary-make-sticky-article
2446a2448
> 	     ["Make article buffer sticky" gnus-summary-make-sticky-article t]
6940,6942c6942,6948
<       (gnus-kill-buffer gnus-article-buffer)
<       (gnus-kill-buffer gnus-original-article-buffer)
<       (setq gnus-article-current nil))
---
>       (when (gnus-buffer-live-p gnus-article-buffer)
> 	(with-current-buffer gnus-article-buffer
> 	  ;; Don't kill sticky article buffers
> 	  (unless (eq major-mode 'gnus-sticky-article-mode)
> 	    (gnus-kill-buffer gnus-article-buffer)
> 	    (setq gnus-article-current nil))))
>       (gnus-kill-buffer gnus-original-article-buffer))
6974,6978d6979
<       ;; If we have several article buffers, we kill them at exit.
<       (unless gnus-single-article-buffer
< 	(gnus-kill-buffer gnus-article-buffer)
< 	(gnus-kill-buffer gnus-original-article-buffer)
< 	(setq gnus-article-current nil))
7910a7912,7953
> (defun gnus-summary-make-sticky-article (arg)
>   "Make the current article sticky. If a prefix arg is given you
> will be asked for a name for this sticky 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)))
>     (setq gnus-article-buffer new-art-buf-name))
>   (gnus-summary-recenter)
>   (gnus-summary-position-point)
>   (set-buffer gnus-article-buffer)
>   (gnus-sticky-article-mode))
> 
12434a12478,12479
> ;; indent-tabs-mode: t
> ;; tab-width: 8
--8<---------------cut here---------------end--------------->8---




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

* Re: Sticky article buffers
  2007-07-25 15:32 Sticky article buffers Tassilo Horn
@ 2007-07-25 18:36 ` Reiner Steib
  2007-07-25 19:32   ` Tassilo Horn
  2007-07-25 20:17   ` Tassilo Horn
  0 siblings, 2 replies; 14+ messages in thread
From: Reiner Steib @ 2007-07-25 18:36 UTC (permalink / raw)
  To: ding

On Wed, Jul 25 2007, Tassilo Horn wrote:

> my assignment papers have arrived at the FSF. Here's my patch, [...]

Thank you.

> One thing that I'm aware of it that the binding `C-c s' is not too good,
> because bindings with `C-c' should be reserved for the user. 

We should not install it with `C-c s'.  If we can't find a better
binding, we can install it without a key binding first and add a
binding later.

> But what other free binding could be used?

If we stay with the term "sticky article buffer", I'd suggest `A S'.
Did you think about menu entries?  Sometimes this helps to find
similar command and key bindings.

> diff -r7.66 gnus.el
> 911a912,923

Oh, please use unified diff (-u) (or context diff (-c)).

> 4360a4373,4378
>> 
>> ;; Local Variables:
>> ;; coding: iso-8859-1
>> ;; indent-tabs-mode: t
>> ;; tab-width: 8
>> ;; End:

Please don't submit proposals that include unrelated changes.

>>     (define-key gnus-sticky-article-mode-map k nil))
>>   (define-key gnus-sticky-article-mode-map "q" 'gnus-sticky-article-kill-buffer)

I'd expect `k' for kill buffer and `q' for quit (bury buffer).

>>   (define-key gnus-sticky-article-mode-map "\C-hc" 'describe-key-briefly)
>>   (define-key gnus-sticky-article-mode-map "\C-hk" 'describe-key))

Why do we need to treat these two command specially?

>> (defun gnus-sticky-article-kill-buffer (&optional buffer)
>>   "Kills the given sticky article buffer. If none is given, it'll
>> assume the current buffer and kill it if it has
>> `gnus-sticky-article-mode'."
[...]
>> (defun gnus-summary-make-sticky-article (arg)
>>   "Make the current article sticky. If a prefix arg is given you
>> will be asked for a name for this sticky buffer."

The doc strings needs a little improvement.  Cf. `M-x checkdoc-defun
RET'.  But I may do this after installing the patch.

> 8089a8119,8124
>> 
>> ;; Local Variables:
>> ;; coding: iso-8859-1
>> ;; indent-tabs-mode: t
>> ;; tab-width: 8
>> ;; End:

Please don't include unrelated changes.  (Same for other
indent-tabs-mode/tab-width hunks below.)

> 1770a1771
>>   "\C-cs" gnus-summary-make-sticky-article

Should be removed/change.  See above.

> 2446a2448
>> 	     ["Make article buffer sticky" gnus-summary-make-sticky-article t]

Okay, a menu entry.  I'd too lazy to check where it would end up.  In
unified/context diff it would be easier to guess.  ;-)

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




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

* Re: Sticky article buffers
  2007-07-25 18:36 ` Reiner Steib
@ 2007-07-25 19:32   ` Tassilo Horn
  2007-07-25 20:17   ` Tassilo Horn
  1 sibling, 0 replies; 14+ messages in thread
From: Tassilo Horn @ 2007-07-25 19:32 UTC (permalink / raw)
  To: ding

Reiner Steib <reinersteib+gmane@imap.cc> writes:

Hi Reiner,

>> But what other free binding could be used?
>
> If we stay with the term "sticky article buffer", I'd suggest `A S'.

Will the translation from `A s' stop if I bind it to `A S'?

,----
| A s (translated from A S) runs the command gnus-summary-isearch-article
|   which is an interactive compiled Lisp function in `gnus-sum.el'.
| It is bound to s, A s, <menu-bar> <Article> <Isearch article...>.
| (gnus-summary-isearch-article &optional REGEXP-P)
| 
| Do incremental search forward on the current article.
| If REGEXP-P (the prefix) is non-nil, do regexp isearch.
`----

> Oh, please use unified diff (-u) (or context diff (-c)).

Ok.

>> 4360a4373,4378
>>> 
>>> ;; Local Variables:
>>> ;; coding: iso-8859-1
>>> ;; indent-tabs-mode: t
>>> ;; tab-width: 8
>>> ;; End:
>
> Please don't submit proposals that include unrelated changes.

Hm, how do I tell `cvs diff' which hunks it should add and which not? Or
may I simply kill those lines before I submit the patch?

>>>     (define-key gnus-sticky-article-mode-map k nil))
>>>   (define-key gnus-sticky-article-mode-map "q" 'gnus-sticky-article-kill-buffer)
>
> I'd expect `k' for kill buffer and `q' for quit (bury buffer).

Ok, I'll change that.

>>>   (define-key gnus-sticky-article-mode-map "\C-hc" 'describe-key-briefly)
>>>   (define-key gnus-sticky-article-mode-map "\C-hk" 'describe-key))
>
> Why do we need to treat these two command specially?

I'm not really sure, but I had a hard time figuring out what to do so
that `C-h m' shows all possible bindings but none that don't work with
sticky articles.

>>> (defun gnus-sticky-article-kill-buffer (&optional buffer)
>>>   "Kills the given sticky article buffer. If none is given, it'll
>>> assume the current buffer and kill it if it has
>>> `gnus-sticky-article-mode'."
> [...]
>>> (defun gnus-summary-make-sticky-article (arg)
>>>   "Make the current article sticky. If a prefix arg is given you
>>> will be asked for a name for this sticky buffer."
>
> The doc strings needs a little improvement.  Cf. `M-x checkdoc-defun
> RET'.  But I may do this after installing the patch.

I'll do that.

Bye,
Tassilo
-- 
People sometimes  ask me if it  is a sin in  the Church of  Emacs to use
vi. Using a free  version of vi is not a sin; it  is a penance. So happy
hacking. (Richard M. Stallman)




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

* Re: Sticky article buffers
  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
  1 sibling, 1 reply; 14+ messages in thread
From: Tassilo Horn @ 2007-07-25 20:17 UTC (permalink / raw)
  To: ding

Hi,

here's a new patch. I did some renaming
(`gnus-sticky-article-kill-buffer' => `gnus-kill-sticky-article-buffer')
and moved that function to gnus.el.

The key to make an article sticky is now `A S' and "q" buries the
buffer -- "k" kills it.

The doc strings should be ok now, too.

I hope the patch works, I just killed the lines modifying file local
variables.

Bye,
Tassilo

--8<---------------cut here---------------start------------->8---
Index: lisp/gnus.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus.el,v
retrieving revision 7.66
diff -u -r7.66 gnus.el
--- lisp/gnus.el	4 Jun 2007 11:58:52 -0000	7.66
+++ lisp/gnus.el	25 Jul 2007 20:07:42 -0000
@@ -909,6 +909,29 @@
 	(setcdr buffers (cddr buffers)))))
   gnus-buffers)
 
+(defun gnus-kill-sticky-article-buffer (&optional buffer)
+  "Kill the given sticky article BUFFER.
+If none is given, assume the current buffer and kill it if it has
+`gnus-sticky-article-mode'."
+  (interactive)
+  (unless buffer
+    (setq buffer (current-buffer)))
+  (with-current-buffer buffer
+    (when (eq major-mode 'gnus-sticky-article-mode)
+      (gnus-kill-buffer buffer))))
+
+(defun gnus-kill-all-sticky-article-buffers (arg)
+  "Kill all sticky article buffers.
+If a prefix ARG is given, ask for confirmation."
+  (interactive "P")
+  (dolist (buf (gnus-buffers))
+    (with-current-buffer buf
+      (when (eq major-mode 'gnus-sticky-article-mode)
+	(if (not arg)
+	    (gnus-kill-buffer buf)
+	  (when (yes-or-no-p (concat "Kill buffer " (buffer-name buf) "? "))
+	    (gnus-kill-buffer buf)))))))
+
 ;;; Splash screen.
 
 (defvar gnus-group-buffer "*Group*")
Index: lisp/gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 7.222
diff -u -r7.222 gnus-art.el
--- lisp/gnus-art.el	20 Jul 2007 11:30:50 -0000	7.222
+++ lisp/gnus-art.el	25 Jul 2007 20:07:55 -0000
@@ -4352,6 +4352,24 @@
     (gnus-run-hooks 'gnus-article-prepare-hook)))
 
 ;;;
+;;; Gnus Sticky Article Mode
+;;;
+
+(define-derived-mode gnus-sticky-article-mode gnus-article-mode "StickyArticle"
+  "Mode for sticky articles."
+  ;; Release bindings that won't work.
+  (substitute-key-definition 'gnus-article-read-summary-keys 'undefined
+			     gnus-sticky-article-mode-map)
+  (substitute-key-definition 'gnus-article-refer-article 'undefined
+			     gnus-sticky-article-mode-map)
+  (dolist (k '("e" "h" "s" "F" "R"))
+    (define-key gnus-sticky-article-mode-map k nil))
+  (define-key gnus-sticky-article-mode-map "k" 'gnus-kill-sticky-article-buffer)
+  (define-key gnus-sticky-article-mode-map "q" 'bury-buffer)
+  (define-key gnus-sticky-article-mode-map "\C-hc" 'describe-key-briefly)
+  (define-key gnus-sticky-article-mode-map "\C-hk" 'describe-key))
+
+;;;
 ;;; Gnus MIME viewing functions
 ;;;
 
Index: lisp/gnus-sum.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-sum.el,v
retrieving revision 7.191
diff -u -r7.191 gnus-sum.el
--- lisp/gnus-sum.el	23 Jul 2007 23:44:36 -0000	7.191
+++ lisp/gnus-sum.el	25 Jul 2007 20:08:17 -0000
@@ -1997,6 +1997,7 @@
   "g" gnus-summary-show-article
   "s" gnus-summary-isearch-article
   "P" gnus-summary-print-article
+  "S" gnus-summary-make-sticky-article
   "M" gnus-mailing-list-insinuate
   "t" gnus-article-babel)
 
@@ -2444,6 +2445,7 @@
 	      ["Remove article" gnus-cache-remove-article t])
 	     ["Translate" gnus-article-babel t]
 	     ["Select article buffer" gnus-summary-select-article-buffer t]
+	     ["Make article buffer sticky" gnus-summary-make-sticky-article t]
 	     ["Enter digest buffer" gnus-summary-enter-digest-group t]
 	     ["Isearch article..." gnus-summary-isearch-article t]
 	     ["Beginning of the article" gnus-summary-beginning-of-article t]
@@ -6937,9 +6939,13 @@
     (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
     ;; If we have several article buffers, we kill them at exit.
     (unless gnus-single-article-buffer
-      (gnus-kill-buffer gnus-article-buffer)
-      (gnus-kill-buffer gnus-original-article-buffer)
-      (setq gnus-article-current nil))
+      (when (gnus-buffer-live-p gnus-article-buffer)
+	(with-current-buffer gnus-article-buffer
+	  ;; Don't kill sticky article buffers
+	  (unless (eq major-mode 'gnus-sticky-article-mode)
+	    (gnus-kill-buffer gnus-article-buffer)
+	    (setq gnus-article-current nil))))
+      (gnus-kill-buffer gnus-original-article-buffer))
     (when gnus-use-cache
       (gnus-cache-possibly-remove-articles)
       (gnus-cache-save-buffers))
@@ -6971,11 +6977,6 @@
     (setq group-point (point))
     (if temporary
 	nil				;Nothing to do.
-      ;; If we have several article buffers, we kill them at exit.
-      (unless gnus-single-article-buffer
-	(gnus-kill-buffer gnus-article-buffer)
-	(gnus-kill-buffer gnus-original-article-buffer)
-	(setq gnus-article-current nil))
       (set-buffer buf)
       (if (not gnus-kill-summary-on-exit)
 	  (progn
@@ -7908,6 +7909,49 @@
       (error "Article history empty")))
   (gnus-summary-position-point))
 
+(defun gnus-summary-make-sticky-article (arg)
+  "Make the current article sticky.
+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)))
+    (setq gnus-article-buffer new-art-buf-name))
+  (gnus-summary-recenter)
+  (gnus-summary-position-point)
+  (set-buffer gnus-article-buffer)
+  (gnus-sticky-article-mode))
+
 ;; Summary commands and functions for limiting the summary buffer.
 
 (defun gnus-summary-limit-to-articles (n)
--8<---------------cut here---------------end--------------->8---




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

* Re: Sticky article buffers
  2007-07-25 20:17   ` Tassilo Horn
@ 2007-08-12 11:15     ` Reiner Steib
  2007-08-12 11:59       ` Tassilo Horn
  0 siblings, 1 reply; 14+ messages in thread
From: Reiner Steib @ 2007-08-12 11:15 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: ding

On Wed, Jul 25 2007, Tassilo Horn wrote:

> here's a new patch. 

Thanks for your patch and sorry for the delay.  I have applied it to
the trunk.

> I did some renaming (`gnus-sticky-article-kill-buffer' =>
> `gnus-kill-sticky-article-buffer') and moved that function to
> gnus.el.

I also did some renaming and move functions around.  Please let me now
if you disagree with my changes.

> The key to make an article sticky is now `A S' and "q" buries the
> buffer -- "k" kills it.  The doc strings should be ok now, too.

I noticed some minor problems WRT article mode key bindings.  I'll
come back to this and some UI improvements later.

> I hope the patch works, I just killed the lines modifying file local
> variables.

It worked.  For future contributions:

- Please also provide a ChangeLog entries.

- When diffing in lisp/ (personally I'd suggest PCL-CVS (info
  "(pcl-cvs)Top")) makes it slightly easier to apply the patch.

- Could you provide documentation for texi/gnus.texi and an entry for
  texi/gnus-news.texi?

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



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

* Re: Sticky article buffers
  2007-08-12 11:15     ` Reiner Steib
@ 2007-08-12 11:59       ` Tassilo Horn
  2007-08-12 12:43         ` Reiner Steib
  0 siblings, 1 reply; 14+ messages in thread
From: Tassilo Horn @ 2007-08-12 11:59 UTC (permalink / raw)
  To: ding

Reiner Steib <reinersteib+gmane@imap.cc> writes:

Hi Reiner,

>> I did some renaming (`gnus-sticky-article-kill-buffer' =>
>> `gnus-kill-sticky-article-buffer') and moved that function to
>> gnus.el.
>
> I also did some renaming and move functions around.  Please let me now
> if you disagree with my changes.

No, not at all.

>> The key to make an article sticky is now `A S' and "q" buries the
>> buffer -- "k" kills it.  The doc strings should be ok now, too.
>
> I noticed some minor problems WRT article mode key bindings.  I'll
> come back to this and some UI improvements later.

Ok.

>> I hope the patch works, I just killed the lines modifying file local
>> variables.
>
> It worked.  For future contributions:
>
> - Please also provide a ChangeLog entries.

Is there something to create them automatically, so that I only need to
add comments to the functions I cahnged?

> - When diffing in lisp/ (personally I'd suggest PCL-CVS (info
>   "(pcl-cvs)Top")) makes it slightly easier to apply the patch.

I'll read it.

> - Could you provide documentation for texi/gnus.texi and an entry for
>   texi/gnus-news.texi?

I think this applies to the current patch as well as to future
contributions, right?  I'll add some docs the next week.

Bye,
Tassilo
-- 
Nothing  can  escape the  gravity  of a  black  hole,  except for  Chuck
Norris. Chuck Norris eats black holes. They taste like chicken.




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

* Re: Sticky article buffers
  2007-08-12 11:59       ` Tassilo Horn
@ 2007-08-12 12:43         ` Reiner Steib
  2007-08-13 13:03           ` Tassilo Horn
  0 siblings, 1 reply; 14+ messages in thread
From: Reiner Steib @ 2007-08-12 12:43 UTC (permalink / raw)
  To: ding

On Sun, Aug 12 2007, Tassilo Horn wrote:

> Reiner Steib <reinersteib+gmane@imap.cc> writes:
>> - Please also provide a ChangeLog entries.
>
> Is there something to create them automatically, so that I only need to
> add comments to the functions I cahnged?

Sure: When point is inside the modified defun, defcustom, ... (in the
lisp or texi file or in the diff buffer) you can use `C-x 4 a'
(`add-change-log-entry-other-window' or `M-x add-change-log-entry
RET').

>> - Could you provide documentation for texi/gnus.texi and an entry for
>>   texi/gnus-news.texi?
>
> I think this applies to the current patch as well as to future
> contributions, right?

Yes.

> I'll add some docs the next week.

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




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

* Re: Sticky article buffers
  2007-08-12 12:43         ` Reiner Steib
@ 2007-08-13 13:03           ` Tassilo Horn
  2007-08-13 14:04             ` Tassilo Horn
  0 siblings, 1 reply; 14+ messages in thread
From: Tassilo Horn @ 2007-08-13 13:03 UTC (permalink / raw)
  To: ding

Reiner Steib <reinersteib+gmane@imap.cc> writes:

Hi Reiner,

>> Is there something to create them automatically, so that I only need
>> to add comments to the functions I cahnged?
>
> Sure: When point is inside the modified defun, defcustom, ... (in the
> lisp or texi file or in the diff buffer) you can use `C-x 4 a'
> (`add-change-log-entry-other-window' or `M-x add-change-log-entry
> RET').

Nifty.

>>> - Could you provide documentation for texi/gnus.texi and an entry
>>>   for texi/gnus-news.texi?
>>
>> I think this applies to the current patch as well as to future
>> contributions, right?
>
> Yes.

Ok, here's the patch, created with pcl-cvs which is indeed very nice.

--8<---------------cut here---------------start------------->8---
Index: texi/gnus.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/gnus.texi,v
retrieving revision 7.242
diff -u -r7.242 gnus.texi
--- texi/gnus.texi	10 Aug 2007 02:34:24 -0000	7.242
+++ texi/gnus.texi	13 Aug 2007 13:00:17 -0000
@@ -496,6 +496,7 @@
 * Asynchronous Fetching::       Gnus might be able to pre-fetch articles.
 * Article Caching::             You may store articles in a cache.
 * Persistent Articles::         Making articles expiry-resistant.
+* Sticky Articles::             Article buffers that are not reused.
 * Article Backlog::             Having already read articles hang around.
 * Saving Articles::             Ways of customizing article saving.
 * Decoding Articles::           Gnus can treat series of (uu)encoded articles.
@@ -4598,6 +4599,7 @@
 * Asynchronous Fetching::       Gnus might be able to pre-fetch articles.
 * Article Caching::             You may store articles in a cache.
 * Persistent Articles::         Making articles expiry-resistant.
+* Sticky Articles::             Article buffers that are not reused.
 * Article Backlog::             Having already read articles hang around.
 * Saving Articles::             Ways of customizing article saving.
 * Decoding Articles::           Gnus can treat series of (uu)encoded articles.
@@ -7484,6 +7486,53 @@
 (setq gnus-use-cache 'passive)
 @end lisp
 
+@node Sticky Articles
+@section Sticky Articles
+@cindex sticky articles
+
+When you select an article the current article buffer will be reused
+according to the value of the variable
+@code{gnus-single-article-buffer}.  If its value is non-nil (the
+default) all articles reuse the same article buffer.  Else each group
+has its own article buffer.
+
+This implies that it's not possible to have more than one article buffer
+in a group at a time.  But sometimes you might want to display all the
+latest emails from your mother, your father, your aunt, your uncle and
+your 17 cousins to coordinate the next christmas party.
+
+That's where sticky articles come in handy.  A sticky article buffer
+basically is a normal article buffer, but it won't be reused when you
+select another article.  You can make an article sticky with:
+
+@table @kbd
+@item A S
+@kindex A S (Summary)
+@findex gnus-sticky-article
+Make the current article sticky.  If a prefix arg is given, ask for a
+name for this sticky article buffer.
+@end table
+
+To close a sticky article buffer you can use these commands:
+
+@table @kbd
+@item q
+@kindex q (Article)
+@findex bury-buffer
+Puts this sticky article buffer at the end of the list of all buffers.
+
+@item k
+@kindex k (Article)
+@findex gnus-kill-sticky-article-buffer
+Kills this sticky article buffer.
+@end table
+
+To kill all sticky article buffers you can use:
+
+@defun gnus-kill-sticky-article-buffers ARG
+Kill all sticky article buffers.
+If a prefix ARG is given, ask for confirmation.
+@end defun
 
 @node Article Backlog
 @section Article Backlog
@@ -26195,6 +26244,7 @@
 P. E. Jareth Hein,
 Hisashige Kenji, @c Hisashige
 Scott Hofmann,
+Tassilo Horn,
 Marc Horowitz,
 Gunnar Horrigmo,
 Richard Hoskins,
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo




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

* Re: Sticky article buffers
  2007-08-13 13:03           ` Tassilo Horn
@ 2007-08-13 14:04             ` Tassilo Horn
  2007-08-14  5:18               ` Katsumi Yamaoka
  2007-08-14  6:12               ` Katsumi Yamaoka
  0 siblings, 2 replies; 14+ messages in thread
From: Tassilo Horn @ 2007-08-13 14:04 UTC (permalink / raw)
  To: ding

Hi,

and sorry for the incomplete patch.  I wasn't aware of the fact that cvs
diff commands don't operate on all marked files by default in pcl-cvs.
Here's the complete patch.

--8<---------------cut here---------------start------------->8---
Index: texi/gnus.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/gnus.texi,v
retrieving revision 7.242
diff -u -r7.242 gnus.texi
--- texi/gnus.texi	10 Aug 2007 02:34:24 -0000	7.242
+++ texi/gnus.texi	13 Aug 2007 14:02:35 -0000
@@ -496,6 +496,7 @@
 * Asynchronous Fetching::       Gnus might be able to pre-fetch articles.
 * Article Caching::             You may store articles in a cache.
 * Persistent Articles::         Making articles expiry-resistant.
+* Sticky Articles::             Article buffers that are not reused.
 * Article Backlog::             Having already read articles hang around.
 * Saving Articles::             Ways of customizing article saving.
 * Decoding Articles::           Gnus can treat series of (uu)encoded articles.
@@ -4598,6 +4599,7 @@
 * Asynchronous Fetching::       Gnus might be able to pre-fetch articles.
 * Article Caching::             You may store articles in a cache.
 * Persistent Articles::         Making articles expiry-resistant.
+* Sticky Articles::             Article buffers that are not reused.
 * Article Backlog::             Having already read articles hang around.
 * Saving Articles::             Ways of customizing article saving.
 * Decoding Articles::           Gnus can treat series of (uu)encoded articles.
@@ -7484,6 +7486,53 @@
 (setq gnus-use-cache 'passive)
 @end lisp
 
+@node Sticky Articles
+@section Sticky Articles
+@cindex sticky articles
+
+When you select an article the current article buffer will be reused
+according to the value of the variable
+@code{gnus-single-article-buffer}.  If its value is non-nil (the
+default) all articles reuse the same article buffer.  Else each group
+has its own article buffer.
+
+This implies that it's not possible to have more than one article buffer
+in a group at a time.  But sometimes you might want to display all the
+latest emails from your mother, your father, your aunt, your uncle and
+your 17 cousins to coordinate the next christmas party.
+
+That's where sticky articles come in handy.  A sticky article buffer
+basically is a normal article buffer, but it won't be reused when you
+select another article.  You can make an article sticky with:
+
+@table @kbd
+@item A S
+@kindex A S (Summary)
+@findex gnus-sticky-article
+Make the current article sticky.  If a prefix arg is given, ask for a
+name for this sticky article buffer.
+@end table
+
+To close a sticky article buffer you can use these commands:
+
+@table @kbd
+@item q
+@kindex q (Article)
+@findex bury-buffer
+Puts this sticky article buffer at the end of the list of all buffers.
+
+@item k
+@kindex k (Article)
+@findex gnus-kill-sticky-article-buffer
+Kills this sticky article buffer.
+@end table
+
+To kill all sticky article buffers you can use:
+
+@defun gnus-kill-sticky-article-buffers ARG
+Kill all sticky article buffers.
+If a prefix ARG is given, ask for confirmation.
+@end defun
 
 @node Article Backlog
 @section Article Backlog
@@ -26195,6 +26244,7 @@
 P. E. Jareth Hein,
 Hisashige Kenji, @c Hisashige
 Scott Hofmann,
+Tassilo Horn,
 Marc Horowitz,
 Gunnar Horrigmo,
 Richard Hoskins,
Index: texi/gnus-news.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/gnus-news.texi,v
retrieving revision 7.52
diff -u -r7.52 gnus-news.texi
--- texi/gnus-news.texi	4 Jul 2007 19:39:52 -0000	7.52
+++ texi/gnus-news.texi	13 Aug 2007 14:02:37 -0000
@@ -69,6 +69,11 @@
 @item Changes in summary and article mode
 
 @itemize @bullet
+
+@item Gnus now supports sticky article buffers.  Those are article buffers
+that are not reused when you select another article.  @xref{Sticky
+Articles}.
+
 @item International host names (@acronym{IDNA}) can now be decoded
 inside article bodies using @kbd{W i}
 (@code{gnus-summary-idna-message}).  This requires that GNU Libidn
Index: texi/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/ChangeLog,v
retrieving revision 7.343
diff -u -r7.343 ChangeLog
--- texi/ChangeLog	10 Aug 2007 02:34:24 -0000	7.343
+++ texi/ChangeLog	13 Aug 2007 14:02:44 -0000
@@ -1,3 +1,9 @@
+2007-08-13  Tassilo Horn  <tassilo@member.fsf.org>
+
+	* gnus-news.texi: Mention sticky article buffers.
+
+	* gnus.texi (Sticky Articles): Documentation for sticky article buffers.
+
 2007-08-10  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus.texi (NNTP): Mention nntp-xref-number-is-evil.
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo
-- 
GNU Emacs is a text editor for Über-Geeks.




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

* Re: Sticky article buffers
  2007-08-13 14:04             ` Tassilo Horn
@ 2007-08-14  5:18               ` Katsumi Yamaoka
  2007-08-14  7:34                 ` Tassilo Horn
  2007-08-14  6:12               ` Katsumi Yamaoka
  1 sibling, 1 reply; 14+ messages in thread
From: Katsumi Yamaoka @ 2007-08-14  5:18 UTC (permalink / raw)
  To: ding

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

Hi,

Thank you for contributing a good feature.  I tried it today and
realized it is really useful.  Though I have no plan for the moment,
people might want a browser function for many sticky articles. :)

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.

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

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.

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.

I tried improving these problems.  Here are a replacement of the
`gnus-sticky-article' function and a patch for gnus-sum.el:


[-- Attachment #2: gnus-sticky-article --]
[-- Type: application/emacs-lisp, Size: 1468 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch for gnus-sum.el --]
[-- Type: text/x-patch, Size: 1067 bytes --]

--- gnus-sum.el~	2007-08-12 22:04:34 +0000
+++ gnus-sum.el	2007-08-14 05:13: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

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

* Re: Sticky article buffers
  2007-08-13 14:04             ` Tassilo Horn
  2007-08-14  5:18               ` Katsumi Yamaoka
@ 2007-08-14  6:12               ` Katsumi Yamaoka
  1 sibling, 0 replies; 14+ messages in thread
From: Katsumi Yamaoka @ 2007-08-14  6:12 UTC (permalink / raw)
  To: ding

>>>>> Tassilo Horn wrote:

> +2007-08-13  Tassilo Horn  <tassilo@member.fsf.org>
> +
> +	* gnus-news.texi: Mention sticky article buffers.
> +
> +	* gnus.texi (Sticky Articles): Documentation for sticky article buffers.

Installed.



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

* Re: Sticky article buffers
  2007-08-14  5:18               ` Katsumi Yamaoka
@ 2007-08-14  7:34                 ` Tassilo Horn
  2007-08-14  9:02                   ` Katsumi Yamaoka
  0 siblings, 1 reply; 14+ messages in thread
From: Tassilo Horn @ 2007-08-14  7:34 UTC (permalink / raw)
  To: ding

[-- 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

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

* Re: Sticky article buffers
  2007-08-14  7:34                 ` Tassilo Horn
@ 2007-08-14  9:02                   ` Katsumi Yamaoka
  2007-08-14 10:41                     ` Tassilo Horn
  0 siblings, 1 reply; 14+ messages in thread
From: Katsumi Yamaoka @ 2007-08-14  9:02 UTC (permalink / raw)
  To: ding

>>>>> Tassilo Horn wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:

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

Or `/ m gnus-sticky-article-mode RET'.  `ibuffer' may be good enough.

> 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?

Frames for sticky articles, an exclusive Gnus summary buffer for
sticky articles, tab browsing like emacs-w3m..., but they all don't
seem to be easy to achieve.

> Anyway, I applied your patch and tested it.

Thanks.  I've installed the patch.

> Is there a mechanism to set variables based on the directory a file
> resides?

I don't know.

> If not I'll do something home-brewed and hook it into find-file-hook.

It looks like this, isn't it? ;-)

(add-hook
 'find-file-hook
 (lambda nil
   (if (string-match "/gnus/lisp/" buffer-file-name)
       (set (make-local-variable 'indent-tabs-mode) t))))



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

* Re: Sticky article buffers
  2007-08-14  9:02                   ` Katsumi Yamaoka
@ 2007-08-14 10:41                     ` Tassilo Horn
  0 siblings, 0 replies; 14+ messages in thread
From: Tassilo Horn @ 2007-08-14 10:41 UTC (permalink / raw)
  To: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:

Hi Katsumi,

> Frames for sticky articles,

How about ibuffer, mark the buffers with `m' and then do `v' (for
windows) or `H' (for frames)?

> an exclusive Gnus summary buffer for sticky articles,

I don't see where this could be more useful than ibuffer.

> tab browsing like emacs-w3m..., but they all don't seem to be easy to
> achieve.

Indeed.

>> If not I'll do something home-brewed and hook it into find-file-hook.
>
> It looks like this, isn't it? ;-)
>
> [...]

Hah! It's far superior. ;-)

--8<---------------cut here---------------start------------->8---
(defvar th-dir-local-variables-alist
  '(("~/repos/gnus/" . ((indent-tabs-mode . t)
                        (tab-width . 8))))
  "An alist with (PATH . LIST) pairs.  PATH is a path and LIST is
a list of variables to set locally for files below that path.  It
has elements of the form (VAR . VAL) where VAR is a symbol and
VAL is its value.")

(defun th-set-dir-local-variables ()
  "Locally set the variables defined in
`th-dir-local-variables-alist' for the current buffer."
  (interactive)
  (let ((file (buffer-file-name (current-buffer))))
    (when file
      (dolist (pair th-dir-local-variables-alist)
        (when (string-match (concat "^" (regexp-quote (expand-file-name (car pair))))
                            file)
          (dolist (var (cdr pair))
            (if (local-variable-if-set-p (car var))
                (set (car var) (cdr var))
              (set (make-local-variable (car var)) (cdr var)))))))))

(add-hook 'find-file-hook
          'th-set-dir-local-variables)
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo
-- 
Chuck Norris uses 8'x10' sheets of plywood as toilet paper. 




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

end of thread, other threads:[~2007-08-14 10:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-25 15:32 Sticky article buffers 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
2007-08-14  9:02                   ` Katsumi Yamaoka
2007-08-14 10:41                     ` Tassilo Horn
2007-08-14  6:12               ` Katsumi Yamaoka

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