You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I place the cursor on the xy variable, then smartscan-symbol-go-forward correctly jumps between the two instances and correctly skips the function xy2 and the variable xyz. However, if I use smartscan-symbol-replace and set it to xyWRONG, then I get:
Here is a solution that is global ---it does not narrow to defun-s and so it may not be ideal for your use case. This is related to issue #10.
(defun my/symbol-replace (replacement)
"Replace all standalone symbols in the buffer matching the one at point."
(interactive (list (read-from-minibuffer "Replacement for thing at point: " nil)))
(save-excursion
(let ((symbol (or (thing-at-point 'symbol) (error "No symbol at point!"))))
(beginning-of-buffer)
;; (query-replace-regexp symbol replacement)
(replace-regexp (format "\\b%s\\b" (regexp-quote symbol)) replacement))))
(global-set-key (kbd "M-'") 'my/symbol-replace))
Sample source code (R-language):
If I place the cursor on the
xy
variable, thensmartscan-symbol-go-forward
correctly jumps between the two instances and correctly skips the functionxy2
and the variablexyz
. However, if I usesmartscan-symbol-replace
and set it toxyWRONG
, then I get:Expected output:
The text was updated successfully, but these errors were encountered: