2014-09-22 14:10:53 +00:00
|
|
|
;;; ibuf-ext.el --- extensions for ibuffer -*- lexical-binding:t -*-
|
2002-01-13 05:55:24 +00:00
|
|
|
|
2016-01-01 09:16:19 +00:00
|
|
|
;; Copyright (C) 2000-2016 Free Software Foundation, Inc.
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;; Author: Colin Walters <walters@verbum.org>
|
2003-01-24 04:54:17 +00:00
|
|
|
;; Maintainer: John Paul Wallington <jpw@gnu.org>
|
2002-01-13 05:55:24 +00:00
|
|
|
;; Created: 2 Dec 2001
|
|
|
|
;; Keywords: buffer, convenience
|
2010-08-29 20:10:43 +00:00
|
|
|
;; Package: ibuffer
|
2002-01-13 05:55:24 +00:00
|
|
|
|
2002-04-24 23:27:02 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
2002-01-13 05:55:24 +00:00
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
;; 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 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2002-01-13 05:55:24 +00:00
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 08:06:51 +00:00
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; These functions should be automatically loaded when called, but you
|
2011-12-12 05:32:49 +00:00
|
|
|
;; can explicitly (require 'ibuf-ext) in your ~/.emacs to have them
|
2002-01-13 05:55:24 +00:00
|
|
|
;; preloaded.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'ibuffer)
|
|
|
|
|
|
|
|
(eval-when-compile
|
|
|
|
(require 'ibuf-macs)
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(require 'cl-lib))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;; Utility functions
|
|
|
|
(defun ibuffer-delete-alist (key alist)
|
|
|
|
"Delete all entries in ALIST that have a key equal to KEY."
|
|
|
|
(let (entry)
|
|
|
|
(while (setq entry (assoc key alist))
|
|
|
|
(setq alist (delete entry alist)))
|
|
|
|
alist))
|
|
|
|
|
2002-12-09 23:46:12 +00:00
|
|
|
;; borrowed from Gnus
|
|
|
|
(defun ibuffer-remove-duplicates (list)
|
|
|
|
"Return a copy of LIST with duplicate elements removed."
|
|
|
|
(let ((new nil)
|
|
|
|
(tail list))
|
|
|
|
(while tail
|
|
|
|
(or (member (car tail) new)
|
|
|
|
(setq new (cons (car tail) new)))
|
|
|
|
(setq tail (cdr tail)))
|
|
|
|
(nreverse new)))
|
|
|
|
|
2002-04-24 23:27:02 +00:00
|
|
|
(defun ibuffer-split-list (ibuffer-split-list-fn ibuffer-split-list-elts)
|
|
|
|
(let ((hip-crowd nil)
|
|
|
|
(lamers nil))
|
|
|
|
(dolist (ibuffer-split-list-elt ibuffer-split-list-elts)
|
2003-01-24 04:54:17 +00:00
|
|
|
(if (funcall ibuffer-split-list-fn ibuffer-split-list-elt)
|
2002-04-24 23:27:02 +00:00
|
|
|
(push ibuffer-split-list-elt hip-crowd)
|
|
|
|
(push ibuffer-split-list-elt lamers)))
|
|
|
|
;; Too bad Emacs Lisp doesn't have multiple values.
|
|
|
|
(list (nreverse hip-crowd) (nreverse lamers))))
|
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
(defcustom ibuffer-never-show-predicates nil
|
|
|
|
"A list of predicates (a regexp or function) for buffers not to display.
|
|
|
|
If a regexp, then it will be matched against the buffer's name.
|
|
|
|
If a function, it will be called with the buffer as an argument, and
|
|
|
|
should return non-nil if this buffer should not be shown."
|
|
|
|
:type '(repeat (choice regexp function))
|
2006-03-13 01:45:16 +00:00
|
|
|
:require 'ibuf-ext
|
2002-01-13 05:55:24 +00:00
|
|
|
:group 'ibuffer)
|
|
|
|
|
|
|
|
(defcustom ibuffer-always-show-predicates nil
|
|
|
|
"A list of predicates (a regexp or function) for buffers to always display.
|
|
|
|
If a regexp, then it will be matched against the buffer's name.
|
|
|
|
If a function, it will be called with the buffer as an argument, and
|
|
|
|
should return non-nil if this buffer should be shown.
|
|
|
|
Note that buffers matching one of these predicates will be shown
|
|
|
|
regardless of any active filters in this buffer."
|
|
|
|
:type '(repeat (choice regexp function))
|
|
|
|
:group 'ibuffer)
|
|
|
|
|
|
|
|
(defvar ibuffer-tmp-hide-regexps nil
|
|
|
|
"A list of regexps which should match buffer names to not show.")
|
2003-02-04 11:26:42 +00:00
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
(defvar ibuffer-tmp-show-regexps nil
|
|
|
|
"A list of regexps which should match buffer names to always show.")
|
|
|
|
|
|
|
|
(defvar ibuffer-auto-buffers-changed nil)
|
|
|
|
|
|
|
|
(defcustom ibuffer-saved-filters '(("gnus"
|
|
|
|
((or (mode . message-mode)
|
|
|
|
(mode . mail-mode)
|
|
|
|
(mode . gnus-group-mode)
|
2003-01-24 04:54:17 +00:00
|
|
|
(mode . gnus-summary-mode)
|
2002-01-13 05:55:24 +00:00
|
|
|
(mode . gnus-article-mode))))
|
|
|
|
("programming"
|
|
|
|
((or (mode . emacs-lisp-mode)
|
|
|
|
(mode . cperl-mode)
|
|
|
|
(mode . c-mode)
|
2003-01-24 04:54:17 +00:00
|
|
|
(mode . java-mode)
|
2002-01-13 05:55:24 +00:00
|
|
|
(mode . idl-mode)
|
|
|
|
(mode . lisp-mode)))))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
"An alist of filter qualifiers to switch between.
|
|
|
|
|
|
|
|
This variable should look like ((\"STRING\" QUALIFIERS)
|
|
|
|
(\"STRING\" QUALIFIERS) ...), where
|
|
|
|
QUALIFIERS is a list of the same form as
|
|
|
|
`ibuffer-filtering-qualifiers'.
|
|
|
|
See also the variables `ibuffer-filtering-qualifiers',
|
|
|
|
`ibuffer-filtering-alist', and the functions
|
|
|
|
`ibuffer-switch-to-saved-filters', `ibuffer-save-filters'."
|
|
|
|
:type '(repeat sexp)
|
|
|
|
:group 'ibuffer)
|
|
|
|
|
|
|
|
(defvar ibuffer-filtering-qualifiers nil
|
|
|
|
"A list like (SYMBOL . QUALIFIER) which filters the current buffer list.
|
|
|
|
See also `ibuffer-filtering-alist'.")
|
|
|
|
|
|
|
|
;; This is now frobbed by `define-ibuffer-filter'.
|
|
|
|
(defvar ibuffer-filtering-alist nil
|
|
|
|
"An alist of (SYMBOL DESCRIPTION FUNCTION) which describes a filter.
|
|
|
|
|
|
|
|
You most likely do not want to modify this variable directly; see
|
|
|
|
`define-ibuffer-filter'.
|
|
|
|
|
|
|
|
SYMBOL is the symbolic name of the filter. DESCRIPTION is used when
|
|
|
|
displaying information to the user. FUNCTION is given a buffer and
|
|
|
|
the value of the qualifier, and returns non-nil if and only if the
|
|
|
|
buffer should be displayed.")
|
|
|
|
|
2002-02-04 03:57:19 +00:00
|
|
|
(defcustom ibuffer-filter-format-alist nil
|
|
|
|
"An alist which has special formats used when a filter is active.
|
|
|
|
The contents of this variable should look like:
|
|
|
|
((FILTER (FORMAT FORMAT ...)) (FILTER (FORMAT FORMAT ...)) ...)
|
|
|
|
|
|
|
|
For example, suppose that when you add a filter for buffers whose
|
|
|
|
major mode is `emacs-lisp-mode', you only want to see the mark and the
|
|
|
|
name of the buffer. You could accomplish that by adding:
|
|
|
|
(mode ((mark \" \" name)))
|
2002-03-08 04:06:18 +00:00
|
|
|
to this variable."
|
|
|
|
:type '(repeat (list :tag "Association" (symbol :tag "Filter")
|
|
|
|
(list :tag "Formats" (repeat (sexp :tag "Format")))))
|
|
|
|
:group 'ibuffer)
|
2002-02-04 03:57:19 +00:00
|
|
|
|
|
|
|
(defvar ibuffer-cached-filter-formats nil)
|
2003-01-24 04:54:17 +00:00
|
|
|
(defvar ibuffer-compiled-filter-formats nil)
|
2002-02-04 03:57:19 +00:00
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
(defvar ibuffer-filter-groups nil
|
2002-04-24 23:27:02 +00:00
|
|
|
"A list like ((\"NAME\" ((SYMBOL . QUALIFIER) ...) ...) which groups buffers.
|
2002-04-25 19:03:55 +00:00
|
|
|
The SYMBOL should be one from `ibuffer-filtering-alist'.
|
|
|
|
The QUALIFIER should be the same as QUALIFIER in
|
|
|
|
`ibuffer-filtering-qualifiers'.")
|
|
|
|
|
|
|
|
(defcustom ibuffer-show-empty-filter-groups t
|
|
|
|
"If non-nil, then show the names of filter groups which are empty."
|
|
|
|
:type 'boolean
|
|
|
|
:group 'ibuffer)
|
|
|
|
|
2002-04-26 03:59:35 +00:00
|
|
|
(defcustom ibuffer-saved-filter-groups nil
|
2002-04-25 19:03:55 +00:00
|
|
|
"An alist of filtering groups to switch between.
|
|
|
|
|
|
|
|
This variable should look like ((\"STRING\" QUALIFIERS)
|
|
|
|
(\"STRING\" QUALIFIERS) ...), where
|
|
|
|
QUALIFIERS is a list of the same form as
|
|
|
|
`ibuffer-filtering-qualifiers'.
|
|
|
|
|
|
|
|
See also the variables `ibuffer-filter-groups',
|
|
|
|
`ibuffer-filtering-qualifiers', `ibuffer-filtering-alist', and the
|
2007-10-18 04:43:08 +00:00
|
|
|
functions `ibuffer-switch-to-saved-filter-groups',
|
|
|
|
`ibuffer-save-filter-groups'."
|
2002-04-25 19:03:55 +00:00
|
|
|
:type '(repeat sexp)
|
|
|
|
:group 'ibuffer)
|
2002-04-24 23:27:02 +00:00
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
(defvar ibuffer-hidden-filter-groups nil
|
2002-04-24 23:27:02 +00:00
|
|
|
"A list of filtering groups which are currently hidden.")
|
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
(defvar ibuffer-filter-group-kill-ring nil)
|
|
|
|
|
2002-02-23 21:33:49 +00:00
|
|
|
(defcustom ibuffer-old-time 72
|
|
|
|
"The number of hours before a buffer is considered \"old\"."
|
|
|
|
:type '(choice (const :tag "72 hours (3 days)" 72)
|
|
|
|
(const :tag "48 hours (2 days)" 48)
|
|
|
|
(const :tag "24 hours (1 day)" 24)
|
|
|
|
(integer :tag "hours"))
|
2002-01-13 05:55:24 +00:00
|
|
|
:group 'ibuffer)
|
|
|
|
|
|
|
|
(defcustom ibuffer-save-with-custom t
|
|
|
|
"If non-nil, then use Custom to save interactively changed variables.
|
2002-04-25 19:03:55 +00:00
|
|
|
Currently, this only applies to `ibuffer-saved-filters' and
|
2003-02-11 14:59:54 +00:00
|
|
|
`ibuffer-saved-filter-groups'."
|
2002-01-13 05:55:24 +00:00
|
|
|
:type 'boolean
|
|
|
|
:group 'ibuffer)
|
|
|
|
|
|
|
|
(defun ibuffer-ext-visible-p (buf all &optional ibuffer-buf)
|
|
|
|
(or
|
|
|
|
(ibuffer-buf-matches-predicates buf ibuffer-tmp-show-regexps)
|
|
|
|
(and (not
|
|
|
|
(or
|
|
|
|
(ibuffer-buf-matches-predicates buf ibuffer-tmp-hide-regexps)
|
|
|
|
(ibuffer-buf-matches-predicates buf ibuffer-never-show-predicates)))
|
|
|
|
(or all
|
|
|
|
(not
|
|
|
|
(ibuffer-buf-matches-predicates buf ibuffer-maybe-show-predicates)))
|
|
|
|
(or ibuffer-view-ibuffer
|
2003-01-24 04:54:17 +00:00
|
|
|
(and ibuffer-buf
|
2002-01-13 05:55:24 +00:00
|
|
|
(not (eq ibuffer-buf buf))))
|
|
|
|
(or
|
|
|
|
(ibuffer-included-in-filters-p buf ibuffer-filtering-qualifiers)
|
|
|
|
(ibuffer-buf-matches-predicates buf ibuffer-always-show-predicates)))))
|
|
|
|
|
2010-05-03 02:29:46 +00:00
|
|
|
;;;###autoload
|
|
|
|
(define-minor-mode ibuffer-auto-mode
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 12:54:24 +00:00
|
|
|
"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."
|
2010-05-03 02:29:46 +00:00
|
|
|
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))
|
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
(defun ibuffer-auto-update-changed ()
|
2005-08-28 06:52:18 +00:00
|
|
|
(when (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed)
|
2007-10-23 15:57:57 +00:00
|
|
|
(dolist (buf (buffer-list))
|
|
|
|
(ignore-errors
|
|
|
|
(with-current-buffer buf
|
|
|
|
(when (and ibuffer-auto-mode
|
2008-01-16 15:57:42 +00:00
|
|
|
(derived-mode-p 'ibuffer-mode))
|
2007-10-23 15:57:57 +00:00
|
|
|
(ibuffer-update nil t)))))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mouse-filter-by-mode (event)
|
|
|
|
"Enable or disable filtering by the major mode chosen via mouse."
|
|
|
|
(interactive "e")
|
|
|
|
(ibuffer-interactive-filter-by-mode event))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-interactive-filter-by-mode (event-or-point)
|
|
|
|
"Enable or disable filtering by the major mode at point."
|
|
|
|
(interactive "d")
|
|
|
|
(if (eventp event-or-point)
|
2005-11-17 22:56:28 +00:00
|
|
|
(posn-set-point (event-end event-or-point))
|
2002-01-13 05:55:24 +00:00
|
|
|
(goto-char event-or-point))
|
|
|
|
(let ((buf (ibuffer-current-buffer)))
|
|
|
|
(if (assq 'mode ibuffer-filtering-qualifiers)
|
|
|
|
(setq ibuffer-filtering-qualifiers
|
|
|
|
(ibuffer-delete-alist 'mode ibuffer-filtering-qualifiers))
|
2008-05-15 01:14:41 +00:00
|
|
|
(ibuffer-push-filter (cons 'mode (buffer-local-value 'major-mode buf)))))
|
2002-01-13 05:55:24 +00:00
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
2002-04-24 23:27:02 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mouse-toggle-filter-group (event)
|
|
|
|
"Toggle the display status of the filter group chosen with the mouse."
|
|
|
|
(interactive "e")
|
|
|
|
(ibuffer-toggle-filter-group-1 (save-excursion
|
|
|
|
(mouse-set-point event)
|
|
|
|
(point))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-toggle-filter-group ()
|
|
|
|
"Toggle the display status of the filter group on this line."
|
2003-01-24 04:54:17 +00:00
|
|
|
(interactive)
|
2002-04-24 23:27:02 +00:00
|
|
|
(ibuffer-toggle-filter-group-1 (point)))
|
|
|
|
|
2003-01-24 04:54:17 +00:00
|
|
|
(defun ibuffer-toggle-filter-group-1 (posn)
|
2002-04-24 23:27:02 +00:00
|
|
|
(let ((name (get-text-property posn 'ibuffer-filter-group-name)))
|
|
|
|
(unless (stringp name)
|
|
|
|
(error "No filtering group name present"))
|
2002-04-25 19:03:55 +00:00
|
|
|
(if (member name ibuffer-hidden-filter-groups)
|
|
|
|
(setq ibuffer-hidden-filter-groups
|
|
|
|
(delete name ibuffer-hidden-filter-groups))
|
|
|
|
(push name ibuffer-hidden-filter-groups))
|
2002-04-24 23:27:02 +00:00
|
|
|
(ibuffer-update nil t)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-forward-filter-group (&optional count)
|
|
|
|
"Move point forwards by COUNT filtering groups."
|
|
|
|
(interactive "P")
|
|
|
|
(unless count
|
|
|
|
(setq count 1))
|
|
|
|
(when (> count 0)
|
|
|
|
(when (get-text-property (point) 'ibuffer-filter-group-name)
|
|
|
|
(goto-char (next-single-property-change
|
|
|
|
(point) 'ibuffer-filter-group-name
|
|
|
|
nil (point-max))))
|
|
|
|
(goto-char (next-single-property-change
|
|
|
|
(point) 'ibuffer-filter-group-name
|
|
|
|
nil (point-max)))
|
|
|
|
(ibuffer-forward-filter-group (1- count)))
|
|
|
|
(ibuffer-forward-line 0))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-backward-filter-group (&optional count)
|
|
|
|
"Move point backwards by COUNT filtering groups."
|
|
|
|
(interactive "P")
|
|
|
|
(unless count
|
|
|
|
(setq count 1))
|
|
|
|
(when (> count 0)
|
|
|
|
(when (get-text-property (point) 'ibuffer-filter-group-name)
|
|
|
|
(goto-char (previous-single-property-change
|
|
|
|
(point) 'ibuffer-filter-group-name
|
|
|
|
nil (point-min))))
|
|
|
|
(goto-char (previous-single-property-change
|
|
|
|
(point) 'ibuffer-filter-group-name
|
|
|
|
nil (point-min)))
|
|
|
|
(ibuffer-backward-filter-group (1- count)))
|
|
|
|
(when (= (point) (point-min))
|
|
|
|
(goto-char (point-max))
|
|
|
|
(ibuffer-backward-filter-group 1))
|
|
|
|
(ibuffer-forward-line 0))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-shell-command-pipe "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op shell-command-pipe (command)
|
|
|
|
"Pipe the contents of each marked buffer to shell command COMMAND."
|
|
|
|
(:interactive "sPipe to shell command: "
|
|
|
|
:opstring "Shell command executed on"
|
|
|
|
:modifier-p nil)
|
|
|
|
(shell-command-on-region
|
|
|
|
(point-min) (point-max) command
|
|
|
|
(get-buffer-create "* ibuffer-shell-output*")))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-shell-command-pipe-replace "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op shell-command-pipe-replace (command)
|
|
|
|
"Replace the contents of marked buffers with output of pipe to COMMAND."
|
|
|
|
(:interactive "sPipe to shell command (replace): "
|
|
|
|
:opstring "Buffer contents replaced in"
|
|
|
|
:active-opstring "replace buffer contents in"
|
|
|
|
:dangerous t
|
|
|
|
:modifier-p t)
|
|
|
|
(with-current-buffer buf
|
|
|
|
(shell-command-on-region (point-min) (point-max)
|
|
|
|
command nil t)))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-shell-command-file "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op shell-command-file (command)
|
|
|
|
"Run shell command COMMAND separately on files of marked buffers."
|
|
|
|
(:interactive "sShell command on buffer's file: "
|
|
|
|
:opstring "Shell command executed on"
|
|
|
|
:modifier-p nil)
|
|
|
|
(shell-command (concat command " "
|
|
|
|
(shell-quote-argument
|
2016-06-07 23:24:51 +00:00
|
|
|
(or buffer-file-name
|
|
|
|
(let ((file
|
|
|
|
(make-temp-file
|
|
|
|
(substring
|
|
|
|
(buffer-name) 0
|
|
|
|
(min 10 (length (buffer-name)))))))
|
|
|
|
(write-region nil nil file nil 0)
|
|
|
|
file))))))
|
2002-04-24 23:27:02 +00:00
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-eval "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op eval (form)
|
|
|
|
"Evaluate FORM in each of the buffers.
|
|
|
|
Does not display the buffer during evaluation. See
|
|
|
|
`ibuffer-do-view-and-eval' for that."
|
2006-10-02 23:26:42 +00:00
|
|
|
(:interactive
|
|
|
|
(list
|
|
|
|
(read-from-minibuffer
|
|
|
|
"Eval in buffers (form): "
|
|
|
|
nil read-expression-map t 'read-expression-history))
|
2002-01-13 05:55:24 +00:00
|
|
|
:opstring "evaluated in"
|
|
|
|
:modifier-p :maybe)
|
|
|
|
(eval form))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-view-and-eval "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op view-and-eval (form)
|
|
|
|
"Evaluate FORM while displaying each of the marked buffers.
|
|
|
|
To evaluate a form without viewing the buffer, see `ibuffer-do-eval'."
|
2006-10-02 23:26:42 +00:00
|
|
|
(:interactive
|
|
|
|
(list
|
|
|
|
(read-from-minibuffer
|
|
|
|
"Eval viewing in buffers (form): "
|
|
|
|
nil read-expression-map t 'read-expression-history))
|
2002-01-13 05:55:24 +00:00
|
|
|
:opstring "evaluated in"
|
|
|
|
:complex t
|
|
|
|
:modifier-p :maybe)
|
|
|
|
(let ((ibuffer-buf (current-buffer)))
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(switch-to-buffer buf)
|
|
|
|
(eval form))
|
|
|
|
(switch-to-buffer ibuffer-buf))))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-rename-uniquely "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op rename-uniquely ()
|
|
|
|
"Rename marked buffers as with `rename-uniquely'."
|
|
|
|
(:opstring "renamed"
|
|
|
|
:modifier-p t)
|
|
|
|
(rename-uniquely))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-revert "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op revert ()
|
|
|
|
"Revert marked buffers as with `revert-buffer'."
|
|
|
|
(:dangerous t
|
|
|
|
:opstring "reverted"
|
|
|
|
:active-opstring "revert"
|
|
|
|
:modifier-p :maybe)
|
|
|
|
(revert-buffer t t))
|
|
|
|
|
2008-07-23 23:53:03 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-isearch "ibuf-ext")
|
|
|
|
(define-ibuffer-op ibuffer-do-isearch ()
|
|
|
|
"Perform a `isearch-forward' in marked buffers."
|
|
|
|
(:interactive ()
|
|
|
|
:opstring "searched in"
|
|
|
|
:complex t
|
|
|
|
:modifier-p :maybe)
|
|
|
|
(multi-isearch-buffers (ibuffer-get-marked-buffers)))
|
|
|
|
|
|
|
|
;;;###autoload (autoload 'ibuffer-do-isearch-regexp "ibuf-ext")
|
|
|
|
(define-ibuffer-op ibuffer-do-isearch-regexp ()
|
|
|
|
"Perform a `isearch-forward-regexp' in marked buffers."
|
|
|
|
(:interactive ()
|
|
|
|
:opstring "searched regexp in"
|
|
|
|
:complex t
|
|
|
|
:modifier-p :maybe)
|
|
|
|
(multi-isearch-buffers-regexp (ibuffer-get-marked-buffers)))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-replace-regexp "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op replace-regexp (from-str to-str)
|
|
|
|
"Perform a `replace-regexp' in marked buffers."
|
|
|
|
(:interactive
|
|
|
|
(let* ((from-str (read-from-minibuffer "Replace regexp: "))
|
|
|
|
(to-str (read-from-minibuffer (concat "Replace " from-str
|
|
|
|
" with: "))))
|
|
|
|
(list from-str to-str))
|
|
|
|
:opstring "replaced in"
|
|
|
|
:complex t
|
|
|
|
:modifier-p :maybe)
|
|
|
|
(save-window-excursion
|
|
|
|
(switch-to-buffer buf)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(let ((case-fold-search ibuffer-case-fold-search))
|
|
|
|
(while (re-search-forward from-str nil t)
|
|
|
|
(replace-match to-str))))
|
|
|
|
t))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-query-replace "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op query-replace (&rest args)
|
|
|
|
"Perform a `query-replace' in marked buffers."
|
|
|
|
(:interactive
|
2002-03-27 22:38:04 +00:00
|
|
|
(query-replace-read-args "Query replace" t t)
|
2002-01-13 05:55:24 +00:00
|
|
|
:opstring "replaced in"
|
|
|
|
:complex t
|
|
|
|
:modifier-p :maybe)
|
|
|
|
(save-window-excursion
|
|
|
|
(switch-to-buffer buf)
|
|
|
|
(save-excursion
|
|
|
|
(let ((case-fold-search ibuffer-case-fold-search))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(apply #'query-replace args)))
|
|
|
|
t))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-query-replace-regexp "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op query-replace-regexp (&rest args)
|
|
|
|
"Perform a `query-replace-regexp' in marked buffers."
|
|
|
|
(:interactive
|
2002-03-27 22:38:04 +00:00
|
|
|
(query-replace-read-args "Query replace regexp" t t)
|
2002-01-13 05:55:24 +00:00
|
|
|
:opstring "replaced in"
|
|
|
|
:complex t
|
|
|
|
:modifier-p :maybe)
|
|
|
|
(save-window-excursion
|
|
|
|
(switch-to-buffer buf)
|
|
|
|
(save-excursion
|
|
|
|
(let ((case-fold-search ibuffer-case-fold-search))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(apply #'query-replace-regexp args)))
|
|
|
|
t))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-print "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-op print ()
|
|
|
|
"Print marked buffers as with `print-buffer'."
|
|
|
|
(:opstring "printed"
|
|
|
|
:modifier-p nil)
|
|
|
|
(print-buffer))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-included-in-filters-p (buf filters)
|
|
|
|
(not
|
|
|
|
(memq nil ;; a filter will return nil if it failed
|
|
|
|
(mapcar
|
|
|
|
;; filter should be like (TYPE . QUALIFIER), or
|
|
|
|
;; (or (TYPE . QUALIFIER) (TYPE . QUALIFIER) ...)
|
|
|
|
#'(lambda (qual)
|
|
|
|
(ibuffer-included-in-filter-p buf qual))
|
|
|
|
filters))))
|
|
|
|
|
|
|
|
(defun ibuffer-included-in-filter-p (buf filter)
|
|
|
|
(if (eq (car filter) 'not)
|
|
|
|
(not (ibuffer-included-in-filter-p-1 buf (cdr filter)))
|
|
|
|
(ibuffer-included-in-filter-p-1 buf filter)))
|
|
|
|
|
|
|
|
(defun ibuffer-included-in-filter-p-1 (buf filter)
|
|
|
|
(not
|
|
|
|
(not
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(pcase (car filter)
|
|
|
|
(`or
|
2002-01-13 05:55:24 +00:00
|
|
|
(memq t (mapcar #'(lambda (x)
|
|
|
|
(ibuffer-included-in-filter-p buf x))
|
|
|
|
(cdr filter))))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(`saved
|
2002-01-13 05:55:24 +00:00
|
|
|
(let ((data
|
|
|
|
(assoc (cdr filter)
|
|
|
|
ibuffer-saved-filters)))
|
|
|
|
(unless data
|
2011-08-14 18:08:20 +00:00
|
|
|
(ibuffer-filter-disable t)
|
2002-01-13 05:55:24 +00:00
|
|
|
(error "Unknown saved filter %s" (cdr filter)))
|
|
|
|
(ibuffer-included-in-filters-p buf (cadr data))))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(_
|
|
|
|
(pcase-let ((`(,_type ,_desc ,func)
|
|
|
|
(assq (car filter) ibuffer-filtering-alist)))
|
|
|
|
(unless func
|
|
|
|
(ibuffer-filter-disable t)
|
|
|
|
(error "Undefined filter %s" (car filter)))
|
|
|
|
(funcall func buf (cdr filter))))))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
2006-03-23 07:05:33 +00:00
|
|
|
(defun ibuffer-generate-filter-groups (bmarklist &optional noempty nodefault)
|
|
|
|
(let ((filter-group-alist (if nodefault
|
|
|
|
ibuffer-filter-groups
|
|
|
|
(append ibuffer-filter-groups
|
|
|
|
(list (cons "Default" nil))))))
|
2014-09-22 14:10:53 +00:00
|
|
|
;; (dolist (hidden ibuffer-hidden-filter-groups)
|
|
|
|
;; (setq filter-group-alist (ibuffer-delete-alist
|
|
|
|
;; hidden filter-group-alist)))
|
2002-04-25 19:03:55 +00:00
|
|
|
(let ((vec (make-vector (length filter-group-alist) nil))
|
2002-04-24 23:27:02 +00:00
|
|
|
(i 0))
|
2002-04-25 19:03:55 +00:00
|
|
|
(dolist (filtergroup filter-group-alist)
|
2002-04-24 23:27:02 +00:00
|
|
|
(let ((filterset (cdr filtergroup)))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-multiple-value-bind (hip-crowd lamers)
|
|
|
|
(cl-values-list
|
2009-03-13 19:43:38 +00:00
|
|
|
(ibuffer-split-list (lambda (bufmark)
|
|
|
|
(ibuffer-included-in-filters-p (car bufmark)
|
|
|
|
filterset))
|
|
|
|
bmarklist))
|
2002-04-24 23:27:02 +00:00
|
|
|
(aset vec i hip-crowd)
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-incf i)
|
2002-04-24 23:27:02 +00:00
|
|
|
(setq bmarklist lamers))))
|
2006-03-23 07:05:33 +00:00
|
|
|
(let (ret)
|
2014-09-22 14:10:53 +00:00
|
|
|
(dotimes (j i)
|
2006-03-23 07:05:33 +00:00
|
|
|
(let ((bufs (aref vec j)))
|
|
|
|
(unless (and noempty (null bufs))
|
|
|
|
(push (cons (car (nth j filter-group-alist))
|
|
|
|
bufs)
|
2014-09-22 14:10:53 +00:00
|
|
|
ret))))
|
|
|
|
ret))))
|
2002-04-24 23:27:02 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-filters-to-filter-group (name)
|
|
|
|
"Make the current filters into a filtering group."
|
|
|
|
(interactive "sName for filtering group: ")
|
|
|
|
(when (null ibuffer-filtering-qualifiers)
|
|
|
|
(error "No filters in effect"))
|
2002-04-25 19:03:55 +00:00
|
|
|
(push (cons name ibuffer-filtering-qualifiers) ibuffer-filter-groups)
|
2002-04-24 23:27:02 +00:00
|
|
|
(ibuffer-filter-disable))
|
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-set-filter-groups-by-mode ()
|
|
|
|
"Set the current filter groups to filter by mode."
|
|
|
|
(interactive)
|
|
|
|
(setq ibuffer-filter-groups
|
2002-04-28 21:40:57 +00:00
|
|
|
(mapcar (lambda (mode)
|
|
|
|
(cons (format "%s" mode) `((mode . ,mode))))
|
|
|
|
(let ((modes
|
2002-12-09 23:46:12 +00:00
|
|
|
(ibuffer-remove-duplicates
|
2007-10-23 14:33:09 +00:00
|
|
|
(mapcar (lambda (buf)
|
2008-05-15 01:14:41 +00:00
|
|
|
(buffer-local-value 'major-mode buf))
|
2002-04-28 21:40:57 +00:00
|
|
|
(buffer-list)))))
|
|
|
|
(if ibuffer-view-ibuffer
|
|
|
|
modes
|
|
|
|
(delq 'ibuffer-mode modes)))))
|
2002-04-25 19:03:55 +00:00
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
2002-04-24 23:27:02 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-pop-filter-group ()
|
2002-05-07 08:13:13 +00:00
|
|
|
"Remove the first filter group."
|
2002-04-24 23:27:02 +00:00
|
|
|
(interactive)
|
2002-04-25 19:03:55 +00:00
|
|
|
(when (null ibuffer-filter-groups)
|
2002-05-07 08:13:13 +00:00
|
|
|
(error "No filter groups active"))
|
2002-04-28 21:40:57 +00:00
|
|
|
(setq ibuffer-hidden-filter-groups
|
|
|
|
(delete (pop ibuffer-filter-groups)
|
|
|
|
ibuffer-hidden-filter-groups))
|
2002-04-25 19:03:55 +00:00
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
2002-05-07 08:13:13 +00:00
|
|
|
(defun ibuffer-read-filter-group-name (msg &optional nodefault noerror)
|
|
|
|
(when (and (not noerror) (null ibuffer-filter-groups))
|
|
|
|
(error "No filter groups active"))
|
2006-03-23 07:05:33 +00:00
|
|
|
;; `ibuffer-generate-filter-groups' returns all non-hidden filter
|
|
|
|
;; groups, possibly excluding empty groups or Default.
|
|
|
|
;; We add `ibuffer-hidden-filter-groups' to the list, excluding
|
|
|
|
;; Default if necessary.
|
|
|
|
(completing-read msg (nconc
|
|
|
|
(ibuffer-generate-filter-groups
|
|
|
|
(ibuffer-current-state-list)
|
|
|
|
(not ibuffer-show-empty-filter-groups)
|
|
|
|
nodefault)
|
|
|
|
(if nodefault
|
|
|
|
(remove "Default" ibuffer-hidden-filter-groups)
|
|
|
|
ibuffer-hidden-filter-groups))
|
|
|
|
nil t))
|
2002-05-07 08:13:13 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-decompose-filter-group (group)
|
|
|
|
"Decompose the filter group GROUP into active filters."
|
2007-10-23 14:33:09 +00:00
|
|
|
(interactive
|
2003-07-05 11:20:30 +00:00
|
|
|
(list (ibuffer-read-filter-group-name "Decompose filter group: " t)))
|
2002-05-07 08:13:13 +00:00
|
|
|
(let ((data (cdr (assoc group ibuffer-filter-groups))))
|
|
|
|
(setq ibuffer-filter-groups (ibuffer-delete-alist
|
|
|
|
group ibuffer-filter-groups)
|
|
|
|
ibuffer-filtering-qualifiers data))
|
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-clear-filter-groups ()
|
2002-05-07 08:13:13 +00:00
|
|
|
"Remove all filter groups."
|
2002-04-25 19:03:55 +00:00
|
|
|
(interactive)
|
2002-04-28 21:40:57 +00:00
|
|
|
(setq ibuffer-filter-groups nil
|
|
|
|
ibuffer-hidden-filter-groups nil)
|
2002-04-24 23:27:02 +00:00
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
(defun ibuffer-current-filter-groups-with-position ()
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(let ((pos nil)
|
|
|
|
(result nil))
|
|
|
|
(while (and (not (eobp))
|
|
|
|
(setq pos (next-single-property-change
|
|
|
|
(point) 'ibuffer-filter-group-name)))
|
|
|
|
(goto-char pos)
|
|
|
|
(push (cons (get-text-property (point) 'ibuffer-filter-group-name)
|
|
|
|
pos)
|
|
|
|
result)
|
|
|
|
(goto-char (next-single-property-change
|
|
|
|
pos 'ibuffer-filter-group-name)))
|
|
|
|
(nreverse result))))
|
|
|
|
|
2002-04-24 23:27:02 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-jump-to-filter-group (name)
|
|
|
|
"Move point to the filter group whose name is NAME."
|
2007-10-23 14:33:09 +00:00
|
|
|
(interactive
|
2003-07-05 11:20:30 +00:00
|
|
|
(list (ibuffer-read-filter-group-name "Jump to filter group: ")))
|
2002-05-07 08:13:13 +00:00
|
|
|
(ibuffer-aif (assoc name (ibuffer-current-filter-groups-with-position))
|
|
|
|
(goto-char (cdr it))
|
|
|
|
(error "No filter group with name %s" name)))
|
2002-04-24 23:27:02 +00:00
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-kill-filter-group (name)
|
2002-05-07 08:13:13 +00:00
|
|
|
"Kill the filter group named NAME.
|
2002-05-05 00:12:17 +00:00
|
|
|
The group will be added to `ibuffer-filter-group-kill-ring'."
|
2002-05-07 08:13:13 +00:00
|
|
|
(interactive (list (ibuffer-read-filter-group-name "Kill filter group: " t)))
|
2002-05-05 00:12:17 +00:00
|
|
|
(when (equal name "Default")
|
2002-05-07 08:13:13 +00:00
|
|
|
(error "Can't kill default filter group"))
|
2002-04-25 19:03:55 +00:00
|
|
|
(ibuffer-aif (assoc name ibuffer-filter-groups)
|
2002-04-28 21:40:57 +00:00
|
|
|
(progn
|
2002-05-05 00:12:17 +00:00
|
|
|
(push (copy-tree it) ibuffer-filter-group-kill-ring)
|
2002-04-28 21:40:57 +00:00
|
|
|
(setq ibuffer-filter-groups (ibuffer-delete-alist
|
|
|
|
name ibuffer-filter-groups))
|
|
|
|
(setq ibuffer-hidden-filter-groups
|
2002-04-29 23:12:29 +00:00
|
|
|
(delete name ibuffer-hidden-filter-groups)))
|
2002-04-25 19:03:55 +00:00
|
|
|
(error "No filter group with name \"%s\"" name))
|
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
|
|
|
;;;###autoload
|
2004-10-23 19:58:27 +00:00
|
|
|
(defun ibuffer-kill-line (&optional arg interactive-p)
|
2002-05-07 08:13:13 +00:00
|
|
|
"Kill the filter group at point.
|
2002-05-05 00:12:17 +00:00
|
|
|
See also `ibuffer-kill-filter-group'."
|
2004-10-23 19:58:27 +00:00
|
|
|
(interactive "P\np")
|
2002-04-25 19:03:55 +00:00
|
|
|
(ibuffer-aif (save-excursion
|
|
|
|
(ibuffer-forward-line 0)
|
|
|
|
(get-text-property (point) 'ibuffer-filter-group-name))
|
|
|
|
(progn
|
|
|
|
(ibuffer-kill-filter-group it))
|
2004-10-23 19:58:27 +00:00
|
|
|
(funcall (if interactive-p #'call-interactively #'funcall)
|
2002-04-25 19:03:55 +00:00
|
|
|
#'kill-line arg)))
|
|
|
|
|
2002-05-05 00:12:17 +00:00
|
|
|
(defun ibuffer-insert-filter-group-before (newgroup group)
|
2002-12-09 23:46:12 +00:00
|
|
|
(let* ((found nil)
|
|
|
|
(pos (let ((groups (mapcar #'car ibuffer-filter-groups))
|
|
|
|
(res 0))
|
|
|
|
(while groups
|
|
|
|
(if (equal (car groups) group)
|
|
|
|
(setq found t
|
|
|
|
groups nil)
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(cl-incf res)
|
2002-12-09 23:46:12 +00:00
|
|
|
(setq groups (cdr groups))))
|
|
|
|
res)))
|
|
|
|
(cond ((not found)
|
2003-07-05 11:20:30 +00:00
|
|
|
(setq ibuffer-filter-groups
|
|
|
|
(nconc ibuffer-filter-groups (list newgroup))))
|
2002-12-09 23:46:12 +00:00
|
|
|
((zerop pos)
|
|
|
|
(push newgroup ibuffer-filter-groups))
|
2002-05-05 00:12:17 +00:00
|
|
|
(t
|
|
|
|
(let ((cell (nthcdr pos ibuffer-filter-groups)))
|
|
|
|
(setf (cdr cell) (cons (car cell) (cdr cell)))
|
|
|
|
(setf (car cell) newgroup))))))
|
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
;;;###autoload
|
2002-05-05 00:12:17 +00:00
|
|
|
(defun ibuffer-yank ()
|
|
|
|
"Yank the last killed filter group before group at point."
|
|
|
|
(interactive)
|
|
|
|
(ibuffer-yank-filter-group
|
|
|
|
(or (get-text-property (point) 'ibuffer-filter-group-name)
|
|
|
|
(get-text-property (point) 'ibuffer-filter-group)
|
|
|
|
(error "No filter group at point"))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-yank-filter-group (name)
|
|
|
|
"Yank the last killed filter group before group named NAME."
|
2003-01-28 08:50:17 +00:00
|
|
|
(interactive (list (ibuffer-read-filter-group-name
|
|
|
|
"Yank filter group before group: ")))
|
|
|
|
(unless ibuffer-filter-group-kill-ring
|
|
|
|
(error "The Ibuffer filter group kill-ring is empty"))
|
2002-04-25 19:03:55 +00:00
|
|
|
(save-excursion
|
|
|
|
(ibuffer-forward-line 0)
|
2002-05-05 00:12:17 +00:00
|
|
|
(ibuffer-insert-filter-group-before (pop ibuffer-filter-group-kill-ring)
|
|
|
|
name))
|
2002-04-25 19:03:55 +00:00
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
|
|
|
;;;###autoload
|
2003-01-24 04:54:17 +00:00
|
|
|
(defun ibuffer-save-filter-groups (name groups)
|
2002-04-25 19:03:55 +00:00
|
|
|
"Save all active filter groups GROUPS as NAME.
|
|
|
|
They are added to `ibuffer-saved-filter-groups'. Interactively,
|
|
|
|
prompt for NAME, and use the current filters."
|
|
|
|
(interactive
|
|
|
|
(if (null ibuffer-filter-groups)
|
|
|
|
(error "No filter groups active")
|
|
|
|
(list
|
|
|
|
(read-from-minibuffer "Save current filter groups as: ")
|
|
|
|
ibuffer-filter-groups)))
|
|
|
|
(ibuffer-aif (assoc name ibuffer-saved-filter-groups)
|
|
|
|
(setcdr it groups)
|
2002-04-26 03:59:35 +00:00
|
|
|
(push (cons name groups) ibuffer-saved-filter-groups))
|
2008-01-17 05:16:35 +00:00
|
|
|
(ibuffer-maybe-save-stuff))
|
2002-04-25 19:03:55 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-delete-saved-filter-groups (name)
|
|
|
|
"Delete saved filter groups with NAME.
|
|
|
|
They are removed from `ibuffer-saved-filter-groups'."
|
|
|
|
(interactive
|
|
|
|
(list
|
|
|
|
(if (null ibuffer-saved-filter-groups)
|
2002-04-29 23:12:29 +00:00
|
|
|
(error "No saved filter groups")
|
|
|
|
(completing-read "Delete saved filter group: "
|
2002-04-25 19:03:55 +00:00
|
|
|
ibuffer-saved-filter-groups nil t))))
|
|
|
|
(setq ibuffer-saved-filter-groups
|
|
|
|
(ibuffer-delete-alist name ibuffer-saved-filter-groups))
|
|
|
|
(ibuffer-maybe-save-stuff)
|
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-switch-to-saved-filter-groups (name)
|
|
|
|
"Set this buffer's filter groups to saved version with NAME.
|
2007-10-23 14:33:09 +00:00
|
|
|
The value from `ibuffer-saved-filter-groups' is used."
|
2002-04-25 19:03:55 +00:00
|
|
|
(interactive
|
|
|
|
(list
|
2012-09-23 11:54:50 +00:00
|
|
|
(cond ((null ibuffer-saved-filter-groups)
|
|
|
|
(error "No saved filters"))
|
|
|
|
;; `ibuffer-saved-filter-groups' is a user variable that defaults
|
|
|
|
;; to nil. We assume that with one element in this list the user
|
|
|
|
;; knows what she wants. See bug#12331.
|
|
|
|
((null (cdr ibuffer-saved-filter-groups))
|
|
|
|
(caar ibuffer-saved-filter-groups))
|
|
|
|
(t
|
|
|
|
(completing-read "Switch to saved filter group: "
|
|
|
|
ibuffer-saved-filter-groups nil t)))))
|
2002-04-28 21:40:57 +00:00
|
|
|
(setq ibuffer-filter-groups (cdr (assoc name ibuffer-saved-filter-groups))
|
|
|
|
ibuffer-hidden-filter-groups nil)
|
2002-04-25 19:03:55 +00:00
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
;;;###autoload
|
2011-08-14 18:08:20 +00:00
|
|
|
(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."
|
2002-01-13 05:55:24 +00:00
|
|
|
(interactive)
|
2011-08-14 18:08:20 +00:00
|
|
|
(setq ibuffer-filtering-qualifiers nil)
|
|
|
|
(if delete-filter-groups
|
|
|
|
(setq ibuffer-filter-groups nil))
|
2005-03-02 21:28:57 +00:00
|
|
|
(let ((buf (ibuffer-current-buffer)))
|
|
|
|
(ibuffer-update nil t)
|
|
|
|
(when buf
|
|
|
|
(ibuffer-jump-to-buffer (buffer-name buf)))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-pop-filter ()
|
|
|
|
"Remove the top filter in this buffer."
|
|
|
|
(interactive)
|
|
|
|
(when (null ibuffer-filtering-qualifiers)
|
|
|
|
(error "No filters in effect"))
|
|
|
|
(pop ibuffer-filtering-qualifiers)
|
2005-03-02 21:28:57 +00:00
|
|
|
(let ((buf (ibuffer-current-buffer)))
|
|
|
|
(ibuffer-update nil t)
|
|
|
|
(when buf
|
|
|
|
(ibuffer-jump-to-buffer (buffer-name buf)))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
(defun ibuffer-push-filter (qualifier)
|
|
|
|
"Add QUALIFIER to `ibuffer-filtering-qualifiers'."
|
|
|
|
(push qualifier ibuffer-filtering-qualifiers))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-decompose-filter ()
|
|
|
|
"Separate the top compound filter (OR, NOT, or SAVED) in this buffer.
|
|
|
|
|
|
|
|
This means that the topmost filter on the filtering stack, which must
|
|
|
|
be a complex filter like (OR [name: foo] [mode: bar-mode]), will be
|
|
|
|
turned into two separate filters [name: foo] and [mode: bar-mode]."
|
|
|
|
(interactive)
|
|
|
|
(when (null ibuffer-filtering-qualifiers)
|
2003-01-24 04:54:17 +00:00
|
|
|
(error "No filters in effect"))
|
2002-01-13 05:55:24 +00:00
|
|
|
(let ((lim (pop ibuffer-filtering-qualifiers)))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(pcase (car lim)
|
|
|
|
(`or
|
2002-01-13 05:55:24 +00:00
|
|
|
(setq ibuffer-filtering-qualifiers (append
|
|
|
|
(cdr lim)
|
|
|
|
ibuffer-filtering-qualifiers)))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(`saved
|
2002-01-13 05:55:24 +00:00
|
|
|
(let ((data
|
|
|
|
(assoc (cdr lim)
|
|
|
|
ibuffer-saved-filters)))
|
|
|
|
(unless data
|
|
|
|
(ibuffer-filter-disable)
|
|
|
|
(error "Unknown saved filter %s" (cdr lim)))
|
|
|
|
(setq ibuffer-filtering-qualifiers (append
|
|
|
|
(cadr data)
|
|
|
|
ibuffer-filtering-qualifiers))))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(`not
|
2002-01-13 05:55:24 +00:00
|
|
|
(push (cdr lim)
|
|
|
|
ibuffer-filtering-qualifiers))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(_
|
2002-01-13 05:55:24 +00:00
|
|
|
(error "Filter type %s is not compound" (car lim)))))
|
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-exchange-filters ()
|
|
|
|
"Exchange the top two filters on the stack in this buffer."
|
|
|
|
(interactive)
|
|
|
|
(when (< (length ibuffer-filtering-qualifiers)
|
|
|
|
2)
|
|
|
|
(error "Need two filters to exchange"))
|
|
|
|
(let ((first (pop ibuffer-filtering-qualifiers))
|
|
|
|
(second (pop ibuffer-filtering-qualifiers)))
|
|
|
|
(push first ibuffer-filtering-qualifiers)
|
|
|
|
(push second ibuffer-filtering-qualifiers))
|
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-negate-filter ()
|
|
|
|
"Negate the sense of the top filter in the current buffer."
|
|
|
|
(interactive)
|
|
|
|
(when (null ibuffer-filtering-qualifiers)
|
|
|
|
(error "No filters in effect"))
|
|
|
|
(let ((lim (pop ibuffer-filtering-qualifiers)))
|
|
|
|
(push (if (eq (car lim) 'not)
|
|
|
|
(cdr lim)
|
|
|
|
(cons 'not lim))
|
|
|
|
ibuffer-filtering-qualifiers))
|
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-or-filter (&optional reverse)
|
|
|
|
"Replace the top two filters in this buffer with their logical OR.
|
|
|
|
If optional argument REVERSE is non-nil, instead break the top OR
|
|
|
|
filter into parts."
|
|
|
|
(interactive "P")
|
|
|
|
(if reverse
|
|
|
|
(progn
|
|
|
|
(when (or (null ibuffer-filtering-qualifiers)
|
|
|
|
(not (eq 'or (caar ibuffer-filtering-qualifiers))))
|
|
|
|
(error "Top filter is not an OR"))
|
|
|
|
(let ((lim (pop ibuffer-filtering-qualifiers)))
|
2007-10-23 14:33:09 +00:00
|
|
|
(setq ibuffer-filtering-qualifiers
|
2003-07-05 11:20:30 +00:00
|
|
|
(nconc (cdr lim) ibuffer-filtering-qualifiers))))
|
2002-01-13 05:55:24 +00:00
|
|
|
(when (< (length ibuffer-filtering-qualifiers) 2)
|
|
|
|
(error "Need two filters to OR"))
|
|
|
|
;; If the second filter is an OR, just add to it.
|
|
|
|
(let ((first (pop ibuffer-filtering-qualifiers))
|
|
|
|
(second (pop ibuffer-filtering-qualifiers)))
|
|
|
|
(if (eq 'or (car second))
|
2003-07-05 11:20:30 +00:00
|
|
|
(push (nconc (list 'or first) (cdr second))
|
|
|
|
ibuffer-filtering-qualifiers)
|
2002-01-13 05:55:24 +00:00
|
|
|
(push (list 'or first second)
|
|
|
|
ibuffer-filtering-qualifiers))))
|
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
(defun ibuffer-maybe-save-stuff ()
|
2002-01-13 05:55:24 +00:00
|
|
|
(when ibuffer-save-with-custom
|
|
|
|
(if (fboundp 'customize-save-variable)
|
|
|
|
(progn
|
|
|
|
(customize-save-variable 'ibuffer-saved-filters
|
2002-04-25 19:03:55 +00:00
|
|
|
ibuffer-saved-filters)
|
|
|
|
(customize-save-variable 'ibuffer-saved-filter-groups
|
|
|
|
ibuffer-saved-filter-groups))
|
2002-01-13 05:55:24 +00:00
|
|
|
(message "Not saved permanently: Customize not available"))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-save-filters (name filters)
|
|
|
|
"Save FILTERS in this buffer with name NAME in `ibuffer-saved-filters'.
|
|
|
|
Interactively, prompt for NAME, and use the current filters."
|
|
|
|
(interactive
|
|
|
|
(if (null ibuffer-filtering-qualifiers)
|
|
|
|
(error "No filters currently in effect")
|
|
|
|
(list
|
|
|
|
(read-from-minibuffer "Save current filters as: ")
|
|
|
|
ibuffer-filtering-qualifiers)))
|
|
|
|
(ibuffer-aif (assoc name ibuffer-saved-filters)
|
|
|
|
(setcdr it filters)
|
2002-04-24 23:27:02 +00:00
|
|
|
(push (list name filters) ibuffer-saved-filters))
|
2008-01-17 05:16:35 +00:00
|
|
|
(ibuffer-maybe-save-stuff))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-delete-saved-filters (name)
|
|
|
|
"Delete saved filters with NAME from `ibuffer-saved-filters'."
|
|
|
|
(interactive
|
|
|
|
(list
|
|
|
|
(if (null ibuffer-saved-filters)
|
|
|
|
(error "No saved filters")
|
|
|
|
(completing-read "Delete saved filters: "
|
|
|
|
ibuffer-saved-filters nil t))))
|
|
|
|
(setq ibuffer-saved-filters
|
|
|
|
(ibuffer-delete-alist name ibuffer-saved-filters))
|
2002-04-25 19:03:55 +00:00
|
|
|
(ibuffer-maybe-save-stuff)
|
2002-01-13 05:55:24 +00:00
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-add-saved-filters (name)
|
|
|
|
"Add saved filters from `ibuffer-saved-filters' to this buffer's filters."
|
|
|
|
(interactive
|
|
|
|
(list
|
|
|
|
(if (null ibuffer-saved-filters)
|
|
|
|
(error "No saved filters")
|
|
|
|
(completing-read "Add saved filters: "
|
|
|
|
ibuffer-saved-filters nil t))))
|
|
|
|
(push (cons 'saved name) ibuffer-filtering-qualifiers)
|
|
|
|
(ibuffer-update nil t))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-switch-to-saved-filters (name)
|
2007-10-23 14:33:09 +00:00
|
|
|
"Set this buffer's filters to filters with NAME from `ibuffer-saved-filters'."
|
2002-01-13 05:55:24 +00:00
|
|
|
(interactive
|
|
|
|
(list
|
|
|
|
(if (null ibuffer-saved-filters)
|
|
|
|
(error "No saved filters")
|
|
|
|
(completing-read "Switch to saved filters: "
|
|
|
|
ibuffer-saved-filters nil t))))
|
|
|
|
(setq ibuffer-filtering-qualifiers (list (cons 'saved name)))
|
|
|
|
(ibuffer-update nil t))
|
2002-05-13 05:59:48 +00:00
|
|
|
|
|
|
|
(defun ibuffer-format-filter-group-data (filter)
|
|
|
|
(if (equal filter "Default")
|
|
|
|
""
|
2003-04-04 21:50:21 +00:00
|
|
|
(concat "Filter:" (mapconcat #'ibuffer-format-qualifier
|
|
|
|
(cdr (assq filter ibuffer-filter-groups))
|
|
|
|
" "))))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
(defun ibuffer-format-qualifier (qualifier)
|
|
|
|
(if (eq (car-safe qualifier) 'not)
|
|
|
|
(concat " [NOT" (ibuffer-format-qualifier-1 (cdr qualifier)) "]")
|
|
|
|
(ibuffer-format-qualifier-1 qualifier)))
|
|
|
|
|
|
|
|
(defun ibuffer-format-qualifier-1 (qualifier)
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(pcase (car qualifier)
|
|
|
|
(`saved
|
2002-01-13 05:55:24 +00:00
|
|
|
(concat " [filter: " (cdr qualifier) "]"))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(`or
|
2002-01-13 05:55:24 +00:00
|
|
|
(concat " [OR" (mapconcat #'ibuffer-format-qualifier
|
|
|
|
(cdr qualifier) "") "]"))
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(_
|
2002-01-13 05:55:24 +00:00
|
|
|
(let ((type (assq (car qualifier) ibuffer-filtering-alist)))
|
|
|
|
(unless qualifier
|
|
|
|
(error "Ibuffer: bad qualifier %s" qualifier))
|
|
|
|
(concat " [" (cadr type) ": " (format "%s]" (cdr qualifier)))))))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
2002-08-06 06:04:44 +00:00
|
|
|
|
2012-04-24 02:07:40 +00:00
|
|
|
(defun ibuffer-list-buffer-modes (&optional include-parents)
|
2012-04-24 03:40:57 +00:00
|
|
|
"Create a completion table of buffer modes currently in use.
|
|
|
|
If INCLUDE-PARENTS is non-nil then include parent modes."
|
|
|
|
(let ((modes))
|
|
|
|
(dolist (buf (buffer-list))
|
|
|
|
(let ((this-mode (buffer-local-value 'major-mode buf)))
|
|
|
|
(while (and this-mode (not (memq this-mode modes)))
|
|
|
|
(push this-mode modes)
|
|
|
|
(setq this-mode (and include-parents
|
|
|
|
(get this-mode 'derived-mode-parent))))))
|
|
|
|
(mapcar #'symbol-name modes)))
|
2002-08-06 06:04:44 +00:00
|
|
|
|
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
;;; Extra operation definitions
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-filter-by-mode "ibuf-ext")
|
2003-01-24 04:54:17 +00:00
|
|
|
(define-ibuffer-filter mode
|
2002-01-13 05:55:24 +00:00
|
|
|
"Toggle current view to buffers with major mode QUALIFIER."
|
|
|
|
(:description "major mode"
|
|
|
|
:reader
|
2012-04-24 03:40:57 +00:00
|
|
|
(let* ((buf (ibuffer-current-buffer))
|
|
|
|
(default (if (and buf (buffer-live-p buf))
|
|
|
|
(symbol-name (buffer-local-value
|
|
|
|
'major-mode buf)))))
|
|
|
|
(intern
|
|
|
|
(completing-read
|
|
|
|
(if default
|
|
|
|
(format "Filter by major mode (default %s): " default)
|
|
|
|
"Filter by major mode: ")
|
|
|
|
obarray
|
|
|
|
#'(lambda (e)
|
|
|
|
(string-match "-mode\\'" (symbol-name e)))
|
|
|
|
t nil nil default))))
|
2008-05-15 01:14:41 +00:00
|
|
|
(eq qualifier (buffer-local-value 'major-mode buf)))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-filter-by-used-mode "ibuf-ext")
|
2003-01-24 04:54:17 +00:00
|
|
|
(define-ibuffer-filter used-mode
|
2002-08-06 06:04:44 +00:00
|
|
|
"Toggle current view to buffers with major mode QUALIFIER.
|
|
|
|
Called interactively, this function allows selection of modes
|
|
|
|
currently used by buffers."
|
|
|
|
(:description "major mode in use"
|
2012-04-24 03:40:57 +00:00
|
|
|
:reader
|
|
|
|
(let* ((buf (ibuffer-current-buffer))
|
|
|
|
(default (if (and buf (buffer-live-p buf))
|
|
|
|
(symbol-name (buffer-local-value
|
|
|
|
'major-mode buf)))))
|
|
|
|
(intern
|
|
|
|
(completing-read
|
|
|
|
(if default
|
|
|
|
(format "Filter by major mode (default %s): " default)
|
|
|
|
"Filter by major mode: ")
|
|
|
|
(ibuffer-list-buffer-modes) nil t nil nil default))))
|
2008-05-15 01:14:41 +00:00
|
|
|
(eq qualifier (buffer-local-value 'major-mode buf)))
|
2002-08-06 06:04:44 +00:00
|
|
|
|
2012-04-24 03:40:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-filter-by-derived-mode "ibuf-ext")
|
2012-04-24 02:07:40 +00:00
|
|
|
(define-ibuffer-filter derived-mode
|
|
|
|
"Toggle current view to buffers whose major mode inherits from QUALIFIER."
|
|
|
|
(:description "derived mode"
|
|
|
|
:reader
|
|
|
|
(intern
|
|
|
|
(completing-read "Filter by derived mode: "
|
|
|
|
(ibuffer-list-buffer-modes t)
|
2012-04-24 03:40:57 +00:00
|
|
|
nil t)))
|
2012-04-24 02:07:40 +00:00
|
|
|
(with-current-buffer buf (derived-mode-p qualifier)))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-filter-by-name "ibuf-ext")
|
2003-01-24 04:54:17 +00:00
|
|
|
(define-ibuffer-filter name
|
2002-01-13 05:55:24 +00:00
|
|
|
"Toggle current view to buffers with name matching QUALIFIER."
|
|
|
|
(:description "buffer name"
|
2002-04-24 23:27:02 +00:00
|
|
|
:reader (read-from-minibuffer "Filter by name (regexp): "))
|
2002-01-13 05:55:24 +00:00
|
|
|
(string-match qualifier (buffer-name buf)))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-filter-by-filename "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-filter filename
|
|
|
|
"Toggle current view to buffers with filename matching QUALIFIER."
|
|
|
|
(:description "filename"
|
2002-04-24 23:27:02 +00:00
|
|
|
:reader (read-from-minibuffer "Filter by filename (regexp): "))
|
2013-07-31 07:32:58 +00:00
|
|
|
(ibuffer-awhen (with-current-buffer buf (ibuffer-buffer-file-name))
|
2008-08-10 03:43:47 +00:00
|
|
|
(string-match qualifier it)))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-filter-by-size-gt "ibuf-ext")
|
2003-01-24 04:54:17 +00:00
|
|
|
(define-ibuffer-filter size-gt
|
2002-01-13 05:55:24 +00:00
|
|
|
"Toggle current view to buffers with size greater than QUALIFIER."
|
|
|
|
(:description "size greater than"
|
|
|
|
:reader
|
|
|
|
(string-to-number (read-from-minibuffer "Filter by size greater than: ")))
|
|
|
|
(> (with-current-buffer buf (buffer-size))
|
|
|
|
qualifier))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-filter-by-size-lt "ibuf-ext")
|
2003-01-24 04:54:17 +00:00
|
|
|
(define-ibuffer-filter size-lt
|
2002-01-13 05:55:24 +00:00
|
|
|
"Toggle current view to buffers with size less than QUALIFIER."
|
|
|
|
(:description "size less than"
|
|
|
|
:reader
|
|
|
|
(string-to-number (read-from-minibuffer "Filter by size less than: ")))
|
|
|
|
(< (with-current-buffer buf (buffer-size))
|
|
|
|
qualifier))
|
2002-04-24 23:27:02 +00:00
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-filter-by-content "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-filter content
|
|
|
|
"Toggle current view to buffers whose contents match QUALIFIER."
|
|
|
|
(:description "content"
|
2002-04-24 23:27:02 +00:00
|
|
|
:reader (read-from-minibuffer "Filter by content (regexp): "))
|
2002-01-13 05:55:24 +00:00
|
|
|
(with-current-buffer buf
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(re-search-forward qualifier nil t))))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-filter-by-predicate "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-filter predicate
|
|
|
|
"Toggle current view to buffers for which QUALIFIER returns non-nil."
|
|
|
|
(:description "predicate"
|
2002-04-24 23:27:02 +00:00
|
|
|
:reader (read-minibuffer "Filter by predicate (form): "))
|
2002-01-13 05:55:24 +00:00
|
|
|
(with-current-buffer buf
|
|
|
|
(eval qualifier)))
|
|
|
|
|
|
|
|
;;; Sorting
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-toggle-sorting-mode ()
|
|
|
|
"Toggle the current sorting mode.
|
2002-02-17 08:57:24 +00:00
|
|
|
Default sorting modes are:
|
2002-01-13 05:55:24 +00:00
|
|
|
Recency - the last time the buffer was viewed
|
|
|
|
Name - the name of the buffer
|
|
|
|
Major Mode - the name of the major mode of the buffer
|
|
|
|
Size - the size of the buffer"
|
|
|
|
(interactive)
|
2014-09-22 14:10:53 +00:00
|
|
|
(let ((modes (mapcar #'car ibuffer-sorting-functions-alist)))
|
|
|
|
(cl-pushnew 'recency modes)
|
|
|
|
(setq modes (sort modes #'string-lessp))
|
2002-03-18 21:21:31 +00:00
|
|
|
(let ((next (or (car-safe (cdr-safe (memq ibuffer-sorting-mode modes)))
|
2002-02-17 08:57:24 +00:00
|
|
|
(car modes))))
|
|
|
|
(setq ibuffer-sorting-mode next)
|
|
|
|
(message "Sorting by %s" next)))
|
2002-01-13 05:55:24 +00:00
|
|
|
(ibuffer-redisplay t))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-invert-sorting ()
|
|
|
|
"Toggle whether or not sorting is in reverse order."
|
|
|
|
(interactive)
|
|
|
|
(setq ibuffer-sorting-reversep (not ibuffer-sorting-reversep))
|
|
|
|
(message "Sorting order %s"
|
|
|
|
(if ibuffer-sorting-reversep
|
|
|
|
"reversed"
|
|
|
|
"normal"))
|
|
|
|
(ibuffer-redisplay t))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-sort-by-major-mode "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-sorter major-mode
|
|
|
|
"Sort the buffers by major modes.
|
|
|
|
Ordering is lexicographic."
|
|
|
|
(:description "major mode")
|
|
|
|
(string-lessp (downcase
|
2008-05-15 01:14:41 +00:00
|
|
|
(symbol-name (buffer-local-value 'major-mode (car a))))
|
2002-01-13 05:55:24 +00:00
|
|
|
(downcase
|
2008-05-15 01:14:41 +00:00
|
|
|
(symbol-name (buffer-local-value 'major-mode (car b))))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-sort-by-mode-name "ibuf-ext")
|
2002-02-26 19:53:56 +00:00
|
|
|
(define-ibuffer-sorter mode-name
|
|
|
|
"Sort the buffers by their mode name.
|
|
|
|
Ordering is lexicographic."
|
2002-03-27 22:19:40 +00:00
|
|
|
(:description "major mode name")
|
2002-02-26 19:53:56 +00:00
|
|
|
(string-lessp (downcase
|
2008-05-15 01:14:41 +00:00
|
|
|
(with-current-buffer
|
|
|
|
(car a)
|
|
|
|
(format-mode-line mode-name)))
|
2002-02-26 19:53:56 +00:00
|
|
|
(downcase
|
2002-03-18 21:21:31 +00:00
|
|
|
(with-current-buffer
|
|
|
|
(car b)
|
2008-01-03 22:01:45 +00:00
|
|
|
(format-mode-line mode-name)))))
|
2002-02-26 19:53:56 +00:00
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-sort-by-alphabetic "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-sorter alphabetic
|
|
|
|
"Sort the buffers by their names.
|
|
|
|
Ordering is lexicographic."
|
|
|
|
(:description "buffer name")
|
|
|
|
(string-lessp
|
|
|
|
(buffer-name (car a))
|
|
|
|
(buffer-name (car b))))
|
|
|
|
|
* ibuf-ext.el (ibuffer-do-shell-command-pipe)
(ibuffer-do-shell-command-pipe-replace)
(ibuffer-do-shell-command-file, ibuffer-do-eval)
(ibuffer-do-view-and-eval, ibuffer-do-rename-uniquely)
(ibuffer-do-revert, ibuffer-do-replace-regexp)
(ibuffer-do-query-replace, ibuffer-do-query-replace-regexp)
(ibuffer-do-print, ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
(ibuffer-filter-by-name, ibuffer-filter-by-filename)
(ibuffer-filter-by-size-gt, ibuffer-filter-by-size-lt)
(ibuffer-filter-by-content, ibuffer-filter-by-predicate
(ibuffer-do-sort-by-major-mode, ibuffer-do-sort-by-mode-name)
(ibuffer-do-sort-by-alphabetic, ibuffer-do-sort-by-size):
Autoload file sans suffix.
* emulation/cua-base.el (cua-toggle-global-mark): Likewise.
2005-10-07 12:43:57 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-sort-by-size "ibuf-ext")
|
2002-01-13 05:55:24 +00:00
|
|
|
(define-ibuffer-sorter size
|
|
|
|
"Sort the buffers by their size."
|
|
|
|
(:description "size")
|
|
|
|
(< (with-current-buffer (car a)
|
|
|
|
(buffer-size))
|
|
|
|
(with-current-buffer (car b)
|
|
|
|
(buffer-size))))
|
|
|
|
|
2008-01-25 05:38:31 +00:00
|
|
|
;;;###autoload (autoload 'ibuffer-do-sort-by-filename/process "ibuf-ext")
|
|
|
|
(define-ibuffer-sorter filename/process
|
|
|
|
"Sort the buffers by their file name/process name."
|
|
|
|
(:description "file name")
|
|
|
|
(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?
|
2009-09-11 06:47:26 +00:00
|
|
|
(or (buffer-file-name (car a))
|
2008-01-25 05:38:31 +00:00
|
|
|
(let ((pr-a (get-buffer-process (car a))))
|
|
|
|
(and (processp pr-a) (process-name pr-a))))
|
2009-09-11 06:47:26 +00:00
|
|
|
(or (buffer-file-name (car b))
|
2008-01-25 05:38:31 +00:00
|
|
|
(let ((pr-b (get-buffer-process (car b))))
|
|
|
|
(and (processp pr-b) (process-name pr-b))))))
|
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
;;; Functions to emulate bs.el
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-bs-show ()
|
|
|
|
"Emulate `bs-show' from the bs.el package."
|
|
|
|
(interactive)
|
|
|
|
(ibuffer t "*Ibuffer-bs*" '((filename . ".*")) nil t)
|
|
|
|
(define-key (current-local-map) "a" 'ibuffer-bs-toggle-all))
|
|
|
|
|
|
|
|
(defun ibuffer-bs-toggle-all ()
|
|
|
|
"Emulate `bs-toggle-show-all' from the bs.el package."
|
|
|
|
(interactive)
|
|
|
|
(if ibuffer-filtering-qualifiers
|
|
|
|
(ibuffer-pop-filter)
|
|
|
|
(progn (ibuffer-push-filter '(filename . ".*"))
|
|
|
|
(ibuffer-update nil t))))
|
|
|
|
|
|
|
|
;;; Handy functions
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-add-to-tmp-hide (regexp)
|
|
|
|
"Add REGEXP to `ibuffer-tmp-hide-regexps'.
|
|
|
|
This means that buffers whose name matches REGEXP will not be shown
|
2003-02-11 14:59:54 +00:00
|
|
|
for this Ibuffer session."
|
2002-01-13 05:55:24 +00:00
|
|
|
(interactive
|
|
|
|
(list
|
|
|
|
(read-from-minibuffer "Never show buffers matching: "
|
|
|
|
(regexp-quote (buffer-name (ibuffer-current-buffer t))))))
|
|
|
|
(push regexp ibuffer-tmp-hide-regexps))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-add-to-tmp-show (regexp)
|
|
|
|
"Add REGEXP to `ibuffer-tmp-show-regexps'.
|
|
|
|
This means that buffers whose name matches REGEXP will always be shown
|
2003-02-11 14:59:54 +00:00
|
|
|
for this Ibuffer session."
|
2002-01-13 05:55:24 +00:00
|
|
|
(interactive
|
|
|
|
(list
|
|
|
|
(read-from-minibuffer "Always show buffers matching: "
|
|
|
|
(regexp-quote (buffer-name (ibuffer-current-buffer t))))))
|
|
|
|
(push regexp ibuffer-tmp-show-regexps))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-forward-next-marked (&optional count mark direction)
|
|
|
|
"Move forward by COUNT marked buffers (default 1).
|
|
|
|
|
|
|
|
If MARK is non-nil, it should be a character denoting the type of mark
|
|
|
|
to move by. The default is `ibuffer-marked-char'.
|
|
|
|
|
|
|
|
If DIRECTION is non-nil, it should be an integer; negative integers
|
|
|
|
mean move backwards, non-negative integers mean move forwards."
|
|
|
|
(interactive "P")
|
|
|
|
(unless count
|
|
|
|
(setq count 1))
|
|
|
|
(unless mark
|
|
|
|
(setq mark ibuffer-marked-char))
|
|
|
|
(unless direction
|
|
|
|
(setq direction 1))
|
|
|
|
;; Skip the title
|
|
|
|
(ibuffer-forward-line 0)
|
2011-04-19 13:44:55 +00:00
|
|
|
(let ((opos (point)))
|
2002-01-13 05:55:24 +00:00
|
|
|
(ibuffer-forward-line direction)
|
|
|
|
(while (not (or (= (point) opos)
|
2011-04-19 13:44:55 +00:00
|
|
|
(eq (ibuffer-current-mark) mark)))
|
2002-01-13 05:55:24 +00:00
|
|
|
(ibuffer-forward-line direction))
|
|
|
|
(when (and (= (point) opos)
|
|
|
|
(not (eq (ibuffer-current-mark) mark)))
|
|
|
|
(error "No buffers with mark %c" mark))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-backwards-next-marked (&optional count mark)
|
|
|
|
"Move backwards by COUNT marked buffers (default 1).
|
|
|
|
|
|
|
|
If MARK is non-nil, it should be a character denoting the type of mark
|
|
|
|
to move by. The default is `ibuffer-marked-char'."
|
|
|
|
(interactive "P")
|
|
|
|
(ibuffer-forward-next-marked count mark -1))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-do-kill-lines ()
|
|
|
|
"Hide all of the currently marked lines."
|
|
|
|
(interactive)
|
|
|
|
(if (= (ibuffer-count-marked-lines) 0)
|
|
|
|
(message "No buffers marked; use 'm' to mark a buffer")
|
|
|
|
(let ((count
|
|
|
|
(ibuffer-map-marked-lines
|
2011-04-19 13:44:55 +00:00
|
|
|
#'(lambda (_buf _mark)
|
2002-01-13 05:55:24 +00:00
|
|
|
'kill))))
|
|
|
|
(message "Killed %s lines" count))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-jump-to-buffer (name)
|
2004-06-02 22:07:42 +00:00
|
|
|
"Move point to the buffer whose name is NAME.
|
|
|
|
|
|
|
|
If called interactively, prompt for a buffer name and go to the
|
|
|
|
corresponding line in the Ibuffer buffer. If said buffer is in a
|
|
|
|
hidden group filter, open it.
|
|
|
|
|
|
|
|
If `ibuffer-jump-offer-only-visible-buffers' is non-nil, only offer
|
|
|
|
visible buffers in the completion list. Calling the command with
|
|
|
|
a prefix argument reverses the meaning of that variable."
|
2004-10-23 10:11:17 +00:00
|
|
|
(interactive (list
|
|
|
|
(let ((only-visible ibuffer-jump-offer-only-visible-buffers))
|
|
|
|
(when current-prefix-arg
|
|
|
|
(setq only-visible (not only-visible)))
|
|
|
|
(if only-visible
|
|
|
|
(let ((table (mapcar #'(lambda (x)
|
|
|
|
(buffer-name (car x)))
|
|
|
|
(ibuffer-current-state-list))))
|
|
|
|
(when (null table)
|
|
|
|
(error "No buffers!"))
|
|
|
|
(completing-read "Jump to buffer: "
|
|
|
|
table nil t))
|
|
|
|
(read-buffer "Jump to buffer: " nil t)))))
|
|
|
|
(when (not (string= "" name))
|
|
|
|
(let (buf-point)
|
|
|
|
;; Blindly search for our buffer: it is very likely that it is
|
|
|
|
;; not in a hidden filter group.
|
2011-04-19 13:44:55 +00:00
|
|
|
(ibuffer-map-lines #'(lambda (buf _marks)
|
2004-10-23 10:11:17 +00:00
|
|
|
(when (string= (buffer-name buf) name)
|
|
|
|
(setq buf-point (point))
|
|
|
|
nil))
|
|
|
|
t nil)
|
|
|
|
(when (and
|
|
|
|
(null buf-point)
|
|
|
|
(not (null ibuffer-hidden-filter-groups)))
|
|
|
|
;; We did not find our buffer. It must be in a hidden filter
|
|
|
|
;; group, so go through all hidden filter groups to find it.
|
|
|
|
(catch 'found
|
|
|
|
(dolist (group ibuffer-hidden-filter-groups)
|
|
|
|
(ibuffer-jump-to-filter-group group)
|
|
|
|
(ibuffer-toggle-filter-group)
|
2011-04-19 13:44:55 +00:00
|
|
|
(ibuffer-map-lines #'(lambda (buf _marks)
|
2004-10-23 10:11:17 +00:00
|
|
|
(when (string= (buffer-name buf) name)
|
|
|
|
(setq buf-point (point))
|
|
|
|
nil))
|
|
|
|
t group)
|
|
|
|
(if buf-point
|
|
|
|
(throw 'found nil)
|
|
|
|
(ibuffer-toggle-filter-group)))))
|
|
|
|
(if (null buf-point)
|
|
|
|
;; Still not found even though we expanded all hidden filter
|
|
|
|
;; groups: that must be because it's hidden by predicate:
|
|
|
|
;; we won't bother trying to display it.
|
|
|
|
(error "No buffer with name %s" name)
|
|
|
|
(goto-char buf-point)))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
2010-12-03 03:01:16 +00:00
|
|
|
(declare-function diff-sentinel "diff"
|
|
|
|
(code &optional old-temp-file new-temp-file))
|
2008-06-27 10:34:50 +00:00
|
|
|
|
2008-06-26 15:26:58 +00:00
|
|
|
(defun ibuffer-diff-buffer-with-file-1 (buffer)
|
|
|
|
(let ((bufferfile (buffer-local-value 'buffer-file-name buffer))
|
|
|
|
(tempfile (make-temp-file "buffer-content-")))
|
|
|
|
(when bufferfile
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(write-region nil nil tempfile nil 'nomessage))
|
|
|
|
(let* ((old (expand-file-name bufferfile))
|
|
|
|
(new (expand-file-name tempfile))
|
|
|
|
(oldtmp (file-local-copy old))
|
|
|
|
(newtmp (file-local-copy new))
|
|
|
|
(switches diff-switches)
|
|
|
|
(command
|
|
|
|
(mapconcat
|
|
|
|
'identity
|
|
|
|
`(,diff-command
|
|
|
|
;; Use explicitly specified switches
|
|
|
|
,@(if (listp switches) switches (list switches))
|
|
|
|
,@(if (or old new)
|
2008-09-07 15:39:05 +00:00
|
|
|
(list "-L" (shell-quote-argument old)
|
2008-06-26 15:26:58 +00:00
|
|
|
"-L" (shell-quote-argument
|
|
|
|
(format "Buffer %s" (buffer-name buffer)))))
|
|
|
|
,(shell-quote-argument (or oldtmp old))
|
|
|
|
,(shell-quote-argument (or newtmp new)))
|
2011-04-19 13:44:55 +00:00
|
|
|
" ")))
|
2008-06-26 15:26:58 +00:00
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
(insert command "\n")
|
|
|
|
(diff-sentinel
|
|
|
|
(call-process shell-file-name nil
|
|
|
|
(current-buffer) nil
|
2012-04-30 11:57:47 +00:00
|
|
|
shell-command-switch command))
|
|
|
|
(insert "\n")))))
|
2008-06-26 15:26:58 +00:00
|
|
|
(sit-for 0)
|
|
|
|
(when (file-exists-p tempfile)
|
|
|
|
(delete-file tempfile)))))
|
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-diff-with-file ()
|
2008-06-26 15:26:58 +00:00
|
|
|
"View the differences between marked buffers and their associated files.
|
|
|
|
If no buffers are marked, use buffer at point.
|
2002-01-13 05:55:24 +00:00
|
|
|
This requires the external program \"diff\" to be in your `exec-path'."
|
|
|
|
(interactive)
|
2008-06-26 15:26:58 +00:00
|
|
|
(require 'diff)
|
|
|
|
(let ((marked-bufs (ibuffer-get-marked-buffers)))
|
|
|
|
(when (null marked-bufs)
|
|
|
|
(setq marked-bufs (list (ibuffer-current-buffer t))))
|
|
|
|
(with-current-buffer (get-buffer-create "*Ibuffer Diff*")
|
|
|
|
(setq buffer-read-only nil)
|
|
|
|
(buffer-disable-undo (current-buffer))
|
|
|
|
(erase-buffer)
|
|
|
|
(buffer-enable-undo (current-buffer))
|
|
|
|
(diff-mode)
|
|
|
|
(dolist (buf marked-bufs)
|
|
|
|
(unless (buffer-live-p buf)
|
|
|
|
(error "Buffer %s has been killed" buf))
|
|
|
|
(ibuffer-diff-buffer-with-file-1 buf))
|
|
|
|
(setq buffer-read-only t)))
|
|
|
|
(switch-to-buffer "*Ibuffer Diff*"))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-copy-filename-as-kill (&optional arg)
|
|
|
|
"Copy filenames of marked buffers into the kill ring.
|
2003-01-24 04:54:17 +00:00
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
The names are separated by a space.
|
|
|
|
If a buffer has no filename, it is ignored.
|
|
|
|
|
2003-01-24 04:54:17 +00:00
|
|
|
With no prefix arg, use the filename sans its directory of each marked file.
|
|
|
|
With a zero prefix arg, use the complete filename of each marked file.
|
|
|
|
With \\[universal-argument], use the filename of each marked file relative
|
2007-08-08 07:40:09 +00:00
|
|
|
to `ibuffer-default-directory' if non-nil, otherwise `default-directory'.
|
2002-01-13 05:55:24 +00:00
|
|
|
|
2003-01-24 04:54:17 +00:00
|
|
|
You can then feed the file name(s) to other commands with \\[yank]."
|
|
|
|
(interactive "p")
|
|
|
|
(if (zerop (ibuffer-count-marked-lines))
|
2002-01-13 05:55:24 +00:00
|
|
|
(message "No buffers marked; use 'm' to mark a buffer")
|
|
|
|
(let ((ibuffer-copy-filename-as-kill-result "")
|
2016-02-23 09:17:21 +00:00
|
|
|
(type (cond ((or (null arg) (zerop arg))
|
2002-01-13 05:55:24 +00:00
|
|
|
'full)
|
2003-01-24 04:54:17 +00:00
|
|
|
((= arg 4)
|
|
|
|
'relative)
|
2002-01-13 05:55:24 +00:00
|
|
|
(t
|
|
|
|
'name))))
|
|
|
|
(ibuffer-map-marked-lines
|
2011-04-19 13:44:55 +00:00
|
|
|
#'(lambda (buf _mark)
|
2002-01-13 05:55:24 +00:00
|
|
|
(setq ibuffer-copy-filename-as-kill-result
|
2016-02-23 09:12:59 +00:00
|
|
|
(concat ibuffer-copy-filename-as-kill-result
|
|
|
|
(let ((name (buffer-file-name buf)))
|
|
|
|
(cond (name
|
|
|
|
(concat
|
|
|
|
(pcase type
|
|
|
|
(`full
|
|
|
|
name)
|
|
|
|
(`relative
|
|
|
|
(file-relative-name
|
|
|
|
name (or ibuffer-default-directory
|
|
|
|
default-directory)))
|
|
|
|
(_
|
|
|
|
(file-name-nondirectory name))) " "))
|
|
|
|
(t "")))))))
|
|
|
|
(when (not (zerop (length ibuffer-copy-filename-as-kill-result)))
|
|
|
|
(setq ibuffer-copy-filename-as-kill-result
|
|
|
|
(substring ibuffer-copy-filename-as-kill-result 0 -1)))
|
2003-01-24 04:54:17 +00:00
|
|
|
(kill-new ibuffer-copy-filename-as-kill-result))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
2002-04-25 19:03:55 +00:00
|
|
|
(defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group)
|
2002-01-13 05:55:24 +00:00
|
|
|
(let ((count
|
|
|
|
(ibuffer-map-lines
|
2011-04-19 13:44:55 +00:00
|
|
|
#'(lambda (buf _mark)
|
2002-01-13 05:55:24 +00:00
|
|
|
(when (funcall func buf)
|
2002-04-25 19:03:55 +00:00
|
|
|
(ibuffer-set-mark-1 (or ibuffer-mark-on-buffer-mark
|
|
|
|
ibuffer-marked-char))
|
|
|
|
t))
|
|
|
|
nil
|
|
|
|
group)))
|
2002-01-13 05:55:24 +00:00
|
|
|
(ibuffer-redisplay t)
|
2008-06-26 15:26:58 +00:00
|
|
|
(unless (eq ibuffer-mark-on-buffer-mark ?\s)
|
|
|
|
(message "Marked %s buffers" count))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-by-name-regexp (regexp)
|
|
|
|
"Mark all buffers whose name matches REGEXP."
|
|
|
|
(interactive "sMark by name (regexp): ")
|
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf)
|
|
|
|
(string-match regexp (buffer-name buf)))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-by-mode-regexp (regexp)
|
|
|
|
"Mark all buffers whose major mode matches REGEXP."
|
|
|
|
(interactive "sMark by major mode (regexp): ")
|
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf)
|
|
|
|
(with-current-buffer buf
|
2008-01-16 15:57:42 +00:00
|
|
|
(string-match regexp (format-mode-line mode-name nil nil buf))))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-by-file-name-regexp (regexp)
|
|
|
|
"Mark all buffers whose file name matches REGEXP."
|
|
|
|
(interactive "sMark by file name (regexp): ")
|
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf)
|
|
|
|
(let ((name (or (buffer-file-name buf)
|
|
|
|
(with-current-buffer buf
|
|
|
|
(and
|
|
|
|
(boundp 'dired-directory)
|
|
|
|
(stringp dired-directory)
|
|
|
|
dired-directory)))))
|
|
|
|
(when name
|
|
|
|
(string-match regexp name))))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-by-mode (mode)
|
|
|
|
"Mark all buffers whose major mode equals MODE."
|
|
|
|
(interactive
|
2012-04-24 03:40:57 +00:00
|
|
|
(let* ((buf (ibuffer-current-buffer))
|
|
|
|
(default (if (and buf (buffer-live-p buf))
|
|
|
|
(symbol-name (buffer-local-value
|
|
|
|
'major-mode buf)))))
|
|
|
|
(list (intern
|
|
|
|
(completing-read
|
|
|
|
(if default
|
|
|
|
(format "Mark by major mode (default %s): " default)
|
|
|
|
"Mark by major mode: ")
|
|
|
|
(ibuffer-list-buffer-modes) nil t nil nil default)))))
|
2002-01-13 05:55:24 +00:00
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf)
|
2008-06-26 15:26:58 +00:00
|
|
|
(eq (buffer-local-value 'major-mode buf) mode))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-modified-buffers ()
|
|
|
|
"Mark all modified buffers."
|
|
|
|
(interactive)
|
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf) (buffer-modified-p buf))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-unsaved-buffers ()
|
|
|
|
"Mark all modified buffers that have an associated file."
|
|
|
|
(interactive)
|
|
|
|
(ibuffer-mark-on-buffer
|
2008-05-15 01:14:41 +00:00
|
|
|
#'(lambda (buf) (and (buffer-local-value 'buffer-file-name buf)
|
2002-01-13 05:55:24 +00:00
|
|
|
(buffer-modified-p buf)))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-dissociated-buffers ()
|
|
|
|
"Mark all buffers whose associated file does not exist."
|
|
|
|
(interactive)
|
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf)
|
|
|
|
(with-current-buffer buf
|
|
|
|
(or
|
|
|
|
(and buffer-file-name
|
|
|
|
(not (file-exists-p buffer-file-name)))
|
|
|
|
(and (eq major-mode 'dired-mode)
|
|
|
|
(boundp 'dired-directory)
|
|
|
|
(stringp dired-directory)
|
|
|
|
(not (file-exists-p (file-name-directory dired-directory)))))))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-help-buffers ()
|
2013-06-12 11:42:12 +00:00
|
|
|
"Mark buffers whose major mode is in variable `ibuffer-help-buffer-modes'."
|
2002-01-13 05:55:24 +00:00
|
|
|
(interactive)
|
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf)
|
|
|
|
(with-current-buffer buf
|
2002-03-27 22:19:40 +00:00
|
|
|
(memq major-mode ibuffer-help-buffer-modes)))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
2006-02-02 21:57:09 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-compressed-file-buffers ()
|
|
|
|
"Mark buffers whose associated file is compressed."
|
|
|
|
(interactive)
|
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf)
|
|
|
|
(with-current-buffer buf
|
|
|
|
(and buffer-file-name
|
|
|
|
(string-match ibuffer-compressed-file-name-regexp
|
|
|
|
buffer-file-name))))))
|
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-old-buffers ()
|
2007-08-01 17:36:31 +00:00
|
|
|
"Mark buffers which have not been viewed in `ibuffer-old-time' hours."
|
2002-01-13 05:55:24 +00:00
|
|
|
(interactive)
|
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf)
|
|
|
|
(with-current-buffer buf
|
|
|
|
;; hacked from midnight.el
|
|
|
|
(when buffer-display-time
|
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
2012-07-11 23:13:41 +00:00
|
|
|
(let* ((now (float-time))
|
|
|
|
(then (float-time buffer-display-time)))
|
2002-02-23 21:33:49 +00:00
|
|
|
(> (- now then) (* 60 60 ibuffer-old-time))))))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-special-buffers ()
|
Prefer directed to neutral quotes
Prefer directed to neutral quotes in docstings and diagnostics.
In docstrings, escape apostrophes that would otherwise be translated
to curved quotes using the newer, simpler rules.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-lang.el (math-read-giac-subscr)
(math-read-math-subscr):
* lisp/calc/calc-misc.el (report-calc-bug):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/dabbrev.el (dabbrev-expand):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/elint.el (elint-get-top-forms):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emulation/viper-cmd.el (viper-toggle-search-style):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-arg.el (eshell-parse-arguments):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/files-x.el (modify-file-local-variable):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer)
(filesets-update-pre010505):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/gnus/auth-source.el (auth-source-netrc-parse-entries):
* lisp/gnus/gnus-agent.el (gnus-agent-check-overview-buffer)
(gnus-agent-fetch-headers):
* lisp/gnus/gnus-int.el (gnus-start-news-server):
* lisp/gnus/gnus-registry.el:
(gnus-registry--split-fancy-with-parent-internal):
* lisp/gnus/gnus-score.el (gnus-summary-increase-score):
* lisp/gnus/gnus-start.el (gnus-convert-old-newsrc):
* lisp/gnus/gnus-topic.el (gnus-topic-rename):
* lisp/gnus/legacy-gnus-agent.el (gnus-agent-unlist-expire-days):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/gnus/spam.el (spam-check-blackholes):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/tramp-cache.el:
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-bibtex.el (org-bibtex-fields):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/play/dunnet.el (dun-score, dun-help, dun-endgame-question)
(dun-rooms, dun-endgame-questions):
* lisp/progmodes/ada-mode.el (ada-goto-matching-start):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/antlr-mode.el (antlr-options-alists):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/server.el (server-get-auth-key):
* lisp/subr.el (version-to-list):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/vc/ediff-diff.el (ediff-same-contents):
* lisp/vc/vc-cvs.el (vc-cvs-mode-line-string):
* test/automated/tramp-tests.el (tramp-test33-asynchronous-requests):
Use directed rather than neutral quotes in diagnostics.
2015-08-25 06:39:33 +00:00
|
|
|
"Mark all buffers whose name begins and ends with `*'."
|
2002-01-13 05:55:24 +00:00
|
|
|
(interactive)
|
|
|
|
(ibuffer-mark-on-buffer
|
|
|
|
#'(lambda (buf) (string-match "^\\*.+\\*$"
|
|
|
|
(buffer-name buf)))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-read-only-buffers ()
|
|
|
|
"Mark all read-only buffers."
|
|
|
|
(interactive)
|
|
|
|
(ibuffer-mark-on-buffer
|
2008-05-15 01:14:41 +00:00
|
|
|
#'(lambda (buf) (buffer-local-value 'buffer-read-only buf))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-mark-dired-buffers ()
|
|
|
|
"Mark all `dired' buffers."
|
|
|
|
(interactive)
|
|
|
|
(ibuffer-mark-on-buffer
|
2008-05-15 01:14:41 +00:00
|
|
|
#'(lambda (buf) (eq (buffer-local-value 'major-mode buf) 'dired-mode))))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ibuffer-do-occur (regexp &optional nlines)
|
|
|
|
"View lines which match REGEXP in all marked buffers.
|
|
|
|
Optional argument NLINES says how many lines of context to display: it
|
|
|
|
defaults to one."
|
2002-04-24 23:27:02 +00:00
|
|
|
(interactive (occur-read-primary-args))
|
2002-01-13 05:55:24 +00:00
|
|
|
(if (or (not (integerp nlines))
|
|
|
|
(< nlines 0))
|
2002-05-09 21:29:20 +00:00
|
|
|
(setq nlines 0))
|
2002-01-13 05:55:24 +00:00
|
|
|
(when (zerop (ibuffer-count-marked-lines))
|
2002-02-26 19:53:56 +00:00
|
|
|
(ibuffer-set-mark ibuffer-marked-char))
|
2002-01-13 05:55:24 +00:00
|
|
|
(let ((ibuffer-do-occur-bufs nil))
|
|
|
|
;; Accumulate a list of marked buffers
|
|
|
|
(ibuffer-map-marked-lines
|
2011-04-19 13:44:55 +00:00
|
|
|
#'(lambda (buf _mark)
|
2002-01-13 05:55:24 +00:00
|
|
|
(push buf ibuffer-do-occur-bufs)))
|
2002-04-23 20:35:37 +00:00
|
|
|
(occur-1 regexp nlines ibuffer-do-occur-bufs)))
|
2002-01-13 05:55:24 +00:00
|
|
|
|
|
|
|
(provide 'ibuf-ext)
|
|
|
|
|
2009-09-11 06:47:26 +00:00
|
|
|
;; Local Variables:
|
2015-12-16 23:08:17 +00:00
|
|
|
;; generated-autoload-file: "ibuffer-loaddefs.el"
|
2009-09-11 06:47:26 +00:00
|
|
|
;; End:
|
|
|
|
|
2002-01-13 05:55:24 +00:00
|
|
|
;;; ibuf-ext.el ends here
|