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
(a) smartscan-symbol-go-forward and smartscan-symbol-go-backward cut these lines (or rather, their respective contents) into equivalence classes. 1 and 2 are considered equivalent by default, the others form singletons. If I want to have line 1 and 2 considered as not identical, I can employ something like
(defadvicesmartscan-symbol-go-forward (around smartscan activate)
"Match in a case-sensitive way."
(let ((case-fold-searchnil))
ad-do-it))
(defadvicesmartscan-symbol-go-backward (around smartscan activate)
"Match in a case-sensitive way."
(let ((case-fold-searchnil))
ad-do-it))
Is there a simpler way?
(b) smartscan-symbol-replace when called on line 1 or 2 will also replace matches in line 3-5. Why?
Here's a fix:
(defunsmartscan-symbol-replace (arg)
"Replaces the symbol at point with another string in the entire buffer. With C-u the scope is limited to the current defun, as defined by `narrow-to-defun'. This function uses `search-forward' and `replace-match' to do the actual work."
(interactive"P")
(save-excursion
(let* ((oldsymbol (smartscan-symbol-at-pt 'beginning))
(newsymbol (query-replace-read-to
oldsymbol (format"%sSmart Scan replace"
(if arg "[Defun] """)) nil))
(counter 0))
(if arg (goto-char (save-excursion (beginning-of-defun) (point)))
;; go to the beginning of the buffer as it's assumed you want to ;; apply it from there onwards. beginning
(goto-char (point-min)))
(while (re-search-forward
(concat"\\_<" oldsymbol "\\_>")
(if arg (save-excursion (end-of-defun) (point)) nil) tnil)
(replace-match newsymbol nilt) (cl-incf counter 1))
(message"Smart Scan replaced %d matches" counter))))
(c) Setting smartscan-use-extended-syntax should affect the behaviour described in (a) and (b), no? [what exactly should it do?]. It doesn't seem to have any effect for me.
The text was updated successfully, but these errors were encountered:
Consider the following "input" with line numbers.
I observe the following.
(a)
smartscan-symbol-go-forward
andsmartscan-symbol-go-backward
cut these lines (or rather, their respective contents) into equivalence classes. 1 and 2 are considered equivalent by default, the others form singletons. If I want to have line 1 and 2 considered as not identical, I can employ something likeIs there a simpler way?
(b)
smartscan-symbol-replace
when called on line 1 or 2 will also replace matches in line 3-5. Why?Here's a fix:
(c) Setting
smartscan-use-extended-syntax
should affect the behaviour described in (a) and (b), no? [what exactly should it do?]. It doesn't seem to have any effect for me.The text was updated successfully, but these errors were encountered: