From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!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: Fri, 16 Oct 2020 15:27:33 -0400 Message-ID: References: <452A6049-893A-4E7E-8349-541D276FAD19@gmail.com> <92D944EF-6BF9-4635-AC05-4B51B386D5C7@gmail.com> <878sca7r43.fsf@gnus.org> <87mu0ozntx.fsf@mail.linkov.net> <87v9fatwdi.fsf@mail.linkov.net> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_D7EAA66F-B37A-47D0-B7F1-26BF874AD209" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31750"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41130@debbugs.gnu.org, Lars Ingebrigtsen , Stefan Kangas , 41198@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 16 21:28:35 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 1kTVP0-000873-OO for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Oct 2020 21:28:34 +0200 Original-Received: from localhost ([::1]:42156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTVOz-0006bT-BL for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Oct 2020 15:28:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTVOU-0006b6-1l for bug-gnu-emacs@gnu.org; Fri, 16 Oct 2020 15:28:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49373) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kTVOT-0008Iu-PD for bug-gnu-emacs@gnu.org; Fri, 16 Oct 2020 15:28:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kTVOT-0004Rs-IH for bug-gnu-emacs@gnu.org; Fri, 16 Oct 2020 15:28: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: Fri, 16 Oct 2020 19:28: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.160287646417064 (code B ref 41130); Fri, 16 Oct 2020 19:28:01 +0000 Original-Received: (at 41130) by debbugs.gnu.org; 16 Oct 2020 19:27:44 +0000 Original-Received: from localhost ([127.0.0.1]:60917 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTVOB-0004R9-Ou for submit@debbugs.gnu.org; Fri, 16 Oct 2020 15:27:43 -0400 Original-Received: from mail-io1-f52.google.com ([209.85.166.52]:35935) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kTVO9-0004Qs-2U; Fri, 16 Oct 2020 15:27:41 -0400 Original-Received: by mail-io1-f52.google.com with SMTP id u19so5322144ion.3; Fri, 16 Oct 2020 12:27:41 -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=sA+Ao8mphQxR1XBB4OSQEeuLe13BJroFZ6mpGxyhae4=; b=tbRImZzEn9EuY8GZS5elKWXr6rkuH6r07wJmKYgzHTvEzCDwZrOrNDW1XuwpzkN+1+ BxC/i2lkg5GnprOb7RQr8FnrvuUTyRfZMmp6GuQkp0FIJ07Q0w6hTf9R2GqAV8e7qxki plM0CsB4ArioM+c6TnmqT3VJL/2agXq/0Ll+7YPJqB9Mbk1efpbr05nk4cSXqy3SA4Bp mnFKmj50nPwNbTaQjev0XEhsRDu2Ua0H8PqreCcSBVVLFDzP8CA93JoHF+H91Mh2qYT0 huKgu4o3C6WYmGkV4E5iuvqiSN9BWHACaZlXCuhQzWCfToT9XsBYqxbJqCPM19m6M8aR +0Ig== 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=sA+Ao8mphQxR1XBB4OSQEeuLe13BJroFZ6mpGxyhae4=; b=bdf5O+QyAsz1voI+qzyU3uJUZwRw0nz4FEZO47p2qYpUk//4B19mX2EY1ZLbx/xYbO ymBLueoXh3lfnyZeyiW+Hu07mslOz1u/fvv+5mDA2yfeeHutrVr0VVm9+jyDr/dnXCDV kc7/cAw6QHLhW34Ea8fIST9XPyT0qFa0/Bw/6ksg/lrbIuD3OZmDnnf9Th01Q325Vv0e pNKNEEerkwxMmk3G3bxnng7GZ7xBDPvafH3JbOzW92BqPbrjG8LQX6FIrvevv+z3UIqd rNrtvla+pEheNW4pPF8xM/lAxNz+UiOq6qBVwA47ozaXS4y56WNhDcpdt2fjZVGgYpx4 fDyA== X-Gm-Message-State: AOAM530eK7MJRbAnlFyvQOUg2KBN2XGfkoHC6TH0jnXPGnNpUo4nXsR4 VjQDZXjNfY8xnRqHcAFfs7gGGPaF9WfipU8x X-Google-Smtp-Source: ABdhPJxX6pg404HK6AtH9mbIVUqsMAVN3436a/1cOiY6WslN0I0Jy6dsRmVBfykap5CHIcu9GslqMA== X-Received: by 2002:a5e:9b11:: with SMTP id j17mr3642317iok.176.1602876455371; Fri, 16 Oct 2020 12:27:35 -0700 (PDT) Original-Received: from ?IPv6:2601:98a:4200:9210:8954:af62:96c7:c6? ([2601:98a:4200:9210:8954:af62:96c7:c6]) by smtp.gmail.com with ESMTPSA id i82sm3099301ill.84.2020.10.16.12.27.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Oct 2020 12:27:34 -0700 (PDT) In-Reply-To: <87v9fatwdi.fsf@mail.linkov.net> X-Mailer: Apple Mail (2.3608.120.23.2.4) 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:190734 Archived-At: --Apple-Mail=_D7EAA66F-B37A-47D0-B7F1-26BF874AD209 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Oct 16, 2020, at 4:20 AM, Juri Linkov wrote: >=20 >>> Now finally org keys are available in etc/NEWS, nice! >>> But typing S-TAB at the beginning of etc/NEWS signals the error: >>>=20 >>> Debugger entered--Lisp error: (error "Before first heading") >>> signal(error ("Before first heading")) >>>=20 >>> This is not how org-mode works - S-TAB doesn't fail before first = heading >>> in org-mode. >>=20 >> Do you suggest to change it to a user-error? Or just be silent? >=20 > 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 --Apple-Mail=_D7EAA66F-B37A-47D0-B7F1-26BF874AD209 Content-Disposition: attachment; filename=outline-fix.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="outline-fix.patch" Content-Transfer-Encoding: quoted-printable =46rom=20147b547355380d134f423b44c988ff18074a4ded=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Thu,=20= 15=20Oct=202020=2022:20:20=20-0400=0ASubject:=20[PATCH]=20Suppress=20= "Before=20first=20headings"=20error=20in=20outline-cycle=0A=0A*=20= lisp/outline.el=20(outline-cycle):=20Suppress=20error.=0A= (outline-cycle-buffer):=20Simply=20pass=201=20to=20= 'outline-hide-sublevels'.=0A---=0A=20lisp/outline.el=20|=2037=20= +++++++++++++++++--------------------=0A=201=20file=20changed,=2017=20= insertions(+),=2020=20deletions(-)=0A=0Adiff=20--git=20a/lisp/outline.el=20= b/lisp/outline.el=0Aindex=20a4ce9afb44..05c884fb95=20100644=0A---=20= a/lisp/outline.el=0A+++=20b/lisp/outline.el=0A@@=20-1167,19=20+1167,22=20= @@=20outline-cycle=0A=20`Headings=20only'=20means=20show=20sub=20= headings=20but=20not=20their=20bodies.=0A=20`Show=20all'=20means=20show=20= all=20subheadings=20and=20their=20bodies."=0A=20=20=20(interactive)=0A-=20= =20(pcase=20(outline--cycle-state)=0A-=20=20=20=20('hide-all=0A-=20=20=20= =20=20(if=20(outline-has-subheading-p)=0A-=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(message=20"Only=20headings"))=0A-=20=20=20=20=20=20=20= (outline-show-subtree)=0A-=20=20=20=20=20=20=20(message=20"Show=20= all")))=0A-=20=20=20=20('headings-only=0A-=20=20=20=20=20= (outline-show-subtree)=0A-=20=20=20=20=20(message=20"Show=20all"))=0A-=20= =20=20=20('show-all=0A-=20=20=20=20=20(outline-hide-subtree)=0A-=20=20=20= =20=20(message=20"Hide=20all"))))=0A+=20=20(condition-case=20nil=0A+=20=20= =20=20=20=20(pcase=20(outline--cycle-state)=0A+=20=20=20=20=20=20=20=20= ('hide-all=0A+=20=20=20=20=20=20=20=20=20(if=20= (outline-has-subheading-p)=0A+=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(message=20"Only=20headings"))=0A+=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= (message=20"Show=20all")))=0A+=20=20=20=20=20=20=20=20('headings-only=0A= +=20=20=20=20=20=20=20=20=20(outline-show-subtree)=0A+=20=20=20=20=20=20=20= =20=20(message=20"Show=20all"))=0A+=20=20=20=20=20=20=20=20('show-all=0A= +=20=20=20=20=20=20=20=20=20(outline-hide-subtree)=0A+=20=20=20=20=20=20=20= =20=20(message=20"Hide=20all")))=0A+=20=20=20=20;;=20If=20error:=20= "Before=20first=20heading"=20occurs,=20ignore=20it.=0A+=20=20=20=20= (error=20nil)))=0A=20=0A=20(defvar-local=20outline--cycle-buffer-state=20= 'show-all=0A=20=20=20"Internal=20variable=20used=20for=20tracking=20= buffer=20cycle=20state.")=0A@@=20-1189,13=20+1192,7=20@@=20= outline-cycle-buffer=0A=20=20=20(interactive)=0A=20=20=20(pcase=20= outline--cycle-buffer-state=0A=20=20=20=20=20('show-all=0A-=20=20=20=20=20= (save-excursion=0A-=20=20=20=20=20=20=20(let=20((start-point=20(point)))=0A= -=20=20=20=20=20=20=20=20=20(while=20(not=20(eq=20(point)=20= start-point))=0A-=20=20=20=20=20=20=20=20=20=20=20(outline-up-heading=20= 1))=0A-=20=20=20=20=20=20=20=20=20(outline-hide-sublevels=0A-=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(funcall=20'outline-level)))))=0A+=20=20= =20=20=20(outline-hide-sublevels=201)=0A=20=20=20=20=20=20(setq=20= outline--cycle-buffer-state=20'top-level)=0A=20=20=20=20=20=20(message=20= "Top=20level=20headings"))=0A=20=20=20=20=20('top-level=0A--=20=0A2.27.0=0A= =0A= --Apple-Mail=_D7EAA66F-B37A-47D0-B7F1-26BF874AD209--