From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.orgmode,gmane.emacs.devel Subject: How to handle both minor mode and major mode remapping a command? (was: Bug: org-kill-line shouldn't assume visual-line-mode means kill-visual-line) Date: Sun, 15 Dec 2024 10:48:56 +0000 Message-ID: <87r0691asn.fsf@localhost> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19680"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org To: Nathan Collins Original-X-From: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sun Dec 15 11:48:35 2024 Return-path: Envelope-to: geo-emacs-orgmode@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 1tMmAs-0004xu-Lk for geo-emacs-orgmode@m.gmane-mx.org; Sun, 15 Dec 2024 11:48:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tMmA0-0007K6-SJ; Sun, 15 Dec 2024 05:47:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tMm9y-0007Jd-EU for emacs-orgmode@gnu.org; Sun, 15 Dec 2024 05:47:39 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tMm9t-0004MF-Fc for emacs-orgmode@gnu.org; Sun, 15 Dec 2024 05:47:38 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id B0C76240101 for ; Sun, 15 Dec 2024 11:47:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1734259648; bh=N7dCYS2d/l6nAaGWTiSAeONkau1bTlYFvPeQXli9PJg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=dFuz+A39i5KueelSPIjzpPoc4tduM1b8S6nUvDYPVgo2zPeHkpYLikQLH4RW2grMD QYpsZNvjGv8dN0nC6PEfc0m1gX0fWZoc1BdWKwi87Q8Fmif8BkRMnLhAySMOUI6fQc EoHFHxYKkKfebLbzHW4q80ZiMLBS8vFpYBnxNg3FRvo+AUKhzrR1aucnE9s66kpsF8 sUfq7EwbJYrB0zAlljKwuywUU+NGT8i0PnUfIZIqfvJG7vqdSt3kdZ0dSYtVh5L36b zhqXPJxYzpVjANgOIPCV7DIe87SENkAP0/84vXWt7dXJnDK/vFVqQizMqyVeGTJ9AG IXiBUa5k5KABg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YB0C40kYwz9rxF; Sun, 15 Dec 2024 11:47:28 +0100 (CET) In-Reply-To: Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Original-Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.orgmode:164158 gmane.emacs.devel:326524 Archived-At: Hi, We have the following situation in Org mode: 1. Org mode remaps `kill-line' to `org-kill-line' 2. `org-kill-line' performs special action when point is on a heading and otherwise falls back to `kill-line' 3. visual-line-mode, if active, sets up minor mode map remapping `kill-line' to `kill-visual-line' In the past, activating `visual-line-mode' caused Org mode binding to be completely shadowed. Later, we tried to fix the problem by 1. Overriding `visual-line-mode' remapping by force 2. Hard-coding a special case for `visual-line-mode' to call `kill-visual-line' instead of `kill-line' as a fallback in `org-kill-line' However, the situation is not ideal. Below is a recent bug report where user changed the default remapping in `visual-line-mode-map' to something else (not considered by Org) I am wondering if there is some canonical way to handle similar scenarios recommended for major modes. Any suggestions? Nathan Collins writes: > Hello, > > In the latest version of org.el, at line 21367 [1], inside `defun > org-kill-line`, we have > > (if (bound-and-true-p visual-line-mode) 'kill-visual-line 'kill-line))) > > but I think instead this should just call whatever `kill-line` is > bound to in `visual-line-mode-map`. By default, `visual-line-mode-map` > remaps `kill-line` to `kill-visual-line`, but I remove this remap > because I prefer the default `C-k` behavior. But in org-mode, I can't > figure out a way to disable this behavior of `org-kill-line`, except > by removing org-mode's remap of `kill-line` to `org-kill-line`, which > loses the other fancy logic of `org-kill-line`. > > Cheers, > > -nathan > > [1]: https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org.el#n213667 > -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at . Support Org development at , or support my work at