From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/64965 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.gnus.general Subject: Re: Sticky article buffers Date: Wed, 25 Jul 2007 22:17:54 +0200 Message-ID: <87ir888cgd.fsf@baldur.tsdh.de> References: <876448eby7.fsf@baldur.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1185394718 16871 80.91.229.12 (25 Jul 2007 20:18:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 Jul 2007 20:18:38 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M13475@lists.math.uh.edu Wed Jul 25 22:18:37 2007 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1IDnJa-0005Qa-Ct for ding-account@gmane.org; Wed, 25 Jul 2007 22:18:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1IDnJK-0001yk-R2; Wed, 25 Jul 2007 15:18:18 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1IDnJI-0001yM-L7 for ding@lists.math.uh.edu; Wed, 25 Jul 2007 15:18:16 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1IDnJG-0004TD-QP for ding@lists.math.uh.edu; Wed, 25 Jul 2007 15:18:16 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1IDnJF-0000CF-00 for ; Wed, 25 Jul 2007 22:18:13 +0200 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IDnJ7-0001wQ-2z for ding@gnus.org; Wed, 25 Jul 2007 22:18:05 +0200 Original-Received: from dslb-084-063-004-050.pools.arcor-ip.net ([84.63.4.50]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Jul 2007 22:18:05 +0200 Original-Received: from tassilo by dslb-084-063-004-050.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Jul 2007 22:18:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 190 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: dslb-084-063-004-050.pools.arcor-ip.net Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAD1BMVEU8PDyjo6P5+fm+v8F/ gIO4imEzAAAACXBIWXMAAArrAAAK6wGCiw1aAAAATnRFWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYA CmV4aWYKICAgICAgMjAKNDU3ODY5NjYwMDAwNGQ0ZDAwMmEwMDAwMDAwODAwMDAwMDAwMDAwMAqJ uBZbAAAACXZwQWcAAAAwAAAAMADO7oxXAAABnklEQVQ4y6WU0YGDIAyGozIAFAY4iAM0iQNAZf+Z LkBrr1f7cseDIp8JyZ8ApA8D/gaiI/9cQne5A6wAcJCYwcwdIEEbbqyH/tGBZHjZ6apgbuALgF/2 XQfArK826CB5gGGA3gUNr9taMApkGLQIbIYeatRNQVcaiBbgCG6ADRadu77aqJo07w3M3W0bdQIo /a+HBQ4/pT1Y/2pRhZaeNTsRBTvlAlPMD6C+kS2UIEvZN7hnHsckwkT+koyjh1ZxTK5QZPdozEWl W7qIum60CJVMIcnGX7um0DWbVIy6Wc+ca6WeGHTNluTIiBNJa65yO0oLN/Q0sTAjglExj2ZglOvC CZNgzvUHQJE8tSIThzTqcy+qBFN6TTz9bB+kAE5rtBo2ifkJKM+roIK8EOPlAGg1GWFJuAEz3V5a tAHxuDmXf/WuZ4w7Ct1b5gmcYJo1ujcQVahNMxf7+xgUlnXHYOYTwMGY/HZwnIalnuobiF4VoxOL VCQ++vsVRKfBLmfA+O3UIgXv8ilIJcD5OQ92PgcrfLgZvvKnK2P9zyXzDWhiiUxowX0ZAAAAGnpU WHRqcGVnOmNvbG9yc3BhY2UAAHjaMwIAADMAM4k4IzUAAAAmelRYdGpwZWc6c2FtcGxpbmctZmFj dG9yAAB42jOqMNIxrDAEYQARgwLpPZcvTwAAAABJRU5ErkJggg== User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:1gHnFV0BIBmp3coc5VYq2kgW/LA= X-Spam-Score: -2.6 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:64965 Archived-At: 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---