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

Comment quote handling #13

Closed
Archenoth opened this issue Nov 8, 2012 · 28 comments
Closed

Comment quote handling #13

Archenoth opened this issue Nov 8, 2012 · 28 comments
Labels

Comments

@Archenoth
Copy link

Comments don't handle quotes correctly.

You can reproduce this bug by putting the following code into a web-mode buffer.

// It's just a comment
return 'cool';

web-mode thinks "return" is a string because of the "'" in the comment.

This only appears to affect things if the quote is closed before the page ends, so:

// It's just a comment
return 1+1;

This actually highlights correctly until you put a "'" somewhere.

@fxbois
Copy link
Owner

fxbois commented Nov 8, 2012

Hi Matthew
could you test the beta version please
http://web-mode.org/beta/web-mode.el

@Archenoth
Copy link
Author

Yep... Still a problem...

Try looking at the above code (First block) in the mode...

@fxbois
Copy link
Owner

fxbois commented Nov 23, 2012

solved in v3

@fxbois fxbois closed this as completed Nov 23, 2012
@almost
Copy link

almost commented Dec 6, 2012

This is still a problem in version 3.0. Not only does it not recognise comments, it stops every other mode from recognising comments and I have to restart Emacs!

@fxbois
Copy link
Owner

fxbois commented Dec 6, 2012

I ll look at it tonight.

Could you send me a screenshot please

@fxbois fxbois reopened this Dec 6, 2012
@fxbois
Copy link
Owner

fxbois commented Dec 6, 2012

Could you try the beta version available on http://web-mode.org/beta/web-mode.el

@almost
Copy link

almost commented Dec 6, 2012

Seems to to work! Thank you so much for that very very quick fix.

And thinks for writing and realising such a useful mode, much appreciated!

@fxbois
Copy link
Owner

fxbois commented Dec 6, 2012

You're welcome ... do not hesitate to share it ... I need more testers

@fxbois fxbois closed this as completed Dec 6, 2012
@almost
Copy link

almost commented Dec 7, 2012

The problem seems to have reoccurred and I'm not quite sure why or how. Here's a screenshot of the problem:

http://awesomescreenshot.com/0b7oxqo4e

It only happens when I have used web-mode, but it doesn't seem to happen always, or right away after use web-mode.

I'll let you know if I manage to find a repeatable way of producing it!

@fxbois
Copy link
Owner

fxbois commented Dec 7, 2012

Could you send me the code please. Moreover what language do you use ? Web-mode is designed for html embedding just little blocks of code

Le 7 déc. 2012 à 11:40, Thomas Parslow notifications@github.com a écrit :

The problem seems to have reoccurred and I'm not quite sure why or how. Here's a screenshot of the problem:

http://awesomescreenshot.com/0b7oxqo4e

It only happens when I have used web-mode, but it doesn't seem to happen always, or right away after use web-mode.

I'll let you know if I manage to find a repeatable way of producing it!


Reply to this email directly or view it on GitHub.

@almost
Copy link

almost commented Dec 7, 2012

The HTML I sent triggers it. But once it's triggered the comments show up
that way in all code files in all modes (or at least I've seen it happening
in CoffeeScript and Python) and only restarting emacs fixes it.

Thomas Parslow
Freelance Developer
Django, Python, Javascript and more!

http://almostobsolete.net
+44 (0) 7951261227
@AlmostObsolete

On 7 December 2012 10:56, fxbois notifications@github.com wrote:

Could you send me the code please. Moreover what language do you use ?
Web-mode is designed for html embedding just little blocks of code

François-Xavier Bois
Kernix
15 rue Cels 75014 PARIS
Tel. 01 53 98 73 43

Le 7 déc. 2012 à 11:40, Thomas Parslow notifications@github.com a écrit
:

The problem seems to have reoccurred and I'm not quite sure why or how.
Here's a screenshot of the problem:

http://awesomescreenshot.com/0b7oxqo4e

It only happens when I have used web-mode, but it doesn't seem to happen
always, or right away after use web-mode.

I'll let you know if I manage to find a repeatable way of producing it!


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-11126077.

@NateEag
Copy link
Contributor

NateEag commented Jan 15, 2013

I have a three-line test case that breaks comments in all modes when current tip of web-mode is activated.

{# Template for admin page. #}

{% extends 'pages/admin/base.html.tmpl' %}

When I open a file with those contents, any file I open after that will not highlight comments correctly. If I edit a file that was already open, comment highlighting will break on everything after the point I edited at.

I am running Aquamacs 2.4:

GNU Emacs 23.3.50.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
of 2011-10-25 on braeburn.aquamacs.org - Aquamacs Distribution 2.4

and I am loading web-mode this way (comment pertaining to attempts to make web-mode work in OS X's default command-line emacs):

;; The following are workarounds since web-mode expects Emacs >= 23, and OS X's
;; built-in Emacs is v. 22. Sadly, they are still not enough to quite make it   
;; work.                                                                        
(unless (fboundp 'prog-mode) (defalias 'prog-mode 'fundamental-mode))
(defun my-string-match-p (regexp string &optional start)
  "Same as `string-match' except this function does not change the match data."
  (let ((inhibit-changing-match-data t))
(string-match regexp string start)))

(when (not (fboundp 'string-match-p))
  (fset 'string-match-p (symbol-function 'my-string-match-p)))

;; Web mode.                                                                    
;; For editing web templates of various stripes.                                
(autoload 'web-mode "web-mode" "Web template editing mode")
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.tmpl\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))

@fxbois
Copy link
Owner

fxbois commented Jan 15, 2013

Hi Nate,
assuredly, this bug is really annoying ...
To be sure to reproduce it, can you give me an example of a file you load after.
Moreover, could create a very strimmed down version of your .emacs file in order to be sure that there is not a conflict with an other mode.
Thank you in advance

@fxbois fxbois reopened this Jan 15, 2013
@fxbois
Copy link
Owner

fxbois commented Jan 15, 2013

Hi Nate,
I am beginning to wonder if the bug is not related to the version of emacs.
(I have tested your file and can not reproduce the bug)

Could you try the last version available on http://emacsformacosx.com/

@fxbois
Copy link
Owner

fxbois commented Jan 15, 2013

@almost Hi, could tell me what version of emacs you used when the bug triggered ?

@NateEag
Copy link
Contributor

NateEag commented Jan 15, 2013

It looks like it might be version-related - the version on the site you linked seems to work as expected.

@johnjcamilleri
Copy link

I am having the exact same problem described here with GNU Emacs 23.4.1.
I strongly suspect that it is being caused by this line:
(unless (fboundp 'prog-mode) (defalias 'prog-mode 'fundamental-mode))
since without it everything works fine in other modes (but of course I am unable to use web-mode).

@almost
Copy link

almost commented Jan 16, 2013

I'm on GNU Emacs 23.3.1.

I'll upgrade later on today if I get a moment...

@NateEag
Copy link
Contributor

NateEag commented Jan 16, 2013

@johnjcamilleri That sounds very plausible. I don't have time to try this right now, but this post suggests implies that defining web-mode-prog-mode and using that in web-mode might work better.

@fxbois
Copy link
Owner

fxbois commented Jan 16, 2013

@johnjcamilleri @almost @Archenoth @NateEag I've added the defalias to web-mode.el
Could you try removing it from your .emacs and tell me if the bug occurs.
Thank you in advance

@johnjcamilleri
Copy link

Hmm I would say this seems to behave a little better, although now for some reason I don't seem to get any syntax highlighting for comments in Emacs-Lisp (.el) files. That's the only thing out of place I can find so far. This is the file I'm testing with, can someone else try this and confirm?

;; Color theme
(require 'color-theme)
(color-theme-initialize)

So if I load Emacs and open only this file, the comments get highlighted correctly. Then if I open a .php file (which triggers web-mode) and subsequently open my test.el file, the comments are no longer properly highlghted in the .el file, although they continue to work properly in the .php file.

@fxbois
Copy link
Owner

fxbois commented Jan 17, 2013

@johnjcamilleri if possible could you try this with emacs 24 and 23
With emacs 24 I've never been able to reproduce those behaviours.

@johnjcamilleri
Copy link

@fxbois The behaviour described above is GNU Emacs 23.4.1 on Ubuntu 12.10. I currently don't have access to Emacs 24, I'm not sure how to install it without overwriting my current Emacs installation...

@NateEag
Copy link
Contributor

NateEag commented Jan 18, 2013

Same issue in Emacs 23 after commenting my workaround and pulling down the newest version.

I also get the following error on loading web-mode:

File mode specification error: (invalid-function with-silent-modifications)

@fxbois
Copy link
Owner

fxbois commented Jan 18, 2013

@johnjcamilleri @NateEag a commit to take of the with-silent-modifications issue

Does it solve anything ?

@fxbois
Copy link
Owner

fxbois commented Jan 18, 2013

@Archenoth @almost @johnjcamilleri @NateEag I've installed emacs 23 and have detected that font-lock-keywords-only was the origin of the problem. Even made buffer-local, this var was spread on other buffers.

@johnjcamilleri
Copy link

Confirmed working in Emacs 23 — thank you so much @fxbois !

@NateEag
Copy link
Contributor

NateEag commented Jan 19, 2013

Working in Emacs 23 for me, too - thank you!

@fxbois fxbois closed this as completed Jan 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants