From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: Set major mode for all visited files by extension Date: Sun, 3 May 2020 07:37:07 -0800 Message-ID: <552ddcd0-34c9-f0c1-a269-d6373024812e@akwebsoft.com> References: <82913dab-368c-f955-08cc-e22f8da3585e@akwebsoft.com> <87y2q9rf8r.fsf@ebih.ebihd> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="16795"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 03 17:39:01 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 1jVGhn-0004Cr-LJ for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 03 May 2020 17:38:59 +0200 Original-Received: from localhost ([::1]:37532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVGhl-0001HQ-3d for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 03 May 2020 11:38:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVGhQ-0001HF-Ik for help-gnu-emacs@gnu.org; Sun, 03 May 2020 11:38:36 -0400 Original-Received: from gateway20.websitewelcome.com ([192.185.44.20]:34745) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVGhP-00047k-3h for help-gnu-emacs@gnu.org; Sun, 03 May 2020 11:38:36 -0400 Original-Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 37295400C8005 for ; Sun, 3 May 2020 09:19:22 -0500 (CDT) Original-Received: from host2075.hostmonster.com ([67.20.113.97]) by cmsmtp with SMTP id VGg0jlGGN1s2xVGg0jLH1t; Sun, 03 May 2020 10:37:09 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tj49.com; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version :Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ZMqzyBXjmMM7U7XZJ6LSGjg5sJphK59wPzfXcISTMbw=; b=bIgdy6N1xFvC3H3GSW21yJisdO cz0awLQ2p3NMdUWYrlirImuu8onM1ctXSs4I60Cw3tqNJtC5uhyvo/0vKcWvMfNWBS5DoIGEmIzfg IvxslhV+Il6UINUYk2b59jQKn; Original-Received: from tjohnson.mtaonline.net ([64.4.232.191]:48634 helo=[192.168.1.6]) by host2075.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1jVGg0-001Dmk-GO for help-gnu-emacs@gnu.org; Sun, 03 May 2020 09:37:08 -0600 In-Reply-To: <87y2q9rf8r.fsf@ebih.ebihd> Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2075.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - akwebsoft.com X-BWhitelist: no X-Source-IP: 64.4.232.191 X-Source-L: No X-Exim-ID: 1jVGg0-001Dmk-GO X-Source-Sender: tjohnson.mtaonline.net ([192.168.1.6]) [64.4.232.191]:48634 X-Source-Auth: tim@tj49.com X-Email-Count: 1 X-Source-Cap: bW9sZG92YXM7bW9sZG92YXM7aG9zdDIwNzUuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes Received-SPF: neutral client-ip=192.185.44.20; envelope-from=tim@akwebsoft.com; helo=gateway20.websitewelcome.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/03 11:38:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779, URIBL_BLOCKED=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:123006 Archived-At: On 5/2/20 5:15 PM, Emanuel Berg via Users list for the GNU Emacs text editor wrote: > Tim Johnson wrote: > >> With my configuration, when I open emacs and load >> a session, it appears that a modified >> auto-mode-alist entry is consulted *after* the >> associated major-mode from the previous session >> [...] > Yeah? This is stored somewhere? I don't like that... I am using the 'session package, it creates a file called .session that lives in .emacs.d, thus the environment of the last session is saved, and subsequently restored when emacs is restarted. Sorry, should have mentioned that. >> A practical application is if I have been using the >> built-in elisp mode for .el files and then implement >> xah-elisp-mode, even if I code >> >> (add-to-list 'auto-mode-alist '("\\.el$" . xah-elisp-mode)) > You keep track of what's already there? Maybe it's > the first hit that gets executed. But I suppose one > don't tell that .el files should be > `emacs-lisp-mode'. What mode do they turn up in? > If you just create a test.el, I mean? > > I do this, it is more clear IMO: > > ;;; -*- lexical-binding: t -*- > ;;; > ;;; this file: > ;;; http://user.it.uu.se/~embe8573/emacs-init/mode-by-filename.el > ;;; https://dataswamp.org/~incal/emacs-init/mode-by-filename.el > > (let ((modes (list > '("\\.bal\\'" . balance-mode) > '("\\.gpi\\'" . gnuplot-mode) > '("\\.lu\\'" . lua-mode) > '("\\.nqp\\'" . perl-mode) > '("\\.php\\'" . html-mode) > '("\\.pic\\'" . nroff-mode) > '("\\.pl\\'" . prolog-mode) > '("\\.tex\\'" . latex-mode) > '("\\.xr\\'" . conf-xdefaults-mode) > '("*" . text-mode) ))) > (setf auto-mode-alist (nconc modes auto-mode-alist)) ) > >> in my init.el, the previously visited buffers that >> are automatically opened when I start emacs will >> still be in elisp-mode. The fix, of course is to >> invoke xah-elisp-mode from the minibuffer. This is >> certainly doable, even with multiple elisp buffers >> opened, but I'm always looking to >> eliminate redundancies. > No, that stinks, that should be automated. > I'm unfamiliar with this automatically opened > principle tho and if I have it (I don't think so) > I would like it inhibited, pretty please? I think what Emanuel is saying is that the 'session package should have a configuration that consults with auto-mode-alist. Emanuel, what are you using - if any - that handles session management. thanks > >> It would be handy if there were a command that >> would set all visited buffers ending in a specific >> file extension to a specific mode. If such were >> available, it would come in handy for experimenting >> with alternative major modes. > Sure you can iterate all the buffers and apply > commands but this is just doing it manually in > a sense (only faster and with less effort). B/c the > files should turn up in the desired mode w/o > any intervention! > -- Tim tj49.com