From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#16160: [PATCH] define-derived-mode clobbers syntax tables Date: Mon, 16 Dec 2013 03:12:43 -0800 Message-ID: <52AEE02B.8060309@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1387192458 28118 80.91.229.3 (16 Dec 2013 11:14:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Dec 2013 11:14:18 +0000 (UTC) To: 16160@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 16 12:14:24 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VsW7w-0007y3-U6 for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Dec 2013 12:14:21 +0100 Original-Received: from localhost ([::1]:55521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsW7w-0007wn-FZ for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Dec 2013 06:14:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsW7l-0007w1-03 for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 06:14:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsW7e-0000Sv-Qa for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 06:14:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsW7e-0000Sr-Nc for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 06:14:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VsW7e-0000tO-FA for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 06:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Dec 2013 11:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16160 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.13871924293398 (code B ref -1); Mon, 16 Dec 2013 11:14:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Dec 2013 11:13:49 +0000 Original-Received: from localhost ([127.0.0.1]:53062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsW7Q-0000sk-UZ for submit@debbugs.gnu.org; Mon, 16 Dec 2013 06:13:49 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35604) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VsW7P-0000sc-2m for submit@debbugs.gnu.org; Mon, 16 Dec 2013 06:13:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsW7I-0000RK-Nw for submit@debbugs.gnu.org; Mon, 16 Dec 2013 06:13:46 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:41663) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsW7I-0000RG-Kn for submit@debbugs.gnu.org; Mon, 16 Dec 2013 06:13:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsW7C-0007sX-Fs for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 06:13:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsW76-0000Pi-Av for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 06:13:34 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:46672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsW75-0000PX-Q4 for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 06:13:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:Subject:To:MIME-Version:From:Date:Message-ID; bh=vFIfUkEwuR6T3twe4JygH3Z5yQMdl8CWNT0FniqopT4=; b=cPgSazUK6h8EjcjBPBhEJ6rfwijsVrdSVKl1umEgof5LU0uEPlDgJgYQPf1ALgvg3NkkvUE7zgxox0+rV+ic//OABebiPJhCAsASrHEwfDPopL7JjFbQrz/5e+VKej1rGyQ/Ci5Mm+Zm5+P5Bb/Ru3z9n8bf+aPfY6d75GaKWX1jt01/MBKbfn7cMql8xp0dGlGIhAHrJLWKY41g3q0TqXu6D62hu4iUJlOJq5ng5y+RZ578YjwY/VWm3Kv8z052yU56cccSsrL/CXO9FkCNemUdqqBY/AIf/px0p0xNpnwUTqYYMOvN10fn0SZvIdCzxa5TKQ1QCUACSj9R4ku/ZA==; Original-Received: from [173.252.71.189] (helo=[172.20.16.114]) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1VsW75-0003zK-5t for bug-gnu-emacs@gnu.org; Mon, 16 Dec 2013 03:13:27 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82052 Archived-At: 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.