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

Auto-replace with backslash doesn't work #92

Open
choco-latin opened this issue Nov 7, 2024 · 2 comments
Open

Auto-replace with backslash doesn't work #92

choco-latin opened this issue Nov 7, 2024 · 2 comments

Comments

@choco-latin
Copy link

Hello,

I discovered your project and tried to import my scripts from windows to Linux.

One of my main uses for AHK are replacement for macros when typing latex. Most of the lines in my scripts look like:

:*:\aa::\alpha

When trying this with AHK_X11 it does not work. Clearly it is unhappy with the backslash in the abbreviation. I couldn't find any info in the documentation about backslashes being not supported, and it does work with AHK on windows.

Is there anything I can do (like escaping the character? I was not successful) about it? Or is it a limitation?

Thanks!

@phil294
Copy link
Owner

phil294 commented Nov 8, 2024

Hi! That's because \ is part of the default hotstring end chars https://phil294.github.io/AHK_X11/#h_Hotstring.htm.

If you include this in your script

#Hotstring EndChars -()[]{}':;"/,.?!`n `t`r

you'll essentially be removing the backslash from it and your snippet will work.

Very interesting that it worked on Windows though, as on there, the same default set of EndChars includes the backslash: https://www.autohotkey.com/docs/v1/Hotstrings.htm#EndChars
So I assume that when the string includes some of the end chars, they affect the overall global end chars directive?! Unsure how this is supposed to work exactly. Maybe someone else has an idea. But either way, ahkx11 should work the same way as win ahkv1.x works, so I'll leave this issue open.

@choco-latin
Copy link
Author

choco-latin commented Nov 8, 2024

Thanks for your answer!

Now to answer to your comment on AHK on windows: my scripts actually contain the following lines

#Hotstring EndChars `n `t
#Hotstring c

which I honestly have no memory why they are there, but from your previous message I understand that they helped me among other things to define shortcuts containing backslash, brackets etc... So the bug was between the chair and the screen here!

EDIT: actually I tried what you proposed with a script containing the following lines and ... it does not work?

#Hotstring EndChars -()[]{}':;"/,.?!`n `t`r

:*:\aa::\alpha

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