;;; ibuf-ext.el --- extensions for ibuffer
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-;; 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
;; Author: Colin Walters <walters@verbum.org>
;; Maintainer: John Paul Wallington <jpw@gnu.org>
;; Created: 2 Dec 2001
;; Keywords: buffer, convenience
+;; Package: ibuffer
;; This file is part of GNU Emacs.
;;; Commentary:
;; These functions should be automatically loaded when called, but you
-;; can explicity (require 'ibuf-ext) in your ~/.emacs to have them
+;; can explicitly (require 'ibuf-ext) in your ~/.emacs to have them
;; preloaded.
;;; Code:
;;;###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."
+ "Toggle use of Ibuffer's auto-update facility (Ibuffer Auto mode).
+With a prefix argument ARG, enable Ibuffer Auto mode if ARG is
+positive, and disable it otherwise. If called from Lisp, enable
+the mode if ARG is omitted or nil."
nil nil nil
(unless (derived-mode-p 'ibuffer-mode)
(error "This buffer is not in Ibuffer mode"))
(assoc (cdr filter)
ibuffer-saved-filters)))
(unless data
- (ibuffer-filter-disable)
+ (ibuffer-filter-disable t)
(error "Unknown saved filter %s" (cdr filter)))
(ibuffer-included-in-filters-p buf (cadr data))))
(t
;; filterdat should be like (TYPE DESCRIPTION FUNC)
;; just a sanity check
(unless filterdat
- (ibuffer-filter-disable)
+ (ibuffer-filter-disable t)
(error "Undefined filter %s" (car filter)))
(not
(not
(ibuffer-update nil t))
;;;###autoload
-(defun ibuffer-filter-disable ()
- "Disable all filters currently in effect in this buffer."
+(defun ibuffer-filter-disable (&optional delete-filter-groups)
+ "Disable all filters currently in effect in this buffer.
+With optional arg DELETE-FILTER-GROUPS non-nil, delete all filter
+group definitions by setting `ibuffer-filter-groups' to nil."
(interactive)
(setq ibuffer-filtering-qualifiers nil)
+ (if delete-filter-groups
+ (setq ibuffer-filter-groups nil))
(let ((buf (ibuffer-current-buffer)))
(ibuffer-update nil t)
(when buf
(setq direction 1))
;; Skip the title
(ibuffer-forward-line 0)
- (let ((opos (point))
- curmark)
+ (let ((opos (point)))
(ibuffer-forward-line direction)
(while (not (or (= (point) opos)
- (eq (setq curmark (ibuffer-current-mark))
- mark)))
+ (eq (ibuffer-current-mark) mark)))
(ibuffer-forward-line direction))
(when (and (= (point) opos)
(not (eq (ibuffer-current-mark) mark)))
(message "No buffers marked; use 'm' to mark a buffer")
(let ((count
(ibuffer-map-marked-lines
- #'(lambda (buf mark)
+ #'(lambda (_buf _mark)
'kill))))
(message "Killed %s lines" count))))
(let (buf-point)
;; Blindly search for our buffer: it is very likely that it is
;; not in a hidden filter group.
- (ibuffer-map-lines #'(lambda (buf marks)
+ (ibuffer-map-lines #'(lambda (buf _marks)
(when (string= (buffer-name buf) name)
(setq buf-point (point))
nil))
(dolist (group ibuffer-hidden-filter-groups)
(ibuffer-jump-to-filter-group group)
(ibuffer-toggle-filter-group)
- (ibuffer-map-lines #'(lambda (buf marks)
+ (ibuffer-map-lines #'(lambda (buf _marks)
(when (string= (buffer-name buf) name)
(setq buf-point (point))
nil))
(error "No buffer with name %s" name)
(goto-char buf-point)))))
-(declare-function diff-sentinel "diff" (code))
+(declare-function diff-sentinel "diff"
+ (code &optional old-temp-file new-temp-file))
(defun ibuffer-diff-buffer-with-file-1 (buffer)
(let ((bufferfile (buffer-local-value 'buffer-file-name buffer))
(format "Buffer %s" (buffer-name buffer)))))
,(shell-quote-argument (or oldtmp old))
,(shell-quote-argument (or newtmp new)))
- " "))
- proc)
+ " ")))
(let ((inhibit-read-only t))
(insert command "\n")
(diff-sentinel
(t
'name))))
(ibuffer-map-marked-lines
- #'(lambda (buf mark)
+ #'(lambda (buf _mark)
(setq ibuffer-copy-filename-as-kill-result
(concat ibuffer-copy-filename-as-kill-result
(let ((name (buffer-file-name buf)))
(defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group)
(let ((count
(ibuffer-map-lines
- #'(lambda (buf mark)
+ #'(lambda (buf _mark)
(when (funcall func buf)
(ibuffer-set-mark-1 (or ibuffer-mark-on-buffer-mark
ibuffer-marked-char))
(let ((ibuffer-do-occur-bufs nil))
;; Accumulate a list of marked buffers
(ibuffer-map-marked-lines
- #'(lambda (buf mark)
+ #'(lambda (buf _mark)
(push buf ibuffer-do-occur-bufs)))
(occur-1 regexp nlines ibuffer-do-occur-bufs)))
;; generated-autoload-file: "ibuffer.el"
;; End:
-;; arch-tag: 9af21953-deda-4c30-b76d-f81d9128e76d
;;; ibuf-ext.el ends here