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.devel Subject: Re: master 6458e16: New mode outline-cycle-minor-mode with Orgmode-like TAB cycling on headings Date: Thu, 04 Mar 2021 10:58:06 +0200 Organization: LINKOV.NET Message-ID: <87a6rj5jdl.fsf@mail.linkov.net> References: <20210303191236.24697.93201@vcs0.savannah.gnu.org> <20210303191237.2B2D720E1B@vcs0.savannah.gnu.org> <87zgzkug5d.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16859"; 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: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 04 11:17:48 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lHl3D-0004I9-Ex for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 11:17:47 +0100 Original-Received: from localhost ([::1]:55714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHl3C-0004Bx-F5 for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 05:17:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHl1y-0002th-1B for emacs-devel@gnu.org; Thu, 04 Mar 2021 05:16:30 -0500 Original-Received: from relay13.mail.gandi.net ([217.70.178.233]:22743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHl1v-0001Xb-P9 for emacs-devel@gnu.org; Thu, 04 Mar 2021 05:16:29 -0500 Original-Received: from mail.gandi.net (m91-129-96-116.cust.tele2.ee [91.129.96.116]) (Authenticated sender: juri@linkov.net) by relay13.mail.gandi.net (Postfix) with ESMTPSA id D817E80006; Thu, 4 Mar 2021 10:16:24 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Wed, 03 Mar 2021 16:44:07 -0500") Received-SPF: pass client-ip=217.70.178.233; envelope-from=juri@linkov.net; helo=relay13.mail.gandi.net 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, 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: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265937 Archived-At: >> ;;; outline-minor-mode-cycle: t >> ;;; outline-minor-mode-highlight: t >> ;;; eval: (outline-minor-mode 1) >> >> But then thought that maybe with a mode would be more concise and convenient. >> >> I'm fine with removing these modes after analyzing more use cases. > > BTW, I'm writing under the assumption that we'd want to eventually have > both of those vars default to t. I don't know, I could try to use outline-minor-mode-highlight unconditionally everywhere to check its effect. It seems that it doesn't put outline faces on parts already highlighted by major mode font-lock keywords. >> Here's is a list of use cases where I tried to use outline-minor-mode >> with cycling, and somewhere also with highlighting. > > Any mode where you've found bad interactions? Only in two modes so far: 1. in emacs-lisp-mode sometimes the inner part of a large expression gets to the beginning of the line, then trying to indent it with TAB hides the remaining part. A workaround is to type SPC before indenting with TAB. 2. in diff-mode TAB on a diff header line used to navigate to the next hunk with 'diff-hunk-next', now it hides the next hunk. A workaround is to move point to the next line before typing TAB to go to the next hunk. Are these a possible reasons that would prevent enabling cycling in outline-minor-mode by default? Or if someone enables outline-minor-mode then it should be easy for them also to customize cycling when it's enabled the default? >> 3. (add-hook 'emacs-lisp-mode-hook 'outline-cycle-minor-mode) >> without outline highlighting to not overwrite major mode faces > > In which way did the highlighting get in the way? Actually, I discovered only now that outline faces with outline-minor-mode-highlight don't override major mode faces. > FWIW, I think the only really good way to solve this problem is to > replace `indent-for-tab-command` with a new command (call it > `tab-dwim`?) which can be more finely configured by major and minor > modes. E.g. by making it call `tab-dwim-function` on which modes can > `add-function` at will (and at various depths so they can control > whether it should take precedence or not over the "TAB causes > indentation" or "TAB causes completion", ...). The problem is that too many commands bound to TAB need to adapt this special handling: indent-for-tab-command, diff-hunk-next, compilation-next-error, forward-button, etc. etc. > The mechanism of priorities of keymaps coupled with "fallthrough" > (either via the "menu-item + filter" trick or via some explicitly > looking up the keymaps and calling the next command) isn't fine-grained > enough to deal with the amount of overloading that people want to use on > that poor TAB key. It seems only some very high-level map like overriding-terminal-local-map could handle this generally.