Git Product home page Git Product logo

smart-scan's People

Contributors

bmalehorn avatar epipping avatar jpkotta avatar mickeynp avatar nilsfagerburg avatar purcell avatar swsnr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

smart-scan's Issues

Case is ignored when case-fold-search is t

Ideally, smartscan would know which languages have case insensitive symbols (like Common Lisp) and know when to ignore case and when to be case sensitive. However, this is probably more trouble than it is worth since symbols are almost always written with the same cases anyway.

An easy fix that seems good enough is to simply wrap the calls to search-forward, re-search-forward and re-search-backward in smartscan-symbol-replace and smartscan-symbol-goto with a

(let ((case-fold-search nil))
  ...)

over-zealous replacement

Sample source code (R-language):

sample_func <- function(...) {
  xy <- xy2(123)
  xyz
  xy
}

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:

sample_func <- function(...) {
  xyWRONG <- xyWRONG2(123)
  xyWRONGz
  xyWRONG
}

Expected output:

sample_func <- function(...) {
  xyWRONG <- xy2(123)
  xyz
  xyWRONG
}

Repository name does not match provides identifier

Hello, Micky.

The name of this repository, "smart-scan", does not match the name of the .el file or the provides identifier in that file. I propose changing the name of the repository to "smartscan" to make it more consistent.

Regards,
Ryan Mulligan

smart scan replacement feature

Feature request for a command that is a combination of cua-repeat-replace-region (M-v) from CUA mode and smartscan-symbol-go-forward (M-n) from smart-scan.

When one uses cua-repeat-replace-region to replace hello with hi, it ends up replacing hello in ohello or helloo as well. On the other hand, the new command should replace just those parts that smart-scan would get to.

At the conservative side, one could provide a command not bound to any key by default that works only when CUA mode is enabled. At the forcing side, the command may be bound to a key in smart-scan mode map by default, depending on a user option.

Allow turning smartscan to run in all modes save some.

Currently, global-smartscan-mode works in all buffers save the minibuffer.

I find that smartscan is not helpful in shell or eshell-modes. I'm sure there are other modes where it would be useful to turn off smartscan. It would be nice to be able to configure something like

(setq smartscan-ignore-modes '(eshell-mode shell-mode)) and have global-smartscan-mode respect that.

Alternatively, you could also have a function that could be hooked in, e.g. turn-off-smartscan or the like.

smart-scan and PHP symbols

Hi there!

I've tried out smart-scan in a PHP mode buffer, changing a symbol inside a function with C-U M-', where symbol under point was $msg, and changed it to $mesg.

But the function also had variables like $error_msg. This ones were changed to $error_mesg.

It seems that smart-scan does not take into account the "$" character as part of the symbol.

Is there a way to configure smart-scan to consider the whole PHP variable as the symbol?

Thank you very much.

inconsistencies among `go-*` and `replace`

Consider the following "input" with line numbers.

1 xxxxxx
2 xxXXxx
3 xxxxxx_bar
4 xxxxxx-bar
5 axxxxxxb

I observe the following.

(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

(defadvice smartscan-symbol-go-forward (around smartscan activate)
  "Match in a case-sensitive way."
  (let ((case-fold-search nil))
    ad-do-it))

(defadvice smartscan-symbol-go-backward (around smartscan activate)
  "Match in a case-sensitive way."
  (let ((case-fold-search nil))
    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:

(defun smartscan-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) t nil)
          (replace-match newsymbol nil t) (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.

Smart-scan does not ignore comments

Hello,

Judging from these lines in the package, smart-scan should jump over occurrences of the symbol/word in strings or comments. It works for strings, but not for comments.

Steps to reproduce:

  1. Enter the *scratch* buffer

  2. Enter the following

    test
    ;; test
    "test"
    ;; test
    test
    
  3. Place point on the first test

  4. Press M-n

As I understand it, point should jump to the last test, instead it jumps to the second and fourth before fifth.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.