From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#50679: 28.0.50; outline-minor-mode-cycle should be able to only cycle at the begining of a line Date: Wed, 22 Sep 2021 19:09:12 +0300 Organization: LINKOV.NET Message-ID: <87czp0x2ej.fsf@mail.linkov.net> References: <87r1dkv8i2.fsf@posteo.net> <87mto8h5hk.fsf@mail.linkov.net> <87mto8uwnu.fsf@posteo.net> <87fstzn2zw.fsf@mail.linkov.net> <87y27rpi4q.fsf@mail.linkov.net> <87bl4nuuon.fsf@posteo.net> <87mto73xh5.fsf@gmail.com> <87tuidkdo2.fsf@mail.linkov.net> <87lf3p3gqn.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5974"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: Philip Kaludercic , 50679@debbugs.gnu.org To: Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 22 18:43:47 2021 Return-path: Envelope-to: geb-bug-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 1mT5LX-0001Hr-7a for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Sep 2021 18:43:47 +0200 Original-Received: from localhost ([::1]:44322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mT5LU-0006Va-KF for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Sep 2021 12:43:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mT4yY-0007S7-Uw for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 12:20:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39963) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mT4yY-0000RB-Md for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 12:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mT4yY-0007ZN-IW for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 12:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Sep 2021 16:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50679 X-GNU-PR-Package: emacs Original-Received: via spool by 50679-submit@debbugs.gnu.org id=B50679.163232754428973 (code B ref 50679); Wed, 22 Sep 2021 16:20:02 +0000 Original-Received: (at 50679) by debbugs.gnu.org; 22 Sep 2021 16:19:04 +0000 Original-Received: from localhost ([127.0.0.1]:51504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mT4xb-0007XC-Hl for submit@debbugs.gnu.org; Wed, 22 Sep 2021 12:19:03 -0400 Original-Received: from relay12.mail.gandi.net ([217.70.178.232]:50187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mT4xX-0007W8-1Z for 50679@debbugs.gnu.org; Wed, 22 Sep 2021 12:18:59 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 8D6C9200003; Wed, 22 Sep 2021 16:18:51 +0000 (UTC) In-Reply-To: <87lf3p3gqn.fsf@gmail.com> (Augusto Stoffel's message of "Tue, 21 Sep 2021 20:50:40 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:215097 Archived-At: >>> "" 'outline-cycle >>> "" 'outline-cycle-buffer >>> "f" 'outline-forward-same-level >>> "b" 'outline-backward-same-level >>> "n" 'outline-next-visible-heading >>> "p" 'outline-previous-visible-heading >>> "u" 'outline-up-heading >>> "F" 'outline-move-subtree-down >>> "B" 'outline-move-subtree-up >>> "@" 'outline-mark-subtree >> >> But this means you can't type all these keys on heading lines? >> This is why I confugured it not to use self-inserting keys: > > In my setup those keys only apply at BOL in a heading line. I never > type anything there. > > TAB for reindenting might be a bit trickier. Apparently I never try to > reindent a heading line when point is at BOL, because I never thought > about a possible conflict, but I guess I would type SPC TAB in that > case. This is exactly what I do every time, i.e. first I type TAB to indent, but it hides the body, then I type again TAB to unhide the body to revert the mistake, then type SPC TAB to workaround this annoyance. >> (let ((map outline-mode-cycle-map) >> (cmds '(("M-" outline-next-visible-heading) >> ("M-" outline-previous-visible-heading) >> ("M-" outline-hide-subtree) >> ("M-" outline-show-subtree)))) >> (dolist (command cmds) >> (define-key map (kbd (nth 0 command)) >> `(menu-item >> "" ,(nth 1 command) >> :filter ,(lambda (cmd) >> (when (outline-on-heading-p)) >> cmd)))))) > > I can't find this block in outline.el, is this a suggestion for a > possible default? This is from my init file. I don't suggest to add it to outline.el, it only shows how it's possible to customize navigation keys. >>> Looking at the code, it seems that adding bindings to >>> `outline-mode-cycle-map` would achieve precisely that, but the name >>> of the keymap doesn't reflect that. >> >> Do you suggest different keymaps? And indeed, these two are >> quite different beasts each with own problems. So we need both >> outline-mode-cycle-map and outline-minor-mode-cycle-map. > > Okay, those keymaps are active in the entire heading line, right? > > I would prefer to only have a special behavior at the first character of > a heading line, Philip already proposed a predicate that can be set to 'bolp' to make the map active only on the first character. > in exchange of allowing _any_ shortcut key with minimal > interference. Org mode already does that with a simple customization, > (setq org-use-speed-commands t), so I don't think it would be too > surprising for most users. Adding more keys to this keymap has more problems. For example, in diff-mode TAB navigates to the next hunk, but with outline-minor-mode TAB on the first character in a diff-mode buffer cycles the outline, so another available key 'n' should be typed to navigate to the next hunk. We can't sacrifice this key for outline-next-visible-heading, because no more keys will remain for diff-hunk-next.