Function: ibuffer-filter-by-directory

ibuffer-filter-by-directory is an autoloaded, interactive and byte-compiled function defined in ibuf-ext.el.gz.

Signature

(ibuffer-filter-by-directory QUALIFIER)

Documentation

Limit current view to buffers with directory matching QUALIFIER.

For a buffer associated with file '/a/b/c.d', this matches against '/a/b'. For a buffer not associated with a file, this matches against the value of default-directory in that buffer.

Probably introduced at or before Emacs version 26.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/ibuf-ext.el.gz
;;;###autoload (autoload 'ibuffer-filter-by-directory "ibuf-ext")
(define-ibuffer-filter directory
    "Limit current view to buffers with directory matching QUALIFIER.

For a buffer associated with file '/a/b/c.d', this matches
against '/a/b'.  For a buffer not associated with a file, this
matches against the value of `default-directory' in that buffer."
  ( :description "directory name"
    :reader (read-from-minibuffer "Filter by directory name (regex): "))
  (with-current-buffer buf
    (if-let* ((filename (ibuffer-buffer-file-name))
              (dirname (file-name-directory filename)))
        (string-match qualifier dirname)
      (when default-directory
        (string-match qualifier default-directory)))))