From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: Hook doesn't run as expected, if buffer mode is set from major-mode Date: Sat, 09 Jan 2016 00:32:03 +0100 Message-ID: <87wprjhclo.fsf@web.de> References: <87h9in4zee.fsf@linux-qg7d.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1452295954 2195 80.91.229.3 (8 Jan 2016 23:32:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Jan 2016 23:32:34 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 09 00:32:26 2016 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 1aHgWA-0007L1-9N for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Jan 2016 00:32:26 +0100 Original-Received: from localhost ([::1]:38389 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHgW9-00040o-OO for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Jan 2016 18:32:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHgVz-00040D-95 for help-gnu-emacs@gnu.org; Fri, 08 Jan 2016 18:32:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aHgVv-00013D-5i for help-gnu-emacs@gnu.org; Fri, 08 Jan 2016 18:32:15 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:39198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHgVu-000133-VA for help-gnu-emacs@gnu.org; Fri, 08 Jan 2016 18:32:11 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aHgVs-00076c-Vv for help-gnu-emacs@gnu.org; Sat, 09 Jan 2016 00:32:09 +0100 Original-Received: from dslb-188-099-160-036.188.099.pools.vodafone-ip.de ([188.99.160.36]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 09 Jan 2016 00:32:08 +0100 Original-Received: from michael_heerdegen by dslb-188-099-160-036.188.099.pools.vodafone-ip.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 09 Jan 2016 00:32:08 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 23 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dslb-188-099-160-036.188.099.pools.vodafone-ip.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:CRwmUXk9raR9QNAs+9l/8zJ628o= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:108664 Archived-At: Rolf Ade writes: > Is it me, doing something wrong or stupid? If not, what's the > rationale behind this behavior? Though it's better to set `default-major-mode' and use (goto-char (point-max)) instead of `end-of-buffer' (which sets the mark) - it should work as you expect. But it doesn't. I tried to edebug `set-auto-mode' - this is where the point is apparently set to the buffer's beginning. But the point seems to be changed magically right after the beginning without any code involved. Either some hook is doing that, or this is some internal thing at the C level (bug?). In a different trial, I traced `goto-char' and `point-min'. But every of these calls was inside a `save-excursion'. So, from the Lisp level, it's a miracle. Michael.