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: Glenn Morris
Subject: bug#16160: [PATCH] define-derived-mode clobbers syntax tables
Date: Mon, 12 Dec 2016 20:04:52 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

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 via email to

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