;;; gnus-salt.el --- alternate summary mode interfaces for Gnus
-;; Copyright (C) 1996, 1997, 1998, 1999, 2001
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
+;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: news
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Set up the menu.
(when (gnus-visual-p 'pick-menu 'menu)
(gnus-pick-make-menu-bar))
- (add-minor-mode 'gnus-pick-mode " Pick" gnus-pick-mode-map
- nil 'gnus-pick-mode)
+ (add-minor-mode 'gnus-pick-mode " Pick" gnus-pick-mode-map)
(gnus-run-hooks 'gnus-pick-mode-hook))))
(defun gnus-pick-setup-message ()
"Make Message do the right thing on exit."
(when (and (gnus-buffer-live-p gnus-summary-buffer)
- (save-excursion
- (set-buffer gnus-summary-buffer)
+ (with-current-buffer gnus-summary-buffer
gnus-pick-mode))
(message-add-action
- '(gnus-configure-windows ,gnus-current-window-configuration t)
+ `(gnus-configure-windows ,gnus-current-window-configuration t)
'send 'exit 'postpone 'kill)))
(defvar gnus-pick-line-number 1)
(let* ((echo-keystrokes 0)
(start-posn (event-start start-event))
(start-point (posn-point start-posn))
- (start-line (1+ (count-lines 1 start-point)))
+ (start-line (1+ (count-lines (point-min) start-point)))
(start-window (posn-window start-posn))
(bounds (gnus-window-edges start-window))
(top (nth 1 bounds))
;; Are we moving within the original window?
((and (eq (posn-window end) start-window)
(integer-or-marker-p end-point))
- ;; 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,
;; if it's in the middle of intangible text,
;; point jumps in the direction away from START-POINT.
(goto-char start-point)
(goto-char end-point)
(gnus-pick-article)
;; In case the user moved his mouse really fast, pick
- ;; articles on the line between this one and the last one.
- (let* ((this-line (1+ (count-lines 1 end-point)))
+ ;; articles on the line between this one and the last one.
+ (let* ((this-line (1+ (count-lines (point-min) end-point)))
(min-line (min this-line start-line))
(max-line (max this-line start-line)))
(while (< min-line max-line)
- (goto-line min-line)
+ (goto-char (point-min))
+ (forward-line (1- min-line))
(gnus-pick-article)
(setq min-line (1+ min-line)))
(setq start-line this-line))
;; Set up the menu.
(when (gnus-visual-p 'binary-menu 'menu)
(gnus-binary-make-menu-bar))
- (add-minor-mode 'gnus-binary-mode " Binary"
- gnus-binary-mode-map nil 'gnus-binary-mode)
+ (add-minor-mode 'gnus-binary-mode " Binary" gnus-binary-mode-map)
(gnus-run-hooks 'gnus-binary-mode-hook))))
(defun gnus-binary-display-article (article &optional all-header)
(gnus-set-work-buffer)
(gnus-tree-node-insert (make-mail-header "") nil)
(setq gnus-tree-node-length (1- (point))))
- (gnus-run-hooks 'gnus-tree-mode-hook))
+ (gnus-run-mode-hooks 'gnus-tree-mode-hook))
(defun gnus-tree-read-summary-keys (&optional arg)
"Read a summary buffer key sequence and execute it."
(interactive (list (gnus-tree-article-number)))
(let ((buf (current-buffer)))
(when article
- (save-excursion
- (set-buffer gnus-summary-buffer)
+ (with-current-buffer gnus-summary-buffer
(gnus-summary-goto-article article))
(select-window (get-buffer-window buf)))))
(defun gnus-get-tree-buffer ()
"Return the tree buffer properly initialized."
- (save-excursion
- (set-buffer (gnus-get-buffer-create gnus-tree-buffer))
+ (with-current-buffer (gnus-get-buffer-create gnus-tree-buffer)
(unless (eq major-mode 'gnus-tree-mode)
(gnus-tree-mode))
(current-buffer)))
"Highlight current line according to `gnus-summary-highlight'."
(let ((list gnus-summary-highlight)
face)
- (save-excursion
- (set-buffer gnus-summary-buffer)
+ (with-current-buffer gnus-summary-buffer
(let* ((score (or (cdr (assq article gnus-newsgroup-scored))
gnus-summary-default-score 0))
(default gnus-summary-default-score)
(defun gnus-generate-tree (thread)
"Generate a thread tree for THREAD."
- (save-excursion
- (set-buffer (gnus-get-tree-buffer))
+ (with-current-buffer (gnus-get-tree-buffer)
(let ((buffer-read-only nil)
(gnus-tmp-indent 0))
(erase-buffer)
(setq beg (point))
(forward-char -1)
;; Draw "-" lines leftwards.
- (while (and (> (point) 1)
+ (while (and (not (bobp))
(eq (char-after (1- (point))) ? ))
(delete-char -1)
(insert (car gnus-tree-parent-child-edges))
(defun gnus-possibly-generate-tree (article &optional force)
"Generate the thread tree for ARTICLE if it isn't displayed already."
- (when (save-excursion
- (set-buffer gnus-summary-buffer)
+ (when (with-current-buffer gnus-summary-buffer
(and gnus-use-trees
gnus-show-threads
(vectorp (gnus-summary-article-header article))))
(save-excursion
- (let ((top (save-excursion
- (set-buffer gnus-summary-buffer)
+ (let ((top (with-current-buffer gnus-summary-buffer
(gnus-cut-thread
(gnus-remove-thread
(mail-header-id
(defun gnus-tree-perhaps-minimize ()
(when (and gnus-tree-minimize-window
(get-buffer gnus-tree-buffer))
- (save-excursion
- (set-buffer gnus-tree-buffer)
+ (with-current-buffer gnus-tree-buffer
(gnus-tree-minimize))))
(defun gnus-highlight-selected-tree (article)
(gnus-extent-detached-p gnus-selected-tree-overlay))
;; Create a new overlay.
(gnus-overlay-put
- (setq gnus-selected-tree-overlay (gnus-make-overlay 1 2))
+ (setq gnus-selected-tree-overlay
+ (gnus-make-overlay (point-min) (1+ (point-min))))
'face gnus-selected-tree-face))
;; Move the overlay to the article.
(gnus-move-overlay
(gnus-horizontal-recenter)
(select-window selected))))
;; If we remove this save-excursion, it updates the wrong mode lines?!?
- (save-excursion
- (set-buffer gnus-tree-buffer)
+ (with-current-buffer gnus-tree-buffer
(gnus-set-mode-line 'tree))
(set-buffer buf)))
(defun gnus-tree-highlight-article (article face)
- (save-excursion
- (set-buffer (gnus-get-tree-buffer))
+ (with-current-buffer (gnus-get-tree-buffer)
(let (region)
(when (setq region (gnus-tree-article-region article))
(gnus-put-text-property (car region) (cdr region) 'face face)
(buffer-disable-undo)
(setq buffer-read-only t)
(make-local-variable 'gnus-carpal-attached-buffer)
- (gnus-run-hooks 'gnus-carpal-mode-hook))
+ (gnus-run-mode-hooks 'gnus-carpal-mode-hook))
(defun gnus-carpal-setup-buffer (type)
(let ((buffer (symbol-value (intern (format "gnus-carpal-%s-buffer" type)))))
(if (get-buffer buffer)
()
- (save-excursion
- (set-buffer (gnus-get-buffer-create buffer))
+ (with-current-buffer (gnus-get-buffer-create buffer)
(gnus-carpal-mode)
(setq gnus-carpal-attached-buffer
(intern (format "gnus-%s-buffer" type)))
(provide 'gnus-salt)
-;;; arch-tag: 35449164-77b3-4398-bcbd-a2e3e998f810
+;; arch-tag: 35449164-77b3-4398-bcbd-a2e3e998f810
;;; gnus-salt.el ends here