GNU bug report logs -
#8933
'js-mode' break single char comment highlighting from 'define-generic-mode'.
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8933 in the body.
You can then email your comments to 8933 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8933
; Package
emacs
.
(Fri, 24 Jun 2011 21:24:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Oleksandr Gavenko <gavenkoa <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 24 Jun 2011 21:24:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I use Emacs 23.3.
$ emacs -Q
Next eval:
(define-generic-mode my-mode
'(?\; ?#)
nil nil nil nil)
And open file with two or more lines:
; commented line (1)
wrongly highlighted line (2)
another wrongly highlighted line (3)
After 'M-x my-mode RET' line (1) highlighted as comment line.
Another line not.
Then open any .js file so js-mode loaded and back to 'my-mode'
file and revert it.
Now all line highlighted as comment lines!
Because of this I switch .js files to c++-mode (from my .emacs):
(setq auto-mode-alist (rassq-delete-all 'js-mode auto-mode-alist))
(add-to-list 'auto-mode-alist '("\\.js$" . c++-mode))
and move '(desktop-save-mode 1)' below this lines.
For C-like comments this bug not reproduced.
--
Best regards!
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#8933
; Package
emacs
.
(Mon, 27 Jun 2011 09:10:03 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Oleksandr Gavenko wrote:
> I use Emacs 23.3.
Also reproducible in Emacs 24.0.50
> $ emacs -Q
> Next eval:
> (define-generic-mode my-mode
> '(?\; ?#)
> nil nil nil nil)
> And open file with two or more lines:
> ; commented line (1)
> wrongly highlighted line (2)
> another wrongly highlighted line (3)
> After 'M-x my-mode RET' line (1) highlighted as comment line.
> Another line not.
> Then open any .js file so js-mode loaded and back to 'my-mode'
> file and revert it.
> Now all line highlighted as comment lines!
This is because js-mode stomps on the default value of
comment-start and comment-end (rather than using
make-local-variable). This confuses generic-mode.
Cheers,
Lawrence
Here's a commit-message plus patch.
js-mode: Don't stomp on comment-start/end's default value
* progmodes/js.el (js-mode): Ensure comment-start and comment-end
are local variables (Bug#8933).
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5bc756e..4b3a2ba 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-27 Lawrence Mitchell <wence <at> gmx.li>
+
+ * progmodes/js.el (js-mode): Ensure comment-start and comment-end
+ are local variables (Bug#8933).
+
2011-06-22 Lawrence Mitchell <wence <at> gmx.li>
* net/browse-url.el (browse-url-xdg-open): Use 0, rather than nil
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index a0437cc..1bdcb4c 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3306,8 +3306,8 @@ If one hasn't been set, or if it's stale, prompt for a new one."
#'js--which-func-joiner)
;; Comments
- (setq comment-start "// ")
- (setq comment-end "")
+ (set (make-local-variable 'comment-start) "// ")
+ (set (make-local-variable 'comment-end) "")
(set (make-local-variable 'fill-paragraph-function)
'js-c-fill-paragraph)
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Thu, 30 Jun 2011 16:24:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Oleksandr Gavenko <gavenkoa <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 30 Jun 2011 16:24:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 8933-done <at> debbugs.gnu.org (full text, mbox):
> This is because js-mode stomps on the default value of
> comment-start and comment-end (rather than using
> make-local-variable). This confuses generic-mode.
Thanks, installed,
Stefan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 29 Jul 2011 11:24:04 GMT)
Full text and
rfc822 format available.
Changed bug submitter to 'Wolfgang Scherer <wrscherer <at> googlemail.com>' from 'Oleksandr Gavenko <gavenkoa <at> gmail.com>'
Request was from
Wolfgang Scherer <wrscherer <at> googlemail.com>
to
control <at> debbugs.gnu.org
.
(Thu, 05 Jan 2012 17:52:02 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 years and 249 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.