bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16160: [PATCH] define-derived-mode clobbers syntax tables


From: Daniel Colascione
Subject: bug#16160: [PATCH] define-derived-mode clobbers syntax tables
Date: Mon, 16 Dec 2013 03:12:43 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

Repro:

1) Visit shell script with comments. See comments fontified properly.
2) M-x find-library sh-script RET
3) M-x eval-buffer
4) Return to shell script buffer
5) C-x C-v RET
6) Observe that comments are no longer fontified as comments.

The define-derived-mode macro in sh-script.el emits code that clobbers sh-mode-syntax-table because we don't have a :syntax-table argument. I think the following patch changes the code to the expected behavior.

~/edev/trunk
$ bzr diff
=== modified file 'lisp/emacs-lisp/derived.el'
--- lisp/emacs-lisp/derived.el  2013-05-27 16:12:52 +0000
+++ lisp/emacs-lisp/derived.el  2013-12-16 11:09:41 +0000
@@ -206,11 +206,11 @@
        ,(if declare-syntax
            `(progn
               (unless (boundp ',syntax)
-                (put ',syntax 'definition-name ',child))
-              (defvar ,syntax (make-syntax-table))
-              (unless (get ',syntax 'variable-documentation)
-                (put ',syntax 'variable-documentation
-                     (purecopy ,(format "Syntax table for `%s'." child))))))
+                (put ',syntax 'definition-name ',child)
+                 (defvar ,syntax (make-syntax-table))
+                 (unless (get ',syntax 'variable-documentation)
+                   (put ',syntax 'variable-documentation
+ (purecopy ,(format "Syntax table for `%s'." child)))))))
        ,(if declare-abbrev
            `(progn
               (put ',abbrev 'definition-name ',child)


That is, we shouldn't touch the syntax table variable at all unless the variable is unbound.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]