-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
Comments
t4sk3 ***@***.***> writes:
1. ( ) text/plain (*) text/html
Suggestion
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.
This could happen in multi match and normal matching but not in fuzzy
match which is not regexp based.
It is already possible like this:
(helm :sources (helm-build-sync-source "test"
:candidates '("Téléchargement" "Galàctica" "héros" "Cimaï" "Tête" "Crête")
:pattern-transformer (lambda (pattern)
(if (string-match " " pattern)
(cl-loop with split = (split-string pattern)
for pat in split
concat (concat (char-fold-to-regexp pat) " "))
(char-fold-to-regexp pattern))))
:buffer "*helm test*")
But I don't know yet how to provide it optionally at user level.
…--
Thierry
|
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))))))) |
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? |
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.) |
t4sk3 ***@***.***> writes:
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.)
Not possible for now, it is implemented only for sync sources,
helm-occur uses in buffer sources.
…--
Thierry
|
@t4sk3 Now implemented for in buffer sources and working with helm-occur but not commited yet, should come in soon. |
Now merged, for helm-occur you need |
Thanks a lot, @thierryvolpiatto for your work :) Since you implemented it for buffer sources, does this mean I could configure it for |
t4sk3 ***@***.***> writes:
Thanks a lot, @thierryvolpiatto for your work :)
Thanks.
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.
I will see if I can make something to enable it globally in helm-mode,
but it is tricky because there is so many parameters there that can make
fail helm e.g. ignore-diacritics vs fuzzy matching etc..., not speaking of the
eventual performance problem, though I have not measured the impact..
…--
Thierry
|
You can now use |
Thanks again :) One last thing: it doesn't seem to work with |
t4sk3 ***@***.***> writes:
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?
It works as soon as you enter a space e.g. "/home/you/ tel" will match
"/home/you/Téléchargement" but "/home/you/tel" will not until you enter
a space, this because helm-find-files is fuzzy matching by default, if
you disable fuzzy matching (see helm-ff-fuzzy-matching) it works in both cases
I didn't find a way to make it work in both worlds apart adding a match
function at the end:
(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))))))
As soon as I find something reliable i will add an extra user variable
to enable diacritics in HFF.
Thanks.
… —
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.*Message ID: ***@***.***>
--
Thierry
|
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
tochar-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.The text was updated successfully, but these errors were encountered: