Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evil-ex-make-pattern: Don't transform the word boundaries into vim-style #1591

Merged
merged 2 commits into from Apr 11, 2022

Conversation

twlz0ne
Copy link
Contributor

@twlz0ne twlz0ne commented Apr 2, 2022

If very magic is enabled, the "\\_<pattern\\_>" will be transformed into "\\_\\<pattern\\_\\>":

image

Minimal configuration to reproduce:

emacs -Q -L ~/repos/emacs-evil --eval "
  (progn
    (toggle-debug-on-error)
    (require 'evil)
    (setq evil-magic 'very-magic)
    (setq evil-ex-search-vim-style-regexp t)
    (evil-select-search-module 'evil-search-module 'evil-search)
    (evil-mode 1)
    (with-current-buffer \"*scratch*\"
      (erase-buffer)
      (insert \"foo bar\nfoo bar\nfoo bar\nfoo bar\nfoo bar\nfoo bar\n\")
      (insert \"\nReproduce: \n\n  Press / and RET to repeat the last search.\")
      (goto-char (point-min))
      (evil-ex-start-word-search nil 'forward 1 t)
      (evil-ex-nohighlight)))
  " -nw

@tomdl89
Copy link
Member

tomdl89 commented Apr 3, 2022

@twlz0ne thanks for the PR. I still get an (albeit different) error when I run your minimum repro after pulling your branch:

(search-failed "\\<foo\\>")

Am I missing something, or does need a little more work?

@twlz0ne
Copy link
Contributor Author

twlz0ne commented Apr 4, 2022

@tomdl89 Sorry for not doing enough testing within the minimal configuration. I will update the PR tomorrow or later.

@twlz0ne twlz0ne force-pushed the dont-transform-word-boundaries branch from 6fb3430 to 04ac63c Compare April 5, 2022 10:19
@twlz0ne
Copy link
Contributor Author

twlz0ne commented Apr 5, 2022

@tomdl89 Updated. Now it's working for "\\<pattern\\>".

@tomdl89 tomdl89 merged commit a6a6a83 into emacs-evil:master Apr 11, 2022
@tomdl89
Copy link
Member

tomdl89 commented May 17, 2023

@twlz0ne I reverted a part of this PR here: 6e22e2b
by removing the ? quantifier from the _ tokens, as it was breaking very-magic's ability to search for literal (escaped) < and > tokens. I realise I may have inadvertently broken something, so please let me know if so, and I can look at a more comprehensive fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants