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

Remove the Emacs Lisp specific escaping test. #4

Merged
merged 1 commit into from
Nov 5, 2014

Conversation

Fanael
Copy link
Owner

@Fanael Fanael commented Nov 5, 2014

In fact, nuke the infrastructure altogether.

Parens as characters without a backslash are nasty and they really should never be used:

  • This syntax is discouraged by the GNU Emacs Lisp Reference Manual.
  • They confuse many a minor mode, such as show-paren-mode.
  • The way we currently handle them partially solves the problem, but is a hack made of eldritch magic, implemented by gluing special cases together hoping they'll work...
  • ...but it doesn't really work, and it's pretty easy to get mishighlighted delimiters anyway.
  • They confuse the Emacs Lisp indentation engine. Really.
  • It's the major mode's job to set the syntax-table properties on individual characters.

Because of these reasons, it's just easier to drop this misfeature and rely on people to start using ?\( instead.

And because the whole point of rainbow-delimiters-escaped-char-predicate-list is to allow for this, nuke it too. It was never really a documented part of the API.


@purcell (and others who want this test still there): I'm sorry. I understand that you want it. But the current hack doesn't really work. Try deleting the backslash in this code:

(lorem '(?\[ ipsum))

(defun lorem (ipsum)
  (dolor)
  (sit amet))

The ) closing the list will be mismatched, and everything below and including the defun will have wrong depth.

If you want to have a truly working handling of unbackslashed parens as characters, you should probably try and contribute to the EVIL-ignore-blacklisted-delims-altogether branch. The approach used there has at least some chance of getting this right, for some values of "right".

Or, convince me that the broken mess used by rainbow-delimiters right now is better than a similarly broken non-mess. To be frank, I suggest you invest your time into making #1 mergable instead of trying to convince me, as it's much easier.

In fact, nuke the infrastructure altogether.

Parens as characters without a backslash are nasty and they really should
never be used:
 - This syntax is discouraged by the GNU Emacs Lisp Reference Manual.
 - They confuse many a minor mode, such as show-paren-mode.
 - The way we currently handle them partially solves the problem, but
   is a hack made of eldritch magic, implemented by gluing special cases
   together hoping they'll work...
 - ...but it doesn't really work, and it's pretty easy to get
   mishighlighted delimiters anyway.
 - They confuse the Emacs Lisp indentation engine. Really.
 - It's the major mode's job to set the syntax-table properties on
   individual characters.

Because of these reasons, it's just easier to drop this misfeature
and rely on people to start using ?\( instead.

And because the whole point of
rainbow-delimiters-escaped-char-predicate-list is to allow for this,
nuke it too. It was never *really* a documented part of the API.
@purcell
Copy link
Contributor

purcell commented Nov 5, 2014

I'm sorry. I understand that you want it.

Really not a problem for me. I'd rather the code be clean, maintainable and performant than slavishly try to handle every possible crazy edge case.

@Fanael Fanael merged commit bb38452 into master Nov 5, 2014
@Fanael Fanael deleted the remove-emacs-lisp-escaping-special-case branch November 5, 2014 19:35
@Fanael
Copy link
Owner Author

Fanael commented Nov 5, 2014

Yet a week ago you said:

I'm probably the wrong person to ask, because IIRC I was the one who complained about that special case not being handled. At this stage I guess I don't care too much, but it would be a shame if parens got wrongly highlighted as mismatched in a source file which contains ?) or ?(.

But I guess you changed your mind.

I'd rather the code be clean, maintainable and performant than slavishly try to handle every possible crazy edge case.

Anyway, it's not important now that this hack got nuked. I wonder how many hacks are left.

@purcell
Copy link
Contributor

purcell commented Nov 6, 2014

That's not a contradiction. You can read it as: it would be a shame if that case didn't work, but ultimately I place greater value on clean code than on keeping that case working. :-)

@Wilfred
Copy link

Wilfred commented Nov 9, 2014

@Fanael could this be fixed in Emacs itself? If so, what would need to change?

@Fanael
Copy link
Owner Author

Fanael commented Nov 9, 2014

I'm not the best person to ask this question, because I don't really know a lot about Emacs, but I imagine that

It's the major mode's job to set the syntax-table properties on individual characters.

is probably the easiest way to deal with this. It should be possible, and likely necessary, to implement this as a third-party minor mode, as an interim solution until it's fixed in Emacs itself, thanks to the amount of bureaucracy driving Emacs development.

@purcell
Copy link
Contributor

purcell commented Nov 9, 2014

It should be possible, and likely necessary, to implement this as a third-party minor mode, as an interim solution until it's fixed in Emacs itself, thanks to the amount of bureaucracy driving Emacs development.

You'd be surprised how quickly fixes can be put in place in the Emacs core thanks to the involvement of people like @dgutov in recent years. But yes, that still helps only users of Emacs HEAD until the next version gets released.

@Fanael
Copy link
Owner Author

Fanael commented Nov 9, 2014

You'd be surprised how quickly fixes can be put in place in the Emacs core thanks to the involvement of people like @dgutov in recent years.

Only if the fix is written by somebody who's already signed the CLA selling one's soul to Stallman. I haven't, so if I wanted to fix something, legalese alone would take a couple of months.

@dgutov
Copy link

dgutov commented Nov 9, 2014

Regarding patches, the first 15 lines are "free".

But you can submit a bug report instead though, right?

@Fanael
Copy link
Owner Author

Fanael commented Nov 9, 2014

But you can submit a bug report instead though, right?

Yes, and that's what I do: so far, I reported all Emacs bugs affecting me. All zero of them.

@purcell
Copy link
Contributor

purcell commented Nov 9, 2014

Hey @Wilfred, would you perhaps go ahead and M-x report-emacs-bug this?

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.

4 participants