From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Set variable in derived mode before running the parent mode function Date: Thu, 04 Jun 2015 17:55:14 -0400 Organization: A noiseless patient Spider Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1433455248 20073 80.91.229.3 (4 Jun 2015 22:00:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Jun 2015 22:00:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 05 00:00:48 2015 Return-path: Envelope-to: geh-help-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 1Z0dBe-0008DL-Hw for geh-help-gnu-emacs@m.gmane.org; Fri, 05 Jun 2015 00:00:30 +0200 Original-Received: from localhost ([::1]:44259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0dBd-0003B8-DX for geh-help-gnu-emacs@m.gmane.org; Thu, 04 Jun 2015 18:00:29 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!feeder1-2.proxad.net!137.226.75.22.MISMATCH!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 21 Injection-Info: mx02.eternal-september.org; posting-host="7d373ed72892ee578c208d3ba2c61e92"; logging-data="24861"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/aMwycNJqsJ6S+usfBYVcv" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:Lz4U/+bxRXE88MB9P0ZYP5mOR20= sha1:ZHlpkLK8MrcT0oYZ0Kq711x4QA0= Original-Xref: usenet.stanford.edu gnu.emacs.help:212472 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104756 Archived-At: >>> `python-mode' are inappropriate for the derived mode; in particular, I'd >>> like to disable auto-guessing of the indentation by setting >>> `python-indent-guess-indent-offset' to nil. However, >>> `define-derived-mode' has no customization point for running code before >>> the parent mode function. What's the best way to solve this? >> Add the code *after* running python-mode? After all, setting vars >> before would be a waste since python-mode (like all other proper major >> modes) begins by calling kill-all-local-variables (also known as >> fundamental-mode). > Can't see this in python.el. python-mode is a derived-mode from prog-mode. Yup, it starts by calling prog-mode. Since prog-mode is a proper major mode it will start by running kill-all-local-variables and hence python-mode does too. Of course prog-mode itself is a derived mode so it doesn't directly call kill-all-local-variables, but instead it calls fundamental-mode, which itself calls kill-all-local-variables (the two used to be aliases, but nowadays, fundamental-mode does a little bit more than just running kill-all-local-variables). Stefan