Function: magit-diff-toggle-file-filter

magit-diff-toggle-file-filter is an interactive and byte-compiled function defined in magit-diff.el.

Signature

(magit-diff-toggle-file-filter)

Documentation

Toggle the file restriction of the current buffer's diffs.

If the current buffer's mode is derived from magit-log-mode, toggle the file restriction in the repository's revision buffer instead.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-diff.el
(defun magit-diff-toggle-file-filter ()
  "Toggle the file restriction of the current buffer's diffs.
If the current buffer's mode is derived from `magit-log-mode',
toggle the file restriction in the repository's revision buffer
instead."
  (interactive)
  (cl-flet ((toggle ()
              (if (or magit-buffer-diff-files
                      magit-buffer-diff-files-suspended)
                  (cl-rotatef magit-buffer-diff-files
                              magit-buffer-diff-files-suspended)
                (setq magit-buffer-diff-files
                      (transient-infix-read 'magit:--)))
              (magit-refresh)))
    (cond
      ((derived-mode-p 'magit-log-mode
                       'magit-cherry-mode
                       'magit-reflog-mode)
       (if-let ((buffer (magit-get-mode-buffer 'magit-revision-mode)))
           (with-current-buffer buffer (toggle))
         (message "No revision buffer")))
      ((local-variable-p 'magit-buffer-diff-files)
       (toggle))
      ((user-error "Cannot toggle file filter in this buffer")))))