comparison lisp/gnus/gnus-sum.el @ 116:9f59509498e1 r20-1b10

Import from CVS: tag r20-1b10
author cvs
date Mon, 13 Aug 2007 09:23:06 +0200
parents 8619ce7e4c50
children 7d55a9ba150c
comparison
equal deleted inserted replaced
115:f109f7dabbe2 116:9f59509498e1
712 712
713 713
714 ;;; Internal variables 714 ;;; Internal variables
715 715
716 (defvar gnus-scores-exclude-files nil) 716 (defvar gnus-scores-exclude-files nil)
717
718 (defvar gnus-summary-display-table
719 ;; Change the display table. Odd characters have a tendency to mess
720 ;; up nicely formatted displays - we make all possible glyphs
721 ;; display only a single character.
722
723 ;; We start from the standard display table, if any.
724 (let ((table (or (copy-sequence standard-display-table)
725 (make-display-table)))
726 ;; Nix out all the control chars...
727 (i 32))
728 (while (>= (setq i (1- i)) 0)
729 (aset table i [??]))
730 ;; ... but not newline and cr, of course. (cr is necessary for the
731 ;; selective display).
732 (aset table ?\n nil)
733 (aset table ?\r nil)
734 ;; We nix out any glyphs over 126 that are not set already.
735 (let ((i 256))
736 (while (>= (setq i (1- i)) 127)
737 ;; Only modify if the entry is nil.
738 (or (aref table i)
739 (aset table i [??]))))
740 table)
741 "Display table used in summary mode buffers.")
742 717
743 (defvar gnus-original-article nil) 718 (defvar gnus-original-article nil)
744 (defvar gnus-article-internal-prepare-hook nil) 719 (defvar gnus-article-internal-prepare-hook nil)
745 (defvar gnus-newsgroup-process-stack nil) 720 (defvar gnus-newsgroup-process-stack nil)
746 721
1870 (buffer-disable-undo (current-buffer)) 1845 (buffer-disable-undo (current-buffer))
1871 (setq buffer-read-only t) ;Disable modification 1846 (setq buffer-read-only t) ;Disable modification
1872 (setq truncate-lines t) 1847 (setq truncate-lines t)
1873 (setq selective-display t) 1848 (setq selective-display t)
1874 (setq selective-display-ellipses t) ;Display `...' 1849 (setq selective-display-ellipses t) ;Display `...'
1875 (setq buffer-display-table gnus-summary-display-table) 1850 (gnus-summary-set-display-table)
1876 (gnus-set-default-directory) 1851 (gnus-set-default-directory)
1877 (setq gnus-newsgroup-name group) 1852 (setq gnus-newsgroup-name group)
1878 (make-local-variable 'gnus-summary-line-format) 1853 (make-local-variable 'gnus-summary-line-format)
1879 (make-local-variable 'gnus-summary-line-format-spec) 1854 (make-local-variable 'gnus-summary-line-format-spec)
1880 (make-local-variable 'gnus-summary-mark-positions) 1855 (make-local-variable 'gnus-summary-mark-positions)
2207 2182
2208 (defun gnus-mouse-pick-article (e) 2183 (defun gnus-mouse-pick-article (e)
2209 (interactive "e") 2184 (interactive "e")
2210 (mouse-set-point e) 2185 (mouse-set-point e)
2211 (gnus-summary-next-page nil t)) 2186 (gnus-summary-next-page nil t))
2187
2188 (defun gnus-summary-set-display-table ()
2189 ;; Change the display table. Odd characters have a tendency to mess
2190 ;; up nicely formatted displays - we make all possible glyphs
2191 ;; display only a single character.
2192
2193 ;; We start from the standard display table, if any.
2194 (let ((table (or (copy-sequence standard-display-table)
2195 (make-display-table)))
2196 ;; Nix out all the control chars...
2197 (i 32))
2198 (while (>= (setq i (1- i)) 0)
2199 (aset table i [??]))
2200 ;; ... but not newline and cr, of course. (cr is necessary for the
2201 ;; selective display).
2202 (aset table ?\n nil)
2203 (aset table ?\r nil)
2204 ;; We nix out any glyphs over 126 that are not set already.
2205 (let ((i 256))
2206 (while (>= (setq i (1- i)) 127)
2207 ;; Only modify if the entry is nil.
2208 (or (aref table i)
2209 (aset table i [??]))))
2210 (setq buffer-display-table table)))
2212 2211
2213 (defun gnus-summary-setup-buffer (group) 2212 (defun gnus-summary-setup-buffer (group)
2214 "Initialize summary buffer." 2213 "Initialize summary buffer."
2215 (let ((buffer (concat "*Summary " group "*"))) 2214 (let ((buffer (concat "*Summary " group "*")))
2216 (if (get-buffer buffer) 2215 (if (get-buffer buffer)
3584 3583
3585 (defun gnus-select-newsgroup (group &optional read-all) 3584 (defun gnus-select-newsgroup (group &optional read-all)
3586 "Select newsgroup GROUP. 3585 "Select newsgroup GROUP.
3587 If READ-ALL is non-nil, all articles in the group are selected." 3586 If READ-ALL is non-nil, all articles in the group are selected."
3588 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb)) 3587 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3588 ;;!!! Dirty hack; should be removed.
3589 (gnus-summary-ignore-duplicates
3590 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
3591 t
3592 gnus-summary-ignore-duplicates))
3589 (info (nth 2 entry)) 3593 (info (nth 2 entry))
3590 articles fetched-articles cached) 3594 articles fetched-articles cached)
3591 3595
3592 (unless (gnus-check-server 3596 (unless (gnus-check-server
3593 (setq gnus-current-select-method 3597 (setq gnus-current-select-method
6178 (save-excursion 6182 (save-excursion
6179 (set-buffer gnus-summary-buffer) 6183 (set-buffer gnus-summary-buffer)
6180 gnus-current-article))) 6184 gnus-current-article)))
6181 (ogroup gnus-newsgroup-name) 6185 (ogroup gnus-newsgroup-name)
6182 (params (append (gnus-info-params (gnus-get-info ogroup)) 6186 (params (append (gnus-info-params (gnus-get-info ogroup))
6183 (list (cons 'to-group ogroup)))) 6187 (list (cons 'to-group ogroup))
6188 (list (cons 'save-article-group ogroup))))
6184 (case-fold-search t) 6189 (case-fold-search t)
6185 (buf (current-buffer)) 6190 (buf (current-buffer))
6186 dig) 6191 dig)
6187 (save-excursion 6192 (save-excursion
6188 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*")) 6193 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
6665 " " new-xref)) 6670 " " new-xref))
6666 (save-excursion 6671 (save-excursion
6667 (set-buffer copy-buf) 6672 (set-buffer copy-buf)
6668 ;; First put the article in the destination group. 6673 ;; First put the article in the destination group.
6669 (gnus-request-article-this-buffer article gnus-newsgroup-name) 6674 (gnus-request-article-this-buffer article gnus-newsgroup-name)
6670 (setq art-group 6675 (when (consp (setq art-group
6671 (gnus-request-accept-article 6676 (gnus-request-accept-article
6672 to-newsgroup select-method (not articles))) 6677 to-newsgroup select-method (not articles))))
6673 (setq new-xref (concat new-xref " " (car art-group) 6678 (setq new-xref (concat new-xref " " (car art-group)
6674 ":" (cdr art-group))) 6679 ":" (cdr art-group)))
6675 ;; Now we have the new Xrefs header, so we insert 6680 ;; Now we have the new Xrefs header, so we insert
6676 ;; it and replace the new article. 6681 ;; it and replace the new article.
6677 (nnheader-replace-header "Xref" new-xref) 6682 (nnheader-replace-header "Xref" new-xref)
6678 (gnus-request-replace-article 6683 (gnus-request-replace-article
6679 (cdr art-group) to-newsgroup (current-buffer)) 6684 (cdr art-group) to-newsgroup (current-buffer))
6680 art-group))))) 6685 art-group))))))
6681 (if (not art-group) 6686 (cond
6682 (gnus-message 1 "Couldn't %s article %s" 6687 ((not art-group)
6683 (cadr (assq action names)) article) 6688 (gnus-message 1 "Couldn't %s article %s"
6689 (cadr (assq action names)) article))
6690 ((and (eq art-group 'junk)
6691 (eq action 'move))
6692 (gnus-summary-mark-article article gnus-canceled-mark)
6693 (gnus-message 4 "Deleted article %s" article))
6694 (t
6684 (let* ((entry 6695 (let* ((entry
6685 (or 6696 (or
6686 (gnus-gethash (car art-group) gnus-newsrc-hashtb) 6697 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
6687 (gnus-gethash 6698 (gnus-gethash
6688 (gnus-group-prefixed-name 6699 (gnus-group-prefixed-name
6753 (gnus-request-replace-article 6764 (gnus-request-replace-article
6754 article gnus-newsgroup-name (current-buffer))))) 6765 article gnus-newsgroup-name (current-buffer)))))
6755 6766
6756 (gnus-summary-goto-subject article) 6767 (gnus-summary-goto-subject article)
6757 (when (eq action 'move) 6768 (when (eq action 'move)
6758 (gnus-summary-mark-article article gnus-canceled-mark))) 6769 (gnus-summary-mark-article article gnus-canceled-mark))))
6759 (gnus-summary-remove-process-mark article)) 6770 (gnus-summary-remove-process-mark article))
6760 ;; Re-activate all groups that have been moved to. 6771 ;; Re-activate all groups that have been moved to.
6761 (while to-groups 6772 (while to-groups
6762 (gnus-activate-group (pop to-groups))) 6773 (gnus-activate-group (pop to-groups)))
6763 6774
7066 (execute-kbd-macro (concat (this-command-keys) key)) 7077 (execute-kbd-macro (concat (this-command-keys) key))
7067 (gnus-article-edit-done)) 7078 (gnus-article-edit-done))
7068 7079
7069 ;;; Respooling 7080 ;;; Respooling
7070 7081
7071 (defun gnus-summary-respool-query () 7082 (defun gnus-summary-respool-query (&optional silent)
7072 "Query where the respool algorithm would put this article." 7083 "Query where the respool algorithm would put this article."
7073 (interactive) 7084 (interactive)
7074 (gnus-set-global-variables) 7085 (gnus-set-global-variables)
7075 (let (gnus-mark-article-hook) 7086 (let (gnus-mark-article-hook)
7076 (gnus-summary-select-article) 7087 (gnus-summary-select-article)
7077 (save-excursion 7088 (save-excursion
7078 (set-buffer gnus-original-article-buffer) 7089 (set-buffer gnus-original-article-buffer)
7079 (save-restriction 7090 (save-restriction
7080 (message-narrow-to-head) 7091 (message-narrow-to-head)
7081 (message "This message would go to %s" 7092 (let ((groups (nnmail-article-group 'identity)))
7082 (mapconcat 'car (nnmail-article-group 'identity) ", ")))))) 7093 (unless silent
7094 (if groups
7095 (message "This message would go to %s"
7096 (mapconcat 'car groups ", "))
7097 (message "This message would go to no groups"))
7098 groups))))))
7083 7099
7084 ;; Summary marking commands. 7100 ;; Summary marking commands.
7085 7101
7086 (defun gnus-summary-kill-same-subject-and-select (&optional unmark) 7102 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
7087 "Mark articles which has the same subject as read, and then select the next. 7103 "Mark articles which has the same subject as read, and then select the next.