* image-mode.el (image-mode): Add image-after-revert-hook to after-revert-hook.
[bpt/emacs.git] / lisp / ibuf-ext.el
index 485a735..dcea1e5 100644 (file)
@@ -1,7 +1,7 @@
 ;;; ibuf-ext.el --- extensions for ibuffer
 
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+;;   2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Colin Walters <walters@verbum.org>
 ;; Maintainer: John Paul Wallington <jpw@gnu.org>
@@ -91,11 +91,6 @@ regardless of any active filters in this buffer."
 (defvar ibuffer-tmp-show-regexps nil
   "A list of regexps which should match buffer names to always show.")
 
-(defvar ibuffer-auto-mode nil
-  "If non-nil, Ibuffer auto-mode should be enabled for this buffer.
-Do not set this variable directly!  Use the function
-`ibuffer-auto-mode' instead.")
-
 (defvar ibuffer-auto-buffers-changed nil)
 
 (defcustom ibuffer-saved-filters '(("gnus"
@@ -220,6 +215,16 @@ Currently, this only applies to `ibuffer-saved-filters' and
         (ibuffer-included-in-filters-p buf ibuffer-filtering-qualifiers)
         (ibuffer-buf-matches-predicates buf ibuffer-always-show-predicates)))))
 
+;;;###autoload
+(define-minor-mode ibuffer-auto-mode
+  "Toggle use of Ibuffer's auto-update facility.
+With numeric ARG, enable auto-update if and only if ARG is positive."
+  nil nil nil
+  (unless (derived-mode-p 'ibuffer-mode)
+    (error "This buffer is not in Ibuffer mode"))
+  (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector
+  (add-hook 'post-command-hook 'ibuffer-auto-update-changed))
+
 (defun ibuffer-auto-update-changed ()
   (when (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed)
     (dolist (buf (buffer-list))
@@ -229,20 +234,6 @@ Currently, this only applies to `ibuffer-saved-filters' and
                     (derived-mode-p 'ibuffer-mode))
            (ibuffer-update nil t)))))))
 
-;;;###autoload
-(defun ibuffer-auto-mode (&optional arg)
-  "Toggle use of Ibuffer's auto-update facility.
-With numeric ARG, enable auto-update if and only if ARG is positive."
-  (interactive)
-  (unless (derived-mode-p 'ibuffer-mode)
-    (error "This buffer is not in Ibuffer mode"))
-  (set (make-local-variable 'ibuffer-auto-mode)
-       (if arg
-          (plusp arg)
-        (not ibuffer-auto-mode)))
-  (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector
-  (add-hook 'post-command-hook 'ibuffer-auto-update-changed))
-
 ;;;###autoload
 (defun ibuffer-mouse-filter-by-mode (event)
   "Enable or disable filtering by the major mode chosen via mouse."
@@ -544,10 +535,11 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'."
       (dolist (filtergroup filter-group-alist)
        (let ((filterset (cdr filtergroup)))
          (multiple-value-bind (hip-crowd lamers)
-             (ibuffer-split-list (lambda (bufmark)
-                                   (ibuffer-included-in-filters-p (car bufmark)
-                                                                  filterset))
-                                 bmarklist)
+             (values-list
+              (ibuffer-split-list (lambda (bufmark)
+                                    (ibuffer-included-in-filters-p (car bufmark)
+                                                                   filterset))
+                                  bmarklist))
            (aset vec i hip-crowd)
            (incf i)
            (setq bmarklist lamers))))
@@ -1160,10 +1152,10 @@ Ordering is lexicographic."
   (string-lessp
    ;; FIXME: For now just compare the file name and the process name
    ;; (if it exists).  Is there a better way to do this?
-   (or (buffer-file-name (car a)) 
+   (or (buffer-file-name (car a))
        (let ((pr-a (get-buffer-process (car a))))
         (and (processp pr-a) (process-name pr-a))))
-   (or (buffer-file-name (car b)) 
+   (or (buffer-file-name (car b))
        (let ((pr-b (get-buffer-process (car b))))
         (and (processp pr-b) (process-name pr-b))))))
 
@@ -1337,7 +1329,7 @@ a prefix argument reverses the meaning of that variable."
                       ;; Use explicitly specified switches
                       ,@(if (listp switches) switches (list switches))
                       ,@(if (or old new)
-                            (list "-L" old
+                            (list "-L" (shell-quote-argument old)
                                   "-L" (shell-quote-argument
                                         (format "Buffer %s" (buffer-name buffer)))))
                       ,(shell-quote-argument (or oldtmp old))
@@ -1597,5 +1589,9 @@ defaults to one."
 
 (provide 'ibuf-ext)
 
+;; Local Variables:
+;; generated-autoload-file: "ibuffer.el"
+;; End:
+
 ;; arch-tag: 9af21953-deda-4c30-b76d-f81d9128e76d
 ;;; ibuf-ext.el ends here