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