From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Emacs keybindings according to file type Date: Mon, 21 Sep 2020 08:46:02 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15498"; mail-complaints-to="usenet@ciao.gmane.io" To: Help Gnu Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 21 08:49:14 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 1kKFdS-0003w6-3s for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 21 Sep 2020 08:49:14 +0200 Original-Received: from localhost ([::1]:37848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKFdQ-0000yO-Tl for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 21 Sep 2020 02:49:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKFaW-0008Sp-Nn for help-gnu-emacs@gnu.org; Mon, 21 Sep 2020 02:46:14 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:47735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKFaR-0004yW-WD for help-gnu-emacs@gnu.org; Mon, 21 Sep 2020 02:46:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1600670762; bh=9EvqJwcrXnQDfHSs5qs/K2EKgm3sSaqEB3nIhnZLB1w=; h=X-UI-Sender-Class:From:To:Subject:Date; b=fzHdjl1a+ekHo+J115RPdyqXx8Q2ul6hzxqQWcZz7TLmADoFhM5pS55bmlkLCphDT ewTvhr3lxi6uFPxueKJVgyoQXLrzeUXdWNh0xmbrlsf8aQhJUjPO4xMLk+c2Ft5awh auOX3JbmGtNIj/AO6XM+Do6Ew9oNEXgY5Ygpp2F8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs09.server.lan [172.19.170.177]) (via HTTP); Mon, 21 Sep 2020 08:46:02 +0200 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:/yG1Ml8nTeGavnG/3VVXmTCN1clYBhZORUG1u//lB0WUdmVPkqa2eMTZbE6+oFHK8vDEg F68vjhDmwcq7y1MQ0hB1GcQFkI7GfPHi6f73W48XCr9boQQ0Jc8HgO2IKge3pCz9TBdXTzINBwdD C08LqvSoT/qKInp1LG0Xl/5hqeqlTvj8U+iTai8e9N5BviLM57qmEIEQsHriphuPfB2HEsSL4SEN +latljnfriA8LLecrxgUKeNJ114DQEMGXAb6yvG0uiJbYGHAlkO5NXW+p9djuwO0RE0Vfg4pjNLc Gs= X-UI-Out-Filterresults: notjunk:1;V03:K0:os8qQ8hqpZk=:6+I6XxW9i5/7wClrhjj9pj xfoOwnm/Ks7Re5y4jKRqrCaslCqXuscmYYbhUQGpjTOOuvVlnbytJLLIC+Tg67a5QGOusiFWN flCVZvoZAOjxwA5DxvAd2yM+CjzvnX5iWnyE7Ng+WCZiU52F993GI+rnWeuZ4IllNvb/D1eh/ zt9uvN/aIz8Wq/Imxweem7kJhSxEhaBV1ZgdYnJwsPGdey5I7Jt20ZdIpIhtMGWIS5mQiVGgc lQ7Cn+wuVpsDUxUrzB5ycWAbXieKggph4kiRdzv6uDEbv6ffbqdL/91tudT+DFvYxdo6tINCk yEGw809Lnf4hjiM3aUSPmmNrustzVQg9Uwaidol8zm9SWbxp8/X4AgyJuBI63Jp3hHo+gE72J xRF4d3rY1deLAqBGzAWhpi2eh9G3ue3vHyPtKN/DtFjwXDfqIS4sxBBJ/B8YfeEnBJpjNdBRV g2vUmb0jTir+ElGpdCYThSHE0skgRJnV+Ufw43BGlyYsOYRHWcGo0A6foB3Zg7CbrOmReirlt kAcwWna9UCY1EBBXcUkNlLQDTpy6cBOZ8QpCN5ZF0FN6GaVA5V7A1pAFKr+gvsltJLG+rOeau KpOs+69oU7q9d9UHsaJB/mbRi8z9s62dzN5f0JuqBvkTdHp7Ps/GuNnfBTe9KwiVuAIKccFZQ jtNKQflnlzacl9o4GetFg1RTMePUIa90yEgqaa9JhfucyaJeW9a2NPk3r1aYf5iLHSTc= Received-SPF: pass client-ip=212.227.17.22; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/21 02:46:03 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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:124123 Archived-At: I want to set different keybinding according to the type of file I load into a buffer. I wonder how I can do that. In my .emacs file I have ; Loads texinfo Customisations (setq texi--customs "/home/hagbard/swadmin/emacs/el/naiad/texi--custom.el"= ) (load texi--customs) ; Loads Fortran Customisations. (setq fortran--customs "/home/hagbard/swadmin/emacs/el/naiad/fortran--cust= om.el") (load fortran--customs) ; Adds Org Mode Custimisations (setq org--customs "/home/hagbard/swadmin/emacs/el/naiad/org--custom.el") (load org--customs) Then in separate files I have commands for each language. =2D-------- I want to have keybinding for f1 and f2 to toggle between org-mode and tex= info-mode when the file is a .texi ; Helps traverse a texinfo document using org-mode commands ; Sets Keybinding for switching between texinfo-mode and org-mode ; The Major Mode toggle is used for Syntax Highlighting (global-set-key [f1] (kbd "M-x org-mode")) (global-set-key [f2] (kbd "M-x texinfo-mode")) And if I have a .f file, I want the keybinding for f90-mode (global-set-key [f1] (kbd "M-x org-mode")) (global-set-key [f2] (kbd "M-x f90-mode")) =2D------ However, if one looks at the .emacs file, the keybindings that take effect= is always of the last file that is loaded, in this case being fortran--custom.el. This= means that if I load a .texi file, the keybinding f2 will not change the buffer to texin= fo-mode. Regards S*