Mercurial > emacs
annotate lisp/gnus/gnus-salt.el @ 111328:d3285b080feb
Silence compilation of mh-mime.el.
* lisp/mh-e/mh-mime.el (dots, type, ov): Avoid unnecessary declaration.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 02 Nov 2010 20:27:38 -0700 |
parents | 0fe64d68a522 |
children | 417b1e4d63cd |
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 |
104769
6558b4c12a5a
(gnus-pick-mouse-pick-region): Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, |
106815 | 4 ;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
17493 | 5 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
6 ;; 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
|
7 ;; Keywords: news |
17493 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
17493 | 12 ;; it under the terms of the GNU General Public License as published by |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
14 ;; (at your option) any later version. |
17493 | 15 |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
17493 | 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)) |
108256
f2dd5d43653f
Require easy-mmode for XEmacs when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108215
diff
changeset
|
29 (eval-when-compile |
f2dd5d43653f
Require easy-mmode for XEmacs when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108215
diff
changeset
|
30 (when (featurep 'xemacs) |
f2dd5d43653f
Require easy-mmode for XEmacs when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108215
diff
changeset
|
31 (require 'easy-mmode))) ; for `define-minor-mode' |
19521
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
32 |
17493 | 33 (require 'gnus) |
34 (require 'gnus-sum) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
35 (require 'gnus-win) |
17493 | 36 |
37 ;;; | |
38 ;;; gnus-pick-mode | |
39 ;;; | |
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 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
51 (when (featurep 'xemacs) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
52 (add-hook 'gnus-pick-mode-hook 'gnus-xmas-pick-menu-add)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
53 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
54 (defcustom gnus-mark-unpicked-articles-as-read nil |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
55 "*If non-nil, mark all unpicked articles as read." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
56 :type 'boolean |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
57 :group 'gnus-summary-pick) |
17493 | 58 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
59 (defcustom gnus-pick-elegant-flow t |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
60 "If non-nil, `gnus-pick-start-reading' runs |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
61 `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
|
62 :type 'boolean |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
63 :group 'gnus-summary-pick) |
17493 | 64 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
65 (defcustom gnus-summary-pick-line-format |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
66 "%-5P %U\%R\%z\%I\%(%[%4L: %-23,23n%]%) %s\n" |
17493 | 67 "*The format specification of the lines in pick buffers. |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
68 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
|
69 :type 'string |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
70 :group 'gnus-summary-pick) |
17493 | 71 |
72 ;;; Internal variables. | |
73 | |
108215
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
74 (defvar gnus-pick-mode-map |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
75 (let ((map (make-sparse-keymap))) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
76 (gnus-define-keys map |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
77 " " gnus-pick-next-page |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
78 "u" gnus-pick-unmark-article-or-thread |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
79 "." gnus-pick-article-or-thread |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
80 gnus-down-mouse-2 gnus-pick-mouse-pick-region |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
81 "\r" gnus-pick-start-reading) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
82 map)) |
17493 | 83 |
84 (defun gnus-pick-make-menu-bar () | |
85 (unless (boundp 'gnus-pick-menu) | |
86 (easy-menu-define | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
87 gnus-pick-menu gnus-pick-mode-map "" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
88 '("Pick" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
89 ("Pick" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
90 ["Article" gnus-summary-mark-as-processable t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
91 ["Thread" gnus-uu-mark-thread t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
92 ["Region" gnus-uu-mark-region t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
93 ["Regexp" gnus-uu-mark-by-regexp t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
94 ["Buffer" gnus-uu-mark-buffer t]) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
95 ("Unpick" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
96 ["Article" gnus-summary-unmark-as-processable t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
97 ["Thread" gnus-uu-unmark-thread t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
98 ["Region" gnus-uu-unmark-region t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
99 ["Regexp" gnus-uu-unmark-by-regexp t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
100 ["Buffer" gnus-summary-unmark-all-processable t]) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
101 ["Start reading" gnus-pick-start-reading t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
102 ["Switch pick mode off" gnus-pick-mode gnus-pick-mode])))) |
17493 | 103 |
108287
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
104 (eval-when-compile |
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
105 (when (featurep 'xemacs) |
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
106 (defvar gnus-pick-mode-on-hook) |
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
107 (defvar gnus-pick-mode-off-hook))) |
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
108 |
108215
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
109 (define-minor-mode gnus-pick-mode |
17493 | 110 "Minor mode for providing a pick-and-read interface in Gnus summary buffers. |
111 | |
112 \\{gnus-pick-mode-map}" | |
108215
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
113 :lighter " Pick" :keymap gnus-pick-mode-map |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
114 (cond |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
115 ((not (derived-mode-p 'gnus-summary-mode)) (setq gnus-pick-mode nil)) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
116 ((not gnus-pick-mode) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
117 ;; FIXME: a buffer-local minor mode removing globally from a hook?? |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
118 (remove-hook 'gnus-message-setup-hook 'gnus-pick-setup-message)) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
119 (t |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
120 ;; Make sure that we don't select any articles upon group entry. |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
121 (set (make-local-variable 'gnus-auto-select-first) nil) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
122 ;; Change line format. |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
123 (setq gnus-summary-line-format gnus-summary-pick-line-format) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
124 (setq gnus-summary-line-format-spec nil) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
125 (gnus-update-format-specifications nil 'summary) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
126 (gnus-update-summary-mark-positions) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
127 ;; FIXME: a buffer-local minor mode adding globally to a hook?? |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
128 (add-hook 'gnus-message-setup-hook 'gnus-pick-setup-message) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
129 (set (make-local-variable 'gnus-summary-goto-unread) 'never) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
130 ;; Set up the menu. |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
131 (when (gnus-visual-p 'pick-menu 'menu) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
132 (gnus-pick-make-menu-bar))))) |
17493 | 133 |
134 (defun gnus-pick-setup-message () | |
135 "Make Message do the right thing on exit." | |
136 (when (and (gnus-buffer-live-p gnus-summary-buffer) | |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
137 (with-current-buffer gnus-summary-buffer |
17493 | 138 gnus-pick-mode)) |
139 (message-add-action | |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
140 `(gnus-configure-windows ,gnus-current-window-configuration t) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
141 'send 'exit 'postpone 'kill))) |
17493 | 142 |
143 (defvar gnus-pick-line-number 1) | |
144 (defun gnus-pick-line-number () | |
145 "Return the current line number." | |
146 (if (bobp) | |
147 (setq gnus-pick-line-number 1) | |
148 (incf gnus-pick-line-number))) | |
149 | |
150 (defun gnus-pick-start-reading (&optional catch-up) | |
151 "Start reading the picked articles. | |
152 If given a prefix, mark all unpicked articles as read." | |
153 (interactive "P") | |
154 (if gnus-newsgroup-processable | |
155 (progn | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
156 (gnus-summary-limit-to-articles nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
157 (when (or catch-up gnus-mark-unpicked-articles-as-read) |
17493 | 158 (gnus-summary-limit-mark-excluded-as-read)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
159 (gnus-summary-first-article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
160 (gnus-configure-windows |
17493 | 161 (if gnus-pick-display-summary 'article 'pick) t)) |
162 (if gnus-pick-elegant-flow | |
163 (progn | |
164 (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
|
165 (gnus-summary-catchup nil t)) |
17493 | 166 (if (gnus-group-quit-config gnus-newsgroup-name) |
167 (gnus-summary-exit) | |
168 (gnus-summary-next-group))) | |
169 (error "No articles have been picked")))) | |
170 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
171 (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
|
172 "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
|
173 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
|
174 (let (pos) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
175 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
176 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
177 (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
|
178 (setq pos (point)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
179 (if (not pos) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
180 (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
|
181 (goto-char pos)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
182 |
17493 | 183 (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
|
184 "Pick the article on the current line. |
17493 | 185 If ARG, pick the article on that line instead." |
186 (interactive "P") | |
187 (when arg | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
188 (gnus-pick-goto-article arg)) |
17493 | 189 (gnus-summary-mark-as-processable 1)) |
190 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
191 (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
|
192 "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
|
193 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
|
194 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
|
195 (interactive "P") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
196 (when arg |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
197 (gnus-pick-goto-article 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 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
199 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
200 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
201 (gnus-uu-mark-thread)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
202 (forward-line 1)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
203 (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
|
204 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
205 (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
|
206 "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
|
207 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
|
208 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
|
209 (interactive "P") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
210 (when arg |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
211 (gnus-pick-goto-article arg)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
212 (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
|
213 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
214 (gnus-uu-unmark-thread)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
215 (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
|
216 |
17493 | 217 (defun gnus-pick-mouse-pick (e) |
218 (interactive "e") | |
219 (mouse-set-point e) | |
220 (save-excursion | |
221 (gnus-summary-mark-as-processable 1))) | |
222 | |
223 (defun gnus-pick-mouse-pick-region (start-event) | |
224 "Pick articles that the mouse is dragged over. | |
225 This must be bound to a button-down mouse event." | |
226 (interactive "e") | |
227 (mouse-minibuffer-check start-event) | |
228 (let* ((echo-keystrokes 0) | |
229 (start-posn (event-start start-event)) | |
230 (start-point (posn-point start-posn)) | |
56945
69f3d9a9952b
(gnus-pick-mouse-pick-region): Switch 1 => point-min.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56927
diff
changeset
|
231 (start-line (1+ (count-lines (point-min) start-point))) |
17493 | 232 (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
|
233 (bounds (gnus-window-edges start-window)) |
17493 | 234 (top (nth 1 bounds)) |
235 (bottom (if (window-minibuffer-p start-window) | |
236 (nth 3 bounds) | |
237 ;; Don't count the mode line. | |
238 (1- (nth 3 bounds)))) | |
239 (click-count (1- (event-click-count start-event)))) | |
240 (setq mouse-selection-click-count click-count) | |
241 (setq mouse-selection-click-count-buffer (current-buffer)) | |
242 (mouse-set-point start-event) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
243 ;; In case the down click is in the middle of some intangible text, |
17493 | 244 ;; use the end of that text, and put it in START-POINT. |
245 (when (< (point) start-point) | |
246 (goto-char start-point)) | |
247 (gnus-pick-article) | |
248 (setq start-point (point)) | |
249 ;; end-of-range is used only in the single-click case. | |
250 ;; It is the place where the drag has reached so far | |
251 ;; (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
|
252 (let (event end end-point (end-of-range (point))) |
17493 | 253 (track-mouse |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
254 (while (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
255 (setq event (cdr (gnus-read-event-char))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
256 (or (mouse-movement-p event) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
257 (eq (car-safe event) 'switch-frame))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
258 (if (eq (car-safe event) 'switch-frame) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
259 nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
260 (setq end (event-end event) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
261 end-point (posn-point end)) |
17493 | 262 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
263 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
264 ;; Are we moving within the original window? |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
265 ((and (eq (posn-window end) start-window) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
266 (integer-or-marker-p end-point)) |
56945
69f3d9a9952b
(gnus-pick-mouse-pick-region): Switch 1 => point-min.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56927
diff
changeset
|
267 ;; Go to START-POINT first, so that when we move to END-POINT, |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
268 ;; if it's in the middle of intangible text, |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
269 ;; point jumps in the direction away from START-POINT. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
270 (goto-char start-point) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
271 (goto-char end-point) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
272 (gnus-pick-article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
273 ;; In case the user moved his mouse really fast, pick |
56945
69f3d9a9952b
(gnus-pick-mouse-pick-region): Switch 1 => point-min.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56927
diff
changeset
|
274 ;; articles on the line between this one and the last one. |
69f3d9a9952b
(gnus-pick-mouse-pick-region): Switch 1 => point-min.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56927
diff
changeset
|
275 (let* ((this-line (1+ (count-lines (point-min) end-point))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
276 (min-line (min this-line start-line)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
277 (max-line (max this-line start-line))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
278 (while (< min-line max-line) |
104769
6558b4c12a5a
(gnus-pick-mouse-pick-region): Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
279 (goto-char (point-min)) |
6558b4c12a5a
(gnus-pick-mouse-pick-region): Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
280 (forward-line (1- min-line)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
281 (gnus-pick-article) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
282 (setq min-line (1+ min-line))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
283 (setq start-line this-line)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
284 (when (zerop (% click-count 3)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
285 (setq end-of-range (point)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
286 (t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
287 (let ((mouse-row (cdr (cdr (mouse-position))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
288 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
289 ((null mouse-row)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
290 ((< mouse-row top) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
291 (mouse-scroll-subr start-window (- mouse-row top))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
292 ((>= mouse-row bottom) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
293 (mouse-scroll-subr start-window |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
294 (1+ (- mouse-row bottom))))))))))) |
17493 | 295 (when (consp event) |
296 (let ((fun (key-binding (vector (car event))))) | |
297 ;; Run the binding of the terminating up-event, if possible. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
298 ;; In the case of a multiple click, it gives the wrong results, |
17493 | 299 ;; because it would fail to set up a region. |
300 (when nil | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
301 ;; (and (= (mod mouse-selection-click-count 3) 0) (fboundp fun)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
302 ;; In this case, we can just let the up-event execute normally. |
17493 | 303 (let ((end (event-end event))) |
304 ;; Set the position in the event before we replay it, | |
305 ;; because otherwise it may have a position in the wrong | |
306 ;; buffer. | |
307 (setcar (cdr end) end-of-range) | |
308 ;; Delete the overlay before calling the function, | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
309 ;; because delete-overlay increases buffer-modified-tick. |
17493 | 310 (push event unread-command-events)))))))) |
311 | |
312 (defun gnus-pick-next-page () | |
313 "Go to the next page. If at the end of the buffer, start reading articles." | |
314 (interactive) | |
315 (let ((scroll-in-place nil)) | |
316 (condition-case nil | |
317 (scroll-up) | |
318 (end-of-buffer (gnus-pick-start-reading))))) | |
319 | |
320 ;;; | |
321 ;;; gnus-binary-mode | |
322 ;;; | |
323 | |
324 (defvar gnus-binary-mode-hook nil | |
325 "Hook run in summary binary mode buffers.") | |
326 | |
108215
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
327 (defvar gnus-binary-mode-map |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
328 (let ((map (make-sparse-keymap))) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
329 (gnus-define-keys map |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
330 "g" gnus-binary-show-article) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
331 map)) |
17493 | 332 |
333 (defun gnus-binary-make-menu-bar () | |
334 (unless (boundp 'gnus-binary-menu) | |
335 (easy-menu-define | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
336 gnus-binary-menu gnus-binary-mode-map "" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
337 '("Pick" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
338 ["Switch binary mode off" gnus-binary-mode t])))) |
17493 | 339 |
108287
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
340 (eval-when-compile |
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
341 (when (featurep 'xemacs) |
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
342 (defvar gnus-binary-mode-on-hook) |
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
343 (defvar gnus-binary-mode-off-hook))) |
c0d13767677a
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108256
diff
changeset
|
344 |
108215
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
345 (define-minor-mode gnus-binary-mode |
17493 | 346 "Minor mode for providing a binary group interface in Gnus summary buffers." |
108215
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
347 :lighter " Binary" :keymap gnus-binary-mode-map |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
348 (cond |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
349 ((not (derived-mode-p 'gnus-summary-mode)) (setq gnus-binary-mode nil)) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
350 (gnus-binary-mode |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
351 ;; Make sure that we don't select any articles upon group entry. |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
352 (make-local-variable 'gnus-auto-select-first) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
353 (setq gnus-auto-select-first nil) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
354 (make-local-variable 'gnus-summary-display-article-function) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
355 (setq gnus-summary-display-article-function 'gnus-binary-display-article) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
356 ;; Set up the menu. |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
357 (when (gnus-visual-p 'binary-menu 'menu) |
8264830363ca
Use define-minor-mode in Gnus where applicable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
358 (gnus-binary-make-menu-bar))))) |
17493 | 359 |
360 (defun gnus-binary-display-article (article &optional all-header) | |
361 "Run ARTICLE through the binary decode functions." | |
362 (when (gnus-summary-goto-subject article) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
363 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) |
17493 | 364 (gnus-uu-decode-uu)))) |
365 | |
366 (defun gnus-binary-show-article (&optional arg) | |
367 "Bypass the binary functions and show the article." | |
368 (interactive "P") | |
369 (let (gnus-summary-display-article-function) | |
370 (gnus-summary-show-article arg))) | |
371 | |
372 ;;; | |
373 ;;; gnus-tree-mode | |
374 ;;; | |
375 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
376 (defcustom gnus-tree-line-format "%(%[%3,3n%]%)" |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
377 "Format of tree elements." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
378 :type 'string |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
379 :group 'gnus-summary-tree) |
17493 | 380 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
381 (defcustom gnus-tree-minimize-window t |
17493 | 382 "If non-nil, minimize the tree buffer window. |
383 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
|
384 lines." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
385 :type '(choice boolean |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
386 integer) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
387 :group 'gnus-summary-tree) |
17493 | 388 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
389 (defcustom gnus-selected-tree-face 'modeline |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
390 "*Face used for highlighting selected articles in the thread tree." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
391 :type 'face |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
392 :group 'gnus-summary-tree) |
17493 | 393 |
394 (defvar gnus-tree-brackets '((?\[ . ?\]) (?\( . ?\)) | |
395 (?\{ . ?\}) (?< . ?>)) | |
396 "Brackets used in tree nodes.") | |
397 | |
398 (defvar gnus-tree-parent-child-edges '(?- ?\\ ?|) | |
399 "Characters used to connect parents with children.") | |
400 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
401 (defcustom gnus-tree-mode-line-format "Gnus: %%b %S %Z" |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
402 "*The format specification for the tree mode line." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
403 :type 'string |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
404 :group 'gnus-summary-tree) |
17493 | 405 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
406 (defcustom gnus-generate-tree-function 'gnus-generate-vertical-tree |
17493 | 407 "*Function for generating a thread tree. |
408 Two predefined functions are available: | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
409 `gnus-generate-horizontal-tree' and `gnus-generate-vertical-tree'." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
410 :type '(radio (function-item gnus-generate-vertical-tree) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
411 (function-item gnus-generate-horizontal-tree) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
412 (function :tag "Other" nil)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
413 :group 'gnus-summary-tree) |
17493 | 414 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
415 (defcustom gnus-tree-mode-hook nil |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
416 "*Hook run in tree mode buffers." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
417 :type 'hook |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
418 :group 'gnus-summary-tree) |
17493 | 419 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
420 (when (featurep 'xemacs) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
421 (add-hook 'gnus-tree-mode-hook 'gnus-xmas-tree-menu-add) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
422 (add-hook 'gnus-tree-mode-hook 'gnus-xmas-switch-horizontal-scrollbar-off)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
423 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
424 |
17493 | 425 ;;; Internal variables. |
426 | |
427 (defvar gnus-tree-line-format-alist | |
428 `((?n gnus-tmp-name ?s) | |
429 (?f gnus-tmp-from ?s) | |
430 (?N gnus-tmp-number ?d) | |
431 (?\[ gnus-tmp-open-bracket ?c) | |
432 (?\] gnus-tmp-close-bracket ?c) | |
433 (?s gnus-tmp-subject ?s))) | |
434 | |
435 (defvar gnus-tree-mode-line-format-alist gnus-summary-mode-line-format-alist) | |
436 | |
437 (defvar gnus-tree-mode-line-format-spec nil) | |
438 (defvar gnus-tree-line-format-spec nil) | |
439 | |
440 (defvar gnus-tree-node-length nil) | |
441 (defvar gnus-selected-tree-overlay nil) | |
442 | |
443 (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
|
444 (defvar gnus-tree-inhibit nil) |
17493 | 445 |
446 (defvar gnus-tree-mode-map nil) | |
447 (put 'gnus-tree-mode 'mode-class 'special) | |
448 | |
449 (unless gnus-tree-mode-map | |
450 (setq gnus-tree-mode-map (make-keymap)) | |
451 (suppress-keymap gnus-tree-mode-map) | |
452 (gnus-define-keys | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
453 gnus-tree-mode-map |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
454 "\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
|
455 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
|
456 "\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
|
457 "h" gnus-tree-show-summary |
17493 | 458 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
459 "\C-c\C-i" gnus-info-find-node) |
17493 | 460 |
461 (substitute-key-definition | |
462 'undefined 'gnus-tree-read-summary-keys gnus-tree-mode-map)) | |
463 | |
464 (defun gnus-tree-make-menu-bar () | |
465 (unless (boundp 'gnus-tree-menu) | |
466 (easy-menu-define | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
467 gnus-tree-menu gnus-tree-mode-map "" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
468 '("Tree" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
469 ["Select article" gnus-tree-select-article t])))) |
17493 | 470 |
471 (defun gnus-tree-mode () | |
472 "Major mode for displaying thread trees." | |
473 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
474 (gnus-set-format 'tree-mode) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
475 (gnus-set-format 'tree t) |
17493 | 476 (when (gnus-visual-p 'tree-menu 'menu) |
477 (gnus-tree-make-menu-bar)) | |
478 (kill-all-local-variables) | |
479 (gnus-simplify-mode-line) | |
480 (setq mode-name "Tree") | |
481 (setq major-mode 'gnus-tree-mode) | |
482 (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
|
483 (buffer-disable-undo) |
17493 | 484 (setq buffer-read-only t) |
485 (setq truncate-lines t) | |
486 (save-excursion | |
487 (gnus-set-work-buffer) | |
488 (gnus-tree-node-insert (make-mail-header "") nil) | |
489 (setq gnus-tree-node-length (1- (point)))) | |
62890
4b7fa3ee8e9e
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-336
Miles Bader <miles@gnu.org>
parents:
56945
diff
changeset
|
490 (gnus-run-mode-hooks 'gnus-tree-mode-hook)) |
17493 | 491 |
492 (defun gnus-tree-read-summary-keys (&optional arg) | |
493 "Read a summary buffer key sequence and execute it." | |
494 (interactive "P") | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
495 (unless gnus-tree-inhibit |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
496 (let ((buf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
497 (gnus-tree-inhibit t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
498 win) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
499 (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
|
500 (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
|
501 (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
|
502 (select-window win) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
503 (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
|
504 (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
|
505 (gnus-tree-minimize))))) |
17493 | 506 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
507 (defun gnus-tree-show-summary () |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
508 "Reconfigure windows to show summary buffer." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
509 (interactive) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
510 (if (not (gnus-buffer-live-p gnus-summary-buffer)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
511 (error "There is no summary buffer for this tree buffer") |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
512 (gnus-configure-windows 'article) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
513 (gnus-summary-goto-subject gnus-current-article))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
514 |
17493 | 515 (defun gnus-tree-select-article (article) |
516 "Select the article under point, if any." | |
517 (interactive (list (gnus-tree-article-number))) | |
518 (let ((buf (current-buffer))) | |
519 (when article | |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
520 (with-current-buffer gnus-summary-buffer |
17493 | 521 (gnus-summary-goto-article article)) |
522 (select-window (get-buffer-window buf))))) | |
523 | |
524 (defun gnus-tree-pick-article (e) | |
525 "Select the article under the mouse pointer." | |
526 (interactive "e") | |
527 (mouse-set-point e) | |
528 (gnus-tree-select-article (gnus-tree-article-number))) | |
529 | |
530 (defun gnus-tree-article-number () | |
531 (get-text-property (point) 'gnus-number)) | |
532 | |
533 (defun gnus-tree-article-region (article) | |
534 "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
|
535 (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
|
536 (point-min) (point-max) 'gnus-number article))) |
17493 | 537 (when pos |
538 (cons pos (next-single-property-change pos 'gnus-number))))) | |
539 | |
540 (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
|
541 (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
|
542 (point-min) (point-max) 'gnus-number article))) |
17493 | 543 (when pos |
544 (goto-char pos)))) | |
545 | |
546 (defun gnus-tree-recenter () | |
547 "Center point in the tree window." | |
548 (let ((selected (selected-window)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
549 (tree-window (gnus-get-buffer-window gnus-tree-buffer t))) |
17493 | 550 (when tree-window |
551 (select-window tree-window) | |
552 (when gnus-selected-tree-overlay | |
553 (goto-char (or (gnus-overlay-end gnus-selected-tree-overlay) 1))) | |
554 (let* ((top (cond ((< (window-height) 4) 0) | |
555 ((< (window-height) 7) 1) | |
556 (t 2))) | |
557 (height (1- (window-height))) | |
558 (bottom (save-excursion (goto-char (point-max)) | |
559 (forward-line (- height)) | |
560 (point)))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
561 ;; Set the window start to either `bottom', which is the biggest |
17493 | 562 ;; possible valid number, or the second line from the top, |
563 ;; whichever is the least. | |
564 (set-window-start | |
565 tree-window (min bottom (save-excursion | |
566 (forward-line (- top)) (point))))) | |
567 (select-window selected)))) | |
568 | |
569 (defun gnus-get-tree-buffer () | |
570 "Return the tree buffer properly initialized." | |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
571 (with-current-buffer (gnus-get-buffer-create gnus-tree-buffer) |
17493 | 572 (unless (eq major-mode 'gnus-tree-mode) |
573 (gnus-tree-mode)) | |
574 (current-buffer))) | |
575 | |
576 (defun gnus-tree-minimize () | |
577 (when (and gnus-tree-minimize-window | |
578 (not (one-window-p))) | |
579 (let ((windows 0) | |
580 tot-win-height) | |
581 (walk-windows (lambda (window) (incf windows))) | |
582 (setq tot-win-height | |
583 (- (frame-height) | |
584 (* window-min-height (1- windows)) | |
585 2)) | |
586 (let* ((window-min-height 2) | |
587 (height (count-lines (point-min) (point-max))) | |
588 (min (max (1- window-min-height) height)) | |
589 (tot (if (numberp gnus-tree-minimize-window) | |
590 (min gnus-tree-minimize-window min) | |
591 min)) | |
592 (win (get-buffer-window (current-buffer))) | |
593 (wh (and win (1- (window-height win))))) | |
594 (setq tot (min tot tot-win-height)) | |
595 (when (and win | |
596 (not (eq tot wh))) | |
597 (let ((selected (selected-window))) | |
598 (when (ignore-errors (select-window win)) | |
599 (enlarge-window (- tot wh)) | |
600 (select-window selected)))))))) | |
601 | |
602 ;;; Generating the tree. | |
603 | |
604 (defun gnus-tree-node-insert (header sparse &optional adopted) | |
605 (let* ((dummy (stringp header)) | |
606 (header (if (vectorp header) header | |
607 (progn | |
608 (setq header (make-mail-header "*****")) | |
609 (mail-header-set-number header 0) | |
610 (mail-header-set-lines header 0) | |
611 (mail-header-set-chars header 0) | |
612 header))) | |
613 (gnus-tmp-from (mail-header-from header)) | |
614 (gnus-tmp-subject (mail-header-subject header)) | |
615 (gnus-tmp-number (mail-header-number header)) | |
616 (gnus-tmp-name | |
617 (cond | |
618 ((string-match "(.+)" gnus-tmp-from) | |
619 (substring gnus-tmp-from | |
620 (1+ (match-beginning 0)) (1- (match-end 0)))) | |
621 ((string-match "<[^>]+> *$" gnus-tmp-from) | |
622 (let ((beg (match-beginning 0))) | |
623 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from) | |
624 (substring gnus-tmp-from (1+ (match-beginning 0)) | |
625 (1- (match-end 0)))) | |
626 (substring gnus-tmp-from 0 beg)))) | |
627 ((memq gnus-tmp-number sparse) | |
628 "***") | |
629 (t gnus-tmp-from))) | |
630 (gnus-tmp-open-bracket | |
631 (cond ((memq gnus-tmp-number sparse) | |
632 (caadr gnus-tree-brackets)) | |
633 (dummy (caaddr gnus-tree-brackets)) | |
634 (adopted (car (nth 3 gnus-tree-brackets))) | |
635 (t (caar gnus-tree-brackets)))) | |
636 (gnus-tmp-close-bracket | |
637 (cond ((memq gnus-tmp-number sparse) | |
638 (cdadr gnus-tree-brackets)) | |
639 (adopted (cdr (nth 3 gnus-tree-brackets))) | |
640 (dummy | |
641 (cdaddr gnus-tree-brackets)) | |
642 (t (cdar gnus-tree-brackets)))) | |
643 (buffer-read-only nil) | |
644 beg end) | |
645 (gnus-add-text-properties | |
646 (setq beg (point)) | |
647 (setq end (progn (eval gnus-tree-line-format-spec) (point))) | |
648 (list 'gnus-number gnus-tmp-number)) | |
649 (when (or t (gnus-visual-p 'tree-highlight 'highlight)) | |
650 (gnus-tree-highlight-node gnus-tmp-number beg end)))) | |
651 | |
652 (defun gnus-tree-highlight-node (article beg end) | |
653 "Highlight current line according to `gnus-summary-highlight'." | |
654 (let ((list gnus-summary-highlight) | |
655 face) | |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
656 (with-current-buffer gnus-summary-buffer |
17493 | 657 (let* ((score (or (cdr (assq article gnus-newsgroup-scored)) |
658 gnus-summary-default-score 0)) | |
659 (default gnus-summary-default-score) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
660 (default-high gnus-summary-default-high-score) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
661 (default-low gnus-summary-default-low-score) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
662 (uncached (memq article gnus-newsgroup-undownloaded)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
663 (downloaded (not uncached)) |
17493 | 664 (mark (or (gnus-summary-article-mark article) gnus-unread-mark))) |
665 ;; Eval the cars of the lists until we find a match. | |
666 (while (and list | |
667 (not (eval (caar list)))) | |
668 (setq list (cdr list))))) | |
669 (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
|
670 (gnus-put-text-property-excluding-characters-with-faces |
17493 | 671 beg end 'face |
672 (if (boundp face) (symbol-value face) face))))) | |
673 | |
674 (defun gnus-tree-indent (level) | |
675 (insert (make-string (1- (* (1+ gnus-tree-node-length) level)) ? ))) | |
676 | |
677 (defvar gnus-tmp-limit) | |
678 (defvar gnus-tmp-sparse) | |
679 (defvar gnus-tmp-indent) | |
680 | |
681 (defun gnus-generate-tree (thread) | |
682 "Generate a thread tree for THREAD." | |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
683 (with-current-buffer (gnus-get-tree-buffer) |
17493 | 684 (let ((buffer-read-only nil) |
685 (gnus-tmp-indent 0)) | |
686 (erase-buffer) | |
687 (funcall gnus-generate-tree-function thread 0) | |
688 (gnus-set-mode-line 'tree) | |
689 (goto-char (point-min)) | |
690 (gnus-tree-minimize) | |
691 (gnus-tree-recenter) | |
692 (let ((selected (selected-window))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
693 (when (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
694 (select-window (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t)) |
17493 | 695 (gnus-horizontal-recenter) |
696 (select-window selected)))))) | |
697 | |
698 (defun gnus-generate-horizontal-tree (thread level &optional dummyp adopted) | |
699 "Generate a horizontal tree." | |
700 (let* ((dummy (stringp (car thread))) | |
701 (do (or dummy | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
702 (and (car thread) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
703 (memq (mail-header-number (car thread)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
704 gnus-tmp-limit)))) |
17493 | 705 col beg) |
706 (if (not do) | |
707 ;; We don't want this article. | |
708 (setq thread (cdr thread)) | |
709 (if (not (bolp)) | |
710 ;; Not the first article on the line, so we insert a "-". | |
711 (insert (car gnus-tree-parent-child-edges)) | |
712 ;; If the level isn't zero, then we insert some indentation. | |
713 (unless (zerop level) | |
714 (gnus-tree-indent level) | |
715 (insert (cadr gnus-tree-parent-child-edges)) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78634
diff
changeset
|
716 (setq col (- (setq beg (point)) (point-at-bol) 1)) |
17493 | 717 ;; Draw "|" lines upwards. |
718 (while (progn | |
719 (forward-line -1) | |
720 (forward-char col) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
721 (eq (char-after) ? )) |
17493 | 722 (delete-char 1) |
723 (insert (caddr gnus-tree-parent-child-edges))) | |
724 (goto-char beg))) | |
725 (setq dummyp nil) | |
726 ;; Insert the article node. | |
727 (gnus-tree-node-insert (pop thread) gnus-tmp-sparse adopted)) | |
728 (if (null thread) | |
729 ;; End of the thread, so we go to the next line. | |
730 (unless (bolp) | |
731 (insert "\n")) | |
732 ;; Recurse downwards in all children of this article. | |
733 (while thread | |
734 (gnus-generate-horizontal-tree | |
735 (pop thread) (if do (1+ level) level) | |
736 (or dummyp dummy) dummy))))) | |
737 | |
738 (defsubst gnus-tree-indent-vertical () | |
739 (let ((len (- (* (1+ gnus-tree-node-length) gnus-tmp-indent) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
78634
diff
changeset
|
740 (- (point) (point-at-bol))))) |
17493 | 741 (when (> len 0) |
742 (insert (make-string len ? ))))) | |
743 | |
744 (defsubst gnus-tree-forward-line (n) | |
745 (while (>= (decf n) 0) | |
746 (unless (zerop (forward-line 1)) | |
747 (end-of-line) | |
748 (insert "\n"))) | |
749 (end-of-line)) | |
750 | |
751 (defun gnus-generate-vertical-tree (thread level &optional dummyp adopted) | |
752 "Generate a vertical tree." | |
753 (let* ((dummy (stringp (car thread))) | |
754 (do (or dummy | |
755 (and (car thread) | |
756 (memq (mail-header-number (car thread)) | |
757 gnus-tmp-limit)))) | |
758 beg) | |
759 (if (not do) | |
760 ;; We don't want this article. | |
761 (setq thread (cdr thread)) | |
762 (if (not (save-excursion (beginning-of-line) (bobp))) | |
763 ;; Not the first article on the line, so we insert a "-". | |
764 (progn | |
765 (gnus-tree-indent-vertical) | |
766 (insert (make-string (/ gnus-tree-node-length 2) ? )) | |
767 (insert (caddr gnus-tree-parent-child-edges)) | |
768 (gnus-tree-forward-line 1)) | |
769 ;; If the level isn't zero, then we insert some indentation. | |
770 (unless (zerop gnus-tmp-indent) | |
771 (gnus-tree-forward-line (1- (* 2 level))) | |
772 (gnus-tree-indent-vertical) | |
773 (delete-char -1) | |
774 (insert (cadr gnus-tree-parent-child-edges)) | |
775 (setq beg (point)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
776 (forward-char -1) |
17493 | 777 ;; Draw "-" lines leftwards. |
56945
69f3d9a9952b
(gnus-pick-mouse-pick-region): Switch 1 => point-min.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56927
diff
changeset
|
778 (while (and (not (bobp)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
779 (eq (char-after (1- (point))) ? )) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
780 (delete-char -1) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
781 (insert (car gnus-tree-parent-child-edges)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
782 (forward-char -1)) |
17493 | 783 (goto-char beg) |
784 (gnus-tree-forward-line 1))) | |
785 (setq dummyp nil) | |
786 ;; Insert the article node. | |
787 (gnus-tree-indent-vertical) | |
788 (gnus-tree-node-insert (pop thread) gnus-tmp-sparse adopted) | |
789 (gnus-tree-forward-line 1)) | |
790 (if (null thread) | |
791 ;; End of the thread, so we go to the next line. | |
792 (progn | |
793 (goto-char (point-min)) | |
794 (end-of-line) | |
795 (incf gnus-tmp-indent)) | |
796 ;; Recurse downwards in all children of this article. | |
797 (while thread | |
798 (gnus-generate-vertical-tree | |
799 (pop thread) (if do (1+ level) level) | |
800 (or dummyp dummy) dummy))))) | |
801 | |
802 ;;; Interface functions. | |
803 | |
804 (defun gnus-possibly-generate-tree (article &optional force) | |
805 "Generate the thread tree for ARTICLE if it isn't displayed already." | |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
806 (when (with-current-buffer gnus-summary-buffer |
17493 | 807 (and gnus-use-trees |
808 gnus-show-threads | |
809 (vectorp (gnus-summary-article-header article)))) | |
810 (save-excursion | |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
811 (let ((top (with-current-buffer gnus-summary-buffer |
17493 | 812 (gnus-cut-thread |
813 (gnus-remove-thread | |
814 (mail-header-id | |
815 (gnus-summary-article-header article)) | |
816 t)))) | |
817 (gnus-tmp-limit gnus-newsgroup-limit) | |
818 (gnus-tmp-sparse gnus-newsgroup-sparse)) | |
819 (when (or force | |
820 (not (eq top gnus-tree-displayed-thread))) | |
821 (gnus-generate-tree top) | |
822 (setq gnus-tree-displayed-thread top)))))) | |
823 | |
824 (defun gnus-tree-open (group) | |
825 (gnus-get-tree-buffer)) | |
826 | |
827 (defun gnus-tree-close (group) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
828 (gnus-kill-buffer gnus-tree-buffer)) |
17493 | 829 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
830 (defun gnus-tree-perhaps-minimize () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
831 (when (and gnus-tree-minimize-window |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
832 (get-buffer gnus-tree-buffer)) |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
833 (with-current-buffer gnus-tree-buffer |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
834 (gnus-tree-minimize)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
835 |
17493 | 836 (defun gnus-highlight-selected-tree (article) |
837 "Highlight the selected article in the tree." | |
838 (let ((buf (current-buffer)) | |
839 region) | |
840 (set-buffer gnus-tree-buffer) | |
841 (when (setq region (gnus-tree-article-region article)) | |
842 (when (or (not gnus-selected-tree-overlay) | |
843 (gnus-extent-detached-p gnus-selected-tree-overlay)) | |
844 ;; Create a new overlay. | |
845 (gnus-overlay-put | |
56945
69f3d9a9952b
(gnus-pick-mouse-pick-region): Switch 1 => point-min.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56927
diff
changeset
|
846 (setq gnus-selected-tree-overlay |
69f3d9a9952b
(gnus-pick-mouse-pick-region): Switch 1 => point-min.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56927
diff
changeset
|
847 (gnus-make-overlay (point-min) (1+ (point-min)))) |
17493 | 848 'face gnus-selected-tree-face)) |
849 ;; Move the overlay to the article. | |
850 (gnus-move-overlay | |
851 gnus-selected-tree-overlay (goto-char (car region)) (cdr region)) | |
852 (gnus-tree-minimize) | |
853 (gnus-tree-recenter) | |
854 (let ((selected (selected-window))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
855 (when (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
856 (select-window (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t)) |
17493 | 857 (gnus-horizontal-recenter) |
858 (select-window selected)))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
859 ;; If we remove this save-excursion, it updates the wrong mode lines?!? |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
860 (with-current-buffer gnus-tree-buffer |
17493 | 861 (gnus-set-mode-line 'tree)) |
862 (set-buffer buf))) | |
863 | |
864 (defun gnus-tree-highlight-article (article face) | |
78634
933891e04bae
Use with-current-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78224
diff
changeset
|
865 (with-current-buffer (gnus-get-tree-buffer) |
17493 | 866 (let (region) |
867 (when (setq region (gnus-tree-article-region article)) | |
868 (gnus-put-text-property (car region) (cdr region) 'face face) | |
869 (set-window-point | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
870 (gnus-get-buffer-window (current-buffer) t) (cdr region)))))) |
17493 | 871 |
872 ;;; Allow redefinition of functions. | |
873 (gnus-ems-redefine) | |
874 | |
875 (provide 'gnus-salt) | |
876 | |
877 ;;; gnus-salt.el ends here |