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