Don't fail when syntax entry is missing for closing parens #2

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

purcell commented Jul 22, 2012

In the case of some buffers, e.g. *urlparse-temp*, there is no syntax entry for closing parens. When trying to enable autopair-global-mode with such buffers open, an error results due to autopair assuming there is such an entry. This commit prevents that error by binding 'autopair-skip-close-maybe only if such a syntax entry exists.

(This behavior was observed in Emacs 24.)

Don't fail when syntax entry is missing for closing parens
In the case of some buffers, e.g. `*urlparse-temp*`, there is no syntax entry for closing parens. When trying to enable `autopair-global-mode` with such buffers open, an error results due to autopair assuming there is such an entry. This commit prevents that error by binding 'autopair-skip-close-maybe only if such a syntax entry exists.

(This behavior was observed in Emacs 24.)
Owner

joaotavora commented Jul 22, 2012

Well spotted, and a protection is in order, but can I ask :-)

  • What is the purpose of having a syntax of "(" with no closing delimiter? Autopairing will probably fail a lot in this situation. Maybe the when could be moved one line higher up into the cond's condition...
  • Do you need even need autopair in *urlparse-temp*? I suspect not, but it's a global mode... Maybe some kind of deactivation in temp buffers should be default. But what heuristic to use? *scratch* look like a temp buffer but autopair is quite useful there. Perhaps this is a different issue already.
Contributor

purcell commented Jul 22, 2012

a) I don't know why the syntax table was like that in the temp buffer, which was simply in Fundamental Mode.

b) Autopair is certainly not needed in that buffer. I guess that you could skip enabling autopair if the syntax table appears broken. Also in read-only buffers, perhaps. I've wondered myself about how to make that judgement.

In the absence of good heuristics, this workaround is at least somewhat helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment