Gnus development mailing list
 help / color / mirror / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: ding@gnus.org
Subject: Sticky article buffers
Date: Wed, 25 Jul 2007 17:32:16 +0200	[thread overview]
Message-ID: <876448eby7.fsf@baldur.tsdh.de> (raw)

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




             reply	other threads:[~2007-07-25 15:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 15:32 Tassilo Horn [this message]
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

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=876448eby7.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).