annotate lisp/gnus/gnus-salt.el @ 108:360340f9fd5f r20-1b6

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