/[emacs]/emacs/lisp/gnus/gnus-salt.el
ViewVC logotype

Diff of /emacs/lisp/gnus/gnus-salt.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7.18.1 by miles, Tue Oct 14 23:34:50 2003 UTC revision 1.7.18.2 by miles, Thu Sep 16 00:12:16 2004 UTC
# Line 1  Line 1 
1  ;;; gnus-salt.el --- alternate summary mode interfaces for Gnus  ;;; gnus-salt.el --- alternate summary mode interfaces for Gnus
2    
3  ;; Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.  ;; Copyright (C) 1996, 1997, 1998, 1999, 2001
4    ;;        Free Software Foundation, Inc.
5    
6  ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>  ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7  ;; Keywords: news  ;; Keywords: news
# Line 30  Line 31 
31    
32  (require 'gnus)  (require 'gnus)
33  (require 'gnus-sum)  (require 'gnus-sum)
34    (require 'gnus-win)
35    
36  ;;;  ;;;
37  ;;; gnus-pick-mode  ;;; gnus-pick-mode
38  ;;;  ;;;
39    
40  (defvar gnus-pick-mode nil  (defvar gnus-pick-mode nil
41    "Minor mode for providing a pick-and-read interface in Gnus summary buffers.")    "Minor mode for providing a pick-and-read interface in Gnus
42    summary buffers.")
43    
44  (defcustom gnus-pick-display-summary nil  (defcustom gnus-pick-display-summary nil
45    "*Display summary while reading."    "*Display summary while reading."
# Line 48  Line 51 
51    :type 'hook    :type 'hook
52    :group 'gnus-summary-pick)    :group 'gnus-summary-pick)
53    
54    (when (featurep 'xemacs)
55      (add-hook 'gnus-pick-mode-hook 'gnus-xmas-pick-menu-add))
56    
57  (defcustom gnus-mark-unpicked-articles-as-read nil  (defcustom gnus-mark-unpicked-articles-as-read nil
58    "*If non-nil, mark all unpicked articles as read."    "*If non-nil, mark all unpicked articles as read."
59    :type 'boolean    :type 'boolean
60    :group 'gnus-summary-pick)    :group 'gnus-summary-pick)
61    
62  (defcustom gnus-pick-elegant-flow t  (defcustom gnus-pick-elegant-flow t
63    "If non-nil, `gnus-pick-start-reading' runs `gnus-summary-next-group' when no articles have been picked."    "If non-nil, `gnus-pick-start-reading' runs
64     `gnus-summary-next-group' when no articles have been picked."
65    :type 'boolean    :type 'boolean
66    :group 'gnus-summary-pick)    :group 'gnus-summary-pick)
67    
68  (defcustom gnus-summary-pick-line-format  (defcustom gnus-summary-pick-line-format
69    "%-5P %U\%R\%z\%I\%(%[%4L: %-20,20n%]%) %s\n"    "%-5P %U\%R\%z\%I\%(%[%4L: %-23,23n%]%) %s\n"
70    "*The format specification of the lines in pick buffers.    "*The format specification of the lines in pick buffers.
71  It accepts the same format specs that `gnus-summary-line-format' does."  It accepts the same format specs that `gnus-summary-line-format' does."
72    :type 'string    :type 'string
# Line 82  It accepts the same format specs that `g Line 89  It accepts the same format specs that `g
89  (defun gnus-pick-make-menu-bar ()  (defun gnus-pick-make-menu-bar ()
90    (unless (boundp 'gnus-pick-menu)    (unless (boundp 'gnus-pick-menu)
91      (easy-menu-define      (easy-menu-define
92       gnus-pick-menu gnus-pick-mode-map ""        gnus-pick-menu gnus-pick-mode-map ""
93       '("Pick"        '("Pick"
94         ("Pick"          ("Pick"
95          ["Article" gnus-summary-mark-as-processable t]           ["Article" gnus-summary-mark-as-processable t]
96          ["Thread" gnus-uu-mark-thread t]           ["Thread" gnus-uu-mark-thread t]
97          ["Region" gnus-uu-mark-region t]           ["Region" gnus-uu-mark-region t]
98          ["Regexp" gnus-uu-mark-by-regexp t]           ["Regexp" gnus-uu-mark-by-regexp t]
99          ["Buffer" gnus-uu-mark-buffer t])           ["Buffer" gnus-uu-mark-buffer t])
100         ("Unpick"          ("Unpick"
101          ["Article" gnus-summary-unmark-as-processable t]           ["Article" gnus-summary-unmark-as-processable t]
102          ["Thread" gnus-uu-unmark-thread t]           ["Thread" gnus-uu-unmark-thread t]
103          ["Region" gnus-uu-unmark-region t]           ["Region" gnus-uu-unmark-region t]
104          ["Regexp" gnus-uu-unmark-by-regexp t]           ["Regexp" gnus-uu-unmark-by-regexp t]
105          ["Buffer" gnus-summary-unmark-all-processable t])           ["Buffer" gnus-summary-unmark-all-processable t])
106         ["Start reading" gnus-pick-start-reading t]          ["Start reading" gnus-pick-start-reading t]
107         ["Switch pick mode off" gnus-pick-mode gnus-pick-mode]))))          ["Switch pick mode off" gnus-pick-mode gnus-pick-mode]))))
108    
109  (defun gnus-pick-mode (&optional arg)  (defun gnus-pick-mode (&optional arg)
110    "Minor mode for providing a pick-and-read interface in Gnus summary buffers.    "Minor mode for providing a pick-and-read interface in Gnus summary buffers.
# Line 148  If given a prefix, mark all unpicked art Line 155  If given a prefix, mark all unpicked art
155    (interactive "P")    (interactive "P")
156    (if gnus-newsgroup-processable    (if gnus-newsgroup-processable
157        (progn        (progn
158          (gnus-summary-limit-to-articles nil)          (gnus-summary-limit-to-articles nil)
159          (when (or catch-up gnus-mark-unpicked-articles-as-read)          (when (or catch-up gnus-mark-unpicked-articles-as-read)
160            (gnus-summary-limit-mark-excluded-as-read))            (gnus-summary-limit-mark-excluded-as-read))
161          (gnus-summary-first-article)          (gnus-summary-first-article)
162          (gnus-configure-windows          (gnus-configure-windows
163           (if gnus-pick-display-summary 'article 'pick) t))           (if gnus-pick-display-summary 'article 'pick) t))
164      (if gnus-pick-elegant-flow      (if gnus-pick-elegant-flow
165          (progn          (progn
# Line 223  This must be bound to a button-down mous Line 230  This must be bound to a button-down mous
230    (let* ((echo-keystrokes 0)    (let* ((echo-keystrokes 0)
231           (start-posn (event-start start-event))           (start-posn (event-start start-event))
232           (start-point (posn-point start-posn))           (start-point (posn-point start-posn))
233           (start-line (1+ (count-lines 1 start-point)))           (start-line (1+ (count-lines (point-min) start-point)))
234           (start-window (posn-window start-posn))           (start-window (posn-window start-posn))
235           (bounds (gnus-window-edges start-window))           (bounds (gnus-window-edges start-window))
236           (top (nth 1 bounds))           (top (nth 1 bounds))
# Line 235  This must be bound to a button-down mous Line 242  This must be bound to a button-down mous
242      (setq mouse-selection-click-count click-count)      (setq mouse-selection-click-count click-count)
243      (setq mouse-selection-click-count-buffer (current-buffer))      (setq mouse-selection-click-count-buffer (current-buffer))
244      (mouse-set-point start-event)      (mouse-set-point start-event)
245      ;; In case the down click is in the middle of some intangible text,     ;; In case the down click is in the middle of some intangible text,
246      ;; use the end of that text, and put it in START-POINT.      ;; use the end of that text, and put it in START-POINT.
247      (when (< (point) start-point)      (when (< (point) start-point)
248        (goto-char start-point))        (goto-char start-point))
# Line 246  This must be bound to a button-down mous Line 253  This must be bound to a button-down mous
253      ;; (but not outside the window where the drag started).      ;; (but not outside the window where the drag started).
254      (let (event end end-point (end-of-range (point)))      (let (event end end-point (end-of-range (point)))
255        (track-mouse        (track-mouse
256         (while (progn          (while (progn
257                  (setq event (cdr (gnus-read-event-char)))                   (setq event (cdr (gnus-read-event-char)))
258                  (or (mouse-movement-p event)                   (or (mouse-movement-p event)
259                      (eq (car-safe event) 'switch-frame)))                       (eq (car-safe event) 'switch-frame)))
260           (if (eq (car-safe event) 'switch-frame)            (if (eq (car-safe event) 'switch-frame)
261               nil                nil
262             (setq end (event-end event)              (setq end (event-end event)
263                   end-point (posn-point end))                    end-point (posn-point end))
264    
265             (cond              (cond
266              ;; Are we moving within the original window?               ;; Are we moving within the original window?
267              ((and (eq (posn-window end) start-window)               ((and (eq (posn-window end) start-window)
268                    (integer-or-marker-p end-point))                     (integer-or-marker-p end-point))
269               ;; Go to START-POINT first, so that when we move to END-POINT,                ;; Go to START-POINT first, so that when we move to END-POINT,
270               ;; if it's in the middle of intangible text,                ;; if it's in the middle of intangible text,
271               ;; point jumps in the direction away from START-POINT.                ;; point jumps in the direction away from START-POINT.
272               (goto-char start-point)                (goto-char start-point)
273               (goto-char end-point)                (goto-char end-point)
274               (gnus-pick-article)                (gnus-pick-article)
275               ;; In case the user moved his mouse really fast, pick                ;; In case the user moved his mouse really fast, pick
276               ;; articles on the line between this one and the last one.                ;; articles on the line between this one and the last one.
277               (let* ((this-line (1+ (count-lines 1 end-point)))                (let* ((this-line (1+ (count-lines (point-min) end-point)))
278                      (min-line (min this-line start-line))                       (min-line (min this-line start-line))
279                      (max-line (max this-line start-line)))                       (max-line (max this-line start-line)))
280                 (while (< min-line max-line)                  ;; Why not use `forward-line'?  --Stef
281                   (goto-line min-line)                  (while (< min-line max-line)
282                   (gnus-pick-article)                    (goto-line min-line)
283                   (setq min-line (1+ min-line)))                    (gnus-pick-article)
284                 (setq start-line this-line))                    (setq min-line (1+ min-line)))
285               (when (zerop (% click-count 3))                  (setq start-line this-line))
286                 (setq end-of-range (point))))                (when (zerop (% click-count 3))
287              (t                  (setq end-of-range (point))))
288               (let ((mouse-row (cdr (cdr (mouse-position)))))               (t
289                 (cond                (let ((mouse-row (cdr (cdr (mouse-position)))))
290                  ((null mouse-row))                  (cond
291                  ((< mouse-row top)                   ((null mouse-row))
292                   (mouse-scroll-subr start-window (- mouse-row top)))                   ((< mouse-row top)
293                  ((>= mouse-row bottom)                    (mouse-scroll-subr start-window (- mouse-row top)))
294                   (mouse-scroll-subr start-window                   ((>= mouse-row bottom)
295                                      (1+ (- mouse-row bottom)))))))))))                    (mouse-scroll-subr start-window
296                                         (1+ (- mouse-row bottom)))))))))))
297        (when (consp event)        (when (consp event)
298          (let ((fun (key-binding (vector (car event)))))          (let ((fun (key-binding (vector (car event)))))
299            ;; Run the binding of the terminating up-event, if possible.            ;; Run the binding of the terminating up-event, if possible.
300            ;; In the case of a multiple click, it gives the wrong results,         ;; In the case of a multiple click, it gives the wrong results,
301            ;; because it would fail to set up a region.            ;; because it would fail to set up a region.
302            (when nil            (when nil
303              ;; (and (= (mod mouse-selection-click-count 3) 0) (fboundp fun))        ;; (and (= (mod mouse-selection-click-count 3) 0) (fboundp fun))
304              ;; In this case, we can just let the up-event execute normally.         ;; In this case, we can just let the up-event execute normally.
305              (let ((end (event-end event)))              (let ((end (event-end event)))
306                ;; Set the position in the event before we replay it,                ;; Set the position in the event before we replay it,
307                ;; because otherwise it may have a position in the wrong                ;; because otherwise it may have a position in the wrong
308                ;; buffer.                ;; buffer.
309                (setcar (cdr end) end-of-range)                (setcar (cdr end) end-of-range)
310                ;; Delete the overlay before calling the function,                ;; Delete the overlay before calling the function,
311                ;; because delete-overlay increases buffer-modified-tick.               ;; because delete-overlay increases buffer-modified-tick.
312                (push event unread-command-events))))))))                (push event unread-command-events))))))))
313    
314  (defun gnus-pick-next-page ()  (defun gnus-pick-next-page ()
# Line 333  This must be bound to a button-down mous Line 341  This must be bound to a button-down mous
341  (defun gnus-binary-make-menu-bar ()  (defun gnus-binary-make-menu-bar ()
342    (unless (boundp 'gnus-binary-menu)    (unless (boundp 'gnus-binary-menu)
343      (easy-menu-define      (easy-menu-define
344       gnus-binary-menu gnus-binary-mode-map ""        gnus-binary-menu gnus-binary-mode-map ""
345       '("Pick"        '("Pick"
346         ["Switch binary mode off" gnus-binary-mode t]))))          ["Switch binary mode off" gnus-binary-mode t]))))
347    
348  (defun gnus-binary-mode (&optional arg)  (defun gnus-binary-mode (&optional arg)
349    "Minor mode for providing a binary group interface in Gnus summary buffers."    "Minor mode for providing a binary group interface in Gnus summary buffers."
# Line 361  This must be bound to a button-down mous Line 369  This must be bound to a button-down mous
369  (defun gnus-binary-display-article (article &optional all-header)  (defun gnus-binary-display-article (article &optional all-header)
370    "Run ARTICLE through the binary decode functions."    "Run ARTICLE through the binary decode functions."
371    (when (gnus-summary-goto-subject article)    (when (gnus-summary-goto-subject article)
372      (let ((gnus-view-pseudos 'automatic))      (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
373        (gnus-uu-decode-uu))))        (gnus-uu-decode-uu))))
374    
375  (defun gnus-binary-show-article (&optional arg)  (defun gnus-binary-show-article (&optional arg)
# Line 418  Two predefined functions are available: Line 426  Two predefined functions are available:
426    :type 'hook    :type 'hook
427    :group 'gnus-summary-tree)    :group 'gnus-summary-tree)
428    
429    (when (featurep 'xemacs)
430      (add-hook 'gnus-tree-mode-hook 'gnus-xmas-tree-menu-add)
431      (add-hook 'gnus-tree-mode-hook 'gnus-xmas-switch-horizontal-scrollbar-off))
432    
433    
434  ;;; Internal variables.  ;;; Internal variables.
435    
436  (defvar gnus-tree-line-format-alist  (defvar gnus-tree-line-format-alist
# Line 460  Two predefined functions are available: Line 473  Two predefined functions are available:
473  (defun gnus-tree-make-menu-bar ()  (defun gnus-tree-make-menu-bar ()
474    (unless (boundp 'gnus-tree-menu)    (unless (boundp 'gnus-tree-menu)
475      (easy-menu-define      (easy-menu-define
476       gnus-tree-menu gnus-tree-mode-map ""        gnus-tree-menu gnus-tree-mode-map ""
477       '("Tree"        '("Tree"
478         ["Select article" gnus-tree-select-article t]))))          ["Select article" gnus-tree-select-article t]))))
479    
480  (defun gnus-tree-mode ()  (defun gnus-tree-mode ()
481    "Major mode for displaying thread trees."    "Major mode for displaying thread trees."
# Line 543  Two predefined functions are available: Line 556  Two predefined functions are available:
556  (defun gnus-tree-recenter ()  (defun gnus-tree-recenter ()
557    "Center point in the tree window."    "Center point in the tree window."
558    (let ((selected (selected-window))    (let ((selected (selected-window))
559          (tree-window (get-buffer-window gnus-tree-buffer t)))          (tree-window (gnus-get-buffer-window gnus-tree-buffer t)))
560      (when tree-window      (when tree-window
561        (select-window tree-window)        (select-window tree-window)
562        (when gnus-selected-tree-overlay        (when gnus-selected-tree-overlay
# Line 555  Two predefined functions are available: Line 568  Two predefined functions are available:
568               (bottom (save-excursion (goto-char (point-max))               (bottom (save-excursion (goto-char (point-max))
569                                       (forward-line (- height))                                       (forward-line (- height))
570                                       (point))))                                       (point))))
571          ;; Set the window start to either `bottom', which is the biggest        ;; Set the window start to either `bottom', which is the biggest
572          ;; possible valid number, or the second line from the top,          ;; possible valid number, or the second line from the top,
573          ;; whichever is the least.          ;; whichever is the least.
574          (set-window-start          (set-window-start
# Line 656  Two predefined functions are available: Line 669  Two predefined functions are available:
669        (let* ((score (or (cdr (assq article gnus-newsgroup-scored))        (let* ((score (or (cdr (assq article gnus-newsgroup-scored))
670                          gnus-summary-default-score 0))                          gnus-summary-default-score 0))
671               (default gnus-summary-default-score)               (default gnus-summary-default-score)
672                 (default-high gnus-summary-default-high-score)
673                 (default-low gnus-summary-default-low-score)
674                 (uncached (memq article gnus-newsgroup-undownloaded))
675                 (downloaded (not uncached))
676               (mark (or (gnus-summary-article-mark article) gnus-unread-mark)))               (mark (or (gnus-summary-article-mark article) gnus-unread-mark)))
677          ;; Eval the cars of the lists until we find a match.          ;; Eval the cars of the lists until we find a match.
678          (while (and list          (while (and list
# Line 686  Two predefined functions are available: Line 703  Two predefined functions are available:
703        (gnus-tree-minimize)        (gnus-tree-minimize)
704        (gnus-tree-recenter)        (gnus-tree-recenter)
705        (let ((selected (selected-window)))        (let ((selected (selected-window)))
706          (when (get-buffer-window (set-buffer gnus-tree-buffer) t)          (when (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t)
707            (select-window (get-buffer-window (set-buffer gnus-tree-buffer) t))            (select-window (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t))
708            (gnus-horizontal-recenter)            (gnus-horizontal-recenter)
709            (select-window selected))))))            (select-window selected))))))
710    
# Line 771  Two predefined functions are available: Line 788  Two predefined functions are available:
788            (setq beg (point))            (setq beg (point))
789            (forward-char -1)            (forward-char -1)
790            ;; Draw "-" lines leftwards.            ;; Draw "-" lines leftwards.
791            (while (and (> (point) 1)            (while (and (not (bobp))
792                        (eq (char-after (1- (point))) ? ))                        (eq (char-after (1- (point))) ? ))
793              (delete-char -1)              (delete-char -1)
794              (insert (car gnus-tree-parent-child-edges))              (insert (car gnus-tree-parent-child-edges))
# Line 825  Two predefined functions are available: Line 842  Two predefined functions are available:
842  (defun gnus-tree-close (group)  (defun gnus-tree-close (group)
843    (gnus-kill-buffer gnus-tree-buffer))    (gnus-kill-buffer gnus-tree-buffer))
844    
845    (defun gnus-tree-perhaps-minimize ()
846      (when (and gnus-tree-minimize-window
847                 (get-buffer gnus-tree-buffer))
848        (save-excursion
849          (set-buffer gnus-tree-buffer)
850          (gnus-tree-minimize))))
851    
852  (defun gnus-highlight-selected-tree (article)  (defun gnus-highlight-selected-tree (article)
853    "Highlight the selected article in the tree."    "Highlight the selected article in the tree."
854    (let ((buf (current-buffer))    (let ((buf (current-buffer))
# Line 835  Two predefined functions are available: Line 859  Two predefined functions are available:
859                  (gnus-extent-detached-p gnus-selected-tree-overlay))                  (gnus-extent-detached-p gnus-selected-tree-overlay))
860          ;; Create a new overlay.          ;; Create a new overlay.
861          (gnus-overlay-put          (gnus-overlay-put
862           (setq gnus-selected-tree-overlay (gnus-make-overlay 1 2))           (setq gnus-selected-tree-overlay
863                   (gnus-make-overlay (point-min) (1+ (point-min))))
864           'face gnus-selected-tree-face))           'face gnus-selected-tree-face))
865        ;; Move the overlay to the article.        ;; Move the overlay to the article.
866        (gnus-move-overlay        (gnus-move-overlay
# Line 843  Two predefined functions are available: Line 868  Two predefined functions are available:
868        (gnus-tree-minimize)        (gnus-tree-minimize)
869        (gnus-tree-recenter)        (gnus-tree-recenter)
870        (let ((selected (selected-window)))        (let ((selected (selected-window)))
871          (when (get-buffer-window (set-buffer gnus-tree-buffer) t)          (when (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t)
872            (select-window (get-buffer-window (set-buffer gnus-tree-buffer) t))            (select-window (gnus-get-buffer-window (set-buffer gnus-tree-buffer) t))
873            (gnus-horizontal-recenter)            (gnus-horizontal-recenter)
874            (select-window selected))))            (select-window selected))))
875      ;; If we remove this save-excursion, it updates the wrong mode lines?!?  ;; If we remove this save-excursion, it updates the wrong mode lines?!?
876      (save-excursion      (save-excursion
877        (set-buffer gnus-tree-buffer)        (set-buffer gnus-tree-buffer)
878        (gnus-set-mode-line 'tree))        (gnus-set-mode-line 'tree))
# Line 860  Two predefined functions are available: Line 885  Two predefined functions are available:
885        (when (setq region (gnus-tree-article-region article))        (when (setq region (gnus-tree-article-region article))
886          (gnus-put-text-property (car region) (cdr region) 'face face)          (gnus-put-text-property (car region) (cdr region) 'face face)
887          (set-window-point          (set-window-point
888           (get-buffer-window (current-buffer) t) (cdr region))))))           (gnus-get-buffer-window (current-buffer) t) (cdr region))))))
889    
890  ;;;  ;;;
891  ;;; gnus-carpal  ;;; gnus-carpal
# Line 886  Two predefined functions are available: Line 911  Two predefined functions are available:
911      ("matching" . gnus-group-list-matching)      ("matching" . gnus-group-list-matching)
912      ("post" . gnus-group-post-news)      ("post" . gnus-group-post-news)
913      ("mail" . gnus-group-mail)      ("mail" . gnus-group-mail)
914        ("local" . (lambda () (interactive) (gnus-group-news 0)))
915      ("rescan" . gnus-group-get-new-news)      ("rescan" . gnus-group-get-new-news)
916      ("browse-foreign" . gnus-group-browse-foreign)      ("browse-foreign" . gnus-group-browse-foreign)
917      ("exit" . gnus-group-exit)))      ("exit" . gnus-group-exit)))
# Line 916  Two predefined functions are available: Line 942  Two predefined functions are available:
942      ("kill" . gnus-summary-kill-thread)      ("kill" . gnus-summary-kill-thread)
943      "post"      "post"
944      ("post" . gnus-summary-post-news)      ("post" . gnus-summary-post-news)
945      ("mail" . gnus-summary-mail)      ("local" . gnus-summary-news-other-window)
946        ("mail" . gnus-summary-mail-other-window)
947      ("followup" . gnus-summary-followup-with-original)      ("followup" . gnus-summary-followup-with-original)
948      ("reply" . gnus-summary-reply-with-original)      ("reply" . gnus-summary-reply-with-original)
949      ("cancel" . gnus-summary-cancel-article)      ("cancel" . gnus-summary-cancel-article)
# Line 1037  The following commands are available: Line 1064  The following commands are available:
1064    
1065  (provide 'gnus-salt)  (provide 'gnus-salt)
1066    
1067  ;;; arch-tag: 35449164-77b3-4398-bcbd-a2e3e998f810  ;; arch-tag: 35449164-77b3-4398-bcbd-a2e3e998f810
1068  ;;; gnus-salt.el ends here  ;;; gnus-salt.el ends here

Legend:
Removed from v.1.7.18.1  
changed lines
  Added in v.1.7.18.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26