unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16160: [PATCH] define-derived-mode clobbers syntax tables
@ 2013-12-16 11:12 Daniel Colascione
  2013-12-16 19:17 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Colascione @ 2013-12-16 11:12 UTC (permalink / raw)
  To: 16160

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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-12-13  1:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-16 11:12 bug#16160: [PATCH] define-derived-mode clobbers syntax tables Daniel Colascione
2013-12-16 19:17 ` Stefan Monnier
2013-12-17  2:17   ` Daniel Colascione
2013-12-17  2:36     ` Stefan Monnier
2013-12-20 21:45     ` Daniel Colascione
2016-03-01  2:05       ` Lars Ingebrigtsen
2016-12-13  1:04         ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).