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

Allow colon : for symbols in binding of evil-ex-grammar #1121

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Alexander-Shukaev
Copy link
Contributor

No description provided.

@Alexander-Shukaev
Copy link
Contributor Author

Just a friendly ping to merge this change.

@TheBB
Copy link
Member

TheBB commented Nov 19, 2019

Sorry for the delay. Is there an example ex command where this is needed?

@Alexander-Shukaev
Copy link
Contributor Author

I defined a number of custom ex commands for myself, which begin with :, so that I can quickly type ::command as evil-ex is itself :.

@TheBB
Copy link
Member

TheBB commented Dec 19, 2019

But if you define them yourself then you can choose different names. The ex parser is somewhat fragile and I'm reluctant to change it just for that.

I tried adding a test for this and as you can see it fails to parse properly. If you experience differently I'd like to see the command(s) you've added.

@TheBB
Copy link
Member

TheBB commented Dec 19, 2019

I guess it's the colon in the first branch of the regexp that's greedily matching just the first colon of :command.

@Alexander-Shukaev
Copy link
Contributor Author

Apologies, I think you misunderstood that I meant custom ex commands (i.e. defined with evil-ex-define-cmd), not the regular Emacs interactive functions. In this case, the test should be against (evil-ex-parse-command ":command").

@TheBB
Copy link
Member

TheBB commented Dec 19, 2019

It still doesn't work as expected.

ELISP> (defun :command () (interactive))
:command
ELISP> (evil-ex-parse-command ":command")
(":" . "command")

ELISP> (defun command () (interactive))
command
ELISP> (evil-ex-parse-command "command")
("command" . "")

ELISP> (defun comm:and () (interactive))
comm:and
ELISP> (evil-ex-parse-command "comm:and")
("comm:and" . "")

Do you see other behaviour?

@Alexander-Shukaev
Copy link
Contributor Author

Once again, you have to use evil-ex-define-cmd rather than plain interactive function.

@TheBB
Copy link
Member

TheBB commented Dec 19, 2019

Sorry. I misunderstood in which direction I was supposed to have misunderstood. Then my original comment stands: you can substitute the defuns with evil-ex-define-cmd in my previous comment and the behaviour is identical.

@Alexander-Shukaev
Copy link
Contributor Author

I get

ELISP> (evil-ex-parse-command ":command")
(":command" . "")

@TheBB
Copy link
Member

TheBB commented Dec 19, 2019

Okay. I rebased this branch on top of master, which also has #1203, so maybe that interferes (if you haven't updated the PR branch since). If not then I'm not sure why the difference.

@Alexander-Shukaev
Copy link
Contributor Author

Right, since I was rather customizing the variable, I had the following

 (binding "[[:alpha:]-:]+\\|[~&*@<>=:]+\\|[[:alpha:]-]+\\|!")

which works but is not what we want to release of course. Sorry.

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