joaotavora / autopair

Automagically pair braces and quotes in emacs like TextMate
208 stars 35 forks source link

Error inside HTML tag of nXML mode #3

Closed demon386 closed 12 years ago

demon386 commented 12 years ago

In nXML mode <link rel="stylesheet" href="url" type="text/css" media={put cursor here, press "} />

it shows

autopair-insert-or-skip-quote: Wrong type argument: integer-or-marker-p, nil

joaotavora commented 12 years ago

Can't reproduce. Can you provide a recipe that triggers this bug starting from something like

emacs -Q -l autopair.el -e autopair-global-mode

? It would also be good to know the exact emacs version you are using.

demon386 commented 12 years ago

Sorry. I forgot to format my code and it disappeared.

In nXML mode

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang=<cursor>>

Put the cursor in the position, and type " (double quote). The bug appears.

I'm using Emacs 24.1 in Mac.

joaotavora commented 12 years ago

You still didn't state if you reproduced from an "Emacs -Q" run, which I doubt, since the problem is irreproducible on such "vanilla" emacs, and you must have some customization. However after doing:

(modify-syntax-entry ?\" "\"" nxml-mode-syntax-table)

I was able to reproduce it and fix it. So try it out and report back here if it works.

demon386 commented 12 years ago

Using Emacs -Q would solve the problem, but then pressing " (double quote) would only generate one, instead of a pair of it.

After a while I figured out the problem has something to do with the version of my nxml-mode. My configuration is based on Purcell and the nxml-mode version he uses is https://github.com/purcell/emacs.d/tree/master/site-lisp/nxml-mode

Still don't know how to resolve the conflict. But deleting it and use the Emacs' inherent nxml-mode would make the error disappear, at least.

joaotavora commented 12 years ago

Let me clarify. I asked you to use emacs -Q to figure out if this is was problem specific to your configuration or to autopair.el, which, as all extensions, is mostly designed to work on an uncustomized Emacs. Only after trial-and-error did I find out it is is specific to your custom configuration, but I had to guess it. I mean, you could have provided the above information earlier in the process.

But again you didn't read my message :-). After analysis, I have decided that your custom configuration is reasonable enough to make autopair adapt to it, at least partially, so I did make a fix in autopair, try out the master branch or commit 9ec0ded.

demon386 commented 12 years ago

Thanks.

I understood your point. The problem is on my customization since autopair works well with default Emacs.

I tried the new patch, which totally solved the problem in my customization.