From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Set major mode for all visited files by extension Date: Tue, 05 May 2020 13:49:38 -0400 Message-ID: References: <82913dab-368c-f955-08cc-e22f8da3585e@akwebsoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="39720"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:WnkuOeA59fb6zDlwduXBxk+djrE= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 05 20:04:08 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jW1vL-000ACZ-Ge for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 May 2020 20:04:07 +0200 Original-Received: from localhost ([::1]:33704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jW1vK-0000YM-HQ for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 May 2020 14:04:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jW1hU-0005XD-GF for help-gnu-emacs@gnu.org; Tue, 05 May 2020 13:49:48 -0400 Original-Received: from ciao.gmane.io ([159.69.161.202]:41422) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jW1hT-00037g-Pu for help-gnu-emacs@gnu.org; Tue, 05 May 2020 13:49:48 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jW1hQ-000Quz-DH for help-gnu-emacs@gnu.org; Tue, 05 May 2020 19:49:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=159.69.161.202; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 13:49:45 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:123024 Archived-At: >> (defun reload-buffer () >> "Reload the current buffer" >> (interactive) >> (let ((curfile (buffer-file-name))) >> (kill-this-buffer) >> (find-file curfile))) > > The built-in (revert-buffer), which I have bound to C-, works for > me in similar cases (but I don’t use session.el, just desktop.el). BTW, if you only want to (re)set the major mode but not reload the buffer's contents, then `normal-mode` is the function you likely want to call. Stefan