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: Strange behavior with major mode specific key bindings Date: Fri, 24 Apr 2020 14:20:41 -0800 Message-ID: <204c0b28-d062-86ca-7a8c-c1e3e80c7c1a@akwebsoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="44237"; 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: MLEmacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 25 00:21:32 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 1jS6hQ-000BQ6-7N for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 25 Apr 2020 00:21:32 +0200 Original-Received: from localhost ([::1]:54382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jS6hP-00064S-7Q for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 24 Apr 2020 18:21:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54414) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jS6gu-00063v-0X for help-gnu-emacs@gnu.org; Fri, 24 Apr 2020 18:21:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jS6gs-0002FX-Se for help-gnu-emacs@gnu.org; Fri, 24 Apr 2020 18:20:59 -0400 Original-Received: from gateway34.websitewelcome.com ([192.185.148.231]:47659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jS6gr-0007BB-6a for help-gnu-emacs@gnu.org; Fri, 24 Apr 2020 18:20:58 -0400 Original-Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway34.websitewelcome.com (Postfix) with ESMTP id D89C929752A7 for ; Fri, 24 Apr 2020 17:20:43 -0500 (CDT) Original-Received: from host2075.hostmonster.com ([67.20.113.97]) by cmsmtp with SMTP id S6gdjUC1hXVkQS6gdjefyc; Fri, 24 Apr 2020 17:20:43 -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:MIME-Version:Date: Message-ID:Subject:From:To:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7UbwRQ4C6gXZaSO5NBSuQMF+Ts0lIEm2luXSSUt4LDU=; b=KzVhfIJbVuASkhDyC9qjyciweQ yU95n4nbQnZrvDh72vGYKt4+I+WjRlNqQJrKqR17TumpjoPsLXK5BLDBk0VoBi2PYt0P+Fz13Rs8p 1cv8HVl5ACk7GeDEG493X3siH; Original-Received: from tjohnson.mtaonline.net ([64.4.232.191]:34100 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 1jS6gd-001Aim-91 for Help-gnu-emacs@gnu.org; Fri, 24 Apr 2020 16:20:43 -0600 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: 1jS6gd-001Aim-91 X-Source-Sender: tjohnson.mtaonline.net ([192.168.1.6]) [64.4.232.191]:34100 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.148.231; envelope-from=tim@akwebsoft.com; helo=gateway34.websitewelcome.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/24 18:20:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 192.185.148.231 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:122928 Archived-At: I have customized a key binding for jinja2 mode. ;; In my init.el I have the following (require 'jinja2-mode) (require 'tj-mode-custom) (add-to-list 'auto-mode-alist '("\\.html$" . jinja2-mode)) (add-hook 'jinja2-mode-hook 'tj-jinja2-mode-keys) ;; In  tj-mode-custom the following (defun tj-jinja2-mode-keys ()   "Bindings and for jinja2"   (define-prefix-command 'jinja2-mode-map)   (local-set-key (kbd "C-c") 'jinja2-mode-map)   (define-key jinja2-mode-map "a" 'jinja2-close-tag)) If an .html file is loaded at emacs startup, the following key sequence: C-c a invokes jinja2-close-tag BUT if I open an .html file that is on disk but not preloaded at startup, OR if I create a new .html file, the single character "a" will execute the same function. In other words, now both "C-c a" and "a" are bound to 'jinja2-close-tag, clobbering 'insert-char I can observe that the newly opened files are in jinja2 mode. I do not have similar issues with elpy mode I am using GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.30) On ubuntu 16.04 thanks -- Tim tj49.com