Skip to content

Commit

Permalink
Update projectile-replace for Emacs 27
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruin0x11 authored and bbatsov committed Mar 26, 2019
1 parent 6444e55 commit 1ac84bf
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -3258,17 +3258,22 @@ to run the replacement."
(projectile-prepend-project-name
(format "Replace %s with: " old-text))))
(files (projectile-files-with-string old-text directory)))
;; Adapted from `tags-query-replace' for literal strings (not regexp)
(setq tags-loop-scan `(let ,(unless (equal old-text (downcase old-text))
'((case-fold-search nil)))
(if (search-forward ',old-text 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))))
tags-loop-operate `(perform-replace ',old-text ',new-text t nil nil
nil multi-query-replace-map))
(tags-loop-continue (or (cons 'list files) t))))
(if (version< emacs-version "27")
;; Adapted from `tags-query-replace' for literal strings (not regexp)
(progn
(setq tags-loop-scan `(let ,(unless (equal old-text (downcase old-text))
'((case-fold-search nil)))
(if (search-forward ',old-text 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))))
tags-loop-operate `(perform-replace ',old-text ',new-text t nil nil
nil multi-query-replace-map))
(tags-loop-continue (or (cons 'list files) t)))
(progn
(fileloop-initialize-replace old-text new-text files 'default)
(fileloop-continue)))))

;;;###autoload
(defun projectile-replace-regexp (&optional arg)
Expand Down

0 comments on commit 1ac84bf

Please sign in to comment.