From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#41130: bug#41198: 27.0.60; [PATCH] heading cycling command for outline Date: Tue, 19 May 2020 21:37:26 -0400 Message-ID: <92D944EF-6BF9-4635-AC05-4B51B386D5C7@gmail.com> References: <452A6049-893A-4E7E-8349-541D276FAD19@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_27772D71-6B93-4500-B432-5A6FDB60B7C8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="124066"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41130@debbugs.gnu.org, 41198@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 20 03:38:11 2020 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 1jbDgP-000WBL-Um for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 May 2020 03:38:10 +0200 Original-Received: from localhost ([::1]:53392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jbDgP-0001fx-0m for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 May 2020 21:38:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbDgI-0001fj-6N for bug-gnu-emacs@gnu.org; Tue, 19 May 2020 21:38:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40099) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbDgH-0007DD-TK for bug-gnu-emacs@gnu.org; Tue, 19 May 2020 21:38:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jbDgH-0004QX-QM for bug-gnu-emacs@gnu.org; Tue, 19 May 2020 21:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 May 2020 01:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41130 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 41130-submit@debbugs.gnu.org id=B41130.158993865916986 (code B ref 41130); Wed, 20 May 2020 01:38:01 +0000 Original-Received: (at 41130) by debbugs.gnu.org; 20 May 2020 01:37:39 +0000 Original-Received: from localhost ([127.0.0.1]:51645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbDfu-0004Pp-TI for submit@debbugs.gnu.org; Tue, 19 May 2020 21:37:39 -0400 Original-Received: from mail-qk1-f170.google.com ([209.85.222.170]:37626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbDfq-0004PU-VZ; Tue, 19 May 2020 21:37:36 -0400 Original-Received: by mail-qk1-f170.google.com with SMTP id m11so2085395qka.4; Tue, 19 May 2020 18:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=VpIr1QcZKldXX8v8VYkKPHWnRedJda5xRPXwJAK0sqs=; b=d+vqLdWDxy7xcP287Q+nS+1QuS51kLO0TShAzhNUBUGHKkJE7gt0aIdR0pvNbhsiyC Lf7V9kMk4N2ibW80Ywb8qRkshrvAzVJP5qLPOrOkYk6RxZ/XaWszzyls83gsyDh9pgKo IfL/woeVZqhBMdyVZYycbib2mlbMCI2JM0IgQdgrEPgYgcWQzzXDEoQRvi1mws44JzsI QqXOXaIumrGmHFcvCas/wZJxsRL+4DdsuWmo3rPzEYnXi78lG5GXyS+eBnlFFRuXA9KJ +ED20DulzEJ2vE57Tm3jDt9qToZUG328ybP30QNM3wRZumhPElx3hPvXkrhp9jhHlc9e Qyrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=VpIr1QcZKldXX8v8VYkKPHWnRedJda5xRPXwJAK0sqs=; b=mKXPpUdluVhjTlSzfYgkOlvvgYBwyqUlnsJaalO7YhWB0CoVXDHwFJJVIwlAwokScp 3718S22n4dnGPWLwMrKKKQlbflzPNV26bNXCgHnFZgviQUuA5WrFiaqQsAuUd/3mxlZ9 6vnanA5jFf7K1JJUxM23DY9De8toNyoPsbfcZUsJ0FBpR4H9ZZx8LygcwW1mIU6ahsmr OMjGdcrXYAehcCTXFTyp7rzB1BiY3vymYmbEak1WHDqx7wqlIZZqqKlqme/gZ/4S3hal i31nyqNSHrbO0/qWHaedG1bq9ESsfYJ2i6pVNp2eUDmCq8s9Tu7ktr0FRYBkZO/tQvT9 758Q== X-Gm-Message-State: AOAM532A6uFHDcSHOBVixcaRS0uJSLmofo1IHz6JSh4LXe5WCI00ifKd eoDUKgwOcxYR8KfP1vTEcPfTCpc49DUx2g== X-Google-Smtp-Source: ABdhPJwEbOfRR0+SBNNf7ESFlX51o43v2iVDdZM2LTDOBldNotmnD0w4bSIJtX9Epj/gYBKUZI3XgA== X-Received: by 2002:a37:7143:: with SMTP id m64mr2573475qkc.215.1589938649107; Tue, 19 May 2020 18:37:29 -0700 (PDT) Original-Received: from [192.168.1.5] (c-174-60-229-153.hsd1.pa.comcast.net. [174.60.229.153]) by smtp.gmail.com with ESMTPSA id n31sm1486530qtc.36.2020.05.19.18.37.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 May 2020 18:37:28 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3608.80.23.2.2) 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:180639 Archived-At: --Apple-Mail=_27772D71-6B93-4500-B432-5A6FDB60B7C8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 19, 2020, at 6:36 PM, Stefan Kangas wrote: >=20 > Yuan Fu writes: >=20 >>> 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? >>=20 >> 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? >=20 > 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. >=20 > 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. >=20 > 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 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=E2=80=94only 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 =E2=80=9Cshow = all=E2=80=9D, =E2=80=9Chide all=E2=80=9D, etc (because they make sense), = but Org mode prints stuff like =E2=80=9CCHILDREN=E2=80=9D, = =E2=80=9CSUBTREE=E2=80=9D, etc. >=20 >>> I think we also need ChangeLog in the commit message, an entry in = NEWS, >>> and updates to the manual. >>=20 >> I updated NEWS and the manual. For ChangeLog, I thought that=E2=80=99s >> automatically generated from commit messages? >=20 > That is my understanding too. >=20 > 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. >=20 > (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=E2=80=99t = notice that the commit message is gone. It is included this time. >=20 >> +@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. >=20 > Looks good to me (but should refer to the above keybindings if they're > added). Yuan --Apple-Mail=_27772D71-6B93-4500-B432-5A6FDB60B7C8 Content-Disposition: attachment; filename=outline.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="outline.patch" Content-Transfer-Encoding: quoted-printable =46rom=20243d6dec5c33c7add2fd12fe0da3e49a134cf0a9=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Sun,=20= 10=20May=202020=2017:10:32=20-0400=0ASubject:=20[PATCH]=20Add=20cycling=20= commands=20to=20outline=0A=0A*=20lisp/outline.el=20= (outline--cycle-state,=20outline-has-subheading-p,=0Aoutline-cycle,=20= outline-cycle-buffer):=20New=20functions.=0A(outline-mode-map):=20Add=20= key=20bindings=20for=20the=20two=20new=20commands.=0A= (outline--cycle-buffer-state):=20New=20variable.=0A*=20= doc/emacs/text.text=20(Outline=20Visibility):=20Add=20'outline-cycle'=20= and=0A'outline-cycle-buffer'.=0A*=20etc/NEWS=20(Outline):=20Record=20the=20= change.=0A---=0A=20doc/emacs/text.texi=20|=2010=20++++++=0A=20etc/NEWS=20= =20=20=20=20=20=20=20=20=20=20=20|=20=209=20++++++=0A=20lisp/outline.el=20= =20=20=20=20|=2077=20+++++++++++++++++++++++++++++++++++++++++++++=0A=20= 3=20files=20changed,=2096=20insertions(+)=0A=0Adiff=20--git=20= a/doc/emacs/text.texi=20b/doc/emacs/text.texi=0Aindex=20= 281e24421c..9c2822ce15=20100644=0A---=20a/doc/emacs/text.texi=0A+++=20= b/doc/emacs/text.texi=0A@@=20-1207,6=20+1207,16=20@@=20Outline=20= Visibility=0A=20it=20completely=20reveals=20all=20the=20@var{n}=20top=20= levels=20and=20the=20body=20lines=0A=20before=20the=20first=20heading.=0A= =20=0A+@findex=20outline-cycle=0A+@findex=20outline-cycle-buffer=0A+=20=20= Outline=20also=20provides=20two=20convenience=20commands=20to=20cycle=20= the=0A+visibility=20of=20each=20section=20and=20the=20whole=20buffer.=20=20= Typing=20@kbd{TAB}=20on=0A+a=20heading=20invokes=20@code{outline-cycle},=20= which=20cycles=20the=20current=0A+section=20between=20"hide=20all",=20= "subheadings",=20and=20"show=20all"=20state.=0A+Typing=20@kbd{S-TAB}=20= invokes=20@code{outline-cycle-buffer},=20which=20cycles=0A+the=20whole=20= buffer=20between=20"only=20top-level=20headings",=20"all=20headings=20= and=0A+subheadings",=20and=20"show=20all"=20states.=0A+=0A=20= @anchor{Outline=20Search}=0A=20@findex=20reveal-mode=0A=20@vindex=20= search-invisible=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20= 025d5c14a7..72057af94d=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A= @@=20-288,6=20+288,15=20@@=20prefix=20on=20the=20Subject=20line=20in=20= various=20languages.=0A=20These=20new=20navigation=20commands=20are=20= bound=20to=20'n'=20and=20'p'=20in=0A=20'apropos-mode'.=0A=20=0A+**=20= Outline=0A+=0A+***=20New=20commands=20to=20cycle=20heading=20visibility=0A= +=0A+Typing=20'TAB'=20on=20a=20heading=20cycles=20the=20current=20= section=20between=20"hide=0A+all",=20"subheadings",=20and=20"show=20all"=20= state.=20Typing=20'S-TAB'=20anywhere=20in=0A+the=20buffer=20cycles=20the=20= whole=20buffer=20between=20"only=20top-level=20headings",=0A+"all=20= headings=20and=20subheadings",=20and=20"show=20all"=20states.=0A+=0A=20=0C= =0A=20*=20New=20Modes=20and=20Packages=20in=20Emacs=2028.1=0A=20=0Adiff=20= --git=20a/lisp/outline.el=20b/lisp/outline.el=0Aindex=20= 28ea8a86e6..0d792dd28c=20100644=0A---=20a/lisp/outline.el=0A+++=20= b/lisp/outline.el=0A@@=20-179,6=20+179,12=20@@=20outline-mode-map=0A=20=20= =20(let=20((map=20(make-sparse-keymap)))=0A=20=20=20=20=20(define-key=20= map=20"\C-c"=20outline-mode-prefix-map)=0A=20=20=20=20=20(define-key=20= map=20[menu-bar]=20outline-mode-menu-bar-map)=0A+=20=20=20=20;;=20Only=20= takes=20effect=20if=20the=20point=20is=20on=20a=20heading.=0A+=20=20=20=20= (define-key=20map=20(kbd=20"TAB")=0A+=20=20=20=20=20=20`(menu-item=20""=20= outline-cycle=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= :filter=20,(lambda=20(cmd)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(when=20(outline-on-heading-p)=20= cmd))))=0A+=20=20=20=20(define-key=20map=20(kbd=20"")=20= #'outline-cycle-buffer)=0A=20=20=20=20=20map))=0A=20=0A=20(defvar=20= outline-font-lock-keywords=0A@@=20-1118,6=20+1124,77=20@@=20= outline-headers-as-kill=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(insert=20"\n\n"))))))=0A=20=20=20=20=20=20=20=20=20=20=20= (kill-new=20(buffer-string)))))))=0A=20=0A+(defun=20outline--cycle-state=20= ()=0A+=20=20"Return=20the=20cycle=20state=20of=20current=20heading.=0A= +Return=20either=20'hide-all,=20'headings-only,=20or=20'show-all."=0A+=20= =20(save-excursion=0A+=20=20=20=20(let=20(start=20end=20ov-list=20= heading-end)=0A+=20=20=20=20=20=20(outline-back-to-heading)=0A+=20=20=20=20= =20=20(setq=20start=20(point))=0A+=20=20=20=20=20=20= (outline-end-of-heading)=0A+=20=20=20=20=20=20(setq=20heading-end=20= (point))=0A+=20=20=20=20=20=20(outline-end-of-subtree)=0A+=20=20=20=20=20= =20(setq=20end=20(point))=0A+=20=20=20=20=20=20(setq=20ov-list=20= (cl-remove-if-not=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(lambda=20(o)=20(eq=20(overlay-get=20o=20'invisible)=20= 'outline))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(overlays-in=20start=20end)))=0A+=20=20=20=20=20=20(cond=20((eq=20= ov-list=20nil)=20'show-all)=0A+=20=20=20=20=20=20=20=20=20=20=20=20;;=20= (eq=20(length=20ov-list)=201)=20wouldn=E2=80=99t=20work:=20what=20if=20= there=20is=0A+=20=20=20=20=20=20=20=20=20=20=20=20;;=20one=20folded=20= subheading?=0A+=20=20=20=20=20=20=20=20=20=20=20=20((and=20(eq=20= (overlay-end=20(car=20ov-list))=20end)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(eq=20(overlay-start=20(car=20ov-list))=20= heading-end))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20'hide-all)=0A+=20= =20=20=20=20=20=20=20=20=20=20=20(t=20'headings-only)))))=0A+=0A+(defun=20= outline-has-subheading-p=20()=0A+=20=20"Return=20t=20if=20this=20heading=20= has=20subheadings,=20nil=20otherwise."=0A+=20=20(save-excursion=0A+=20=20= =20=20(outline-back-to-heading)=0A+=20=20=20=20(<=20(save-excursion=20= (outline-next-heading)=20(point))=0A+=20=20=20=20=20=20=20= (save-excursion=20(outline-end-of-subtree)=20(point)))))=0A+=0A+(defun=20= outline-cycle=20()=0A+=20=20"Cycle=20between=20`hide=20all',=20`headings=20= only'=20and=20`show=20all'.=0A+=0A+`Hide=20all'=20means=20hide=20all=20= subheadings=20and=20their=20bodies.=0A+`Headings=20only'=20means=20show=20= sub=20headings=20but=20not=20their=20bodies.=0A+`Show=20all'=20means=20= show=20all=20subheadings=20and=20their=20bodies."=0A+=20=20(interactive)=0A= +=20=20(pcase=20(outline--cycle-state)=0A+=20=20=20=20('hide-all=20(if=20= (outline-has-subheading-p)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(progn=20(outline-show-children)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(message=20"Only=20= headings"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (outline-show-subtree)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(message=20"Show=20all")))=0A+=20=20=20=20('headings-only=20= (outline-show-subtree)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(message=20"Show=20all"))=0A+=20=20=20=20('show-all=20= (outline-hide-subtree)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (message=20"Hide=20all"))))=0A+=0A+(defvar-local=20= outline--cycle-buffer-state=20'show-all=0A+=20=20"Internal=20variable=20= used=20for=20tracking=20buffer=20cycle=20state.")=0A+=0A+(defun=20= outline-cycle-buffer=20()=0A+=20=20"Cycle=20the=20whole=20buffer=20like=20= in=20`outline-cycle'."=0A+=20=20(interactive)=0A+=20=20(pcase=20= outline--cycle-buffer-state=0A+=20=20=20=20('show-all=20(save-excursion=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(let=20((start-point=20= (point)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (while=20(not=20(eq=20(point)=20start-point))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(outline-up-heading=201))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (outline-hide-sublevels=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(progn=20(outline-back-to-heading)=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(funcall=20= 'outline-level)))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (setq=20outline--cycle-buffer-state=20'top-level)=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(message=20"Top=20level=20headings"))=0A+=20=20=20= =20('top-level=20(outline-show-all)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(outline-hide-region-body=20(point-min)=20(point-max))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20= outline--cycle-buffer-state=20'all-heading)=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(message=20"All=20headings"))=0A+=20=20=20=20= ('all-heading=20(outline-show-all)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(setq=20outline--cycle-buffer-state=20'show-all)=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(message=20"Show=20= all"))))=0A+=0A=20(provide=20'outline)=0A=20(provide=20'noutline)=0A=20=0A= --=20=0A2.26.1=0A=0A= --Apple-Mail=_27772D71-6B93-4500-B432-5A6FDB60B7C8 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_27772D71-6B93-4500-B432-5A6FDB60B7C8--