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 14:31:52 -0400 Message-ID: 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=_C326A5FC-00B3-4BF7-ACC6-56221F24B8BE" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="12659"; 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 Tue May 19 20:33:13 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 1jb73A-00037B-Gz for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 May 2020 20:33:12 +0200 Original-Received: from localhost ([::1]:48942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jb739-0006BQ-Fr for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 May 2020 14:33:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jb730-00068P-5T for bug-gnu-emacs@gnu.org; Tue, 19 May 2020 14:33:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39407) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jb72z-0001dO-Sl for bug-gnu-emacs@gnu.org; Tue, 19 May 2020 14:33:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jb72z-0004Qm-Pz for bug-gnu-emacs@gnu.org; Tue, 19 May 2020 14:33: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: Tue, 19 May 2020 18:33: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.158991313716049 (code B ref 41130); Tue, 19 May 2020 18:33:01 +0000 Original-Received: (at 41130) by debbugs.gnu.org; 19 May 2020 18:32:17 +0000 Original-Received: from localhost ([127.0.0.1]:50953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jb72C-00046j-6L for submit@debbugs.gnu.org; Tue, 19 May 2020 14:32:16 -0400 Original-Received: from mail-qk1-f171.google.com ([209.85.222.171]:36438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jb721-0003sA-EQ; Tue, 19 May 2020 14:32:06 -0400 Original-Received: by mail-qk1-f171.google.com with SMTP id y22so623943qki.3; Tue, 19 May 2020 11:32:01 -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=qrH1UbxjXXW4oks7QAHIe9LdluTx9zGRQEMZ+Cs0qQ8=; b=MJH3GhoaGfK/Md7WbwacZJZaIIafVObQHZqgEgYMU+ilgG0sGQIPuwEDdvSdoSo8pG lXpkzmmhJvrkpm69BOXik8AV0LpFFB5F4njszflRUdVSYRaNfkVwqxAb1V0dTeBh55jc kRVFrXR6JvwsjdodUJgUBjqKEQFbd0I/HtkyV66TlFBmPWX/hEKS/3CxOaC+QHk0iCtO ms+DPGdSObGNPK7t+QF1l6L8UT+JVWb4LmX6rouher9iKofS4MNZNEdiTiSSkEXC/EQ0 t8EpiKIB2/XQ0Eh9KNytWevLkBvATHcFNAYcKMbAAdac0qZU17UA0SaSuDoDWD28NteN 68JQ== 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=qrH1UbxjXXW4oks7QAHIe9LdluTx9zGRQEMZ+Cs0qQ8=; b=aZSFCVNmMTB3e49bGMUgbzvjxiCbxngKkRdRqk3M0tVMN8vDJFrwntm0Rhw38TuA+l IHVL/xFoFqiBt0/GzZBK0S/U6ygqK5vt/8iUTxL9hUWqiX57cFl/9kNBNaVgdbZg0UdW 9YldSYFa8SorD2jpTQCqfaPanfSE4lGTHfIb4kdrMrYG3xlpq+w4YG284awAwADVXxh8 fVSpu+SjLHT+GTiKQLVuEfcwJz+PBzDBeb/briVgdnyqqFG1NF38vDC+hak4E53vtLCN Rd9Z8T+wOt6cMSJa6VSfyh2/DFtAxKE1ek7fU4kFgwIb0K3fh6DSB0UCTjMF9G9X81R5 zt9Q== X-Gm-Message-State: AOAM530igyPzb5kayQ/NrqCRB0CnmlVCS6TQ/yfue8PHIwEKuQ10azPv TgejcrzyFnhtvFZgsEB1bfB38JtlOMAJ0Q== X-Google-Smtp-Source: ABdhPJw+cp1YNXD727FPFhKiWoIL00W8yOmwWMmA/FDh2FlmVX5hDsBmBmMG/oc+BhfYH5kvos174w== X-Received: by 2002:a37:498a:: with SMTP id w132mr678106qka.221.1589913114608; Tue, 19 May 2020 11:31:54 -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 w43sm430486qtw.68.2020.05.19.11.31.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 May 2020 11:31:54 -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:180608 Archived-At: --Apple-Mail=_C326A5FC-00B3-4BF7-ACC6-56221F24B8BE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 18, 2020, at 10:45 PM, Stefan Kangas wrote: >=20 > forcemerge 41130 41198 > thanks >=20 > Yuan Fu writes: >=20 >> Add two commands that cycles a heading (like that in Org mode) in = outline-mode: >>=20 >> - outline-cycle: cycles between =E2=80=9Chide all=E2=80=9D, =E2=80=9Csu= b headings=E2=80=9D and =E2=80=9Cshow all=E2=80=9D state. They are = called =E2=80=9CFOLDED=E2=80=9D, =E2=80=9CCHILDREN=E2=80=9D, = =E2=80=9CSUBTREE=E2=80=9D in Org mode. >> - outline-cycle-buffer: cycles between =E2=80=9Conly top level = headings=E2=80=9D, =E2=80=9Call headings=E2=80=9D, =E2=80=9Cshow all=E2=80= =9D states >=20 > Thanks for working on this. I've tested your patch, and it seems to > work as advertised. Thanks. >=20 >> Could this be useful? >=20 > 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. >=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? 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 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=E2=80=99s = automatically generated from commit messages? >=20 >> +(defun outline-cycle () >> + "Cycle between =E2=80=9Chide all=E2=80=9D, =E2=80=9Cheadings = only=E2=80=9D and =E2=80=9Cshow all=E2=80=9D. >> + >> +=E2=80=9CHide all=E2=80=9D means hide all subheadings and their = bodies. >> +=E2=80=9CHeadings only=E2=80=9D means show sub headings but not = their bodies. >> +=E2=80=9CShow all=E2=80=9D means show all subheadings and their = bodies." >=20 > 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? >=20 Done. Yuan --Apple-Mail=_C326A5FC-00B3-4BF7-ACC6-56221F24B8BE Content-Disposition: attachment; filename=outline.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="outline.patch" Content-Transfer-Encoding: quoted-printable diff=20--git=20a/doc/emacs/text.texi=20b/doc/emacs/text.texi=0Aindex=20= 281e24421c..e2f829b7c5=20100644=0A---=20a/doc/emacs/text.texi=0A+++=20= b/doc/emacs/text.texi=0A@@=20-1207,6=20+1207,15=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=20heading=20and=20the=20whole=20buffer.=20=20= @code{outline-cycle}=0A+cycles=20the=20current=20heading=20between=20= "hide=20all",=20"subheadings",=20and=0A+"show=20all"=20state.=20=20= @code{outline-cycle-buffer}=20cycles=20the=20whole=20buffer=0A+between=20= "only=20top-level=20headings",=20"all=20headings=20and=20subheadings",=20= and=0A+"show=20all"=20states.=0A+=0A=20@anchor{Outline=20Search}=0A=20= @findex=20reveal-mode=0A=20@vindex=20search-invisible=0Adiff=20--git=20= a/etc/NEWS=20b/etc/NEWS=0Aindex=20025d5c14a7..3ecec6d0e4=20100644=0A---=20= a/etc/NEWS=0A+++=20b/etc/NEWS=0A@@=20-288,6=20+288,14=20@@=20prefix=20on=20= the=20Subject=20line=20in=20various=20languages.=0A=20These=20new=20= navigation=20commands=20are=20bound=20to=20'n'=20and=20'p'=20in=0A=20= 'apropos-mode'.=0A=20=0A+**=20Outline=0A+=0A+***=20New=20commands=20to=20= cycle=20heading=20visibility.=0A+'outline-cycle'=20cycles=20the=20= current=20heading=20between=20"hide=20all",=0A+"subheadings",=20and=20= "show=20all"=20state.=20'outline-cycle-buffer'=20cycles=20the=0A+whole=20= buffer=20between=20"only=20top-level=20headings",=20"all=20headings=20= and=0A+subheadings",=20and=20"show=20all"=20states.=0A+=0A=20=0C=0A=20*=20= New=20Modes=20and=20Packages=20in=20Emacs=2028.1=0A=20=0Adiff=20--git=20= a/lisp/outline.el=20b/lisp/outline.el=0Aindex=2028ea8a86e6..8dd1b4483c=20= 100644=0A---=20a/lisp/outline.el=0A+++=20b/lisp/outline.el=0A@@=20= -1118,6=20+1118,77=20@@=20outline-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=20= state=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=20heading-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=20= heading-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=20= ov-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=20ov-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:=20= what=20if=20there=20is=0A+=20=20=20=20=20=20=20=20=20=20=20=20;;=20one=20= folded=20subheading?=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= --Apple-Mail=_C326A5FC-00B3-4BF7-ACC6-56221F24B8BE--