unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: 16160@debbugs.gnu.org
Subject: bug#16160: [PATCH] define-derived-mode clobbers syntax tables
Date: Mon, 16 Dec 2013 03:12:43 -0800	[thread overview]
Message-ID: <52AEE02B.8060309@dancol.org> (raw)

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	other threads:[~2013-12-16 11:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 11:12 Daniel Colascione [this message]
2013-12-16 19:17 ` bug#16160: [PATCH] define-derived-mode clobbers syntax tables 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52AEE02B.8060309@dancol.org \
    --to=dancol@dancol.org \
    --cc=16160@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).