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#41198: 27.0.60; [PATCH] heading cycling command for outline Date: Mon, 11 May 2020 21:52:25 -0400 Message-ID: <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=_CC3C253A-5129-4254-A5DF-DF5C1E4BB804" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="6519"; mail-complaints-to="usenet@ciao.gmane.io" To: 41198@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 12 03:53:12 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 1jYK6a-0001aH-07 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 May 2020 03:53:12 +0200 Original-Received: from localhost ([::1]:43902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYK6Y-0007gA-Ld for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 May 2020 21:53:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYK6Q-0007fx-LS for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 21:53:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42189) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYK6Q-0001Pc-CI for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 21:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jYK6Q-0002Gv-BG for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 21:53:02 -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, 12 May 2020 01:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41198 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Bug Report Emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.15892483528689 (code B ref -1); Tue, 12 May 2020 01:53:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 May 2020 01:52:32 +0000 Original-Received: from localhost ([127.0.0.1]:53735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYK5w-0002G5-DB for submit@debbugs.gnu.org; Mon, 11 May 2020 21:52:32 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:49162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYK5u-0002Fx-SC for submit@debbugs.gnu.org; Mon, 11 May 2020 21:52:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYK5u-0007d2-KP for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 21:52:30 -0400 Original-Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:41679) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYK5s-0001Km-PB for bug-gnu-emacs@gnu.org; Mon, 11 May 2020 21:52:30 -0400 Original-Received: by mail-qv1-xf2d.google.com with SMTP id v15so1483376qvr.8 for ; Mon, 11 May 2020 18:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:message-id:date:to; bh=M0PZyrrzagsTrB5CODGbbD48PFhPpoNBFHgXbRzXAjM=; b=dnj9fCELEh57bkaBquzaBBuiTMezm7UwBbANUs1Y1/+XdCbTFlFtsQSE75YwDM1YSX rF6ok86/nlKDhiVcvv/LGoULjhDRlWwtIdVk/FXVbNTE+30mzJtCwrMuzlBgxrLwwCzl v+eeun7/Q65mG9w8o6lLWvvlK/j20l1PrZI9VP5enDvT4HsfWpXcqVYGHdW6DpPBBHN/ v5+eFN+qgECcvwvULaRL/A4h+Y6bo2P1YOmrs0zLZvhMrSE3ZZ7F24b8sFPVmqjx92f5 x85GYucNLAZgBZS/igip8TFQsWcTQNgi8Q5qbnOMUwFb+v4FaZDprZ4dWcJNSwBEofAq xN/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:date:to; bh=M0PZyrrzagsTrB5CODGbbD48PFhPpoNBFHgXbRzXAjM=; b=mCVSoLNIl816OgxMhTn+W67+jkf2pO5ZdDTkOQirs75SgpV6O3iAGguY+qwFvuIEHg rLlVeGkFWLRR2XL7Pm3Scm/z+cVDPEL4DsQ0MlFYPO29LThhzgAWCxu5MimbpOBdu0Qz gKfft4bhfer8pLCoH12kAKH8rRrgWywt8yLspgvRgPk9vfDSVpUaU5kpjLwnhO30GCK3 7XCeVq+SR14OHHWdr8brF6TLG5VyAEkIeeUjt5ajHgVkZ8S1G4c5ByFrhPXQWTmzDlNu 2QBAh4umJru2hLDzyJ2M1oOtfZ6WJM57U+r1NSGCkXr6tR0jvMO1bM9ynrFnvGLgAFHl 6WCA== X-Gm-Message-State: AGi0PuZxIfwkBufNI0O2qZ3ejf2X6M7lMXHKX7sZeDaEzbPKqVE1CUQV 4kdL+Pl4BxjXvdvpzOk/wrohkNfVxLjvPQ== X-Google-Smtp-Source: APiQypJhJfJc42TYgD5v+NjAT7Hmq+JtHSZbIygEaj+QYRspdc0NclSsMhVyNsM4n2+Ib42gPLb5xQ== X-Received: by 2002:a05:6214:122e:: with SMTP id p14mr12148951qvv.168.1589248347158; Mon, 11 May 2020 18:52:27 -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 c68sm9892054qke.129.2020.05.11.18.52.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 18:52:26 -0700 (PDT) X-Mailer: Apple Mail (2.3608.80.23.2.2) Received-SPF: pass client-ip=2607:f8b0:4864:20::f2d; envelope-from=casouri@gmail.com; helo=mail-qv1-xf2d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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:180088 Archived-At: --Apple-Mail=_CC3C253A-5129-4254-A5DF-DF5C1E4BB804 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Add two commands that cycles a heading (like that in Org mode) in = outline-mode: - outline-cycle: cycles between =E2=80=9Chide all=E2=80=9D, =E2=80=9Csub = 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.=20 - 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 Could this be useful? Yuan --Apple-Mail=_CC3C253A-5129-4254-A5DF-DF5C1E4BB804 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/lisp/outline.el=20b/lisp/outline.el=0Aindex=20= 28ea8a86e6..99a24deed0=20100644=0A---=20a/lisp/outline.el=0A+++=20= b/lisp/outline.el=0A@@=20-1118,6=20+1118,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=E2=80=9Chide=20all=E2=80=9D= ,=20=E2=80=9Cheadings=20only=E2=80=9D=20and=20=E2=80=9Cshow=20all=E2=80=9D= .=0A+=0A+=E2=80=9CHide=20all=E2=80=9D=20means=20hide=20all=20subheadings=20= and=20their=20bodies.=0A+=E2=80=9CHeadings=20only=E2=80=9D=20means=20= show=20sub=20headings=20but=20not=20their=20bodies.=0A+=E2=80=9CShow=20= all=E2=80=9D=20means=20show=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=20headings"))=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"Interval=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=E2=80=98outline-cycle=E2=80=99."=0A+=20=20(interactive)=0A+=20=20= (pcase=20outline--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=_CC3C253A-5129-4254-A5DF-DF5C1E4BB804 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_CC3C253A-5129-4254-A5DF-DF5C1E4BB804--