From: Dmitry Gutov Date: Thu, 7 Feb 2019 09:20:09 +0000 (+0300) Subject: Rename multifile.el to fileloop.el X-Git-Tag: emacs-27.0.90~3657 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5e627fa5f5db8f27ea789d61148e7d5ade644956;p=emacs.git Rename multifile.el to fileloop.el * lisp/multifile.el: Rename to fileloop.el as discussed in https://lists.gnu.org/archive/html/emacs-devel/2018-12/msg00475.html. Update symbol prefixes and all callers --- diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index d97cfd355cc..fd0119e98ce 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1990,7 +1990,7 @@ table. @item M-x tags-query-replace @key{RET} @var{regexp} @key{RET} @var{replacement} @key{RET} Perform a @code{query-replace-regexp} on each file in the selected tags table. -@item M-x multifile-continue +@item M-x fileloop-continue Restart one of the last 2 commands above, from the current location of point. @end table @@ -2026,9 +2026,9 @@ you can follow its progress. As soon as it finds an occurrence, @code{tags-search} returns. This command requires tags tables to be available (@pxref{Tags Tables}). -@findex multifile-continue +@findex fileloop-continue Having found one match with @code{tags-search}, you probably want to -find all the rest. @kbd{M-x multifile-continue} resumes the +find all the rest. @kbd{M-x fileloop-continue} resumes the @code{tags-search}, finding one more match. This searches the rest of the current buffer, followed by the remaining files of the tags table. @@ -2051,10 +2051,10 @@ default is to use the same setting as the value of single invocation of @kbd{M-x tags-query-replace}. But often it is useful to exit temporarily, which you can do with any input event that has no special query replace meaning. You can resume the query -replace subsequently by typing @kbd{M-x multifile-continue}; this +replace subsequently by typing @kbd{M-x fileloop-continue}; this command resumes the last tags search or replace command that you did. For instance, to skip the rest of the current file, you can type -@w{@kbd{M-> M-x multifile-continue}}. +@w{@kbd{M-> M-x fileloop-continue}}. Note that the commands described above carry out much broader searches than the @code{xref-find-definitions} family. The diff --git a/etc/NEWS b/etc/NEWS index 406ed6e3788..f889a8ac3c0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -394,11 +394,11 @@ The mode is automatically enabled in files that start with the *** 'next-file' is now an obsolete alias of 'tags-next-file'. *** 'tags-loop-revert-buffers' is an obsolete alias of -'multifile-revert-buffers'. +'fileloop-revert-buffers'. *** The 'tags-loop-continue' function along with the 'tags-loop-operate' and 'tags-loop-scan' variables are now obsolete; -use the new 'multifile-initialize' and 'multifile-continue' functions +use the new 'fileloop-initialize' and 'fileloop-continue' functions instead. ** bibtex @@ -1085,7 +1085,7 @@ indicator instead of just the indicator (which is sometimes cryptic). * New Modes and Packages in Emacs 27.1 -** multifile.el lets one setup multifile operations like search&replace. +** fileloop.el lets one setup multifile operations like search&replace. +++ ** Emacs can now visit files in archives as if they were directories. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 7e709601468..4be93c32207 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -2859,11 +2859,11 @@ is part of a file name (i.e., has the text property `dired-filename')." Stops when a match is found. To continue searching for next match, use command \\[tags-loop-continue]." (interactive "sSearch marked files (regexp): ") - (multifile-initialize-search + (fileloop-initialize-search regexp (dired-get-marked-files nil nil #'dired-nondirectory-p) 'default) - (multifile-continue)) + (fileloop-continue)) ;;;###autoload (defun dired-do-query-replace-regexp (from to &optional delimited) @@ -2881,11 +2881,11 @@ with the command \\[tags-loop-continue]." (if (and buffer (with-current-buffer buffer buffer-read-only)) (error "File `%s' is visited read-only" file)))) - (multifile-initialize-replace + (fileloop-initialize-replace from to (dired-get-marked-files nil nil #'dired-nondirectory-p) (if (equal from (downcase from)) nil 'default) delimited) - (multifile-continue)) + (fileloop-continue)) (declare-function xref--show-xrefs "xref") (declare-function xref-query-replace-in-results "xref") diff --git a/lisp/fileloop.el b/lisp/fileloop.el new file mode 100644 index 00000000000..2e77811a576 --- /dev/null +++ b/lisp/fileloop.el @@ -0,0 +1,217 @@ +;;; fileloop.el --- Operations on multiple files -*- lexical-binding: t; -*- + +;; Copyright (C) 2018-2019 Free Software Foundation, Inc. + +;; Author: Stefan Monnier + +;; This program 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. + +;; This program 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. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Support functions for operations like search or query&replace applied to +;; several files. This code was largely inspired&extracted from an earlier +;; version of etags.el. + +;; TODO: +;; - Maybe it would make sense to replace the fileloop--* vars with a single +;; global var holding a struct, and then stash those structs into a history +;; of past operations, so you can perform a fileloop-search while in the +;; middle of a fileloop-replace and later go back to that +;; fileloop-replace. +;; - Make multi-isearch work on top of this library (might require changes +;; to this library, of course). + +;;; Code: + +(require 'generator) + +(defgroup fileloop nil + "Operations on multiple files." + :group 'tools) + +(defcustom fileloop-revert-buffers 'silent + "Whether to revert files during fileloop operation. + `silent' means to only do it if `revert-without-query' is applicable; + t means to offer to do it for all applicable files; + nil means never to do it" + :type '(choice (const silent) (const t) (const nil))) + +;; FIXME: This already exists in GNU ELPA's iterator.el. Maybe it should move +;; to generator.el? +(iter-defun fileloop--list-to-iterator (list) + (while list (iter-yield (pop list)))) + +(defvar fileloop--iterator iter-empty) +(defvar fileloop--scan-function + (lambda () (user-error "No operation in progress"))) +(defvar fileloop--operate-function #'ignore) +(defvar fileloop--freshly-initialized nil) + +;;;###autoload +(defun fileloop-initialize (files scan-function operate-function) + "Initialize a new round of operation on several files. +FILES can be either a list of file names, or an iterator (used with `iter-next') +which returns a file name at each step. +SCAN-FUNCTION is a function called with no argument inside a buffer +and it should return non-nil if that buffer has something on which to operate. +OPERATE-FUNCTION is a function called with no argument; it is expected +to perform the operation on the current file buffer and when done +should return non-nil to mean that we should immediately continue +operating on the next file and nil otherwise." + (setq fileloop--iterator + (if (and (listp files) (not (functionp files))) + (fileloop--list-to-iterator files) + files)) + (setq fileloop--scan-function scan-function) + (setq fileloop--operate-function operate-function) + (setq fileloop--freshly-initialized t)) + +(defun fileloop-next-file (&optional novisit) + ;; FIXME: Should we provide an interactive command, like tags-next-file? + (let ((next (condition-case nil + (iter-next fileloop--iterator) + (iter-end-of-sequence nil)))) + (unless next + (and novisit + (get-buffer " *next-file*") + (kill-buffer " *next-file*")) + (user-error "All files processed")) + (let* ((buffer (get-file-buffer next)) + (new (not buffer))) + ;; Optionally offer to revert buffers + ;; if the files have changed on disk. + (and buffer fileloop-revert-buffers + (not (verify-visited-file-modtime buffer)) + (if (eq fileloop-revert-buffers 'silent) + (and (not (buffer-modified-p buffer)) + (let ((revertible nil)) + (dolist (re revert-without-query) + (when (string-match-p re next) + (setq revertible t))) + revertible)) + (y-or-n-p + (format + (if (buffer-modified-p buffer) + "File %s changed on disk. Discard your edits? " + "File %s changed on disk. Reread from disk? ") + next))) + (with-current-buffer buffer + (revert-buffer t t))) + (if (not (and new novisit)) + (set-buffer (find-file-noselect next)) + ;; Like find-file, but avoids random warning messages. + (set-buffer (get-buffer-create " *next-file*")) + (kill-all-local-variables) + (erase-buffer) + (setq new next) + (insert-file-contents new nil)) + new))) + +(defun fileloop-continue () + "Continue last multi-file operation." + (interactive) + (let (new + ;; Non-nil means we have finished one file + ;; and should not scan it again. + file-finished + original-point + (messaged nil)) + (while + (progn + ;; Scan files quickly for the first or next interesting one. + ;; This starts at point in the current buffer. + (while (or fileloop--freshly-initialized file-finished + (save-restriction + (widen) + (not (funcall fileloop--scan-function)))) + ;; If nothing was found in the previous file, and + ;; that file isn't in a temp buffer, restore point to + ;; where it was. + (when original-point + (goto-char original-point)) + + (setq file-finished nil) + (setq new (fileloop-next-file t)) + + ;; If NEW is non-nil, we got a temp buffer, + ;; and NEW is the file name. + (when (or messaged + (and (not fileloop--freshly-initialized) + (> baud-rate search-slow-speed) + (setq messaged t))) + (message "Scanning file %s..." (or new buffer-file-name))) + + (setq fileloop--freshly-initialized nil) + (setq original-point (if new nil (point))) + (goto-char (point-min))) + + ;; If we visited it in a temp buffer, visit it now for real. + (if new + (let ((pos (point))) + (erase-buffer) + (set-buffer (find-file-noselect new)) + (setq new nil) ;No longer in a temp buffer. + (widen) + (goto-char pos)) + (push-mark original-point t)) + + (switch-to-buffer (current-buffer)) + + ;; Now operate on the file. + ;; If value is non-nil, continue to scan the next file. + (save-restriction + (widen) + (funcall fileloop--operate-function))) + (setq file-finished t)))) + +;;;###autoload +(defun fileloop-initialize-search (regexp files case-fold) + (let ((last-buffer (current-buffer))) + (fileloop-initialize + files + (lambda () + (let ((case-fold-search + (if (memq case-fold '(t nil)) case-fold case-fold-search))) + (re-search-forward regexp nil t))) + (lambda () + (unless (eq last-buffer (current-buffer)) + (setq last-buffer (current-buffer)) + (message "Scanning file %s...found" buffer-file-name)) + nil)))) + +;;;###autoload +(defun fileloop-initialize-replace (from to files case-fold &optional delimited) + "Initialize a new round of query&replace on several files. +FROM is a regexp and TO is the replacement to use. +FILES describes the file, as in `fileloop-initialize'. +CASE-FOLD can be t, nil, or `default', the latter one meaning to obey +the default setting of `case-fold-search'. +DELIMITED if non-nil means replace only word-delimited matches." + ;; FIXME: Not sure how the delimited-flag interacts with the regexp-flag in + ;; `perform-replace', so I just try to mimic the old code. + (fileloop-initialize + files + (lambda () + (let ((case-fold-search + (if (memql case-fold '(nil t)) case-fold case-fold-search))) + (if (re-search-forward from nil t) + ;; When we find a match, move back + ;; to the beginning of it so perform-replace + ;; will see it. + (goto-char (match-beginning 0))))) + (lambda () + (perform-replace from to t t delimited nil multi-query-replace-map)))) + +(provide 'fileloop) +;;; fileloop.el ends here diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 4c5e6a4dae0..b913b1bb362 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -11493,7 +11493,7 @@ argument is passed to `next-file', which see). \(fn &optional FIRST-TIME)" t nil) -(make-obsolete 'tags-loop-continue 'multifile-continue '"27.1") +(make-obsolete 'tags-loop-continue 'fileloop-continue '"27.1") (autoload 'tags-search "etags" "\ Search through all files listed in tags table for match for REGEXP. @@ -11512,7 +11512,7 @@ Do `query-replace-regexp' of FROM with TO on all files listed in tags table. Third arg DELIMITED (prefix arg) means replace only word-delimited matches. If you exit (\\[keyboard-quit], RET or q), you can resume the query replace with the command \\[tags-loop-continue]. -For non-interactive use, superceded by `multifile-initialize-replace'. +For non-interactive use, superceded by `fileloop-initialize-replace'. \(fn FROM TO &optional DELIMITED FILES)" t nil) @@ -22298,10 +22298,10 @@ QUALITY can be: ;;;*** -;;;### (autoloads nil "multifile" "multifile.el" (0 0 0 0)) -;;; Generated autoloads from multifile.el +;;;### (autoloads nil "fileloop" "fileloop.el" (0 0 0 0)) +;;; Generated autoloads from fileloop.el -(autoload 'multifile-initialize "multifile" "\ +(autoload 'fileloop-initialize "fileloop" "\ Initialize a new round of operation on several files. FILES can be either a list of file names, or an iterator (used with `iter-next') which returns a file name at each step. @@ -22314,22 +22314,22 @@ operating on the next file and nil otherwise. \(fn FILES SCAN-FUNCTION OPERATE-FUNCTION)" nil nil) -(autoload 'multifile-initialize-search "multifile" "\ +(autoload 'fileloop-initialize-search "fileloop" "\ \(fn REGEXP FILES CASE-FOLD)" nil nil) -(autoload 'multifile-initialize-replace "multifile" "\ +(autoload 'fileloop-initialize-replace "fileloop" "\ Initialize a new round of query&replace on several files. FROM is a regexp and TO is the replacement to use. -FILES describes the file, as in `multifile-initialize'. +FILES describes the file, as in `fileloop-initialize'. CASE-FOLD can be t, nil, or `default', the latter one meaning to obey the default setting of `case-fold-search'. DELIMITED if non-nil means replace only word-delimited matches. \(fn FROM TO FILES CASE-FOLD &optional DELIMITED)" nil nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "multifile" '("multifile-"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "fileloop" '("fileloop-"))) ;;;*** @@ -26455,14 +26455,14 @@ recognized. (autoload 'project-search "project" "\ Search for REGEXP in all the files of the project. Stops when a match is found. -To continue searching for next match, use command \\[multifile-continue]. +To continue searching for next match, use command \\[fileloop-continue]. \(fn REGEXP)" t nil) (autoload 'project-query-replace "project" "\ Search for REGEXP in all the files of the project. Stops when a match is found. -To continue searching for next match, use command \\[multifile-continue]. +To continue searching for next match, use command \\[fileloop-continue]. \(fn FROM TO)" t nil) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 98135852d1a..4ff60ed9910 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -309,7 +309,7 @@ menu-bar-separator) (bindings--define-key menu [tags-continue] - '(menu-item "Continue Tags Search" multifile-continue + '(menu-item "Continue Tags Search" fileloop-continue :help "Continue last tags search operation")) (bindings--define-key menu [tags-srch] '(menu-item "Search Tagged Files..." tags-search @@ -358,7 +358,7 @@ (defvar menu-bar-replace-menu (let ((menu (make-sparse-keymap "Replace"))) (bindings--define-key menu [tags-repl-continue] - '(menu-item "Continue Replace" multifile-continue + '(menu-item "Continue Replace" fileloop-continue :help "Continue last tags replace operation")) (bindings--define-key menu [tags-repl] '(menu-item "Replace in Tagged Files..." tags-query-replace diff --git a/lisp/multifile.el b/lisp/multifile.el deleted file mode 100644 index a40f80947fb..00000000000 --- a/lisp/multifile.el +++ /dev/null @@ -1,217 +0,0 @@ -;;; multifile.el --- Operations on multiple files -*- lexical-binding: t; -*- - -;; Copyright (C) 2018-2019 Free Software Foundation, Inc. - -;; Author: Stefan Monnier - -;; This program 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. - -;; This program 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. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Support functions for operations like search or query&replace applied to -;; several files. This code was largely inspired&extracted from an earlier -;; version of etags.el. - -;; TODO: -;; - Maybe it would make sense to replace the multifile--* vars with a single -;; global var holding a struct, and then stash those structs into a history -;; of past operations, so you can perform a multifile-search while in the -;; middle of a multifile-replace and later go back to that -;; multifile-replace. -;; - Make multi-isearch work on top of this library (might require changes -;; to this library, of course). - -;;; Code: - -(require 'generator) - -(defgroup multifile nil - "Operations on multiple files." - :group 'tools) - -(defcustom multifile-revert-buffers 'silent - "Whether to revert files during multifile operation. - `silent' means to only do it if `revert-without-query' is applicable; - t means to offer to do it for all applicable files; - nil means never to do it" - :type '(choice (const silent) (const t) (const nil))) - -;; FIXME: This already exists in GNU ELPA's iterator.el. Maybe it should move -;; to generator.el? -(iter-defun multifile--list-to-iterator (list) - (while list (iter-yield (pop list)))) - -(defvar multifile--iterator iter-empty) -(defvar multifile--scan-function - (lambda () (user-error "No operation in progress"))) -(defvar multifile--operate-function #'ignore) -(defvar multifile--freshly-initialized nil) - -;;;###autoload -(defun multifile-initialize (files scan-function operate-function) - "Initialize a new round of operation on several files. -FILES can be either a list of file names, or an iterator (used with `iter-next') -which returns a file name at each step. -SCAN-FUNCTION is a function called with no argument inside a buffer -and it should return non-nil if that buffer has something on which to operate. -OPERATE-FUNCTION is a function called with no argument; it is expected -to perform the operation on the current file buffer and when done -should return non-nil to mean that we should immediately continue -operating on the next file and nil otherwise." - (setq multifile--iterator - (if (and (listp files) (not (functionp files))) - (multifile--list-to-iterator files) - files)) - (setq multifile--scan-function scan-function) - (setq multifile--operate-function operate-function) - (setq multifile--freshly-initialized t)) - -(defun multifile-next-file (&optional novisit) - ;; FIXME: Should we provide an interactive command, like tags-next-file? - (let ((next (condition-case nil - (iter-next multifile--iterator) - (iter-end-of-sequence nil)))) - (unless next - (and novisit - (get-buffer " *next-file*") - (kill-buffer " *next-file*")) - (user-error "All files processed")) - (let* ((buffer (get-file-buffer next)) - (new (not buffer))) - ;; Optionally offer to revert buffers - ;; if the files have changed on disk. - (and buffer multifile-revert-buffers - (not (verify-visited-file-modtime buffer)) - (if (eq multifile-revert-buffers 'silent) - (and (not (buffer-modified-p buffer)) - (let ((revertible nil)) - (dolist (re revert-without-query) - (when (string-match-p re next) - (setq revertible t))) - revertible)) - (y-or-n-p - (format - (if (buffer-modified-p buffer) - "File %s changed on disk. Discard your edits? " - "File %s changed on disk. Reread from disk? ") - next))) - (with-current-buffer buffer - (revert-buffer t t))) - (if (not (and new novisit)) - (set-buffer (find-file-noselect next)) - ;; Like find-file, but avoids random warning messages. - (set-buffer (get-buffer-create " *next-file*")) - (kill-all-local-variables) - (erase-buffer) - (setq new next) - (insert-file-contents new nil)) - new))) - -(defun multifile-continue () - "Continue last multi-file operation." - (interactive) - (let (new - ;; Non-nil means we have finished one file - ;; and should not scan it again. - file-finished - original-point - (messaged nil)) - (while - (progn - ;; Scan files quickly for the first or next interesting one. - ;; This starts at point in the current buffer. - (while (or multifile--freshly-initialized file-finished - (save-restriction - (widen) - (not (funcall multifile--scan-function)))) - ;; If nothing was found in the previous file, and - ;; that file isn't in a temp buffer, restore point to - ;; where it was. - (when original-point - (goto-char original-point)) - - (setq file-finished nil) - (setq new (multifile-next-file t)) - - ;; If NEW is non-nil, we got a temp buffer, - ;; and NEW is the file name. - (when (or messaged - (and (not multifile--freshly-initialized) - (> baud-rate search-slow-speed) - (setq messaged t))) - (message "Scanning file %s..." (or new buffer-file-name))) - - (setq multifile--freshly-initialized nil) - (setq original-point (if new nil (point))) - (goto-char (point-min))) - - ;; If we visited it in a temp buffer, visit it now for real. - (if new - (let ((pos (point))) - (erase-buffer) - (set-buffer (find-file-noselect new)) - (setq new nil) ;No longer in a temp buffer. - (widen) - (goto-char pos)) - (push-mark original-point t)) - - (switch-to-buffer (current-buffer)) - - ;; Now operate on the file. - ;; If value is non-nil, continue to scan the next file. - (save-restriction - (widen) - (funcall multifile--operate-function))) - (setq file-finished t)))) - -;;;###autoload -(defun multifile-initialize-search (regexp files case-fold) - (let ((last-buffer (current-buffer))) - (multifile-initialize - files - (lambda () - (let ((case-fold-search - (if (memq case-fold '(t nil)) case-fold case-fold-search))) - (re-search-forward regexp nil t))) - (lambda () - (unless (eq last-buffer (current-buffer)) - (setq last-buffer (current-buffer)) - (message "Scanning file %s...found" buffer-file-name)) - nil)))) - -;;;###autoload -(defun multifile-initialize-replace (from to files case-fold &optional delimited) - "Initialize a new round of query&replace on several files. -FROM is a regexp and TO is the replacement to use. -FILES describes the file, as in `multifile-initialize'. -CASE-FOLD can be t, nil, or `default', the latter one meaning to obey -the default setting of `case-fold-search'. -DELIMITED if non-nil means replace only word-delimited matches." - ;; FIXME: Not sure how the delimited-flag interacts with the regexp-flag in - ;; `perform-replace', so I just try to mimic the old code. - (multifile-initialize - files - (lambda () - (let ((case-fold-search - (if (memql case-fold '(nil t)) case-fold case-fold-search))) - (if (re-search-forward from nil t) - ;; When we find a match, move back - ;; to the beginning of it so perform-replace - ;; will see it. - (goto-char (match-beginning 0))))) - (lambda () - (perform-replace from to t t delimited nil multi-query-replace-map)))) - -(provide 'multifile) -;;; multifile.el ends here diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 2994071b153..a2392328bac 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -36,7 +36,7 @@ (require 'ring) (require 'button) (require 'xref) -(require 'multifile) +(require 'fileloop) ;;;###autoload (defvar tags-file-name nil @@ -1693,12 +1693,12 @@ Point should be just after a string that matches TAG." (let ((bol (point))) (and (search-forward "\177" (line-end-position) t) (re-search-backward re bol t))))) -(define-obsolete-variable-alias 'tags-loop-revert-buffers 'multifile-revert-buffers "27.1") +(define-obsolete-variable-alias 'tags-loop-revert-buffers 'fileloop-revert-buffers "27.1") ;;;###autoload (defalias 'next-file 'tags-next-file) (make-obsolete 'next-file - "use tags-next-file or multifile-initialize and multifile-next-file instead" "27.1") + "use tags-next-file or fileloop-initialize and fileloop-next-file instead" "27.1") ;;;###autoload (defun tags-next-file (&optional initialize novisit) "Select next file among files in current tags table. @@ -1716,7 +1716,7 @@ if the file was newly read in, the value is the filename." (interactive (list (if current-prefix-arg t))) (when initialize ;; Not the first run. (tags--compat-initialize initialize)) - (multifile-next-file novisit) + (fileloop-next-file novisit) (switch-to-buffer (current-buffer))) (defun tags--all-files () @@ -1742,11 +1742,11 @@ if the file was newly read in, the value is the filename." (mapcar #'expand-file-name (tags-table-files))))) files))) -(make-obsolete-variable 'tags-loop-operate 'multifile-initialize "27.1") +(make-obsolete-variable 'tags-loop-operate 'fileloop-initialize "27.1") (defvar tags-loop-operate nil "Form for `tags-loop-continue' to eval to change one file.") -(make-obsolete-variable 'tags-loop-scan 'multifile-initialize "27.1") +(make-obsolete-variable 'tags-loop-scan 'fileloop-initialize "27.1") (defvar tags-loop-scan '(user-error "%s" (substitute-command-keys @@ -1775,7 +1775,7 @@ Bind `case-fold-search' during the evaluation, depending on the value of (eval files)))) (defun tags--compat-initialize (initialize) - (multifile-initialize + (fileloop-initialize (tags--compat-files initialize) (if tags-loop-operate (lambda () (tags-loop-eval tags-loop-operate)) @@ -1792,11 +1792,11 @@ argument is passed to `next-file', which see)." ;; interesting (it returns non-nil if so) and `tags-loop-operate' is a form to ;; evaluate to operate on an interesting file. If the latter evaluates to ;; nil, we exit; otherwise we scan the next file. - (declare (obsolete multifile-continue "27.1")) + (declare (obsolete fileloop-continue "27.1")) (interactive) (when first-time ;; Backward compatibility. (tags--compat-initialize first-time)) - (multifile-continue)) + (fileloop-continue)) ;; We use it to detect when the last loop was a tags-search. (defvar tags--last-search-operate-function nil) @@ -1813,18 +1813,18 @@ The search will be restricted to these files. Also see the documentation of the `tags-file-name' variable." (interactive "sTags search (regexp): ") (unless (and (equal regexp "") - ;; FIXME: If some other multifile operation took place, + ;; FIXME: If some other fileloop operation took place, ;; rather than search for "", we should repeat the last search! - (eq multifile--operate-function + (eq fileloop--operate-function tags--last-search-operate-function)) - (multifile-initialize-search + (fileloop-initialize-search regexp (tags--compat-files (or files t)) tags-case-fold-search) - ;; Store it, so we can detect if some other multifile operation took + ;; Store it, so we can detect if some other fileloop operation took ;; place since the last search! - (setq tags--last-search-operate-function multifile--operate-function)) - (multifile-continue)) + (setq tags--last-search-operate-function fileloop--operate-function)) + (fileloop-continue)) ;;;###autoload (defun tags-query-replace (from to &optional delimited files) @@ -1832,15 +1832,15 @@ Also see the documentation of the `tags-file-name' variable." Third arg DELIMITED (prefix arg) means replace only word-delimited matches. If you exit (\\[keyboard-quit], RET or q), you can resume the query replace with the command \\[tags-loop-continue]. -For non-interactive use, superceded by `multifile-initialize-replace'." +For non-interactive use, superceded by `fileloop-initialize-replace'." (declare (advertised-calling-convention (from to &optional delimited) "27.1")) (interactive (query-replace-read-args "Tags query replace (regexp)" t t)) - (multifile-initialize-replace + (fileloop-initialize-replace from to (tags--compat-files (or files t)) (if (equal from (downcase from)) nil 'default) delimited) - (multifile-continue)) + (fileloop-continue)) (defun tags-complete-tags-table-file (string predicate what) ; Doc string? (save-excursion diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 8648d0047d1..3906f6cb24b 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -511,30 +511,30 @@ recognized." inherit-input-method))) (concat common-parent-directory res))) -(declare-function multifile-continue "multifile" ()) +(declare-function fileloop-continue "fileloop" ()) ;;;###autoload (defun project-search (regexp) "Search for REGEXP in all the files of the project. Stops when a match is found. -To continue searching for next match, use command \\[multifile-continue]." +To continue searching for next match, use command \\[fileloop-continue]." (interactive "sSearch (regexp): ") - (multifile-initialize-search + (fileloop-initialize-search regexp (project-files (project-current t)) 'default) - (multifile-continue)) + (fileloop-continue)) ;;;###autoload (defun project-query-replace (from to) "Search for REGEXP in all the files of the project. Stops when a match is found. -To continue searching for next match, use command \\[multifile-continue]." +To continue searching for next match, use command \\[fileloop-continue]." (interactive (pcase-let ((`(,from ,to) (query-replace-read-args "Query replace (regexp)" t t))) (list from to))) - (multifile-initialize-replace + (fileloop-initialize-replace from to (project-files (project-current t)) 'default) - (multifile-continue)) + (fileloop-continue)) (provide 'project) ;;; project.el ends here