From f41256edb95d9c11ccc201c20921d82f2a36886c Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 6 Jul 2024 22:10:18 +0200 Subject: [PATCH] Mark many 'ibuffer-mode'-specific commands as such --- lisp/ibuf-ext.el | 127 ++++++++++++++++++++++++++-------------------- lisp/ibuf-macs.el | 8 ++- lisp/ibuffer.el | 50 +++++++++--------- 3 files changed, 100 insertions(+), 85 deletions(-) diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 33b68b96ff2..9cff15c76be 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -422,7 +422,7 @@ format. See `ibuffer-update-saved-filters-format' and ;;;###autoload (defun ibuffer-interactive-filter-by-mode (event-or-point) "Enable or disable filtering by the major mode at point." - (interactive "d") + (interactive "d" ibuffer-mode) (if (eventp event-or-point) (posn-set-point (event-end event-or-point)) (goto-char event-or-point)) @@ -444,7 +444,7 @@ format. See `ibuffer-update-saved-filters-format' and ;;;###autoload (defun ibuffer-toggle-filter-group () "Toggle the display status of the filter group on this line." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-toggle-filter-group-1 (point))) (defun ibuffer-toggle-filter-group-1 (posn) @@ -460,7 +460,7 @@ format. See `ibuffer-update-saved-filters-format' and ;;;###autoload (defun ibuffer-forward-filter-group (&optional count) "Move point forwards by COUNT filtering groups." - (interactive "P") + (interactive "P" ibuffer-mode) (unless count (setq count 1)) (when (> count 0) @@ -477,7 +477,7 @@ format. See `ibuffer-update-saved-filters-format' and ;;;###autoload (defun ibuffer-backward-filter-group (&optional count) "Move point backwards by COUNT filtering groups." - (interactive "P") + (interactive "P" ibuffer-mode) (unless count (setq count 1)) (when (> count 0) @@ -766,7 +766,7 @@ specification, with the same structure as an element of the list ;;;###autoload (defun ibuffer-filters-to-filter-group (name) "Make the current filters into a filtering group." - (interactive "sName for filtering group: ") + (interactive "sName for filtering group: " ibuffer-mode) (when (null ibuffer-filtering-qualifiers) (error "No filters in effect")) (push (cons name ibuffer-filtering-qualifiers) ibuffer-filter-groups) @@ -775,7 +775,7 @@ specification, with the same structure as an element of the list ;;;###autoload (defun ibuffer-set-filter-groups-by-mode () "Set the current filter groups to filter by mode." - (interactive) + (interactive "" ibuffer-mode) (setq ibuffer-filter-groups (mapcar (lambda (mode) (cons (format "%s" mode) `((mode . ,mode)))) @@ -792,7 +792,7 @@ specification, with the same structure as an element of the list ;;;###autoload (defun ibuffer-pop-filter-group () "Remove the first filter group." - (interactive) + (interactive "" ibuffer-mode) (when (null ibuffer-filter-groups) (error "No filter groups active")) (setq ibuffer-hidden-filter-groups @@ -821,7 +821,8 @@ specification, with the same structure as an element of the list (defun ibuffer-decompose-filter-group (group) "Decompose the filter group GROUP into active filters." (interactive - (list (ibuffer-read-filter-group-name "Decompose filter group: " t))) + (list (ibuffer-read-filter-group-name "Decompose filter group: " t)) + ibuffer-mode) (let ((data (cdr (assoc group ibuffer-filter-groups)))) (setq ibuffer-filter-groups (ibuffer-remove-alist group ibuffer-filter-groups) @@ -831,7 +832,7 @@ specification, with the same structure as an element of the list ;;;###autoload (defun ibuffer-clear-filter-groups () "Remove all filter groups." - (interactive) + (interactive "" ibuffer-mode) (setq ibuffer-filter-groups nil ibuffer-hidden-filter-groups nil) (ibuffer-update nil t)) @@ -856,7 +857,8 @@ specification, with the same structure as an element of the list (defun ibuffer-jump-to-filter-group (name) "Move point to the filter group whose name is NAME." (interactive - (list (ibuffer-read-filter-group-name "Jump to filter group: "))) + (list (ibuffer-read-filter-group-name "Jump to filter group: ")) + ibuffer-mode) (if-let ((it (assoc name (ibuffer-current-filter-groups-with-position)))) (goto-char (cdr it)) (error "No filter group with name %s" name))) @@ -865,7 +867,8 @@ specification, with the same structure as an element of the list (defun ibuffer-kill-filter-group (name) "Kill the filter group named NAME. The group will be added to `ibuffer-filter-group-kill-ring'." - (interactive (list (ibuffer-read-filter-group-name "Kill filter group: " t))) + (interactive (list (ibuffer-read-filter-group-name "Kill filter group: " t)) + ibuffer-mode) (when (equal name "Default") (error "Can't kill default filter group")) (if-let ((it (assoc name ibuffer-filter-groups))) @@ -882,7 +885,7 @@ The group will be added to `ibuffer-filter-group-kill-ring'." (defun ibuffer-kill-line (&optional arg interactive-p) "Kill the filter group at point. See also `ibuffer-kill-filter-group'." - (interactive "P\np") + (interactive "P\np" ibuffer-mode) (if-let ((it (save-excursion (ibuffer-forward-line 0) (get-text-property (point) 'ibuffer-filter-group-name)))) @@ -914,7 +917,7 @@ See also `ibuffer-kill-filter-group'." ;;;###autoload (defun ibuffer-yank () "Yank the last killed filter group before group at point." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-yank-filter-group (or (get-text-property (point) 'ibuffer-filter-group-name) (get-text-property (point) 'ibuffer-filter-group) @@ -924,7 +927,8 @@ See also `ibuffer-kill-filter-group'." (defun ibuffer-yank-filter-group (name) "Yank the last killed filter group before group named NAME." (interactive (list (ibuffer-read-filter-group-name - "Yank filter group before group: "))) + "Yank filter group before group: ")) + ibuffer-mode) (unless ibuffer-filter-group-kill-ring (error "The Ibuffer filter group kill-ring is empty")) (save-excursion @@ -943,7 +947,8 @@ prompt for NAME, and use the current filters." (error "No filter groups active") (list (read-from-minibuffer "Save current filter groups as: ") - ibuffer-filter-groups))) + ibuffer-filter-groups)) + ibuffer-mode) (if-let ((it (assoc name ibuffer-saved-filter-groups))) (setcdr it groups) (push (cons name groups) ibuffer-saved-filter-groups)) @@ -958,7 +963,8 @@ They are removed from `ibuffer-saved-filter-groups'." (if (null ibuffer-saved-filter-groups) (error "No saved filter groups") (completing-read "Delete saved filter group: " - ibuffer-saved-filter-groups nil t)))) + ibuffer-saved-filter-groups nil t))) + ibuffer-mode) (setq ibuffer-saved-filter-groups (ibuffer-remove-alist name ibuffer-saved-filter-groups)) (ibuffer-maybe-save-stuff) @@ -979,7 +985,8 @@ The value from `ibuffer-saved-filter-groups' is used." (caar ibuffer-saved-filter-groups)) (t (completing-read "Switch to saved filter group: " - ibuffer-saved-filter-groups nil t))))) + ibuffer-saved-filter-groups nil t)))) + ibuffer-mode) (setq ibuffer-filter-groups (cdr (assoc name ibuffer-saved-filter-groups)) ibuffer-hidden-filter-groups nil) (ibuffer-update nil t)) @@ -989,7 +996,7 @@ The value from `ibuffer-saved-filter-groups' is used." "Disable all filters currently in effect in this buffer. With optional arg DELETE-FILTER-GROUPS non-nil, delete all filter group definitions by setting `ibuffer-filter-groups' to nil." - (interactive) + (interactive "" ibuffer-mode) (setq ibuffer-filtering-qualifiers nil) (if delete-filter-groups (setq ibuffer-filter-groups nil)) @@ -1001,7 +1008,7 @@ group definitions by setting `ibuffer-filter-groups' to nil." ;;;###autoload (defun ibuffer-pop-filter () "Remove the top filter in this buffer." - (interactive) + (interactive "" ibuffer-mode) (when (null ibuffer-filtering-qualifiers) (error "No filters in effect")) (pop ibuffer-filtering-qualifiers) @@ -1024,7 +1031,7 @@ return the updated list." 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 separate filters, like [name: foo] and [mode: bar-mode]." - (interactive) + (interactive "" ibuffer-mode) (unless ibuffer-filtering-qualifiers (error "No filters in effect")) (let* ((filters ibuffer-filtering-qualifiers) @@ -1048,7 +1055,7 @@ turned into separate filters, like [name: foo] and [mode: bar-mode]." ;;;###autoload (defun ibuffer-exchange-filters () "Exchange the top two filters on the stack in this buffer." - (interactive) + (interactive "" ibuffer-mode) (let ((filters ibuffer-filtering-qualifiers)) (when (< (length filters) 2) (error "Need two filters to exchange")) @@ -1058,7 +1065,7 @@ turned into separate filters, like [name: foo] and [mode: bar-mode]." ;;;###autoload (defun ibuffer-negate-filter () "Negate the sense of the top filter in the current buffer." - (interactive) + (interactive "" ibuffer-mode) (when (null ibuffer-filtering-qualifiers) (error "No filters in effect")) (let ((lim (pop ibuffer-filtering-qualifiers))) @@ -1088,7 +1095,7 @@ turned into separate filters, like [name: foo] and [mode: bar-mode]." "Replace the top two filters in this buffer with their logical OR. If optional argument DECOMPOSE is non-nil, instead break the top OR filter into parts." - (interactive "P") + (interactive "P" ibuffer-mode) (ibuffer--or-and-filter 'or decompose)) ;;;###autoload @@ -1096,7 +1103,7 @@ filter into parts." "Replace the top two filters in this buffer with their logical AND. If optional argument DECOMPOSE is non-nil, instead break the top AND filter into parts." - (interactive "P") + (interactive "P" ibuffer-mode) (ibuffer--or-and-filter 'and decompose)) (defun ibuffer-maybe-save-stuff () @@ -1115,7 +1122,8 @@ Interactively, prompt for NAME, and use the current filters." (error "No filters currently in effect") (list (read-from-minibuffer "Save current filters as: ") - ibuffer-filtering-qualifiers))) + ibuffer-filtering-qualifiers)) + ibuffer-mode) (if-let ((it (assoc name ibuffer-saved-filters))) (setcdr it filters) (push (cons name filters) ibuffer-saved-filters)) @@ -1143,7 +1151,8 @@ Interactively, prompt for NAME, and use the current filters." (if (null ibuffer-saved-filters) (error "No saved filters") (completing-read "Add saved filters: " - ibuffer-saved-filters nil t)))) + ibuffer-saved-filters nil t))) + ibuffer-mode) (push (cons 'saved name) ibuffer-filtering-qualifiers) (ibuffer-update nil t)) @@ -1155,7 +1164,8 @@ Interactively, prompt for NAME, and use the current filters." (if (null ibuffer-saved-filters) (error "No saved filters") (completing-read "Switch to saved filters: " - ibuffer-saved-filters nil t)))) + ibuffer-saved-filters nil t))) + ibuffer-mode) (setq ibuffer-filtering-qualifiers (list (cons 'saved name))) (ibuffer-update nil t)) @@ -1397,7 +1407,7 @@ Indicates corresponding key sequences in echo area after filtering. The completion matches against the filter description text of each filter in `ibuffer-filtering-alist'." - (interactive) + (interactive "" ibuffer-mode) (let* ((filters (mapcar (lambda (x) (cons (cadr x) (car x))) ibuffer-filtering-alist)) (match (completing-read "Filter by: " filters nil t)) @@ -1421,7 +1431,7 @@ Default sorting modes are: Name - the name of the buffer Major Mode - the name of the major mode of the buffer Size - the size of the buffer" - (interactive) + (interactive "" ibuffer-mode) (let ((modes (mapcar #'car ibuffer-sorting-functions-alist))) (cl-pushnew 'recency modes) (setq modes (sort modes #'string-lessp)) @@ -1434,7 +1444,7 @@ Default sorting modes are: ;;;###autoload (defun ibuffer-invert-sorting () "Toggle whether or not sorting is in reverse order." - (interactive) + (interactive "" ibuffer-mode) (setq ibuffer-sorting-reversep (not ibuffer-sorting-reversep)) (message "Sorting order %s" (if ibuffer-sorting-reversep @@ -1509,7 +1519,7 @@ Ordering is lexicographic." (defun ibuffer-bs-toggle-all () "Emulate `bs-toggle-show-all' from the bs.el package." - (interactive) + (interactive "" ibuffer-mode) (if ibuffer-filtering-qualifiers (ibuffer-pop-filter) (progn (ibuffer-push-filter '(filename . ".*")) @@ -1525,7 +1535,8 @@ for this Ibuffer session." (interactive (list (read-from-minibuffer "Never show buffers matching: " - (regexp-quote (buffer-name (ibuffer-current-buffer t)))))) + (regexp-quote (buffer-name (ibuffer-current-buffer t))))) + ibuffer-mode) (push regexp ibuffer-tmp-hide-regexps)) ;;;###autoload @@ -1536,7 +1547,8 @@ for this Ibuffer session." (interactive (list (read-from-minibuffer "Always show buffers matching: " - (regexp-quote (buffer-name (ibuffer-current-buffer t)))))) + (regexp-quote (buffer-name (ibuffer-current-buffer t))))) + ibuffer-mode) (push regexp ibuffer-tmp-show-regexps)) ;;;###autoload @@ -1548,7 +1560,7 @@ 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") + (interactive "P" ibuffer-mode) (unless count (setq count 1)) (unless mark @@ -1572,13 +1584,13 @@ mean move backwards, non-negative integers mean move forwards." 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") + (interactive "P" ibuffer-mode) (ibuffer-forward-next-marked count mark -1)) ;;;###autoload (defun ibuffer-do-kill-lines () "Hide all of the currently marked lines." - (interactive) + (interactive "" ibuffer-mode) (if (= (ibuffer-count-marked-lines) 0) (message (substitute-command-keys (concat @@ -1613,7 +1625,8 @@ a prefix argument reverses the meaning of that variable." (error "No buffers!")) (completing-read "Jump to buffer: " table nil t)) - (read-buffer "Jump to buffer: " nil t))))) + (read-buffer "Jump to buffer: " nil t)))) + ibuffer-mode) (when (not (string= "" name)) (let (buf-point) ;; Blindly search for our buffer: it is very likely that it is @@ -1686,7 +1699,7 @@ without erasing it." If no buffers are marked, use buffer at point. This requires the external program `diff-command' to be in your `exec-path'." - (interactive) + (interactive "" ibuffer-mode) (require 'diff) (let ((marked-bufs (or (ibuffer-get-marked-buffers) (list (ibuffer-current-buffer t)))) @@ -1722,7 +1735,7 @@ With \\[universal-argument], use the filename of each marked file relative to `ibuffer-default-directory' if non-nil, otherwise `default-directory'. You can then feed the file name(s) to other commands with \\[yank]." - (interactive "P") + (interactive "P" ibuffer-mode) (let* ((buffers (cond ((and (integerp arg) (not (zerop arg))) (ibuffer--near-buffers arg)) (t @@ -1755,7 +1768,7 @@ You can then feed the file name(s) to other commands with \\[yank]." "Copy buffer names of marked (or next ARG) buffers into the kill ring. The names are separated by a space. You can then feed the file name(s) to other commands with \\[yank]." - (interactive "P") + (interactive "P" ibuffer-mode) (let* ((buffers (cond ((and (integerp arg) (not (zerop arg))) (ibuffer--near-buffers arg)) (t @@ -1785,7 +1798,7 @@ You can then feed the file name(s) to other commands with \\[yank]." ;;;###autoload (defun ibuffer-mark-by-name-regexp (regexp) "Mark all buffers whose name matches REGEXP." - (interactive "sMark by name (regexp): ") + (interactive "sMark by name (regexp): " ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (string-match regexp (buffer-name buf))))) @@ -1801,7 +1814,7 @@ When BUF nil, default to the buffer at current line." ;;;###autoload (defun ibuffer-mark-by-locked () "Mark all locked buffers." - (interactive) + (interactive "" ibuffer-mode) (when (featurep 'emacs-lock) (ibuffer-mark-on-buffer (lambda (buf) @@ -1810,7 +1823,7 @@ When BUF nil, default to the buffer at current line." ;;;###autoload (defun ibuffer-mark-by-mode-regexp (regexp) "Mark all buffers whose major mode matches REGEXP." - (interactive "sMark by major mode (regexp): ") + (interactive "sMark by major mode (regexp): " ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (with-current-buffer buf @@ -1819,7 +1832,7 @@ When BUF nil, default to the buffer at current line." ;;;###autoload (defun ibuffer-mark-by-file-name-regexp (regexp) "Mark all buffers whose file name matches REGEXP." - (interactive (list (read-regexp "Mark by file name (regexp)"))) + (interactive (list (read-regexp "Mark by file name (regexp)")) ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (when-let ((name (with-current-buffer buf (ibuffer-buffer-file-name)))) @@ -1834,7 +1847,8 @@ Otherwise buffers whose name matches an element of `ibuffer-never-search-content-name' or whose major mode is on `ibuffer-never-search-content-mode' are excluded." (interactive (let ((reg (read-string "Mark by content (regexp): "))) - (list reg current-prefix-arg))) + (list reg current-prefix-arg)) + ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (let ((mode (with-current-buffer buf major-mode)) @@ -1863,7 +1877,8 @@ Otherwise buffers whose name matches an element of (list (intern (completing-read (format-prompt "Mark by major mode" default) - (ibuffer-list-buffer-modes) nil t nil nil default))))) + (ibuffer-list-buffer-modes) nil t nil nil default)))) + ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (eq (buffer-local-value 'major-mode buf) mode)))) @@ -1871,14 +1886,14 @@ Otherwise buffers whose name matches an element of ;;;###autoload (defun ibuffer-mark-modified-buffers () "Mark all modified buffers." - (interactive) + (interactive "" ibuffer-mode) (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) + (interactive "" ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (and (buffer-local-value 'buffer-file-name buf) (buffer-modified-p buf))))) @@ -1886,7 +1901,7 @@ Otherwise buffers whose name matches an element of ;;;###autoload (defun ibuffer-mark-dissociated-buffers () "Mark all buffers whose associated file does not exist." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (with-current-buffer buf @@ -1901,7 +1916,7 @@ Otherwise buffers whose name matches an element of ;;;###autoload (defun ibuffer-mark-help-buffers () "Mark buffers whose major mode is in variable `ibuffer-help-buffer-modes'." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (with-current-buffer buf @@ -1910,7 +1925,7 @@ Otherwise buffers whose name matches an element of ;;;###autoload (defun ibuffer-mark-compressed-file-buffers () "Mark buffers whose associated file is compressed." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (with-current-buffer buf @@ -1921,7 +1936,7 @@ Otherwise buffers whose name matches an element of ;;;###autoload (defun ibuffer-mark-old-buffers () "Mark buffers which have not been viewed in `ibuffer-old-time' hours." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (with-current-buffer buf @@ -1933,7 +1948,7 @@ Otherwise buffers whose name matches an element of ;;;###autoload (defun ibuffer-mark-special-buffers () "Mark all buffers whose name begins and ends with `*'." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (string-match "^\\*.+\\*$" (buffer-name buf))))) @@ -1941,14 +1956,14 @@ Otherwise buffers whose name matches an element of ;;;###autoload (defun ibuffer-mark-read-only-buffers () "Mark all read-only buffers." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (buffer-local-value 'buffer-read-only buf)))) ;;;###autoload (defun ibuffer-mark-dired-buffers () "Mark all `dired' buffers." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-mark-on-buffer (lambda (buf) (eq (buffer-local-value 'major-mode buf) 'dired-mode)))) @@ -1957,7 +1972,7 @@ Otherwise buffers whose name matches an element of "View lines which match REGEXP in all marked buffers. Optional argument NLINES says how many lines of context to display: it defaults to one." - (interactive (occur-read-primary-args)) + (interactive (occur-read-primary-args) ibuffer-mode) (if (or (not (integerp nlines)) (< nlines 0)) (setq nlines 0)) diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el index 1fd94967836..806e724c2ae 100644 --- a/lisp/ibuf-macs.el +++ b/lisp/ibuf-macs.el @@ -146,7 +146,7 @@ value if and only if `a' is \"less than\" `b'. `(progn (defun ,(intern (concat "ibuffer-do-sort-by-" (symbol-name name))) () ,(or documentation "No :documentation specified for this sorting method.") - (interactive) + (interactive "" ibuffer-mode) (setq ibuffer-sorting-mode ',name) (when (eq ibuffer-sorting-mode ibuffer-last-sorting-mode) (setq ibuffer-sorting-reversep (not ibuffer-sorting-reversep))) @@ -219,9 +219,7 @@ buffer object. ,(if (stringp documentation) documentation (format "%s marked buffers." active-opstring)) - ,(if (not (null interactive)) - `(interactive ,interactive) - '(interactive)) + (interactive ,(or interactive "") ibuffer-mode) (cl-assert (derived-mode-p 'ibuffer-mode)) (setq ibuffer-did-modification nil) (let ((marked-names (,(pcase mark @@ -310,7 +308,7 @@ bound to the current value of the filter. `(progn (defun ,fn-name (qualifier) ,(or documentation "This filter is not documented.") - (interactive (list ,reader)) + (interactive (list ,reader) ibuffer-mode) (let ((,filter (cons ',name qualifier)) (,qualifier-str qualifier)) ,(when accept-list diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index c65213f5bde..82f3728a6f8 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -851,7 +851,8 @@ width and the longest string in LIST." default-directory) default-directory)))) (list (read-file-name "Find file: " default-directory) - t))) + t)) + ibuffer-mode) (find-file file wildcards)) (defun ibuffer-mouse-visit-buffer (event) @@ -900,7 +901,7 @@ width and the longest string in LIST." (defun ibuffer-backward-line (&optional arg skip-group-names) "Move backwards ARG lines, wrapping around the list if necessary." - (interactive "P") + (interactive "P" ibuffer-mode) (or arg (setq arg 1)) (beginning-of-line) (while (> arg 0) @@ -924,7 +925,7 @@ width and the longest string in LIST." (defun ibuffer-forward-line (&optional arg skip-group-names) "Move forward ARG lines, wrapping around the list if necessary." - (interactive "P") + (interactive "P" ibuffer-mode) (or arg (setq arg 1)) (beginning-of-line) (when (and ibuffer-movement-cycle @@ -958,7 +959,7 @@ width and the longest string in LIST." "Visit the buffer on this line. If optional argument SINGLE is non-nil, then also ensure there is only one window." - (interactive "P") + (interactive "P" ibuffer-mode) (let ((buf (ibuffer-current-buffer t))) (switch-to-buffer buf) (when single @@ -966,7 +967,7 @@ one window." (defun ibuffer-visit-buffer-other-window (&optional noselect) "Visit the buffer on this line in another window." - (interactive) + (interactive "" ibuffer-mode) (let ((buf (ibuffer-current-buffer t))) (bury-buffer (current-buffer)) (if noselect @@ -975,24 +976,24 @@ one window." (defun ibuffer-visit-buffer-other-window-noselect () "Visit the buffer on this line in another window, but don't select it." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-visit-buffer-other-window t)) (defun ibuffer-visit-buffer-other-frame () "Visit the buffer on this line in another frame." - (interactive) + (interactive "" ibuffer-mode) (let ((buf (ibuffer-current-buffer t))) (bury-buffer (current-buffer)) (switch-to-buffer-other-frame buf))) (defun ibuffer-visit-buffer-1-window () "Visit the buffer on this line, and delete other windows." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-visit-buffer t)) (defun ibuffer-bury-buffer () "Bury the buffer on this line." - (interactive) + (interactive "" ibuffer-mode) (let ((buf (ibuffer-current-buffer t)) (line (+ 1 (count-lines 1 (point))))) (bury-buffer buf) @@ -1002,7 +1003,7 @@ one window." (defun ibuffer-visit-tags-table () "Visit the tags table in the buffer on this line. See `visit-tags-table'." - (interactive) + (interactive "" ibuffer-mode) (let ((file (buffer-file-name (ibuffer-current-buffer t)))) (if file (visit-tags-table file) @@ -1013,12 +1014,12 @@ one window." If optional argument OTHER-FRAME is non-nil, then display each marked buffer in a new frame. Otherwise, display each buffer as a new window in the current frame, splitting vertically." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-do-view-1 (if other-frame 'other-frame 'vertically))) (defun ibuffer-do-view-horizontally (&optional other-frame) "As `ibuffer-do-view', but split windows horizontally." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-do-view-1 (if other-frame 'other-frame 'horizontally))) (defun ibuffer-do-view-1 (type) @@ -1050,7 +1051,7 @@ a new window in the current frame, splitting vertically." (defun ibuffer-do-view-other-frame () "View each of the marked buffers in a separate frame." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-do-view t)) (defsubst ibuffer-map-marked-lines (func) @@ -1237,7 +1238,7 @@ Otherwise, toggle lock status." (defun ibuffer-unmark-all (mark) "Unmark all buffers with mark MARK." - (interactive "cRemove marks (RET means all):") + (interactive "cRemove marks (RET means all):" ibuffer-mode) (if (= (ibuffer-count-marked-lines t) 0) (message (substitute-command-keys "No buffers marked; use \\\ @@ -1252,7 +1253,7 @@ Otherwise, toggle lock status." (defun ibuffer-unmark-all-marks () "Remove all marks from all marked buffers in Ibuffer." - (interactive) + (interactive "" ibuffer-mode) ;; hm. we could probably do this in a better fashion (ibuffer-unmark-all ?\r)) @@ -1262,7 +1263,7 @@ In other words, unmarked buffers become marked, and marked buffers become unmarked. If point is on a group name, then this function operates on that group." - (interactive) + (interactive "" ibuffer-mode) (when-let ((it (get-text-property (point) 'ibuffer-filter-group-name))) (setq group it)) (let ((count @@ -1288,7 +1289,8 @@ OLD and NEW are both characters used to mark buffers." (old (progn (message "Change (old mark): ") (read-char))) (new (progn (message "Change %c marks to (new mark): " old) (read-char)))) - (list old new))) + (list old new)) + ibuffer-mode) (if (or (eq old ?\r) (eq new ?\r)) (ding) (let ((count @@ -1306,19 +1308,19 @@ OLD and NEW are both characters used to mark buffers." (defun ibuffer-mark-forward (start end arg) "Mark the buffers in the region, or ARG buffers. If point is on a group name, this function operates on that group." - (interactive (ibuffer-get-region-and-prefix)) + (interactive (ibuffer-get-region-and-prefix) ibuffer-mode) (ibuffer-mark-region-or-n-with-char start end arg ibuffer-marked-char)) (defun ibuffer-unmark-forward (start end arg) "Unmark the buffers in the region, or ARG buffers. If point is on a group name, this function operates on that group." - (interactive (ibuffer-get-region-and-prefix)) + (interactive (ibuffer-get-region-and-prefix) ibuffer-mode) (ibuffer-mark-region-or-n-with-char start end arg ?\s)) (defun ibuffer-unmark-backward (start end arg) "Unmark the buffers in the region, or previous ARG buffers. If point is on a group name, this function operates on that group." - (interactive (ibuffer-get-region-and-prefix)) + (interactive (ibuffer-get-region-and-prefix) ibuffer-mode) (ibuffer-unmark-forward start end (- arg))) (defun ibuffer-mark-region-or-n-with-char (start end arg mark-char) @@ -1368,13 +1370,13 @@ If point is on a group name, this function operates on that group." (defun ibuffer-mark-for-delete (start end arg) "Mark for deletion the buffers in the region, or ARG buffers. If point is on a group name, this function operates on that group." - (interactive (ibuffer-get-region-and-prefix)) + (interactive (ibuffer-get-region-and-prefix) ibuffer-mode) (ibuffer-mark-region-or-n-with-char start end arg ibuffer-deletion-char)) (defun ibuffer-mark-for-delete-backwards (arg) "Mark for deletion the ARG previous buffers. If point is on a group name, this function operates on that group." - (interactive "p") + (interactive "p" ibuffer-mode) (ibuffer-mark-interactive arg ibuffer-deletion-char -1)) (defun ibuffer-current-buffer (&optional must-be-live) @@ -2121,7 +2123,7 @@ the value of point at the beginning of the line for that buffer." This does not show new buffers; use `ibuffer-update' for that. If optional arg SILENT is non-nil, do not display progress messages." - (interactive) + (interactive "" ibuffer-mode) (ibuffer-forward-line 0) (unless silent (message "Redisplaying current buffer list...")) @@ -2142,7 +2144,7 @@ Prefix arg non-nil means to toggle whether buffers that match `ibuffer-maybe-show-predicates' should be displayed. If optional arg SILENT is non-nil, do not display progress messages." - (interactive "P") + (interactive "P" ibuffer-mode) (if arg (setq ibuffer-display-maybe-show-predicates (not ibuffer-display-maybe-show-predicates))) -- 2.39.2