wolray / symbol-overlay

Highlight symbols with keymap-enabled overlays
346 stars 42 forks source link

`symbol-overlay-rename` initial input introduce extra slash if symbol has Regexp special chars #48

Closed cireu closed 5 years ago

cireu commented 5 years ago
  1. Load symbol-overlay.el in emacs -Q
  2. type test*t? in scratch buffer
  3. run symbol-overlay-put and symbol-overlay-rename
  4. Expect initial input test*t? but get test\*t\?

Plugin ver: https://github.com/wolray/symbol-overlay/commit/ff16ccf472507ef4a4d8303e79bb12bf25345714 Emacs ver: 26

purcell commented 5 years ago

Yes, this is currently pervasive in the code: the symbols are currently handled internally as a regexp, so lots of places in the code perform (substring symbol 3 -3) to make a displayable version of them. What's needed IMO is for symbol-overlay-get-symbol to return the raw symbol, and for regexp-quote-ing to happen as-needed, or for symbol-overlay-get-symbol to return a structure that contains both the symbol string and the regexp for it. This feels like a risky change to make.

cireu commented 5 years ago

the symbols are currently handled internally as a regexp, so lots of places in the code perform (substring symbol 3 -3) to make a displayable version of them.

What about a new function like symbol-overlay-get-symbol-raw to return the raw symbol for a quick fix?

This feels like a risky change to make

My opinion is make symbol-overlay-get-symbol return a cons (RAW . REGEXP). But I don't think it's neccesary to hurry to it.