;;; mh-speed.el --- MH-E speedbar support
-;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2011 Free Software Foundation, Inc.
;; Author: Satyaki Das <satyaki@theforce.stanford.edu>
;; Maintainer: Bill Wohler <wohler@newt.com>
;; 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 3, 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., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(defvar mh-folder-speedbar-menu-items
'("--"
["Visit Folder" mh-speed-view
- (save-excursion
- (set-buffer speedbar-buffer)
+ (with-current-buffer speedbar-buffer
(get-text-property (mh-line-beginning-position) 'mh-folder))]
["Expand Nested Folders" mh-speed-expand-folder
(and (get-text-property (mh-line-beginning-position) 'mh-children-p)
(defun mh-speed-stealth-update (&optional force)
"Do stealth update.
With non-nil FORCE, the update is always carried out."
- (cond ((save-excursion (set-buffer speedbar-buffer)
- (get-text-property (point-min) 'mh-level))
+ (cond ((with-current-buffer speedbar-buffer
+ (get-text-property (point-min) 'mh-level))
;; Execute this hook and *don't* run anything else
(mh-speed-update-current-folder force)
nil)
;; Otherwise on to your regular programming
(t t)))
-(defun mh-speed-toggle (&rest args)
+(defun mh-speed-toggle (&rest ignored)
"Toggle the display of child folders in the speedbar.
-The optional ARGS from speedbar are ignored."
+The optional arguments from speedbar are IGNORED."
(interactive)
(declare (ignore args))
(beginning-of-line)
(mh-line-beginning-position) (1+ (line-beginning-position))
`(mh-expanded t)))))))
-(defun mh-speed-view (&rest args)
+(defun mh-speed-view (&rest ignored)
"Visits the selected folder just as if you had used \\<mh-folder-mode-map>\\[mh-visit-folder].
-The optional ARGS from speedbar are ignored."
+The optional arguments from speedbar are IGNORED."
(interactive)
(declare (ignore args))
(let* ((folder (get-text-property (mh-line-beginning-position) 'mh-folder))
"Given an MH-E BUFFER find the folder that should be highlighted.
Do the right thing for the different kinds of buffers that MH-E
uses."
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(cond ((eq major-mode 'mh-folder-mode)
mh-current-folder)
((eq major-mode 'mh-show-mode)
(substring output position line-end))
mh-speed-partial-line "")
(multiple-value-setq (folder unseen total)
- (mh-parse-flist-output-line line mh-speed-current-folder))
+ (values-list
+ (mh-parse-flist-output-line line mh-speed-current-folder)))
(when (and folder unseen total
(let ((old-pair (gethash folder mh-speed-flists-cache)))
(or (not (equal (car old-pair) unseen))
(not (equal (cdr old-pair) total)))))
(setf (gethash folder mh-speed-flists-cache) (cons unseen total))
- (save-excursion
- (when (buffer-live-p (get-buffer speedbar-buffer))
- (set-buffer speedbar-buffer)
+ (when (buffer-live-p (get-buffer speedbar-buffer))
+ (with-current-buffer speedbar-buffer
(speedbar-with-writable
(when (get-text-property (point-min) 'mh-level)
(let ((pos (gethash folder mh-speed-folder-map))
(defun mh-speed-invalidate-map (folder)
"Remove FOLDER from various optimization caches."
(interactive (list ""))
- (save-excursion
- (set-buffer speedbar-buffer)
+ (with-current-buffer speedbar-buffer
(let* ((speedbar-update-flag nil)
(last-slash (mh-search-from-end ?/ folder))
(parent (if last-slash (substring folder 0 last-slash) nil))
(defun mh-speed-add-folder (folder)
"Add FOLDER since it is being created.
The function invalidates the latest ancestor that is present."
- (save-excursion
- (set-buffer speedbar-buffer)
+ (with-current-buffer speedbar-buffer
(let ((speedbar-update-flag nil)
(last-slash (mh-search-from-end ?/ folder))
(ancestor folder)
;; sentence-end-double-space: nil
;; End:
-;; arch-tag: d38ddcd4-3c00-4e37-99bf-8b89dda7b32c
;;; mh-speed.el ends here