GNU bug report logs - #41198
27.0.60; [PATCH] heading cycling command for outline

Previous Next

Package: emacs;

Reported by: Yuan Fu <casouri <at> gmail.com>

Date: Tue, 12 May 2020 01:53:02 UTC

Severity: wishlist

Tags: patch

Merged with 41130

Found in version 27.0.60

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41198 in the body.
You can then email your comments to 41198 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 12 May 2020 01:53:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yuan Fu <casouri <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 May 2020 01:53:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Bug Report Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 27.0.60; [PATCH] heading cycling command for outline
Date: Mon, 11 May 2020 21:52:25 -0400
[Message part 1 (text/plain, inline)]
Add two commands that cycles a heading (like that in Org mode) in outline-mode:

- outline-cycle: cycles between “hide all”, “sub headings” and “show all” state. They are called “FOLDED”, “CHILDREN”, “SUBTREE” in Org mode. 
- outline-cycle-buffer: cycles between “only top level headings”, “all headings”, “show all” states

Could this be useful?

Yuan

[outline.patch (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 19 May 2020 02:46:02 GMT) Full text and rfc822 format available.

Message #8 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 27.0.60; [PATCH] heading cycling command for outline
Date: Mon, 18 May 2020 19:45:10 -0700
forcemerge 41130 41198
thanks

Yuan Fu <casouri <at> gmail.com> writes:

> Add two commands that cycles a heading (like that in Org mode) in outline-mode:
>
> - outline-cycle: cycles between “hide all”, “sub headings” and “show all” state. They are called “FOLDED”, “CHILDREN”, “SUBTREE” in Org mode.
> - outline-cycle-buffer: cycles between “only top level headings”, “all headings”, “show all” states

Thanks for working on this.  I've tested your patch, and it seems to
work as advertised.

> Could this be useful?

I think it could.  I have previously sent the wishlist Bug#41130, which
I have now merged with this bug.  I have seen no objections to that
proposal, so I hope that it is uncontroversial.

In Bug#41130, I also suggest to add the same keybinding as in org-mode:
TAB and S-TAB.  Could you add such keybindings to outline-mode-map in
your patch?

I think we also need ChangeLog in the commit message, an entry in NEWS,
and updates to the manual.

> +(defun outline-cycle ()
> +  "Cycle between “hide all”, “headings only” and “show all”.
> +
> +“Hide all” means hide all subheadings and their bodies.
> +“Headings only” means show sub headings but not their bodies.
> +“Show all” means show all subheadings and their bodies."

I can't remember seeing double quotes used like that before in doc
strings.  Correct me if I'm wrong, but wouldn't we normally use
`single-quotes' for something like this?

Best regards,
Stefan Kangas




Forcibly Merged 41130 41198. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 19 May 2020 02:46:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 19 May 2020 18:33:02 GMT) Full text and rfc822 format available.

Message #13 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 27.0.60; [PATCH] heading cycling command for outline
Date: Tue, 19 May 2020 14:31:52 -0400
[Message part 1 (text/plain, inline)]

> On May 18, 2020, at 10:45 PM, Stefan Kangas <stefan <at> marxist.se> wrote:
> 
> forcemerge 41130 41198
> thanks
> 
> Yuan Fu <casouri <at> gmail.com> writes:
> 
>> Add two commands that cycles a heading (like that in Org mode) in outline-mode:
>> 
>> - outline-cycle: cycles between “hide all”, “sub headings” and “show all” state. They are called “FOLDED”, “CHILDREN”, “SUBTREE” in Org mode.
>> - outline-cycle-buffer: cycles between “only top level headings”, “all headings”, “show all” states
> 
> Thanks for working on this.  I've tested your patch, and it seems to
> work as advertised.

Thanks.

> 
>> Could this be useful?
> 
> I think it could.  I have previously sent the wishlist Bug#41130, which
> I have now merged with this bug.  I have seen no objections to that
> proposal, so I hope that it is uncontroversial.
> 
> In Bug#41130, I also suggest to add the same keybinding as in org-mode:
> TAB and S-TAB.  Could you add such keybindings to outline-mode-map in
> your patch?

It seems that the outline-mode bindings all live under C-c. Maybe C-c TAB and C-c S-TAB? Should I ask on emacs-devel for for suggestions?

> 
> I think we also need ChangeLog in the commit message, an entry in NEWS,
> and updates to the manual.

I updated NEWS and the manual. For ChangeLog, I thought that’s automatically generated from commit messages?

> 
>> +(defun outline-cycle ()
>> +  "Cycle between “hide all”, “headings only” and “show all”.
>> +
>> +“Hide all” means hide all subheadings and their bodies.
>> +“Headings only” means show sub headings but not their bodies.
>> +“Show all” means show all subheadings and their bodies."
> 
> I can't remember seeing double quotes used like that before in doc
> strings.  Correct me if I'm wrong, but wouldn't we normally use
> `single-quotes' for something like this?
> 

Done.

Yuan

[outline.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 19 May 2020 22:37:02 GMT) Full text and rfc822 format available.

Message #16 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 27.0.60; [PATCH] heading cycling command for outline
Date: Tue, 19 May 2020 15:36:01 -0700
Yuan Fu <casouri <at> gmail.com> writes:

>> In Bug#41130, I also suggest to add the same keybinding as in org-mode:
>> TAB and S-TAB.  Could you add such keybindings to outline-mode-map in
>> your patch?
>
> It seems that the outline-mode bindings all live under C-c. Maybe C-c
> TAB and C-c S-TAB? Should I ask on emacs-devel for for suggestions?

I think it is better to use the same keys as org-mode, since one
important motivation for this feature is precisely to align the
outline-mode keybindings with org-mode.  This aspect would be
significantly diminished by using other keys, IMHO.

My impression was that also there was consensus around (or at least no
objections to) that idea the last time we discussed it.  I would
therefore propose to just add TAB and S-TAB to the patch, but allow a
week or two before pushing to give others a chance to comment here.

But, if you really want to, of course you could also ask on emacs-devel.
Worst case, we get to have another round of bikeshedding. ;-)

>> I think we also need ChangeLog in the commit message, an entry in NEWS,
>> and updates to the manual.
>
> I updated NEWS and the manual. For ChangeLog, I thought that’s
> automatically generated from commit messages?

That is my understanding too.

But I only saw a diff attached, not a patch with a commit message.  That
is what I tried to say, but I could've been more clear.

(CONTRIBUTE suggests using `git format-patch -1' to email a patch, which
includes the commit message.)

> +@findex outline-cycle
> +@findex outline-cycle-buffer
> +  Outline also provides two convenience commands to cycle the
> +visibility of each heading and the whole buffer.  @code{outline-cycle}
> +cycles the current heading between "hide all", "subheadings", and
> +"show all" state.  @code{outline-cycle-buffer} cycles the whole buffer
> +between "only top-level headings", "all headings and subheadings", and
> +"show all" states.
[...]
> +*** New commands to cycle heading visibility.
> +'outline-cycle' cycles the current heading between "hide all",
> +"subheadings", and "show all" state. 'outline-cycle-buffer' cycles the
> +whole buffer between "only top-level headings", "all headings and
> +subheadings", and "show all" states.

Looks good to me (but should refer to the above keybindings if they're
added).

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Wed, 20 May 2020 01:38:02 GMT) Full text and rfc822 format available.

Message #19 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 27.0.60; [PATCH] heading cycling command for outline
Date: Tue, 19 May 2020 21:37:26 -0400
[Message part 1 (text/plain, inline)]

> On May 19, 2020, at 6:36 PM, Stefan Kangas <stefan <at> marxist.se> wrote:
> 
> Yuan Fu <casouri <at> gmail.com> writes:
> 
>>> In Bug#41130, I also suggest to add the same keybinding as in org-mode:
>>> TAB and S-TAB.  Could you add such keybindings to outline-mode-map in
>>> your patch?
>> 
>> It seems that the outline-mode bindings all live under C-c. Maybe C-c
>> TAB and C-c S-TAB? Should I ask on emacs-devel for for suggestions?
> 
> I think it is better to use the same keys as org-mode, since one
> important motivation for this feature is precisely to align the
> outline-mode keybindings with org-mode.  This aspect would be
> significantly diminished by using other keys, IMHO.
> 
> My impression was that also there was consensus around (or at least no
> objections to) that idea the last time we discussed it.  I would
> therefore propose to just add TAB and S-TAB to the patch, but allow a
> week or two before pushing to give others a chance to comment here.
> 
> But, if you really want to, of course you could also ask on emacs-devel.
> Worst case, we get to have another round of bikeshedding. ;-)

I added TAB and S-TAB bindings. Though S-TAB appears to be <backtab> on my machine (Mac) for both terminal and GUI so I bound that instead. Is that so for other machines? To reduce the possible allergy, I made the TAB binding conditional—only invokes outline-cycle when point is on a heading.

A minor thing: if the motivation is to align with Org mode, should I change the text message to align with Org mode? It prints “show all”, “hide all”, etc (because they make sense), but Org mode prints stuff like “CHILDREN”, “SUBTREE”, etc.

> 
>>> I think we also need ChangeLog in the commit message, an entry in NEWS,
>>> and updates to the manual.
>> 
>> I updated NEWS and the manual. For ChangeLog, I thought that’s
>> automatically generated from commit messages?
> 
> That is my understanding too.
> 
> But I only saw a diff attached, not a patch with a commit message.  That
> is what I tried to say, but I could've been more clear.
> 
> (CONTRIBUTE suggests using `git format-patch -1' to email a patch, which
> includes the commit message.)

Ah sorry, I switched to a new way to generate patches and didn’t notice that the commit message is gone. It is included this time.

> 
>> +@findex outline-cycle
>> +@findex outline-cycle-buffer
>> +  Outline also provides two convenience commands to cycle the
>> +visibility of each heading and the whole buffer.  @code{outline-cycle}
>> +cycles the current heading between "hide all", "subheadings", and
>> +"show all" state.  @code{outline-cycle-buffer} cycles the whole buffer
>> +between "only top-level headings", "all headings and subheadings", and
>> +"show all" states.
> [...]
>> +*** New commands to cycle heading visibility.
>> +'outline-cycle' cycles the current heading between "hide all",
>> +"subheadings", and "show all" state. 'outline-cycle-buffer' cycles the
>> +whole buffer between "only top-level headings", "all headings and
>> +subheadings", and "show all" states.
> 
> Looks good to me (but should refer to the above keybindings if they're
> added).

Yuan

[outline.patch (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 13 Oct 2020 03:17:02 GMT) Full text and rfc822 format available.

Message #22 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 41130 <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>,
 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Tue, 13 Oct 2020 05:16:12 +0200
Yuan Fu <casouri <at> gmail.com> writes:

> Ah sorry, I switched to a new way to generate patches and didn’t
> notice that the commit message is gone. It is included this time.

Skimming this thread, it seemed that everybody was in agreement that
this was a good change, but the patch was never applied, so I did that
now.

Some discussion then followed about what key(s) would be the best ones
here, and I didn't see any consensus, so I left the patch as is.  Feel
free to change the keys as you want, but I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 41130 <at> debbugs.gnu.org and Stefan Kangas <stefankangas <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 13 Oct 2020 03:17:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 13 Oct 2020 13:17:02 GMT) Full text and rfc822 format available.

Message #27 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 41130 <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>,
 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Tue, 13 Oct 2020 09:16:00 -0400

> On Oct 12, 2020, at 11:16 PM, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> 
> Yuan Fu <casouri <at> gmail.com> writes:
> 
>> Ah sorry, I switched to a new way to generate patches and didn’t
>> notice that the commit message is gone. It is included this time.
> 
> Skimming this thread, it seemed that everybody was in agreement that
> this was a good change, but the patch was never applied, so I did that
> now.
> 
> Some discussion then followed about what key(s) would be the best ones
> here, and I didn't see any consensus, so I left the patch as is.  Feel
> free to change the keys as you want, but I'm closing this bug report.
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no

Thanks Lars :-)



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Wed, 14 Oct 2020 19:51:02 GMT) Full text and rfc822 format available.

Message #30 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Stefan Kangas <stefan <at> marxist.se>, Yuan Fu <casouri <at> gmail.com>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Wed, 14 Oct 2020 22:24:10 +0300
> Skimming this thread, it seemed that everybody was in agreement that
> this was a good change, but the patch was never applied, so I did that
> now.

Now finally org keys are available in etc/NEWS, nice!
But typing S-TAB at the beginning of etc/NEWS signals the error:

  Debugger entered--Lisp error: (error "Before first heading")
    signal(error ("Before first heading"))

This is not how org-mode works - S-TAB doesn't fail before first heading
in org-mode.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Thu, 15 Oct 2020 07:03:02 GMT) Full text and rfc822 format available.

Message #33 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Stefan Kangas <stefan <at> marxist.se>, Yuan Fu <casouri <at> gmail.com>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Thu, 15 Oct 2020 09:02:25 +0200
Juri Linkov <juri <at> linkov.net> writes:

>> Skimming this thread, it seemed that everybody was in agreement that
>> this was a good change, but the patch was never applied, so I did that
>> now.
>
> Now finally org keys are available in etc/NEWS, nice!
> But typing S-TAB at the beginning of etc/NEWS signals the error:
>
>   Debugger entered--Lisp error: (error "Before first heading")
>     signal(error ("Before first heading"))
>
> This is not how org-mode works - S-TAB doesn't fail before first heading
> in org-mode.

How does it work in org-mode?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Thu, 15 Oct 2020 07:53:02 GMT) Full text and rfc822 format available.

Message #36 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Stefan Kangas <stefan <at> marxist.se>, Yuan Fu <casouri <at> gmail.com>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Thu, 15 Oct 2020 09:52:08 +0200
>>>>> On Thu, 15 Oct 2020 09:02:25 +0200, Lars Ingebrigtsen <larsi <at> gnus.org> said:

    Lars> Juri Linkov <juri <at> linkov.net> writes:
    >>> Skimming this thread, it seemed that everybody was in agreement that
    >>> this was a good change, but the patch was never applied, so I did that
    >>> now.
    >> 
    >> Now finally org keys are available in etc/NEWS, nice!
    >> But typing S-TAB at the beginning of etc/NEWS signals the error:
    >> 
    >> Debugger entered--Lisp error: (error "Before first heading")
    >> signal(error ("Before first heading"))
    >> 
    >> This is not how org-mode works - S-TAB doesn't fail before first heading
    >> in org-mode.

    Lars> How does it work in org-mode?

The same as anywhere else: it cycles the visibility of the headings downbuffer.

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Thu, 15 Oct 2020 23:34:02 GMT) Full text and rfc822 format available.

Message #39 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Stefan Kangas <stefan <at> marxist.se>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Thu, 15 Oct 2020 19:33:39 -0400

> On Oct 14, 2020, at 3:24 PM, Juri Linkov <juri <at> linkov.net> wrote:
> 
>> Skimming this thread, it seemed that everybody was in agreement that
>> this was a good change, but the patch was never applied, so I did that
>> now.
> 
> Now finally org keys are available in etc/NEWS, nice!
> But typing S-TAB at the beginning of etc/NEWS signals the error:
> 
>  Debugger entered--Lisp error: (error "Before first heading")
>    signal(error ("Before first heading"))
> 
> This is not how org-mode works - S-TAB doesn't fail before first heading
> in org-mode.

Do you suggest to change it to a user-error? Or just be silent?

Yuan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Fri, 16 Oct 2020 03:13:02 GMT) Full text and rfc822 format available.

Message #42 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Stefan Kangas <stefan <at> marxist.se>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Thu, 15 Oct 2020 23:12:01 -0400
[Message part 1 (text/plain, inline)]

> On Oct 15, 2020, at 7:33 PM, Yuan Fu <casouri <at> gmail.com> wrote:
> 
> 
> 
>> On Oct 14, 2020, at 3:24 PM, Juri Linkov <juri <at> linkov.net> wrote:
>> 
>>> Skimming this thread, it seemed that everybody was in agreement that
>>> this was a good change, but the patch was never applied, so I did that
>>> now.
>> 
>> Now finally org keys are available in etc/NEWS, nice!
>> But typing S-TAB at the beginning of etc/NEWS signals the error:
>> 
>> Debugger entered--Lisp error: (error "Before first heading")
>>   signal(error ("Before first heading"))
>> 
>> This is not how org-mode works - S-TAB doesn't fail before first heading
>> in org-mode.
> 
> Do you suggest to change it to a user-error? Or just be silent?
> 

This patch should suppresses errors in both commands. Let me use it for a while and see if it works ok.

Yuan


[outline-fix.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Fri, 16 Oct 2020 05:00:02 GMT) Full text and rfc822 format available.

Message #45 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Stefan Kangas <stefan <at> marxist.se>, 41130 <at> debbugs.gnu.org,
 41198 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Fri, 16 Oct 2020 06:59:37 +0200
Yuan Fu <casouri <at> gmail.com> writes:

> Do you suggest to change it to a user-error? Or just be silent?

Robert suggested:

>     Lars> How does it work in org-mode?
>
> The same as anywhere else: it cycles the visibility of the headings
> downbuffer.

I guess that makes sense?  I don't use outlining, though, so I don't
really know whether that would be surprising behaviour in outline mode,
though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Fri, 16 Oct 2020 08:26:02 GMT) Full text and rfc822 format available.

Message #48 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Stefan Kangas <stefan <at> marxist.se>, Yuan Fu <casouri <at> gmail.com>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#41198: bug#41130: bug#41198: 27.0.60; [PATCH] heading
 cycling command for outline
Date: Fri, 16 Oct 2020 10:25:09 +0200
>>>>> On Fri, 16 Oct 2020 06:59:37 +0200, Lars Ingebrigtsen <larsi <at> gnus.org> said:

    Lars> Yuan Fu <casouri <at> gmail.com> writes:
    >> Do you suggest to change it to a user-error? Or just be silent?

    Lars> Robert suggested:

    Lars> How does it work in org-mode?
    >> 
    >> The same as anywhere else: it cycles the visibility of the headings
    >> downbuffer.

    Lars> I guess that makes sense?  I don't use outlining, though, so I don't
    Lars> really know whether that would be surprising behaviour in outline mode,
    Lars> though.

I donʼt think Iʼd find it surprising. Of course we could fix this by
just adding "* " to the first line of NEWS :-)

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Fri, 16 Oct 2020 08:27:02 GMT) Full text and rfc822 format available.

Message #51 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Stefan Kangas <stefan <at> marxist.se>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Fri, 16 Oct 2020 11:20:41 +0300
>> Now finally org keys are available in etc/NEWS, nice!
>> But typing S-TAB at the beginning of etc/NEWS signals the error:
>>
>>  Debugger entered--Lisp error: (error "Before first heading")
>>    signal(error ("Before first heading"))
>>
>> This is not how org-mode works - S-TAB doesn't fail before first heading
>> in org-mode.
>
> Do you suggest to change it to a user-error? Or just be silent?

To imitate org-mode, maybe outline-mode could temporarily (i.e. by
using save-excursion) navigate to the first heading before running
the rest of outline-cycle-buffer when it's before first heading?

Thank you for this nice feature!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Fri, 16 Oct 2020 19:28:01 GMT) Full text and rfc822 format available.

Message #54 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Stefan Kangas <stefan <at> marxist.se>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Fri, 16 Oct 2020 15:27:33 -0400
[Message part 1 (text/plain, inline)]

> On Oct 16, 2020, at 4:20 AM, Juri Linkov <juri <at> linkov.net> wrote:
> 
>>> Now finally org keys are available in etc/NEWS, nice!
>>> But typing S-TAB at the beginning of etc/NEWS signals the error:
>>> 
>>> Debugger entered--Lisp error: (error "Before first heading")
>>>   signal(error ("Before first heading"))
>>> 
>>> This is not how org-mode works - S-TAB doesn't fail before first heading
>>> in org-mode.
>> 
>> Do you suggest to change it to a user-error? Or just be silent?
> 
> To imitate org-mode, maybe outline-mode could temporarily (i.e. by
> using save-excursion) navigate to the first heading before running
> the rest of outline-cycle-buffer when it's before first heading?


This patch should make outline behaves like org: S-TAB always cycle the whole buffer, regardless where is the point. TAB cycles a heading, and does nothing if point is before the first heading.

Yuan

[outline-fix.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Sat, 17 Oct 2020 06:37:02 GMT) Full text and rfc822 format available.

Message #57 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Stefan Kangas <stefan <at> marxist.se>, 41130 <at> debbugs.gnu.org,
 41198 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Sat, 17 Oct 2020 08:36:47 +0200
Yuan Fu <casouri <at> gmail.com> writes:

> This patch should make outline behaves like org: S-TAB always cycle
> the whole buffer, regardless where is the point. TAB cycles a heading,
> and does nothing if point is before the first heading.

I think the behaviour makes sense, but the implementation isn't ideal:

[...]

> +  (condition-case nil
> +      (pcase (outline--cycle-state)
> +        ('hide-all
> +         (if (outline-has-subheading-p)
> +             (progn (outline-show-children)
> +                    (message "Only headings"))
> +           (outline-show-subtree)
> +           (message "Show all")))
> +        ('headings-only
> +         (outline-show-subtree)
> +         (message "Show all"))
> +        ('show-all
> +         (outline-hide-subtree)
> +         (message "Hide all")))
> +    ;; If error: "Before first heading" occurs, ignore it.
> +    (error nil)))

This is basically an `ignore-errors' around a whole bunch of code, used
as a program flow mechanism, and that's always awkward, because it hides
real errors in the code.

Altering the functions to not error out in these situations would be
better.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Sat, 17 Oct 2020 20:52:02 GMT) Full text and rfc822 format available.

Message #60 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Stefan Kangas <stefan <at> marxist.se>, Yuan Fu <casouri <at> gmail.com>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Sat, 17 Oct 2020 23:30:06 +0300
>> +  (condition-case nil
>> +      (pcase (outline--cycle-state)
>> +        ('hide-all
>> +         (if (outline-has-subheading-p)
>> +             (progn (outline-show-children)
>> +                    (message "Only headings"))
>> +           (outline-show-subtree)
>> +           (message "Show all")))
>> +        ('headings-only
>> +         (outline-show-subtree)
>> +         (message "Show all"))
>> +        ('show-all
>> +         (outline-hide-subtree)
>> +         (message "Hide all")))
>> +    ;; If error: "Before first heading" occurs, ignore it.
>> +    (error nil)))
>
> This is basically an `ignore-errors' around a whole bunch of code, used
> as a program flow mechanism, and that's always awkward, because it hides
> real errors in the code.
>
> Altering the functions to not error out in these situations would be
> better.

Like 'outline-back-to-heading' has an optional argument 'invisible-ok',
maybe a new argument named 'error-ok' or 'outside-ok' could
be added to not error out when point is outside of the outline tree.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Sun, 18 Oct 2020 00:29:02 GMT) Full text and rfc822 format available.

Message #63 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Stefan Kangas <stefan <at> marxist.se>, Lars Ingebrigtsen <larsi <at> gnus.org>,
 41130 <at> debbugs.gnu.org, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Sat, 17 Oct 2020 20:28:25 -0400

> On Oct 17, 2020, at 4:30 PM, Juri Linkov <juri <at> linkov.net> wrote:
> 
>>> +  (condition-case nil
>>> +      (pcase (outline--cycle-state)
>>> +        ('hide-all
>>> +         (if (outline-has-subheading-p)
>>> +             (progn (outline-show-children)
>>> +                    (message "Only headings"))
>>> +           (outline-show-subtree)
>>> +           (message "Show all")))
>>> +        ('headings-only
>>> +         (outline-show-subtree)
>>> +         (message "Show all"))
>>> +        ('show-all
>>> +         (outline-hide-subtree)
>>> +         (message "Hide all")))
>>> +    ;; If error: "Before first heading" occurs, ignore it.
>>> +    (error nil)))
>> 
>> This is basically an `ignore-errors' around a whole bunch of code, used
>> as a program flow mechanism, and that's always awkward, because it hides
>> real errors in the code.
>> 
>> Altering the functions to not error out in these situations would be
>> better.
> 
> Like 'outline-back-to-heading' has an optional argument 'invisible-ok',
> maybe a new argument named 'error-ok' or 'outside-ok' could
> be added to not error out when point is outside of the outline tree.

I can modify outline code to signal a signal (say ‘outline-before-first-heading) rather than an error, and handle that signal specifically. How’s that?

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Sun, 18 Oct 2020 08:37:02 GMT) Full text and rfc822 format available.

Message #66 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Stefan Kangas <stefan <at> marxist.se>, 41130 <at> debbugs.gnu.org,
 41198 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Sun, 18 Oct 2020 10:36:21 +0200
Yuan Fu <casouri <at> gmail.com> writes:

> I can modify outline code to signal a signal (say
> ‘outline-before-first-heading) rather than an error, and handle that
> signal specifically. How’s that?

Yes, that would also work.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Sun, 18 Oct 2020 20:24:02 GMT) Full text and rfc822 format available.

Message #69 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Stefan Kangas <stefan <at> marxist.se>, 41130 <at> debbugs.gnu.org,
 41198 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Sun, 18 Oct 2020 16:23:12 -0400
[Message part 1 (text/plain, inline)]

> On Oct 18, 2020, at 4:36 AM, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> 
> Yuan Fu <casouri <at> gmail.com> writes:
> 
>> I can modify outline code to signal a signal (say
>> ‘outline-before-first-heading) rather than an error, and handle that
>> signal specifically. How’s that?
> 
> Yes, that would also work.
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no

Here is the new patch.

Yuan

[outline-fix.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Mon, 19 Oct 2020 08:46:02 GMT) Full text and rfc822 format available.

Message #72 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Stefan Kangas <stefan <at> marxist.se>, 41130 <at> debbugs.gnu.org,
 41198 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command
 for outline
Date: Mon, 19 Oct 2020 10:45:35 +0200
Yuan Fu <casouri <at> gmail.com> writes:

> Here is the new patch.

Thanks; looks good to me.  I've now pushed it to the trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Sun, 15 Nov 2020 05:51:02 GMT) Full text and rfc822 format available.

Message #75 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: "Paul W. Rankin" <hello <at> paulwrankin.com>
To: 41198 <at> debbugs.gnu.org
Subject: 28.0.50; heading cycling command for outline
Date: Sun, 15 Nov 2020 15:50:31 +1000
Hello,

Sorry to revisit this but there are a few edge cases with the new 
outline-cycle and outline-cycle-buffer commands...


1. In command outline-hide-sublevels#L901 we see:

      ;; Finally unhide any trailing newline.
      (goto-char (point-max))
      (if (and (bolp) (not (bobp)) (outline-invisible-p (1- (point))))
          (outline-flag-region (1- (point)) (point) nil))))

When calling this function the overlay created to hide the buffer's 
final subheading ends at the end-of-subtree - 1. This means that the 
following code in outline--cycle-state#L1130 fails with an off-by-1:

            ((and (eq (overlay-end (car ov-list)) end)
                  (eq (overlay-start (car ov-list)) heading-end))

The result of this is that when calling outline-cycle-buffer to set the 
outline in a top-level state, if the user navigates to the last 
top-level heading and presses TAB for outline-cycle, the expectation is 
to show that heading's subheadings, but the result is show all.

To fix, if leaving outline-hide-sublevels alone, a workaround would be:

diff --git a/lisp/outline.el b/lisp/outline.el
index 47e6528859..054d2cb62b 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1127,7 +1127,7 @@ outline--cycle-state
       (cond ((eq ov-list nil) 'show-all)
             ;; (eq (length ov-list) 1) wouldn’t work: what if there is
             ;; one folded subheading?
-            ((and (eq (overlay-end (car ov-list)) end)
+            ((and (<= 0 (- end (overlay-end (car ov-list))) 1)
                   (eq (overlay-start (car ov-list)) heading-end))
              'hide-all)
             (t 'headings-only)))))


2. This may sound strange, but overlays with an invisible property of 
'outline are not guaranteed to be overlays for collapsed outline 
headings. This is true if a lisp program has used outline-flag-region 
for something other than an outline heading. I had done this for 
collapsing a major mode's notes markup:

    [[ here's a note ]] -> [[...]]

This is simply solved by testing each overlay-start with 
outline-on-heading-p:

diff --git a/lisp/outline.el b/lisp/outline.el
index 054d2cb62b..a05cf87d4e 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1121,10 +1121,15 @@ outline--cycle-state
       (setq heading-end (point))
       (outline-end-of-subtree)
       (setq end (point))
-      (setq ov-list (cl-remove-if-not
-                     (lambda (o) (eq (overlay-get o 'invisible) 
'outline))
-                     (overlays-in start end)))
-      (cond ((eq ov-list nil) 'show-all)
+      (setq ov-list
+            (seq-filter
+             (lambda (o)
+               (and (eq (overlay-get o 'invisible) 'outline)
+                    (save-excursion
+                      (goto-char (overlay-start o))
+                      (outline-on-heading-p t)))))
+            (overlays-in start end)))
+    (cond ((eq ov-list nil) 'show-all)
             ;; (eq (length ov-list) 1) wouldn’t work: what if there is
             ;; one folded subheading?
             ((and (<= 0 (- end (overlay-end (car ov-list))) 1)

n.b. This will fail if the user/program has changed 
outline-heading-end-regexp to have multiple newlines, because 
outline-on-heading-p only checks if it's looking at outline-regexp from 
the beginning of that line.


3. When a buffer contains outline headings of only < 1 (e.g. all 
headings are level 3) calling outline-cycle-buffer to show only 
top-level headings will results in an unexpected buffer state of:

    ...

This is fixed with a simple test of whether the buffer has top-level 
headings before allowing cycling to top-level.


-- 
Paul W. Rankin
https://www.paulwrankin.com

The single best thing you can do for the world is delete your social 
media accounts.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Mon, 16 Nov 2020 22:01:02 GMT) Full text and rfc822 format available.

Message #78 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 41198 <at> debbugs.gnu.org
Cc: "Paul W. Rankin" <hello <at> paulwrankin.com>
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Mon, 16 Nov 2020 22:59:47 +0100
"Paul W. Rankin" via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Sorry to revisit this but there are a few edge cases with the new 
> outline-cycle and outline-cycle-buffer commands...

The patches look OK to me, but look like they've been slightly mangled
during transmission, so could you include them as a single patch as an
attachment?  (And adding a ChangeLog-format text would also be nice.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 17 Nov 2020 03:04:02 GMT) Full text and rfc822 format available.

Message #81 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: "Paul W. Rankin" <pwr <at> skeletons.cc>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Tue, 17 Nov 2020 12:47:33 +1000
[Message part 1 (text/plain, inline)]
On 2020-11-17 07:59, Lars Ingebrigtsen wrote:
> 
> The patches look OK to me, but look like they've been slightly mangled
> during transmission, so could you include them as a single patch as an
> attachment?  (And adding a ChangeLog-format text would also be nice.)

2x patches attached with changelog.

I took a more precise approach with outline--cycle-state, where the +1 
case is only handled when the subtree end is point-max, otherwise the 
overlay-end must equal end of subtree point in all other cases.

I rewrote outline-cycle-buffer; it now first checks that the buffer has 
top-level headings before attempting to show only top-level headings, 
thus avoiding the disconcerting state where all buffer content is 
reduced to "...". If buffer has no outline headings, we still get an 
annoying message toggle from "All headings" to "Show all".

Also this avoids using pcase, which is awful.
[0001-lisp-outline.el-better-handing-of-outline-overlays-w.patch (text/x-diff, attachment)]
[0002-lisp-outline.el-avoid-hiding-all-buffer-content.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 24 Nov 2020 05:10:02 GMT) Full text and rfc822 format available.

Message #84 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Paul W. Rankin" <pwr <at> skeletons.cc>
Cc: 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Tue, 24 Nov 2020 06:09:28 +0100
"Paul W. Rankin" <pwr <at> skeletons.cc> writes:

> 2x patches attached with changelog.

Thanks; looks OK to me, so I've applied it to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Wed, 25 Nov 2020 19:31:01 GMT) Full text and rfc822 format available.

Message #87 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: "Paul W. Rankin" <pwr <at> skeletons.cc>, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Wed, 25 Nov 2020 21:24:02 +0200
>> 2x patches attached with changelog.
>
> Thanks; looks OK to me, so I've applied it to Emacs 28.

BTW, since now S-TAB cycles headings nicely in etc/NEWS,
what about enabling outline-minor-mode in the output
Help buffer of 'C-h b'?  Currently its section
"Key translations" is so long that it takes too much time
to scroll down to the most interesting section
"Major Mode Bindings".  With outline-minor-mode it would
be possible to collapse "Key translations" initially.
Then typing S-TAB would show such nice overview:

* Key translations
* `override-global-mode' Minor Mode Bindings
* `outline-minor-mode' Minor Mode Bindings
* recentf-mode Minor Mode Bindings
* Major Mode Bindings
* Global Bindings
* Function key map translations
* Input decoding map translations




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Thu, 26 Nov 2020 10:14:02 GMT) Full text and rfc822 format available.

Message #90 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: "Paul W. Rankin" <pwr <at> skeletons.cc>, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Thu, 26 Nov 2020 11:13:34 +0100
Juri Linkov <juri <at> linkov.net> writes:

> BTW, since now S-TAB cycles headings nicely in etc/NEWS,
> what about enabling outline-minor-mode in the output
> Help buffer of 'C-h b'?  Currently its section
> "Key translations" is so long that it takes too much time
> to scroll down to the most interesting section
> "Major Mode Bindings".

Yes, that's a general problem, I think -- I'm often tapping `C-h b' to
look for something, but then getting a wall of stuff that's never what
I'm interested in (i.e., the "Key translation" stuff), and no easy way
to navigate to the sections that I'm looking far.

> With outline-minor-mode it would
> be possible to collapse "Key translations" initially.
> Then typing S-TAB would show such nice overview:
>
> * Key translations
> * `override-global-mode' Minor Mode Bindings
> * `outline-minor-mode' Minor Mode Bindings
> * recentf-mode Minor Mode Bindings
> * Major Mode Bindings
> * Global Bindings
> * Function key map translations
> * Input decoding map translations

I think this is a good idea.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Fri, 27 Nov 2020 08:55:02 GMT) Full text and rfc822 format available.

Message #93 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: "Paul W. Rankin" <pwr <at> skeletons.cc>, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Fri, 27 Nov 2020 10:29:52 +0200
>> With outline-minor-mode it would
>> be possible to collapse "Key translations" initially.
>> Then typing S-TAB would show such nice overview:
>>
>> * Key translations
>> * `override-global-mode' Minor Mode Bindings
>> * `outline-minor-mode' Minor Mode Bindings
>> * recentf-mode Minor Mode Bindings
>> * Major Mode Bindings
>> * Global Bindings
>> * Function key map translations
>> * Input decoding map translations
>
> I think this is a good idea.

I tried to modify the format of `C-h b' to output '*' headings,
but unfortunately after enabling `outline-minor-mode'
TAB has no effect on such headings.

I wonder why heading cycling implemented in this bug report
supports only `outline-mode', but not `outline-minor-mode'?

It would make sense in `outline-minor-mode' if TAB typed on a heading
then cycle outline heading.  If TAB is typed outside of a heading,
then use the default TAB binding, e.g. in case of the Help buffer
navigate to the next link.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Fri, 27 Nov 2020 18:41:02 GMT) Full text and rfc822 format available.

Message #96 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: "Paul W. Rankin" <pwr <at> skeletons.cc>, 41198 <at> debbugs.gnu.org
Subject: RE: bug#41198: 28.0.50; heading cycling command for outline
Date: Fri, 27 Nov 2020 10:39:59 -0800 (PST)
> I wonder why heading cycling implemented in this bug report
> supports only `outline-mode', but not `outline-minor-mode'?

`outline-minor-mode' is a thousand times more
useful than `outline-mode', IMO.

There should probably be few cases where no
other major mode makes sense, and we really
want to use `outline-mode'.  (Just a guess.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Sat, 28 Nov 2020 02:00:02 GMT) Full text and rfc822 format available.

Message #99 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: "Paul W. Rankin" <pwr <at> skeletons.cc>
To: Juri Linkov <juri <at> linkov.net>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Sat, 28 Nov 2020 11:58:51 +1000
On 2020-11-27 18:29, Juri Linkov wrote:
> I tried to modify the format of `C-h b' to output '*' headings,
> but unfortunately after enabling `outline-minor-mode'
> TAB has no effect on such headings.
> 
> I wonder why heading cycling implemented in this bug report
> supports only `outline-mode', but not `outline-minor-mode'?
> 
> It would make sense in `outline-minor-mode' if TAB typed on a heading
> then cycle outline heading.  If TAB is typed outside of a heading,
> then use the default TAB binding, e.g. in case of the Help buffer
> navigate to the next link.

This is because it's not possible to know how the underlying major mode 
implements TAB.

For just one example, I maintain a major mode where TAB performs outline 
cycling when at a heading, but calls completion-at-point when at a 
heading but at eolp. The assumption of outline-on-heading-p is 
insufficient to allow outline-minor-mode to hijack TAB.

The correct way to implement what you're suggesting is for the major 
mode to require outline as a library, then alias the cycling commands 
prefixed as MODE-outline-cycle[-buffer] mapped them to TAB/S-TAB in 
their own keymaps.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Thu, 10 Dec 2020 19:09:02 GMT) Full text and rfc822 format available.

Message #102 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Howard Melman <hmelman <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Thu, 10 Dec 2020 14:08:17 -0500
"Paul W. Rankin" via "Bug reports for GNU Emacs, the Swiss
army knife of text editors" <bug-gnu-emacs <at> gnu.org> writes:

> On 2020-11-27 18:29, Juri Linkov wrote:
>> I wonder why heading cycling implemented in this bug
>> report supports only `outline-mode', but not
>> `outline-minor-mode'?  It would make sense in
>> `outline-minor-mode' if TAB typed on a heading then cycle
>> outline heading.  If TAB is typed outside of a heading,
>> then use the default TAB binding, e.g. in case of the
>> Help buffer navigate to the next link.
>
> This is because it's not possible to know how the underlying major
> mode implements TAB.
>
> For just one example, I maintain a major mode where TAB performs
> outline cycling when at a heading, but calls completion-at-point when
> at a heading but at eolp. The assumption of outline-on-heading-p is 
> insufficient to allow outline-minor-mode to hijack TAB.
>
> The correct way to implement what you're suggesting is for the major
> mode to require outline as a library, then alias the cycling commands 
> prefixed as MODE-outline-cycle[-buffer] mapped them to TAB/S-TAB in
> their own keymaps.

I don't follow master so I'm not quite sure what's
implemented, but my original suggestion for this was:

(define-key outline-minor-mode-map (kbd "C-<tab>") 'outline-cycle)
(define-key outline-minor-mode-map (kbd "S-<tab>") 'outline-global-cycle)

It's definitely very useful in outline-minor-mode. I use
this for code folding in prog-modes amongst other things and
that's one of the reasons I used C-TAB for outline-cycle
(since TAB often has other uses in prog-modes).

AFAIR people commented that C-TAB wasn't always available in
some terminals and said it should just be on TAB.  Fine.
Either way S-TAB should work.

I'd argue that if you're enabling outline-minor-mode in a
major mode that has a binding for TAB, you want it to be
overridden.  If not, don't enable the minor mode or change
one keymap to not conflict.  Maybe outline-minor-mode should
support a variable option a major mode could set to change
the TAB keybinding or at least not override it with a
minor-mode binding?

-- 

Howard





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Sat, 12 Dec 2020 21:09:02 GMT) Full text and rfc822 format available.

Message #105 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Howard Melman <hmelman <at> gmail.com>
Cc: 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Sat, 12 Dec 2020 22:57:02 +0200
> I don't follow master so I'm not quite sure what's
> implemented, but my original suggestion for this was:
>
> (define-key outline-minor-mode-map (kbd "C-<tab>") 'outline-cycle)
> (define-key outline-minor-mode-map (kbd "S-<tab>") 'outline-global-cycle)
>
> It's definitely very useful in outline-minor-mode. I use
> this for code folding in prog-modes amongst other things and
> that's one of the reasons I used C-TAB for outline-cycle
> (since TAB often has other uses in prog-modes).
>
> AFAIR people commented that C-TAB wasn't always available in
> some terminals and said it should just be on TAB.  Fine.
> Either way S-TAB should work.
>
> I'd argue that if you're enabling outline-minor-mode in a
> major mode that has a binding for TAB, you want it to be
> overridden.  If not, don't enable the minor mode or change
> one keymap to not conflict.  Maybe outline-minor-mode should
> support a variable option a major mode could set to change
> the TAB keybinding or at least not override it with a
> minor-mode binding?

This feature request was closed, so in a new feature request
in https://debbugs.gnu.org/45147#8 this is implemented as a new variable
'outline-minor-mode-cycle' that you can set to t to allow cycling keys
in 'outline-minor-mode', and a keymap 'outline-mode-cycle-map' where you
can define your bindings such as C-TAB instead of the default key TAB.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Mon, 14 Dec 2020 20:39:02 GMT) Full text and rfc822 format available.

Message #108 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Howard Melman <hmelman <at> gmail.com>
Cc: 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Mon, 14 Dec 2020 22:31:57 +0200
> I don't follow master so I'm not quite sure what's
> implemented, but my original suggestion for this was:
>
> (define-key outline-minor-mode-map (kbd "C-<tab>") 'outline-cycle)
> (define-key outline-minor-mode-map (kbd "S-<tab>") 'outline-global-cycle)

This is what's implemented in master:

(define-key outline-minor-mode-map (kbd "<C-tab>") 'outline-cycle)
(define-key outline-minor-mode-map (kbd "<backtab>") 'outline-cycle-buffer)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 15 Dec 2020 00:11:02 GMT) Full text and rfc822 format available.

Message #111 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Howard Melman <hmelman <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Mon, 14 Dec 2020 19:09:58 -0500
Juri Linkov <juri <at> linkov.net> writes:

>> I don't follow master so I'm not quite sure what's
>> implemented, but my original suggestion for this was:
>>
>> (define-key outline-minor-mode-map (kbd "C-<tab>") 'outline-cycle)
>> (define-key outline-minor-mode-map (kbd "S-<tab>") 'outline-global-cycle)
>
> This is what's implemented in master:
>
> (define-key outline-minor-mode-map (kbd "<C-tab>") 'outline-cycle)
> (define-key outline-minor-mode-map (kbd "<backtab>") 'outline-cycle-buffer)

Sounds great.  I look forward to Emacs 28.

-- 

Howard





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 15 Dec 2020 03:47:02 GMT) Full text and rfc822 format available.

Message #114 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Howard Melman <hmelman <at> gmail.com>, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Tue, 15 Dec 2020 09:16:04 +0530
Juri Linkov <juri <at> linkov.net> writes:

>> I don't follow master so I'm not quite sure what's
>> implemented, but my original suggestion for this was:
>>
>> (define-key outline-minor-mode-map (kbd "C-<tab>") 'outline-cycle)
>> (define-key outline-minor-mode-map (kbd "S-<tab>") 'outline-global-cycle)
>
> This is what's implemented in master:
>
> (define-key outline-minor-mode-map (kbd "<C-tab>") 'outline-cycle)
> (define-key outline-minor-mode-map (kbd "<backtab>") 'outline-cycle-buffer)

1. <tab> and <C-tab> have same binding on master i.e. both invoking
‘outline-cycle’.

2. Body of last heading doesn’t hide when using the above command.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 15 Dec 2020 09:21:02 GMT) Full text and rfc822 format available.

Message #117 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: Howard Melman <hmelman <at> gmail.com>, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Tue, 15 Dec 2020 11:10:40 +0200
>>> I don't follow master so I'm not quite sure what's
>>> implemented, but my original suggestion for this was:
>>>
>>> (define-key outline-minor-mode-map (kbd "C-<tab>") 'outline-cycle)
>>> (define-key outline-minor-mode-map (kbd "S-<tab>") 'outline-global-cycle)
>>
>> This is what's implemented in master:
>>
>> (define-key outline-minor-mode-map (kbd "<C-tab>") 'outline-cycle)
>> (define-key outline-minor-mode-map (kbd "<backtab>") 'outline-cycle-buffer)
>
> 1. <tab> and <C-tab> have same binding on master i.e. both invoking
> ‘outline-cycle’.

I meant that with current master it's possible to add these bindings
in the init file because C-TAB and S-TAB they can't be bound by default
in outline-minor-mode to not interfere with major mode key bindings.

In outline-mode (not minor) in current master, TAB is bound to outline-cycle,
and S-TAB is bound to outline-cycle-buffer, but C-TAB is unbound in outline-mode
to not interfere with other uses of C-TAB.

> 2. Body of last heading doesn’t hide when using the above command.

This sounds like a bug.  Please provide a recipe for reproducing it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 15 Dec 2020 10:43:01 GMT) Full text and rfc822 format available.

Message #120 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Howard Melman <hmelman <at> gmail.com>, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Tue, 15 Dec 2020 16:12:08 +0530
Juri Linkov <juri <at> linkov.net> writes:

>> 2. Body of last heading doesn’t hide when using the above command.
>
> This sounds like a bug.  Please provide a recipe for reproducing it.

Sorry. This was my fault. Somehow I was expecting all headings to
collapse with TAB key. TAB and S-TAB are perfectly working.

Not related. At present, I am on a text base virtual terminal on
Debian. And S-TAB is invoking C-M-i which triggers
ispell-complete-word. Is this a bug? To test the above thing,I had to
startx.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Tue, 15 Dec 2020 20:24:03 GMT) Full text and rfc822 format available.

Message #123 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: Howard Melman <hmelman <at> gmail.com>, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Tue, 15 Dec 2020 22:23:19 +0200
> Not related. At present, I am on a text base virtual terminal on
> Debian. And S-TAB is invoking C-M-i which triggers
> ispell-complete-word. Is this a bug? To test the above thing,I had to
> startx.

Doesn't look like a bug.  S-TAB is unavailable on some terminals.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41198; Package emacs. (Wed, 16 Dec 2020 04:03:02 GMT) Full text and rfc822 format available.

Message #126 received at 41198 <at> debbugs.gnu.org (full text, mbox):

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Howard Melman <hmelman <at> gmail.com>, 41198 <at> debbugs.gnu.org
Subject: Re: bug#41198: 28.0.50; heading cycling command for outline
Date: Wed, 16 Dec 2020 09:32:24 +0530
Juri Linkov <juri <at> linkov.net> writes:

>> Not related. At present, I am on a text base virtual terminal on
>> Debian. And S-TAB is invoking C-M-i which triggers
>> ispell-complete-word. Is this a bug? To test the above thing,I had to
>> startx.
>
> Doesn't look like a bug.  S-TAB is unavailable on some terminals.

I guess, I was not clear enough. By text based virtual terminal I meant
when X is not running. The default text console of debian.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 13 Jan 2021 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 97 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.