Skip to content

Commit a2f90ae

Browse files
committed
Automatically regexp-quote aliases in rename-ns-alias
This allows for renaming ns aliases with special regex chars like . and *, without having to quote them
1 parent 64ed043 commit a2f90ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clojure-mode.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,16 +2687,16 @@ lists up."
26872687
(defun clojure--rename-ns-alias-internal (current-alias new-alias)
26882688
"Rename a namespace alias CURRENT-ALIAS to NEW-ALIAS."
26892689
(clojure--find-ns-in-direction 'backward)
2690-
(let ((rgx (concat ":as +" current-alias))
2690+
(let ((rgx (concat ":as +" (regexp-quote current-alias)))
26912691
(bound (save-excursion (forward-list 1) (point))))
26922692
(when (search-forward-regexp rgx bound t)
26932693
(replace-match (concat ":as " new-alias))
26942694
(save-excursion
2695-
(while (re-search-forward (concat current-alias "/") nil t)
2695+
(while (re-search-forward (concat (regexp-quote current-alias) "/") nil t)
26962696
(when (not (nth 3 (syntax-ppss)))
26972697
(replace-match (concat new-alias "/")))))
26982698
(save-excursion
2699-
(while (re-search-forward (concat "#::" current-alias "{") nil t)
2699+
(while (re-search-forward (concat "#::" (regexp-quote current-alias) "{") nil t)
27002700
(replace-match (concat "#::" new-alias "{"))))
27012701
(message "Successfully renamed alias '%s' to '%s'" current-alias new-alias))))
27022702

0 commit comments

Comments
 (0)