Mercurial > emacs
annotate lisp/gnus/gnus-salt.el @ 33306:7fa642dbbaf8
*** empty log message ***
author | Dave Love <fx@gnu.org> |
---|---|
date | Wed, 08 Nov 2000 15:46:49 +0000 |
parents | 6055a1f6073c |
children | e06db3b8e558 |
rev | line source |
---|---|
17493 | 1 ;;; gnus-salt.el --- alternate summary mode interfaces for Gnus |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. |
17493 | 4 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
33272
6055a1f6073c
(gnus-binary-mode): Fix call to gnus-add-minor-mode.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
6 ;; Maintainer: bugs@gnus.org |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
7 ;; Keywords: news |
17493 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;;; Code: | |
29 | |
19521
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
30 (eval-when-compile (require 'cl)) |
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
31 |
17493 | 32 (require 'gnus) |
33 (require 'gnus-sum) | |
34 | |
35 ;;; | |
36 ;;; gnus-pick-mode | |
37 ;;; | |
38 | |
39 (defvar gnus-pick-mode nil | |
40 "Minor mode for providing a pick-and-read interface in Gnus summary buffers.") | |
41 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
42 (defcustom gnus-pick-display-summary nil |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
43 "*Display summary while reading." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
44 :type 'boolean |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
45 :group 'gnus-summary-pick) |
17493 | 46 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
47 (defcustom gnus-pick-mode-hook nil |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
48 "Hook run in summary pick mode buffers." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
49 :type 'hook |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
50 :group 'gnus-summary-pick) |
17493 | 51 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
52 (defcustom gnus-mark-unpicked-articles-as-read nil |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
53 "*If non-nil, mark all unpicked articles as read." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
54 :type 'boolean |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
55 :group 'gnus-summary-pick) |
17493 | 56 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
57 (defcustom gnus-pick-elegant-flow t |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
58 "If non-nil, `gnus-pick-start-reading' runs `gnus-summary-next-group' when no articles have been picked." |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
59 :type 'boolean |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
60 :group 'gnus-summary-pick) |
17493 | 61 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
62 (defcustom gnus-summary-pick-line-format |
17493 | 63 "%-5P %U\%R\%z\%I\%(%[%4L: %-20,20n%]%) %s\n" |
64 "*The format specification of the lines in pick buffers. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
65 It accepts the same format specs that `gnus-summary-line-format' does." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
66 :type 'string |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
67 :group 'gnus-summary-pick) |
17493 | 68 |
69 ;;; Internal variables. | |
70 | |
71 (defvar gnus-pick-mode-map nil) | |
72 | |
73 (unless gnus-pick-mode-map | |
74 (setq gnus-pick-mode-map (make-sparse-keymap)) | |
75 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
76 (gnus-define-keys gnus-pick-mode-map |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
77 " " gnus-pick-next-page |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
78 "u" gnus-pick-unmark-article-or-thread |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
79 "." gnus-pick-article-or-thread |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
80 gnus-down-mouse-2 gnus-pick-mouse-pick-region |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
81 "\r" gnus-pick-start-reading)) |
17493 | 82 |
83 (defun gnus-pick-make-menu-bar () | |
84 (unless (boundp 'gnus-pick-menu) | |
85 (easy-menu-define | |
86 gnus-pick-menu gnus-pick-mode-map "" | |
87 '("Pick" | |
88 ("Pick" | |
89 ["Article" gnus-summary-mark-as-processable t] | |
90 ["Thread" gnus-uu-mark-thread t] | |
91 ["Region" gnus-uu-mark-region t] | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
92 ["Regexp" gnus-uu-mark-by-regexp t] |
17493 | 93 ["Buffer" gnus-uu-mark-buffer t]) |
94 ("Unpick" | |
95 ["Article" gnus-summary-unmark-as-processable t] | |
96 ["Thread" gnus-uu-unmark-thread t] | |
97 ["Region" gnus-uu-unmark-region t] | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
98 ["Regexp" gnus-uu-unmark-by-regexp t] |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
99 ["Buffer" gnus-summary-unmark-all-processable t]) |
17493 | 100 ["Start reading" gnus-pick-start-reading t] |
101 ["Switch pick mode off" gnus-pick-mode gnus-pick-mode])))) | |
102 | |
103 (defun gnus-pick-mode (&optional arg) | |
104 "Minor mode for providing a pick-and-read interface in Gnus summary buffers. | |
105 | |
106 \\{gnus-pick-mode-map}" | |
107 (interactive "P") | |
108 (when (eq major-mode 'gnus-summary-mode) | |
109 (if (not (set (make-local-variable 'gnus-pick-mode) | |
110 (if (null arg) (not gnus-pick-mode) | |
111 (> (prefix-numeric-value arg) 0)))) | |
112 (remove-hook 'gnus-message-setup-hook 'gnus-pick-setup-message) | |
113 ;; Make sure that we don't select any articles upon group entry. | |
114 (set (make-local-variable 'gnus-auto-select-first) nil) | |
115 ;; Change line format. | |
116 (setq gnus-summary-line-format gnus-summary-pick-line-format) | |
117 (setq gnus-summary-line-format-spec nil) | |
118 (gnus-update-format-specifications nil 'summary) | |
119 (gnus-update-summary-mark-positions) | |
120 (add-hook 'gnus-message-setup-hook 'gnus-pick-setup-message) | |
121 (set (make-local-variable 'gnus-summary-goto-unread) 'never) | |
122 ;; Set up the menu. | |
123 (when (gnus-visual-p 'pick-menu 'menu) | |
124 (gnus-pick-make-menu-bar)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
125 (gnus-add-minor-mode 'gnus-pick-mode " Pick" gnus-pick-mode-map |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
126 nil 'gnus-pick-mode) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
127 (gnus-run-hooks 'gnus-pick-mode-hook)))) |
17493 | 128 |
129 (defun gnus-pick-setup-message () | |
130 "Make Message do the right thing on exit." | |
131 (when (and (gnus-buffer-live-p gnus-summary-buffer) | |
132 (save-excursion | |
133 (set-buffer gnus-summary-buffer) | |
134 gnus-pick-mode)) | |
135 (message-add-action | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
136 '(gnus-configure-windows ,gnus-current-window-configuration t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
137 'send 'exit 'postpone 'kill))) |
17493 | 138 |
139 (defvar gnus-pick-line-number 1) | |
140 (defun gnus-pick-line-number () | |
141 "Return the current line number." | |
142 (if (bobp) | |
143 (setq gnus-pick-line-number 1) | |
144 (incf gnus-pick-line-number))) | |
145 | |
146 (defun gnus-pick-start-reading (&optional catch-up) | |
147 "Start reading the picked articles. | |
148 If given a prefix, mark all unpicked articles as read." | |
149 (interactive "P") | |
150 (if gnus-newsgroup-processable | |
151 (progn | |
152 (gnus-summary-limit-to-articles nil) | |
153 (when (or catch-up gnus-mark-unpicked-articles-as-read) | |
154 (gnus-summary-limit-mark-excluded-as-read)) | |
155 (gnus-summary-first-article) | |
156 (gnus-configure-windows | |
157 (if gnus-pick-display-summary 'article 'pick) t)) | |
158 (if gnus-pick-elegant-flow | |
159 (progn | |
160 (when (or catch-up gnus-mark-unpicked-articles-as-read) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
161 (gnus-summary-catchup nil t)) |
17493 | 162 (if (gnus-group-quit-config gnus-newsgroup-name) |
163 (gnus-summary-exit) | |
164 (gnus-summary-next-group))) | |
165 (error "No articles have been picked")))) | |
166 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
167 (defun gnus-pick-goto-article (arg) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
168 "Go to the article number indicated by ARG. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
169 If ARG is an invalid article number, then stay on current line." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
170 (let (pos) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
171 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
172 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
173 (when (zerop (forward-line (1- (prefix-numeric-value arg)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
174 (setq pos (point)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
175 (if (not pos) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
176 (gnus-error 2 "No such line: %s" arg) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
177 (goto-char pos)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
178 |
17493 | 179 (defun gnus-pick-article (&optional arg) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
180 "Pick the article on the current line. |
17493 | 181 If ARG, pick the article on that line instead." |
182 (interactive "P") | |
183 (when arg | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
184 (gnus-pick-goto-article arg)) |
17493 | 185 (gnus-summary-mark-as-processable 1)) |
186 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
187 (defun gnus-pick-article-or-thread (&optional arg) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
188 "If `gnus-thread-hide-subtree' is t, then pick the thread on the current line. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
189 Otherwise pick the article on the current line. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
190 If ARG, pick the article/thread on that line instead." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
191 (interactive "P") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
192 (when arg |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
193 (gnus-pick-goto-article arg)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
194 (if gnus-thread-hide-subtree |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
195 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
196 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
197 (gnus-uu-mark-thread)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
198 (forward-line 1)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
199 (gnus-summary-mark-as-processable 1))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
200 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
201 (defun gnus-pick-unmark-article-or-thread (&optional arg) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
202 "If `gnus-thread-hide-subtree' is t, then unmark the thread on current line. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
203 Otherwise unmark the article on current line. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
204 If ARG, unmark thread/article on that line instead." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
205 (interactive "P") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
206 (when arg |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
207 (gnus-pick-goto-article arg)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
208 (if gnus-thread-hide-subtree |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
209 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
210 (gnus-uu-unmark-thread)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
211 (gnus-summary-unmark-as-processable 1))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
212 |
17493 | 213 (defun gnus-pick-mouse-pick (e) |
214 (interactive "e") | |
215 (mouse-set-point e) | |
216 (save-excursion | |
217 (gnus-summary-mark-as-processable 1))) | |
218 | |
219 (defun gnus-pick-mouse-pick-region (start-event) | |
220 "Pick articles that the mouse is dragged over. | |
221 This must be bound to a button-down mouse event." | |
222 (interactive "e") | |
223 (mouse-minibuffer-check start-event) | |
224 (let* ((echo-keystrokes 0) | |
225 (start-posn (event-start start-event)) | |
226 (start-point (posn-point start-posn)) | |
227 (start-line (1+ (count-lines 1 start-point))) | |
228 (start-window (posn-window start-posn)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
229 (bounds (gnus-window-edges start-window)) |
17493 | 230 (top (nth 1 bounds)) |
231 (bottom (if (window-minibuffer-p start-window) | |
232 (nth 3 bounds) | |
233 ;; Don't count the mode line. | |
234 (1- (nth 3 bounds)))) | |
235 (click-count (1- (event-click-count start-event)))) | |
236 (setq mouse-selection-click-count click-count) | |
237 (setq mouse-selection-click-count-buffer (current-buffer)) | |
238 (mouse-set-point start-event) | |
239 ;; In case the down click is in the middle of some intangible text, | |
240 ;; use the end of that text, and put it in START-POINT. | |
241 (when (< (point) start-point) | |
242 (goto-char start-point)) | |
243 (gnus-pick-article) | |
244 (setq start-point (point)) | |
245 ;; end-of-range is used only in the single-click case. | |
246 ;; It is the place where the drag has reached so far | |
247 ;; (but not outside the window where the drag started). | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
248 (let (event end end-point (end-of-range (point))) |
17493 | 249 (track-mouse |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
250 (while (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
251 (setq event (cdr (gnus-read-event-char))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
252 (or (mouse-movement-p event) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
253 (eq (car-safe event) 'switch-frame))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
254 (if (eq (car-safe event) 'switch-frame) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
255 nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
256 (setq end (event-end event) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
257 end-point (posn-point end)) |
17493 | 258 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
259 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
260 ;; Are we moving within the original window? |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
261 ((and (eq (posn-window end) start-window) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
262 (integer-or-marker-p end-point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
263 ;; Go to START-POINT first, so that when we move to END-POINT, |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
264 ;; if it's in the middle of intangible text, |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
265 ;; point jumps in the direction away from START-POINT. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
266 (goto-char start-point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
267 (goto-char end-point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
268 (gnus-pick-article) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
269 ;; In case the user moved his mouse really fast, pick |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
270 ;; articles on the line between this one and the last one. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
271 (let* ((this-line (1+ (count-lines 1 end-point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
272 (min-line (min this-line start-line)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
273 (max-line (max this-line start-line))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
274 (while (< min-line max-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
275 (goto-line min-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
276 (gnus-pick-article) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
277 (setq min-line (1+ min-line))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
278 (setq start-line this-line)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
279 (when (zerop (% click-count 3)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
280 (setq end-of-range (point)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
281 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
282 (let ((mouse-row (cdr (cdr (mouse-position))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
283 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
284 ((null mouse-row)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
285 ((< mouse-row top) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
286 (mouse-scroll-subr start-window (- mouse-row top))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
287 ((>= mouse-row bottom) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
288 (mouse-scroll-subr start-window |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
289 (1+ (- mouse-row bottom))))))))))) |
17493 | 290 (when (consp event) |
291 (let ((fun (key-binding (vector (car event))))) | |
292 ;; Run the binding of the terminating up-event, if possible. | |
293 ;; In the case of a multiple click, it gives the wrong results, | |
294 ;; because it would fail to set up a region. | |
295 (when nil | |
296 ;; (and (= (mod mouse-selection-click-count 3) 0) (fboundp fun)) | |
297 ;; In this case, we can just let the up-event execute normally. | |
298 (let ((end (event-end event))) | |
299 ;; Set the position in the event before we replay it, | |
300 ;; because otherwise it may have a position in the wrong | |
301 ;; buffer. | |
302 (setcar (cdr end) end-of-range) | |
303 ;; Delete the overlay before calling the function, | |
304 ;; because delete-overlay increases buffer-modified-tick. | |
305 (push event unread-command-events)))))))) | |
306 | |
307 (defun gnus-pick-next-page () | |
308 "Go to the next page. If at the end of the buffer, start reading articles." | |
309 (interactive) | |
310 (let ((scroll-in-place nil)) | |
311 (condition-case nil | |
312 (scroll-up) | |
313 (end-of-buffer (gnus-pick-start-reading))))) | |
314 | |
315 ;;; | |
316 ;;; gnus-binary-mode | |
317 ;;; | |
318 | |
319 (defvar gnus-binary-mode nil | |
320 "Minor mode for providing a binary group interface in Gnus summary buffers.") | |
321 | |
322 (defvar gnus-binary-mode-hook nil | |
323 "Hook run in summary binary mode buffers.") | |
324 | |
325 (defvar gnus-binary-mode-map nil) | |
326 | |
327 (unless gnus-binary-mode-map | |
328 (setq gnus-binary-mode-map (make-sparse-keymap)) | |
329 | |
330 (gnus-define-keys | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
331 gnus-binary-mode-map |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
332 "g" gnus-binary-show-article)) |
17493 | 333 |
334 (defun gnus-binary-make-menu-bar () | |
335 (unless (boundp 'gnus-binary-menu) | |
336 (easy-menu-define | |
337 gnus-binary-menu gnus-binary-mode-map "" | |
338 '("Pick" | |
339 ["Switch binary mode off" gnus-binary-mode t])))) | |
340 | |
341 (defun gnus-binary-mode (&optional arg) | |
342 "Minor mode for providing a binary group interface in Gnus summary buffers." | |
343 (interactive "P") | |
344 (when (eq major-mode 'gnus-summary-mode) | |
345 (make-local-variable 'gnus-binary-mode) | |
346 (setq gnus-binary-mode | |
347 (if (null arg) (not gnus-binary-mode) | |
348 (> (prefix-numeric-value arg) 0))) | |
349 (when gnus-binary-mode | |
350 ;; Make sure that we don't select any articles upon group entry. | |
351 (make-local-variable 'gnus-auto-select-first) | |
352 (setq gnus-auto-select-first nil) | |
353 (make-local-variable 'gnus-summary-display-article-function) | |
354 (setq gnus-summary-display-article-function 'gnus-binary-display-article) | |
355 ;; Set up the menu. | |
356 (when (gnus-visual-p 'binary-menu 'menu) | |
357 (gnus-binary-make-menu-bar)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
358 (gnus-add-minor-mode 'gnus-binary-mode " Binary" |
33272
6055a1f6073c
(gnus-binary-mode): Fix call to gnus-add-minor-mode.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
359 gnus-binary-mode-map nil 'gnus-binary-mode) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
360 (gnus-run-hooks 'gnus-binary-mode-hook)))) |
17493 | 361 |
362 (defun gnus-binary-display-article (article &optional all-header) | |
363 "Run ARTICLE through the binary decode functions." | |
364 (when (gnus-summary-goto-subject article) | |
365 (let ((gnus-view-pseudos 'automatic)) | |
366 (gnus-uu-decode-uu)))) | |
367 | |
368 (defun gnus-binary-show-article (&optional arg) | |
369 "Bypass the binary functions and show the article." | |
370 (interactive "P") | |
371 (let (gnus-summary-display-article-function) | |
372 (gnus-summary-show-article arg))) | |
373 | |
374 ;;; | |
375 ;;; gnus-tree-mode | |
376 ;;; | |
377 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
378 (defcustom gnus-tree-line-format "%(%[%3,3n%]%)" |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
379 "Format of tree elements." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
380 :type 'string |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
381 :group 'gnus-summary-tree) |
17493 | 382 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
383 (defcustom gnus-tree-minimize-window t |
17493 | 384 "If non-nil, minimize the tree buffer window. |
385 If a number, never let the tree buffer grow taller than that number of | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
386 lines." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
387 :type '(choice boolean |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
388 integer) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
389 :group 'gnus-summary-tree) |
17493 | 390 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
391 (defcustom gnus-selected-tree-face 'modeline |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
392 "*Face used for highlighting selected articles in the thread tree." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
393 :type 'face |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
394 :group 'gnus-summary-tree) |
17493 | 395 |
396 (defvar gnus-tree-brackets '((?\[ . ?\]) (?\( . ?\)) | |
397 (?\{ . ?\}) (?< . ?>)) | |
398 "Brackets used in tree nodes.") | |
399 | |
400 (defvar gnus-tree-parent-child-edges '(?- ?\\ ?|) | |
401 "Characters used to connect parents with children.") | |
402 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
403 (defcustom gnus-tree-mode-line-format "Gnus: %%b %S %Z" |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
404 "*The format specification for the tree mode line." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
405 :type 'string |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
406 :group 'gnus-summary-tree) |
17493 | 407 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
408 (defcustom gnus-generate-tree-function 'gnus-generate-vertical-tree |
17493 | 409 "*Function for generating a thread tree. |
410 Two predefined functions are available: | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
411 `gnus-generate-horizontal-tree' and `gnus-generate-vertical-tree'." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
412 :type '(radio (function-item gnus-generate-vertical-tree) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
413 (function-item gnus-generate-horizontal-tree) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
414 (function :tag "Other" nil)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
415 :group 'gnus-summary-tree) |
17493 | 416 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
417 (defcustom gnus-tree-mode-hook nil |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
418 "*Hook run in tree mode buffers." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
419 :type 'hook |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
420 :group 'gnus-summary-tree) |
17493 | 421 |
422 ;;; Internal variables. | |
423 | |
424 (defvar gnus-tree-line-format-alist | |
425 `((?n gnus-tmp-name ?s) | |
426 (?f gnus-tmp-from ?s) | |
427 (?N gnus-tmp-number ?d) | |
428 (?\[ gnus-tmp-open-bracket ?c) | |
429 (?\] gnus-tmp-close-bracket ?c) | |
430 (?s gnus-tmp-subject ?s))) | |
431 | |
432 (defvar gnus-tree-mode-line-format-alist gnus-summary-mode-line-format-alist) | |
433 | |
434 (defvar gnus-tree-mode-line-format-spec nil) | |
435 (defvar gnus-tree-line-format-spec nil) | |
436 | |
437 (defvar gnus-tree-node-length nil) | |
438 (defvar gnus-selected-tree-overlay nil) | |
439 | |
440 (defvar gnus-tree-displayed-thread nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
441 (defvar gnus-tree-inhibit nil) |
17493 | 442 |
443 (defvar gnus-tree-mode-map nil) | |
444 (put 'gnus-tree-mode 'mode-class 'special) | |
445 | |
446 (unless gnus-tree-mode-map | |
447 (setq gnus-tree-mode-map (make-keymap)) | |
448 (suppress-keymap gnus-tree-mode-map) | |
449 (gnus-define-keys | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
450 gnus-tree-mode-map |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
451 "\r" gnus-tree-select-article |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
452 gnus-mouse-2 gnus-tree-pick-article |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
453 "\C-?" gnus-tree-read-summary-keys |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
454 "h" gnus-tree-show-summary |
17493 | 455 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
456 "\C-c\C-i" gnus-info-find-node) |
17493 | 457 |
458 (substitute-key-definition | |
459 'undefined 'gnus-tree-read-summary-keys gnus-tree-mode-map)) | |
460 | |
461 (defun gnus-tree-make-menu-bar () | |
462 (unless (boundp 'gnus-tree-menu) | |
463 (easy-menu-define | |
464 gnus-tree-menu gnus-tree-mode-map "" | |
465 '("Tree" | |
466 ["Select article" gnus-tree-select-article t])))) | |
467 | |
468 (defun gnus-tree-mode () | |
469 "Major mode for displaying thread trees." | |
470 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
471 (gnus-set-format 'tree-mode) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
472 (gnus-set-format 'tree t) |
17493 | 473 (when (gnus-visual-p 'tree-menu 'menu) |
474 (gnus-tree-make-menu-bar)) | |
475 (kill-all-local-variables) | |
476 (gnus-simplify-mode-line) | |
477 (setq mode-name "Tree") | |
478 (setq major-mode 'gnus-tree-mode) | |
479 (use-local-map gnus-tree-mode-map) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
480 (buffer-disable-undo) |
17493 | 481 (setq buffer-read-only t) |
482 (setq truncate-lines t) | |
483 (save-excursion | |
484 (gnus-set-work-buffer) | |
485 (gnus-tree-node-insert (make-mail-header "") nil) | |
486 (setq gnus-tree-node-length (1- (point)))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
487 (gnus-run-hooks 'gnus-tree-mode-hook)) |
17493 | 488 |
489 (defun gnus-tree-read-summary-keys (&optional arg) | |
490 "Read a summary buffer key sequence and execute it." | |
491 (interactive "P") | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
492 (unless gnus-tree-inhibit |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
493 (let ((buf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
494 (gnus-tree-inhibit t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
495 win) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
496 (set-buffer gnus-article-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
497 (gnus-article-read-summary-keys arg nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
498 (when (setq win (get-buffer-window buf)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
499 (select-window win) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
500 (when gnus-selected-tree-overlay |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
501 (goto-char (or (gnus-overlay-end gnus-selected-tree-overlay) 1))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
502 (gnus-tree-minimize))))) |
17493 | 503 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
504 (defun gnus-tree-show-summary () |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
505 "Reconfigure windows to show summary buffer." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
506 (interactive) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
507 (if (not (gnus-buffer-live-p gnus-summary-buffer)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
508 (error "There is no summary buffer for this tree buffer") |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
509 (gnus-configure-windows 'article) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
510 (gnus-summary-goto-subject gnus-current-article))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
511 |
17493 | 512 (defun gnus-tree-select-article (article) |
513 "Select the article under point, if any." | |
514 (interactive (list (gnus-tree-article-number))) | |
515 (let ((buf (current-buffer))) | |
516 (when article | |
517 (save-excursion | |
518 (set-buffer gnus-summary-buffer) | |
519 (gnus-summary-goto-article article)) | |
520 (select-window (get-buffer-window buf))))) | |
521 | |
522 (defun gnus-tree-pick-article (e) | |
523 "Select the article under the mouse pointer." | |
524 (interactive "e") | |
525 (mouse-set-point e) | |
526 (gnus-tree-select-article (gnus-tree-article-number))) | |
527 | |
528 (defun gnus-tree-article-number () | |
529 (get-text-property (point) 'gnus-number)) | |
530 | |
531 (defun gnus-tree-article-region (article) | |
532 "Return a cons with BEG and END of the article region." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
533 (let ((pos (text-property-any |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
534 (point-min) (point-max) 'gnus-number article))) |
17493 | 535 (when pos |
536 (cons pos (next-single-property-change pos 'gnus-number))))) | |
537 | |
538 (defun gnus-tree-goto-article (article) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
539 (let ((pos (text-property-any |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
540 (point-min) (point-max) 'gnus-number article))) |
17493 | 541 (when pos |
542 (goto-char pos)))) | |
543 | |
544 (defun gnus-tree-recenter () | |
545 "Center point in the tree window." | |
546 (let ((selected (selected-window)) | |
547 (tree-window (get-buffer-window gnus-tree-buffer t))) | |
548 (when tree-window | |
549 (select-window tree-window) | |
550 (when gnus-selected-tree-overlay | |
551 (goto-char (or (gnus-overlay-end gnus-selected-tree-overlay) 1))) | |
552 (let* ((top (cond ((< (window-height) 4) 0) | |
553 ((< (window-height) 7) 1) | |
554 (t 2))) | |
555 (height (1- (window-height))) | |
556 (bottom (save-excursion (goto-char (point-max)) | |
557 (forward-line (- height)) | |
558 (point)))) | |
559 ;; Set the window start to either `bottom', which is the biggest | |
560 ;; possible valid number, or the second line from the top, | |
561 ;; whichever is the least. | |
562 (set-window-start | |
563 tree-window (min bottom (save-excursion | |
564 (forward-line (- top)) (point))))) | |
565 (select-window selected)))) | |
566 | |
567 (defun gnus-get-tree-buffer () | |
568 "Return the tree buffer properly initialized." | |
569 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
570 (set-buffer (gnus-get-buffer-create gnus-tree-buffer)) |
17493 | 571 (unless (eq major-mode 'gnus-tree-mode) |
572 (gnus-tree-mode)) | |
573 (current-buffer))) | |
574 | |
575 (defun gnus-tree-minimize () | |
576 (when (and gnus-tree-minimize-window | |
577 (not (one-window-p))) | |
578 (let ((windows 0) | |
579 tot-win-height) | |
580 (walk-windows (lambda (window) (incf windows))) | |
581 (setq tot-win-height | |
582 (- (frame-height) | |
583 (* window-min-height (1- windows)) | |
584 2)) | |
585 (let* ((window-min-height 2) | |
586 (height (count-lines (point-min) (point-max))) | |
587 (min (max (1- window-min-height) height)) | |
588 (tot (if (numberp gnus-tree-minimize-window) | |
589 (min gnus-tree-minimize-window min) | |
590 min)) | |
591 (win (get-buffer-window (current-buffer))) | |
592 (wh (and win (1- (window-height win))))) | |
593 (setq tot (min tot tot-win-height)) | |
594 (when (and win | |
595 (not (eq tot wh))) | |
596 (let ((selected (selected-window))) | |
597 (when (ignore-errors (select-window win)) | |
598 (enlarge-window (- tot wh)) | |
599 (select-window selected)))))))) | |
600 | |
601 ;;; Generating the tree. | |
602 | |
603 (defun gnus-tree-node-insert (header sparse &optional adopted) | |
604 (let* ((dummy (stringp header)) | |
605 (header (if (vectorp header) header | |
606 (progn | |
607 (setq header (make-mail-header "*****")) | |
608 (mail-header-set-number header 0) | |
609 (mail-header-set-lines header 0) | |
610 (mail-header-set-chars header 0) | |
611 header))) | |
612 (gnus-tmp-from (mail-header-from header)) | |
613 (gnus-tmp-subject (mail-header-subject header)) | |
614 (gnus-tmp-number (mail-header-number header)) | |
615 (gnus-tmp-name | |
616 (cond | |
617 ((string-match "(.+)" gnus-tmp-from) | |
618 (substring gnus-tmp-from | |
619 (1+ (match-beginning 0)) (1- (match-end 0)))) | |
620 ((string-match "<[^>]+> *$" gnus-tmp-from) | |
621 (let ((beg (match-beginning 0))) | |
622 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from) | |
623 (substring gnus-tmp-from (1+ (match-beginning 0)) | |
624 (1- (match-end 0)))) | |
625 (substring gnus-tmp-from 0 beg)))) | |
626 ((memq gnus-tmp-number sparse) | |
627 "***") | |
628 (t gnus-tmp-from))) | |
629 (gnus-tmp-open-bracket | |
630 (cond ((memq gnus-tmp-number sparse) | |
631 (caadr gnus-tree-brackets)) | |
632 (dummy (caaddr gnus-tree-brackets)) | |
633 (adopted (car (nth 3 gnus-tree-brackets))) | |
634 (t (caar gnus-tree-brackets)))) | |
635 (gnus-tmp-close-bracket | |
636 (cond ((memq gnus-tmp-number sparse) | |
637 (cdadr gnus-tree-brackets)) | |
638 (adopted (cdr (nth 3 gnus-tree-brackets))) | |
639 (dummy | |
640 (cdaddr gnus-tree-brackets)) | |
641 (t (cdar gnus-tree-brackets)))) | |
642 (buffer-read-only nil) | |
643 beg end) | |
644 (gnus-add-text-properties | |
645 (setq beg (point)) | |
646 (setq end (progn (eval gnus-tree-line-format-spec) (point))) | |
647 (list 'gnus-number gnus-tmp-number)) | |
648 (when (or t (gnus-visual-p 'tree-highlight 'highlight)) | |
649 (gnus-tree-highlight-node gnus-tmp-number beg end)))) | |
650 | |
651 (defun gnus-tree-highlight-node (article beg end) | |
652 "Highlight current line according to `gnus-summary-highlight'." | |
653 (let ((list gnus-summary-highlight) | |
654 face) | |
655 (save-excursion | |
656 (set-buffer gnus-summary-buffer) | |
657 (let* ((score (or (cdr (assq article gnus-newsgroup-scored)) | |
658 gnus-summary-default-score 0)) | |
659 (default gnus-summary-default-score) | |
660 (mark (or (gnus-summary-article-mark article) gnus-unread-mark))) | |
661 ;; Eval the cars of the lists until we find a match. | |
662 (while (and list | |
663 (not (eval (caar list)))) | |
664 (setq list (cdr list))))) | |
665 (unless (eq (setq face (cdar list)) (get-text-property beg 'face)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
666 (gnus-put-text-property-excluding-characters-with-faces |
17493 | 667 beg end 'face |
668 (if (boundp face) (symbol-value face) face))))) | |
669 | |
670 (defun gnus-tree-indent (level) | |
671 (insert (make-string (1- (* (1+ gnus-tree-node-length) level)) ? ))) | |
672 | |
673 (defvar gnus-tmp-limit) | |
674 (defvar gnus-tmp-sparse) | |
675 (defvar gnus-tmp-indent) | |
676 | |
677 (defun gnus-generate-tree (thread) | |
678 "Generate a thread tree for THREAD." | |
679 (save-excursion | |
680 (set-buffer (gnus-get-tree-buffer)) | |
681 (let ((buffer-read-only nil) | |
682 (gnus-tmp-indent 0)) | |
683 (erase-buffer) | |
684 (funcall gnus-generate-tree-function thread 0) | |
685 (gnus-set-mode-line 'tree) | |
686 (goto-char (point-min)) | |
687 (gnus-tree-minimize) | |
688 (gnus-tree-recenter) | |
689 (let ((selected (selected-window))) | |
690 (when (get-buffer-window (set-buffer gnus-tree-buffer) t) | |
691 (select-window (get-buffer-window (set-buffer gnus-tree-buffer) t)) | |
692 (gnus-horizontal-recenter) | |
693 (select-window selected)))))) | |
694 | |
695 (defun gnus-generate-horizontal-tree (thread level &optional dummyp adopted) | |
696 "Generate a horizontal tree." | |
697 (let* ((dummy (stringp (car thread))) | |
698 (do (or dummy | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
699 (and (car thread) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
700 (memq (mail-header-number (car thread)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
701 gnus-tmp-limit)))) |
17493 | 702 col beg) |
703 (if (not do) | |
704 ;; We don't want this article. | |
705 (setq thread (cdr thread)) | |
706 (if (not (bolp)) | |
707 ;; Not the first article on the line, so we insert a "-". | |
708 (insert (car gnus-tree-parent-child-edges)) | |
709 ;; If the level isn't zero, then we insert some indentation. | |
710 (unless (zerop level) | |
711 (gnus-tree-indent level) | |
712 (insert (cadr gnus-tree-parent-child-edges)) | |
713 (setq col (- (setq beg (point)) (gnus-point-at-bol) 1)) | |
714 ;; Draw "|" lines upwards. | |
715 (while (progn | |
716 (forward-line -1) | |
717 (forward-char col) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
718 (eq (char-after) ? )) |
17493 | 719 (delete-char 1) |
720 (insert (caddr gnus-tree-parent-child-edges))) | |
721 (goto-char beg))) | |
722 (setq dummyp nil) | |
723 ;; Insert the article node. | |
724 (gnus-tree-node-insert (pop thread) gnus-tmp-sparse adopted)) | |
725 (if (null thread) | |
726 ;; End of the thread, so we go to the next line. | |
727 (unless (bolp) | |
728 (insert "\n")) | |
729 ;; Recurse downwards in all children of this article. | |
730 (while thread | |
731 (gnus-generate-horizontal-tree | |
732 (pop thread) (if do (1+ level) level) | |
733 (or dummyp dummy) dummy))))) | |
734 | |
735 (defsubst gnus-tree-indent-vertical () | |
736 (let ((len (- (* (1+ gnus-tree-node-length) gnus-tmp-indent) | |
737 (- (point) (gnus-point-at-bol))))) | |
738 (when (> len 0) | |
739 (insert (make-string len ? ))))) | |
740 | |
741 (defsubst gnus-tree-forward-line (n) | |
742 (while (>= (decf n) 0) | |
743 (unless (zerop (forward-line 1)) | |
744 (end-of-line) | |
745 (insert "\n"))) | |
746 (end-of-line)) | |
747 | |
748 (defun gnus-generate-vertical-tree (thread level &optional dummyp adopted) | |
749 "Generate a vertical tree." | |
750 (let* ((dummy (stringp (car thread))) | |
751 (do (or dummy | |
752 (and (car thread) | |
753 (memq (mail-header-number (car thread)) | |
754 gnus-tmp-limit)))) | |
755 beg) | |
756 (if (not do) | |
757 ;; We don't want this article. | |
758 (setq thread (cdr thread)) | |
759 (if (not (save-excursion (beginning-of-line) (bobp))) | |
760 ;; Not the first article on the line, so we insert a "-". | |
761 (progn | |
762 (gnus-tree-indent-vertical) | |
763 (insert (make-string (/ gnus-tree-node-length 2) ? )) | |
764 (insert (caddr gnus-tree-parent-child-edges)) | |
765 (gnus-tree-forward-line 1)) | |
766 ;; If the level isn't zero, then we insert some indentation. | |
767 (unless (zerop gnus-tmp-indent) | |
768 (gnus-tree-forward-line (1- (* 2 level))) | |
769 (gnus-tree-indent-vertical) | |
770 (delete-char -1) | |
771 (insert (cadr gnus-tree-parent-child-edges)) | |
772 (setq beg (point)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
773 (forward-char -1) |
17493 | 774 ;; Draw "-" lines leftwards. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
775 (while (and (> (point) 1) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
776 (eq (char-after (1- (point))) ? )) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
777 (delete-char -1) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
778 (insert (car gnus-tree-parent-child-edges)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
779 (forward-char -1)) |
17493 | 780 (goto-char beg) |
781 (gnus-tree-forward-line 1))) | |
782 (setq dummyp nil) | |
783 ;; Insert the article node. | |
784 (gnus-tree-indent-vertical) | |
785 (gnus-tree-node-insert (pop thread) gnus-tmp-sparse adopted) | |
786 (gnus-tree-forward-line 1)) | |
787 (if (null thread) | |
788 ;; End of the thread, so we go to the next line. | |
789 (progn | |
790 (goto-char (point-min)) | |
791 (end-of-line) | |
792 (incf gnus-tmp-indent)) | |
793 ;; Recurse downwards in all children of this article. | |
794 (while thread | |
795 (gnus-generate-vertical-tree | |
796 (pop thread) (if do (1+ level) level) | |
797 (or dummyp dummy) dummy))))) | |
798 | |
799 ;;; Interface functions. | |
800 | |
801 (defun gnus-possibly-generate-tree (article &optional force) | |
802 "Generate the thread tree for ARTICLE if it isn't displayed already." | |
803 (when (save-excursion | |
804 (set-buffer gnus-summary-buffer) | |
805 (and gnus-use-trees | |
806 gnus-show-threads | |
807 (vectorp (gnus-summary-article-header article)))) | |
808 (save-excursion | |
809 (let ((top (save-excursion | |
810 (set-buffer gnus-summary-buffer) | |
811 (gnus-cut-thread | |
812 (gnus-remove-thread | |
813 (mail-header-id | |
814 (gnus-summary-article-header article)) | |
815 t)))) | |
816 (gnus-tmp-limit gnus-newsgroup-limit) | |
817 (gnus-tmp-sparse gnus-newsgroup-sparse)) | |
818 (when (or force | |
819 (not (eq top gnus-tree-displayed-thread))) | |
820 (gnus-generate-tree top) | |
821 (setq gnus-tree-displayed-thread top)))))) | |
822 | |
823 (defun gnus-tree-open (group) | |
824 (gnus-get-tree-buffer)) | |
825 | |
826 (defun gnus-tree-close (group) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
827 (gnus-kill-buffer gnus-tree-buffer)) |
17493 | 828 |
829 (defun gnus-highlight-selected-tree (article) | |
830 "Highlight the selected article in the tree." | |
831 (let ((buf (current-buffer)) | |
832 region) | |
833 (set-buffer gnus-tree-buffer) | |
834 (when (setq region (gnus-tree-article-region article)) | |
835 (when (or (not gnus-selected-tree-overlay) | |
836 (gnus-extent-detached-p gnus-selected-tree-overlay)) | |
837 ;; Create a new overlay. | |
838 (gnus-overlay-put | |
839 (setq gnus-selected-tree-overlay (gnus-make-overlay 1 2)) | |
840 'face gnus-selected-tree-face)) | |
841 ;; Move the overlay to the article. | |
842 (gnus-move-overlay | |
843 gnus-selected-tree-overlay (goto-char (car region)) (cdr region)) | |
844 (gnus-tree-minimize) | |
845 (gnus-tree-recenter) | |
846 (let ((selected (selected-window))) | |
847 (when (get-buffer-window (set-buffer gnus-tree-buffer) t) | |
848 (select-window (get-buffer-window (set-buffer gnus-tree-buffer) t)) | |
849 (gnus-horizontal-recenter) | |
850 (select-window selected)))) | |
851 ;; If we remove this save-excursion, it updates the wrong mode lines?!? | |
852 (save-excursion | |
853 (set-buffer gnus-tree-buffer) | |
854 (gnus-set-mode-line 'tree)) | |
855 (set-buffer buf))) | |
856 | |
857 (defun gnus-tree-highlight-article (article face) | |
858 (save-excursion | |
859 (set-buffer (gnus-get-tree-buffer)) | |
860 (let (region) | |
861 (when (setq region (gnus-tree-article-region article)) | |
862 (gnus-put-text-property (car region) (cdr region) 'face face) | |
863 (set-window-point | |
864 (get-buffer-window (current-buffer) t) (cdr region)))))) | |
865 | |
866 ;;; | |
867 ;;; gnus-carpal | |
868 ;;; | |
869 | |
870 (defvar gnus-carpal-group-buffer-buttons | |
871 '(("next" . gnus-group-next-unread-group) | |
872 ("prev" . gnus-group-prev-unread-group) | |
873 ("read" . gnus-group-read-group) | |
874 ("select" . gnus-group-select-group) | |
875 ("catch-up" . gnus-group-catchup-current) | |
876 ("new-news" . gnus-group-get-new-news-this-group) | |
877 ("toggle-sub" . gnus-group-unsubscribe-current-group) | |
878 ("subscribe" . gnus-group-unsubscribe-group) | |
879 ("kill" . gnus-group-kill-group) | |
880 ("yank" . gnus-group-yank-group) | |
881 ("describe" . gnus-group-describe-group) | |
882 "list" | |
883 ("subscribed" . gnus-group-list-groups) | |
884 ("all" . gnus-group-list-all-groups) | |
885 ("killed" . gnus-group-list-killed) | |
886 ("zombies" . gnus-group-list-zombies) | |
887 ("matching" . gnus-group-list-matching) | |
888 ("post" . gnus-group-post-news) | |
889 ("mail" . gnus-group-mail) | |
890 ("rescan" . gnus-group-get-new-news) | |
891 ("browse-foreign" . gnus-group-browse-foreign) | |
892 ("exit" . gnus-group-exit))) | |
893 | |
894 (defvar gnus-carpal-summary-buffer-buttons | |
895 '("mark" | |
896 ("read" . gnus-summary-mark-as-read-forward) | |
897 ("tick" . gnus-summary-tick-article-forward) | |
898 ("clear" . gnus-summary-clear-mark-forward) | |
899 ("expirable" . gnus-summary-mark-as-expirable) | |
900 "move" | |
901 ("scroll" . gnus-summary-next-page) | |
902 ("next-unread" . gnus-summary-next-unread-article) | |
903 ("prev-unread" . gnus-summary-prev-unread-article) | |
904 ("first" . gnus-summary-first-unread-article) | |
905 ("best" . gnus-summary-best-unread-article) | |
906 "article" | |
907 ("headers" . gnus-summary-toggle-header) | |
908 ("uudecode" . gnus-uu-decode-uu) | |
909 ("enter-digest" . gnus-summary-enter-digest-group) | |
910 ("fetch-parent" . gnus-summary-refer-parent-article) | |
911 "mail" | |
912 ("move" . gnus-summary-move-article) | |
913 ("copy" . gnus-summary-copy-article) | |
914 ("respool" . gnus-summary-respool-article) | |
915 "threads" | |
916 ("lower" . gnus-summary-lower-thread) | |
917 ("kill" . gnus-summary-kill-thread) | |
918 "post" | |
919 ("post" . gnus-summary-post-news) | |
920 ("mail" . gnus-summary-mail) | |
921 ("followup" . gnus-summary-followup-with-original) | |
922 ("reply" . gnus-summary-reply-with-original) | |
923 ("cancel" . gnus-summary-cancel-article) | |
924 "misc" | |
925 ("exit" . gnus-summary-exit) | |
926 ("fed-up" . gnus-summary-catchup-and-goto-next-group))) | |
927 | |
928 (defvar gnus-carpal-server-buffer-buttons | |
929 '(("add" . gnus-server-add-server) | |
930 ("browse" . gnus-server-browse-server) | |
931 ("list" . gnus-server-list-servers) | |
932 ("kill" . gnus-server-kill-server) | |
933 ("yank" . gnus-server-yank-server) | |
934 ("copy" . gnus-server-copy-server) | |
935 ("exit" . gnus-server-exit))) | |
936 | |
937 (defvar gnus-carpal-browse-buffer-buttons | |
938 '(("subscribe" . gnus-browse-unsubscribe-current-group) | |
939 ("exit" . gnus-browse-exit))) | |
940 | |
941 (defvar gnus-carpal-group-buffer "*Carpal Group*") | |
942 (defvar gnus-carpal-summary-buffer "*Carpal Summary*") | |
943 (defvar gnus-carpal-server-buffer "*Carpal Server*") | |
944 (defvar gnus-carpal-browse-buffer "*Carpal Browse*") | |
945 | |
946 (defvar gnus-carpal-attached-buffer nil) | |
947 | |
948 (defvar gnus-carpal-mode-hook nil | |
949 "*Hook run in carpal mode buffers.") | |
950 | |
951 (defvar gnus-carpal-button-face 'bold | |
952 "*Face used on carpal buttons.") | |
953 | |
954 (defvar gnus-carpal-header-face 'bold-italic | |
955 "*Face used on carpal buffer headers.") | |
956 | |
957 (defvar gnus-carpal-mode-map nil) | |
958 (put 'gnus-carpal-mode 'mode-class 'special) | |
959 | |
960 (if gnus-carpal-mode-map | |
961 nil | |
962 (setq gnus-carpal-mode-map (make-keymap)) | |
963 (suppress-keymap gnus-carpal-mode-map) | |
964 (define-key gnus-carpal-mode-map " " 'gnus-carpal-select) | |
965 (define-key gnus-carpal-mode-map "\r" 'gnus-carpal-select) | |
966 (define-key gnus-carpal-mode-map gnus-mouse-2 'gnus-carpal-mouse-select)) | |
967 | |
968 (defun gnus-carpal-mode () | |
969 "Major mode for clicking buttons. | |
970 | |
971 All normal editing commands are switched off. | |
972 \\<gnus-carpal-mode-map> | |
973 The following commands are available: | |
974 | |
975 \\{gnus-carpal-mode-map}" | |
976 (interactive) | |
977 (kill-all-local-variables) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
978 (setq mode-line-modified (cdr gnus-mode-line-modified)) |
17493 | 979 (setq major-mode 'gnus-carpal-mode) |
980 (setq mode-name "Gnus Carpal") | |
981 (setq mode-line-process nil) | |
982 (use-local-map gnus-carpal-mode-map) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
983 (buffer-disable-undo) |
17493 | 984 (setq buffer-read-only t) |
985 (make-local-variable 'gnus-carpal-attached-buffer) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
986 (gnus-run-hooks 'gnus-carpal-mode-hook)) |
17493 | 987 |
988 (defun gnus-carpal-setup-buffer (type) | |
989 (let ((buffer (symbol-value (intern (format "gnus-carpal-%s-buffer" type))))) | |
990 (if (get-buffer buffer) | |
991 () | |
992 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
993 (set-buffer (gnus-get-buffer-create buffer)) |
17493 | 994 (gnus-carpal-mode) |
995 (setq gnus-carpal-attached-buffer | |
996 (intern (format "gnus-%s-buffer" type))) | |
997 (let ((buttons (symbol-value | |
998 (intern (format "gnus-carpal-%s-buffer-buttons" | |
999 type)))) | |
1000 (buffer-read-only nil) | |
1001 button) | |
1002 (while buttons | |
1003 (setq button (car buttons) | |
1004 buttons (cdr buttons)) | |
1005 (if (stringp button) | |
1006 (gnus-set-text-properties | |
1007 (point) | |
1008 (prog2 (insert button) (point) (insert " ")) | |
1009 (list 'face gnus-carpal-header-face)) | |
1010 (gnus-set-text-properties | |
1011 (point) | |
1012 (prog2 (insert (car button)) (point) (insert " ")) | |
1013 (list 'gnus-callback (cdr button) | |
1014 'face gnus-carpal-button-face | |
1015 gnus-mouse-face-prop 'highlight)))) | |
1016 (let ((fill-column (- (window-width) 2))) | |
1017 (fill-region (point-min) (point-max))) | |
1018 (set-window-point (get-buffer-window (current-buffer)) | |
1019 (point-min))))))) | |
1020 | |
1021 (defun gnus-carpal-select () | |
1022 "Select the button under point." | |
1023 (interactive) | |
1024 (let ((func (get-text-property (point) 'gnus-callback))) | |
1025 (if (null func) | |
1026 () | |
1027 (pop-to-buffer (symbol-value gnus-carpal-attached-buffer)) | |
1028 (call-interactively func)))) | |
1029 | |
1030 (defun gnus-carpal-mouse-select (event) | |
1031 "Select the button under the mouse pointer." | |
1032 (interactive "e") | |
1033 (mouse-set-point event) | |
1034 (gnus-carpal-select)) | |
1035 | |
1036 ;;; Allow redefinition of functions. | |
1037 (gnus-ems-redefine) | |
1038 | |
1039 (provide 'gnus-salt) | |
1040 | |
1041 ;;; gnus-salt.el ends here |