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

Include - in punctuation syntax class #307

Merged
merged 1 commit into from
Jun 1, 2016

Conversation

aaronjensen
Copy link
Contributor

- is subtraction in elixir, not part of a symbol, though I may be missing something.

@gausby
Copy link
Contributor

gausby commented May 16, 2016

I guess - is a special form. I don't know if that count for anything.

@aaronjensen
Copy link
Contributor Author

I'd say no, it's an operator first imo. Specifically it should not consider a-b to be a single symbol. It is two symbols separated by an operator.

@gausby
Copy link
Contributor

gausby commented May 17, 2016

I might be a schoolboy here, but what is the benefits to adding minus to the syntax table? I notice that other infix characters are not there, such as multiply, division, plus, etc.

@aaronjensen aaronjensen changed the title Include - in operator syntax class Include - in punctuation syntax class May 17, 2016
@aaronjensen
Copy link
Contributor Author

@gausby they're all in the syntax table and they're categorized as punctuation, like what I moved - to:

help 2016-05-17 07-42-17

From the docs:

Syntax class: symbol constituent

Symbol constituents (designated with _') are the extra characters that are used in variable and command names along with word constituents. For example, the symbol constituents class is used in Lisp mode to indicate that certain characters may be part of symbol names even though they are not part of English words. These characters are$&*+-<>'. In standard C, the only non-word-constituent character that is valid in symbols is underscore (`').

Syntax class: punctuation character

Punctuation characters (`.') are those characters that are used as punctuation in English, or are used in some way in a programming language to separate symbols from one another. Most programming language modes, including Emacs Lisp mode, have no characters in this class since the few characters that are not symbol or word constituents all have other uses.

For a practical reason, this is kill-sexp with - as a symbol:

symbol

And as punctuation:

punctuation

It would also apply to searching for a symbol under the point. In short, there's no actual reason I can come up with that - would be marked as a symbol other than forgetting to override it from the default syntax table.

@gausby
Copy link
Contributor

gausby commented May 17, 2016

Okay. Thanks for the explanation. I agree that it would be awesome.

On my machine (running the latest master of elixir-mode) I get the same behaviour for +, -, *, and / when running kill-sexp; I do think they are all symbols. Could be something with my setup…anyways, it seems that there are some issues with the unit tests after applying this change.

@aaronjensen
Copy link
Contributor Author

@gausby ah, indeed, I think I was looking at the syntax table for ruby at the time. I updated the pull request to include all of those operators. I'm not sure about the unit tests, I'll see if they pass this time.

@aaronjensen
Copy link
Contributor Author

Looks like the tests are still failing which is rather surprising. I'll see if I can get the tests running and figure out what's going on when i get a chance.

@aaronjensen
Copy link
Contributor Author

@gausby I saw some conversation on #emacs-elixir, are these failures just intermittent ones or are they actual failures?

@gausby
Copy link
Contributor

gausby commented May 24, 2016

@aaronjensen it seems that they are actual errors: https://travis-ci.org/elixir-lang/emacs-elixir/jobs/130900904

@aaronjensen
Copy link
Contributor Author

@gausby I was missing < and >, so it treated <- incorrectly I believe. All good now.

@tonini
Copy link
Contributor

tonini commented Jun 1, 2016

@aaronjensen great! thanks a lot guys 💛 💙 💚

@tonini tonini merged commit fe313d3 into elixir-editors:master Jun 1, 2016
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.

3 participants