1 ;;; gnus-visual: display-oriented parts of Gnus.
2 ;; Copyright (C) 1995 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 (require (if gnus-xemacs 'auc-menu 'easymenu))
30 (defvar gnus-summary-selected-face 'underline
31 "*Face used for highlighting the current article in the summary buffer.")
33 (defvar gnus-visual-summary-highlight
34 '(((> score default) . bold)
35 ((< score default) . italic))
36 "*Alist of `(FORM . FACE)'.
37 Summary lines are highlighted with the FACE for the first FORM which
38 evaluate to a non-nil value.
40 Point will be at the beginning of the line when FORM is evaluated.
41 The following can be used for convenience:
43 score: (gnus-summary-article-score)
44 default: gnus-summary-default-score
45 below: gnus-summary-mark-below
47 To check for marks, e.g. to underline replied articles, use
48 `gnus-summary-article-mark':
50 ((= (gnus-summary-article-mark) gnus-replied-mark) . underline)")
53 (autoload 'nnkiboze-generate-groups "nnkiboze"))
57 ;; Make a menu bar item.
58 (defun gnus-group-make-menu-bar ()
60 gnus-group-reading-menu
64 ["Read" gnus-group-read-group t]
65 ["Select" gnus-group-select-group t]
66 ["Catch up" gnus-group-catchup-current t]
67 ["Catch up all articles" gnus-group-catchup-current-all t]
68 ["Check for new articles" gnus-group-get-new-news-this-group t]
69 ["Toggle subscription" gnus-group-unsubscribe-current-group t]
70 ["Kill" gnus-group-kill-group t]
71 ["Yank" gnus-group-yank-group t]
72 ["Describe" gnus-group-describe-group t]
73 ["Fetch FAQ" gnus-group-fetch-faq t]
74 ["Edit kill file" gnus-group-edit-local-kill t]
75 ["Expire articles" gnus-group-expire-articles t]
76 ["Set group level" gnus-group-set-current-level t]
85 ["List subscribed groups" gnus-group-list-groups t]
86 ["List all groups" gnus-group-list-all-groups t]
87 ["List groups matching..." gnus-group-list-matching t]
88 ["List killed groups" gnus-group-list-killed t]
89 ["List zombie groups" gnus-group-list-zombies t]
90 ["Describe all groups" gnus-group-describe-all-groups t]
91 ["Group apropos" gnus-group-apropos t]
92 ["Group and description apropos" gnus-group-description-apropos t]
93 ["List groups matching..." gnus-group-list-matching t])
95 ["Subscribe to random group" gnus-group-unsubscribe-group t]
96 ["Kill all newsgroups in region" gnus-group-kill-region t]
97 ["Kill all zombie groups" gnus-group-kill-all-zombies t])
99 ["Make a foreign group" gnus-group-make-group t]
100 ["Edit a group entry" gnus-group-edit-group t]
101 ["Add a directory group" gnus-group-make-directory-group t]
102 ["Add the help group" gnus-group-make-help-group t]
103 ["Add the archive group" gnus-group-make-archive-group t]
104 ["Make a kiboze group" gnus-group-make-kiboze-group t])
105 ["Jump to group" gnus-group-jump-to-group t]
106 ["Best unread group" gnus-group-best-unread-group t]
114 ["Send a mail" gnus-group-mail t]
115 ["Post an article" gnus-group-post-news t]
123 ["Check for new news" gnus-group-get-new-news t]
124 ["Delete bogus groups" gnus-group-check-bogus-groups t]
125 ["Find new newsgroups" gnus-find-new-newsgroups t]
126 ["Restart Gnus" gnus-group-restart t]
127 ["Read init file" gnus-group-read-init-file t]
128 ["Browse foreign server" gnus-group-browse-foreign-server t]
129 ["Edit the global kill file" gnus-group-edit-global-kill t]
130 ["Expire all expirable articles" gnus-group-expire-all-groups t]
131 ["Generate any kiboze groups" nnkiboze-generate-groups t]
132 ["Gnus version" gnus-version t]
133 ["Save .newsrc files" gnus-group-save-newsrc t]
134 ["Suspend Gnus" gnus-group-suspend t]
135 ["Clear dribble buffer" gnus-group-clear-dribble t]
136 ["Exit from Gnus" gnus-group-exit t]
137 ["Exit without saving" gnus-group-quit t]
138 ["Sort group buffer" gnus-group-sort-groups t]
139 ["Edit global KILL file" gnus-group-edit-global-kill t]
145 (defun gnus-summary-make-menu-bar ()
148 gnus-summary-mark-menu
149 gnus-summary-mode-map
153 ["Mark as read" gnus-summary-mark-as-read-forward t]
154 ["Mark same subject and select" gnus-summary-kill-same-subject-and-select t]
155 ["Mark same subject" gnus-summary-kill-same-subject t]
156 ["Catchup" gnus-summary-catchup t]
157 ["Catchup all" gnus-summary-catchup-all t]
158 ["Catchup to here" gnus-summary-catchup-to-here t]
159 ["Catchup region" gnus-summary-mark-region-as-read t])
161 ["Tick" gnus-summary-tick-article-forward t]
162 ["Mark as dormant" gnus-summary-mark-as-dormant t]
163 ["Remove marks" gnus-summary-clear-mark-forward t]
164 ["Set expirable mark" gnus-summary-mark-as-expirable t]
165 ["Set bookmark" gnus-summary-set-bookmark t]
166 ["Remove bookmark" gnus-summary-remove-bookmark t])
168 ["Raise score" gnus-summary-raise-score t]
169 ["Lower score" gnus-summary-lower-score t]
170 ["Set score" gnus-summary-set-score t])
172 ["Remove lines marked as read" gnus-summary-remove-lines-marked-as-read t]
173 ["Remove lines marked with..." gnus-summary-remove-lines-marked-with t]
174 ["Show dormant articles" gnus-summary-show-all-dormant t]
175 ["Hide dormant articles" gnus-summary-hide-all-dormant t]
176 ["Show expunged articles" gnus-summary-show-all-expunged t])
178 ["Set mark" gnus-summary-mark-as-processable t]
179 ["Remove mark" gnus-summary-unmark-as-processable t]
180 ["Remove all marks" gnus-summary-unmark-all-processable t]
181 ["Mark series" gnus-uu-mark-series t]
182 ["Mark region" gnus-uu-mark-region t]
183 ["Mark by regexp" gnus-uu-mark-by-regexp t]
184 ["Mark all" gnus-uu-mark-all t]
185 ["Mark sparse" gnus-uu-mark-sparse t]
186 ["Mark thread" gnus-uu-mark-thread t]
191 gnus-summary-move-menu
192 gnus-summary-mode-map
195 ["Scroll article forwards" gnus-summary-next-page t]
196 ["Next unread article" gnus-summary-next-unread-article t]
197 ["Previous unread article" gnus-summary-prev-unread-article t]
198 ["Next article" gnus-summary-next-article t]
199 ["Previous article" gnus-summary-prev-article t]
200 ["Next article same subject" gnus-summary-next-same-subject t]
201 ["Previous article same subject" gnus-summary-prev-same-subject t]
202 ["First unread article" gnus-summary-first-unread-article t]
203 ["Go to subject number..." gnus-summary-goto-subject t]
204 ["Go to the last article" gnus-summary-goto-last-article t]
205 ["Pop article off history" gnus-summary-pop-article t]
209 gnus-summary-article-menu
210 gnus-summary-mode-map
214 ["Headers" gnus-article-hide-headers t]
215 ["Signature" gnus-article-hide-signature t]
216 ["Citation" gnus-article-hide-citation t]
217 ["Overstrike" gnus-article-treat-overstrike t]
218 ["Word wrap" gnus-article-word-wrap t]
219 ["CR" gnus-article-remove-cr t]
220 ["Show X-Face" gnus-article-display-x-face t]
221 ["Quoted-Printable" gnus-article-de-quoted-unreadable t])
223 ["Uudecode" gnus-uu-decode-uu t]
224 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
225 ["Unshar" gnus-uu-decode-unshar t]
226 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
227 ["Save" gnus-uu-decode-save t]
228 ["Binhex" gnus-uu-decode-binhex t])
229 ["Enter digest buffer" gnus-summary-enter-digest-group t]
230 ["Isearch article" gnus-summary-isearch-article t]
231 ["Search all articles" gnus-summary-search-article-forward t]
232 ["Beginning of the article" gnus-summary-beginning-of-article t]
233 ["End of the article" gnus-summary-end-of-article t]
234 ["Fetch parent of article" gnus-summary-refer-parent-article t]
235 ["Fetch article with id..." gnus-summary-refer-article t]
236 ["Stop page breaking" gnus-summary-stop-page-breaking t]
237 ["Caesar rotate" gnus-summary-caesar-message t]
238 ["Redisplay" gnus-summary-show-article t]
239 ["Toggle header" gnus-summary-toggle-header t]
240 ["Toggle MIME" gnus-summary-toggle-mime t]
241 ["Save" gnus-summary-save-article t]
242 ["Save in mail format" gnus-summary-save-article-mail t]
243 ["Pipe through a filter" gnus-summary-pipe-output t]
245 ["Respool article" gnus-summary-respool-article t]
246 ["Move article" gnus-summary-move-article t]
247 ["Edit article" gnus-summary-edit-article t]
248 ["Delete article" gnus-summary-delete-article t])
252 gnus-summary-thread-menu
253 gnus-summary-mode-map
256 ["Toggle threading" gnus-summary-toggle-threads t]
257 ["Display hidden thread" gnus-summary-show-thread t]
258 ["Hide thread" gnus-summary-hide-thread t]
259 ["Go to next thread" gnus-summary-next-thread t]
260 ["Go to previous thread" gnus-summary-prev-thread t]
261 ["Go down thread" gnus-summary-down-thread t]
262 ["Go up thread" gnus-summary-up-thread t]
263 ["Mark thread as read" gnus-summary-kill-thread t]
264 ["Lower thread score" gnus-summary-lower-thread t]
265 ["Raise thread score" gnus-summary-raise-thread t]
269 gnus-summary-misc-menu
270 gnus-summary-mode-map
274 ["Sort by number" gnus-summary-sort-by-number t]
275 ["Sort by author" gnus-summary-sort-by-author t]
276 ["Sort by subject" gnus-summary-sort-by-subject t]
277 ["Sort by date" gnus-summary-sort-by-date t])
279 ["Catchup and exit" gnus-summary-catchup-and-exit t]
280 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
281 ["Exit group" gnus-summary-exit t]
282 ["Exit group without updating" gnus-summary-quit t]
283 ["Reselect group" gnus-summary-reselect-current-group t]
284 ["Rescan group" gnus-summary-rescan-group t])
285 ["Fetch group FAQ" gnus-summary-fetch-faq t]
286 ["Filter articles" gnus-summary-execute-command t]
287 ["Toggle line truncation" gnus-summary-toggle-truncation t]
288 ["Expire expirable articles" gnus-summary-expire-articles t]
289 ["Describe group" gnus-summary-describe-group t]
290 ["Edit local kill file" gnus-summary-edit-local-kill t]
291 ["Edit global kill file" gnus-summary-edit-global-kill t]
295 gnus-summary-post-menu
296 gnus-summary-mode-map
299 ["Post an article" gnus-summary-post-news t]
300 ["Followup" gnus-summary-followup t]
301 ["Followup and yank" gnus-summary-followup-with-original t]
302 ["Supersede article" gnus-summary-supersede-article t]
303 ["Cancel article" gnus-summary-cancel-article t]
304 ["Reply" gnus-summary-reply t]
305 ["Reply and yank" gnus-summary-reply-with-original t]
306 ["Forward" gnus-summary-mail-forward t]
307 ["Digest and forward" gnus-uu-digest-and-forward t]
308 ["Send a mail" gnus-summary-mail-other-window t]
309 ["Reply & followup" gnus-summary-followup-and-reply t]
310 ["Reply & followup and yank" gnus-summary-followup-and-reply-with-original t]
311 ["Uuencode and post" gnus-uu-post-news t]
315 gnus-summary-kill-menu
316 gnus-summary-mode-map
320 ["Switch current score file" gnus-score-change-score-file t]
321 ["Set mark below" gnus-score-set-mark-below t]
322 ["Set expunge below" gnus-score-set-expunge-below t]
323 ["Edit current score file" gnus-score-edit-alist t]
324 ["Edit score file" gnus-score-edit-file t])
325 ["Raise score with current subject"
326 gnus-summary-temporarily-raise-by-subject t]
327 ["Raise score with current author"
328 gnus-summary-temporarily-raise-by-author t]
329 ["Raise score with current thread"
330 gnus-summary-temporarily-raise-by-thread t]
331 ["Raise score with current crossposting"
332 gnus-summary-temporarily-raise-by-xref t]
333 ["Permanently raise score with current subject"
334 gnus-summary-raise-by-subject t]
335 ["Permanently raise score with current author"
336 gnus-summary-raise-by-author t]
337 ["Permanently raise score with current crossposting"
338 gnus-summary-raise-by-xref t]
339 ["Permanently raise score for followups to current author"
340 gnus-summary-raise-followups-to-author t]
341 ["Lower score with current subject"
342 gnus-summary-temporarily-lower-by-subject t]
343 ["Lower score with current author"
344 gnus-summary-temporarily-lower-by-author t]
345 ["Lower score with current thread"
346 gnus-summary-temporarily-lower-by-thread t]
347 ["Lower score with current crossposting"
348 gnus-summary-temporarily-lower-by-xref t]
349 ["Permanently lower score with current subject"
350 gnus-summary-lower-by-subject t]
351 ["Permanently lower score with current author"
352 gnus-summary-lower-by-author t]
353 ["Permanently lower score with current crossposting"
354 gnus-summary-lower-by-xref t]
355 ["Permanently lower score for followups to current author"
356 gnus-summary-lower-followups-to-author t]
361 (defun gnus-article-make-menu-bar ()
364 gnus-article-article-menu
365 gnus-article-mode-map
368 ["Scroll forwards" gnus-article-next-page t]
369 ["Scroll backwards" gnus-article-prev-page t]
370 ["Show summary" gnus-article-show-summary t]
371 ["Fetch Message-ID at point" gnus-article-refer-article t]
372 ["Mail to address at point" gnus-article-mail t]
373 ["Mail to address at point and include original"
374 gnus-article-mail-with-original t]
378 gnus-article-treatment-menu
379 gnus-article-mode-map
382 ["Hide headers" gnus-article-hide-headers t]
383 ["Hide signature" gnus-article-hide-signature t]
384 ["Hide citation" gnus-article-hide-citation t]
385 ["Treat overstrike" gnus-article-treat-overstrike t]
386 ["Remove carriage return" gnus-article-remove-cr t]
387 ["Remove quoted-unreadble" gnus-article-de-quoted-unreadable t]
392 (defun gnus-visual-highlight-selected-summary ()
393 (if gnus-summary-selected-face
395 (let* ((beg (progn (beginning-of-line) (point)))
396 (end (progn (end-of-line) (point)))
398 (next-single-property-change beg 'mouse-face nil end)
400 (to (or (next-single-property-change from 'mouse-face nil end)
402 (if gnus-newsgroup-selected-overlay
403 (move-overlay gnus-newsgroup-selected-overlay
404 from to (current-buffer))
405 (setq gnus-newsgroup-selected-overlay (make-overlay from to))
406 (overlay-put gnus-newsgroup-selected-overlay 'face
407 gnus-summary-selected-face))))))
409 (defun gnus-visual-highlight-selected-summary ()
410 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
411 ;; Highlight selected article in summary buffer
412 (if gnus-summary-selected-face
414 (let* ((beg (progn (beginning-of-line) (point)))
415 (end (progn (end-of-line) (point)))
416 (to (max 1 (1- (previous-single-property-change
417 end 'mouse-face nil beg))))
418 (from (1+ (previous-single-property-change
419 to 'mouse-face nil beg))))
420 (if gnus-newsgroup-selected-overlay
421 (move-overlay gnus-newsgroup-selected-overlay
422 from to (current-buffer))
423 (setq gnus-newsgroup-selected-overlay (make-overlay from to))
424 (overlay-put gnus-newsgroup-selected-overlay 'face
425 gnus-summary-selected-face)))))))
427 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
428 (defun gnus-visual-summary-highlight-line ()
429 "Highlight current line according to `gnus-visual-summary-highlight'."
430 (let* ((list gnus-visual-summary-highlight)
432 (end (progn (end-of-line) (point)))
433 ;; now find out where the line starts and leave point there.
434 (beg (progn (beginning-of-line) (point)))
435 (score (or (cdr (assq (or (get-text-property beg 'gnus-number)
436 gnus-current-article)
437 gnus-newsgroup-scored))
438 gnus-summary-default-score 0))
439 (default gnus-summary-default-score)
440 (mark (get-text-property beg 'gnus-mark))
441 (inhibit-read-only t))
442 (while (and list (not (eval (car (car list)))))
443 (setq list (cdr list)))
444 (let ((face (and list (cdr (car list)))))
445 ;; BUG! For some reason the text properties of the first
446 ;; characters get mangled.
447 (or (eq face (get-text-property (+ beg 10) 'face))
448 (put-text-property beg end 'face face)))
451 (if (not gnus-xemacs)
453 (setq gnus-group-mode-hook
456 (easy-menu-add gnus-group-reading-menu)
457 (easy-menu-add gnus-group-group-menu)
458 (easy-menu-add gnus-group-post-menu)
459 (easy-menu-add gnus-group-misc-menu))
460 gnus-group-mode-hook))
461 (setq gnus-summary-mode-hook
464 (easy-menu-add gnus-summary-mark-menu)
465 (easy-menu-add gnus-summary-move-menu)
466 (easy-menu-add gnus-summary-article-menu)
467 (easy-menu-add gnus-summary-thread-menu)
468 (easy-menu-add gnus-summary-misc-menu)
469 (easy-menu-add gnus-summary-post-menu)
470 (easy-menu-add gnus-summary-kill-menu))
471 gnus-summary-mode-hook))
472 (setq gnus-article-mode-hook
475 (easy-menu-add gnus-article-article-menu)
476 (easy-menu-add gnus-article-treatment-menu))
477 gnus-article-mode-hook)))
479 (provide 'gnus-visual)
481 ;;; gnus-visual.el ends here