susam / devil

Emacs minor mode that intercepts and translates keystrokes to provide a modifier-free non-modal editing experience
https://susam.github.io/devil/
Other
169 stars 10 forks source link

Cannot search for "," using isearch #7

Closed morganwillcock closed 1 year ago

morganwillcock commented 1 year ago

Given the following buffer contents:

x = (1, 2)

...it doesn't seem possible to use isearch and match the "," in the expression, since the "," character is inserted into the buffer rather than added to the search string.

  1. , s initiates isearch
  2. (1 adds "(1" to the search string
  3. , displays devil-mode prompt "Devil: C-"
  4. , inserts "," into the buffer at point instead of adding "," to the search string

Testing with version 0.4.0 and the default global setup:

(require 'devil)
(global-devil-mode)
susam commented 1 year ago

Thank you for reporting this issue. The behaviour of , in isearch has changed in the latest release available on MELPA, however it still does not fix this issue. In the latest version, typing , , in isearch simply exits isearch which is still broken behaviour.

This issue affects me as well. I use the key sequence , q , to insert a comma in Isearch. It works because , q , is translated to C-q , which inserts a literal comma. It is not convenient but serves as a workaround for this issue.

The way isearch processes input is quite complex. It sets up several hooks, rebinds too many keys, etc. and that interferes with how Devil executes special keys like , ,. Or perhaps, the more accurate thing to say would be that Devil interferes with isearch and fails to work correctly. I have been studying the isearch code in my spare time to understand all the surprises hidden away in isearch and figure out how to get a Devil special key executed without interfering with isearch.

I have a few competing solutions in mind and have to test them out in my day-to-day Emacs usage. It will take me a while to release a fix for this but I am working on it. Until then , q , could serve as an inconvenient but effective workaround.

morganwillcock commented 1 year ago

Thank you for trying to find a solution.

I've just re-installed the package using commit https://github.com/susam/devil/commit/e9d2024b695b14a318f74f08774548292021fb69 to test your solution and the issue seems to be fixed. I'll let you know if I notice any problems.

susam commented 1 year ago

The fix discussed in this thread is now available in version 0.5.0.