unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: 16160-done@debbugs.gnu.org
Subject: bug#16160: [PATCH] define-derived-mode clobbers syntax tables
Date: Mon, 12 Dec 2016 20:04:52 -0500	[thread overview]
Message-ID: <58eg1cbpvv.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87oaaz2bs6.fsf@gnus.org> (Lars Ingebrigtsen's message of "Tue, 01 Mar 2016 13:05:13 +1100")

Version: 26.1

>> The repro steps are incorrect. Try these:
>>
>> 1) emacs -Q
>> 2) visit a shell script
>> 3) M-x find-library sh-script RET
>> 4) C-s define-derived-mode RET
>> 5) C-M-x
>> 6) switch to your shell script buffer
>> 7) C-x C-v
>> 8) Observe that the shell script is fontified incorrectly; the syntax
>> table is now clobbered.

Fixed in 8db7b65 along the suggested lines.

So AIUI the issue is that define-derived-mode expands to 

(defvar ,syntax (make-syntax-table))

Normally this has no effect if ,syntax is already bound.
But M-x eval-defun resets defvars to their default settings...
Hence if you selectively re-evaluate only the mode definition from
sh-script.el, you get the reported problem.

So I changed it to explicitly check if ,syntax is bound.

This will however now make things go wrong in the opposite way for
someone who has been playing around with customizing a syntax table that
was actually defined by define-derived-mode and wants to reset it by
re-evaluating the derived mode definition. But AFAICS there's no way to
fix both scenarios, and the second seems less likely (?) to me than the
one reported here.





      reply	other threads:[~2016-12-13  1:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=58eg1cbpvv.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=16160-done@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).