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

Ignoring diacritics #2470

Open
t4sk3 opened this issue Dec 29, 2021 · 12 comments
Open

Ignoring diacritics #2470

t4sk3 opened this issue Dec 29, 2021 · 12 comments

Comments

@t4sk3
Copy link

t4sk3 commented Dec 29, 2021

In Emacs it's possible for isearch to ignore diacritics when searching (so for instance "galaxia" would match "galáxia"). This is achieved by setting search-default-mode to char-fold-to-regexp. This does not change the behavior of helm, though, and as far as I can see there is no option to set which would get helm to ignore diacritics. I think this would be a nice optional behavior to have.

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented Dec 30, 2021 via email

@thierryvolpiatto
Copy link
Member

It is not possible to enable this globally with a simple variable because there is too much matching methods in helm and other corner cases, e.g. buffers source use many match functions (on mode, dirs etc...) and adding this is actually complicated, but it can be set by sources when possible, here for example how to add this feature to helm-find-files:

(cl-defmethod helm-setup-user-source ((source helm-source-ffiles))
  (helm-aif (slot-value source 'match)
      (setf (slot-value source 'match)
            (append it
                    '((lambda (candidate)
                        (string-match (concat (helm-basedir helm-input)
                                              (char-fold-to-regexp
                                               (helm-basename helm-input)))
                                      candidate)))))))

@t4sk3
Copy link
Author

t4sk3 commented Jan 2, 2022

I see. Personally I only need this for helm-occur and for org-refile when I have enabled helm-mode. How would I go about for enabling this feature for those sources?

@t4sk3
Copy link
Author

t4sk3 commented May 9, 2022

Thanks for implementing support for this! Would it be possible to have an option to enable this for helm-occur, so that it would act like isearch-forward when search-default-mode is set to char-fold-to-regexp ? (I'm not familiar enough with helm to customize this myself.)

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented May 10, 2022 via email

@thierryvolpiatto
Copy link
Member

@t4sk3 Now implemented for in buffer sources and working with helm-occur but not commited yet, should come in soon.

@thierryvolpiatto
Copy link
Member

Now merged, for helm-occur you need (setq helm-occur-ignore-diacritics t).

@t4sk3
Copy link
Author

t4sk3 commented May 13, 2022

Thanks a lot, @thierryvolpiatto for your work :)

Since you implemented it for buffer sources, does this mean I could configure it for helm-mode-org-refile? Personally I don't mind having it on by default, so if it's easier to configure it globally for helm-mode (since I guess org-refile is nothing special for helm), then I would do that.

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented May 13, 2022 via email

@thierryvolpiatto
Copy link
Member

You can now use helm-mode-ignore-diacritics.

@t4sk3
Copy link
Author

t4sk3 commented May 30, 2022

Thanks again :)

One last thing: it doesn't seem to work with helm-find-files. Would it be possible to have an option to ignore diacritics for this command as well?

@thierryvolpiatto
Copy link
Member

thierryvolpiatto commented May 30, 2022 via email

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

No branches or pull requests

2 participants