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: Sun, 18 Oct 2020 16:23:12 -0400 Message-ID: <70FAFCD6-33C6-4254-97B7-EE3DF77B6EF1@gmail.com> 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> <87sgadz7cw.fsf@gnus.org> <871rhwh91d.fsf@mail.linkov.net> <3346E33F-BFF2-4DD7-8411-F852CCF3C830@gmail.com> <871rhwj5h6.fsf@gnus.org> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_7B4AB68D-810C-4604-B476-F5B9D37CDCE3" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8998"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41130@debbugs.gnu.org, Stefan Kangas , 41198@debbugs.gnu.org, Juri Linkov To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 18 22:24: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 1kUFDv-0002EH-CV for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Oct 2020 22:24:11 +0200 Original-Received: from localhost ([::1]:60210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUFDu-00061V-9j for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Oct 2020 16:24:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUFDm-000617-OR for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 16:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55834) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kUFDm-000847-F8 for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 16:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kUFDm-0001g8-B4 for bug-gnu-emacs@gnu.org; Sun, 18 Oct 2020 16:24: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: Sun, 18 Oct 2020 20:24:02 +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.16030526026397 (code B ref 41130); Sun, 18 Oct 2020 20:24:02 +0000 Original-Received: (at 41130) by debbugs.gnu.org; 18 Oct 2020 20:23:22 +0000 Original-Received: from localhost ([127.0.0.1]:39145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUFD7-0001f5-VS for submit@debbugs.gnu.org; Sun, 18 Oct 2020 16:23:22 -0400 Original-Received: from mail-io1-f41.google.com ([209.85.166.41]:38627) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUFD6-0001eq-6g; Sun, 18 Oct 2020 16:23:20 -0400 Original-Received: by mail-io1-f41.google.com with SMTP id y20so10622330iod.5; Sun, 18 Oct 2020 13:23:20 -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=LfNzbwf/dWwEd7Fcg+R/xoS35alz439bjkvcgJuk58I=; b=RoC0JJIlq5/H7FytHbUQ+8eb/VdYufVaeKx1Vt+AUOX2z0Q9NcVKZFsxdc50h6zoFc dKQ9QdsZvOljmCkCVzMewfXOBnfNcpa/BVbtduhRa01PJMcrdawOiDZzixUKd/+DLHMi eOgvxqPevmYNIH9Qj9nmCw+2EuFSQL3WQWLM3Phkfj3i+EWvFw6qZIyzhzDzCqJgYF7l Ezu6pYC66g2+306SJjFDDD/0Z7LDYXwE9KAM5TjqBlOje3YQxqA/1ZZ423F207WVaRrV pesKoUf/Z8oWXWQTNT8jXz3C1E8D5ZZzOrLq4SvkFSbTwI/9Zkw2TebfrurvQ32duyOw gB0Q== 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=LfNzbwf/dWwEd7Fcg+R/xoS35alz439bjkvcgJuk58I=; b=GjNJ9hdvmems2THlomcoCPHtsooDWR+wVEfY9YGJjQi65OtIUnKqLWIMcknz49gs9N WNxqxnsauYBFvApEbCaCw9I13/USkylYyA/k0fpG9jhtYnSm8y/3mCY1m+rDTppFExYJ glnnBkpcNse0Uhgo0x4VLugrt/fdnPLbJbN4WZxzvNKLdeL/GBKdN2LTTBwgXkTZW4Ls 0JTuPp+lXa9pZwv+syR0ogL/3DLnEkLumTY1Rsn7JkzQ4iPhaD6s6GDw+b3qYJ97YW+e P3l7O1IHJJNr7Rofp04CPYlPcrOVE4toYNjNLXiOBnBIHji21bjfj6yveIB3RQ63/Tod AQgQ== X-Gm-Message-State: AOAM532keQnTQqzI5ksh6Oln2ZSxPjzBGJIcZTUygDxww2ch2m0fUIuD opt91xK43rIePSKI/wKlQPw= X-Google-Smtp-Source: ABdhPJyfQ0gAdJluHs+Zk5R4zLfqgTsXw2i0WhHw6ORyXXuiqmjDkXGOoLxwNzc7lI7EfX2erfEKng== X-Received: by 2002:a02:caa1:: with SMTP id e1mr9227997jap.80.1603052594457; Sun, 18 Oct 2020 13:23:14 -0700 (PDT) Original-Received: from ?IPv6:2601:98a:4200:9210:d02a:1c66:2033:eacb? ([2601:98a:4200:9210:d02a:1c66:2033:eacb]) by smtp.gmail.com with ESMTPSA id v9sm8496222ioq.41.2020.10.18.13.23.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2020 13:23:13 -0700 (PDT) In-Reply-To: <871rhwj5h6.fsf@gnus.org> 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:190915 Archived-At: --Apple-Mail=_7B4AB68D-810C-4604-B476-F5B9D37CDCE3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Oct 18, 2020, at 4:36 AM, Lars Ingebrigtsen wrote: >=20 > Yuan Fu writes: >=20 >> I can modify outline code to signal a signal (say >> =E2=80=98outline-before-first-heading) rather than an error, and = handle that >> signal specifically. How=E2=80=99s that? >=20 > Yes, that would also work. >=20 > --=20 > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no Here is the new patch. Yuan --Apple-Mail=_7B4AB68D-810C-4604-B476-F5B9D37CDCE3 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=20ff4722534c1e47a2536257116436b66c79db3e8b=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]=20Handle=20= "Before=20first=20headings"=20error=20in=20outline-cycle=0A=0A*=20= lisp/outline.el=20(outline-before-first-heading):=20New=20error.=0A= (outline-back-to-heading):=20Signal=20the=20new=20error.=0A= (outline-cycle):=20Ignore=20the=20error.=0A(outline-cycle-buffer):=20= Simply=20pass=201=20to=20'outline-hide-sublevels'.=0A---=0A=20= lisp/outline.el=20|=2040=20+++++++++++++++++++---------------------=0A=20= 1=20file=20changed,=2019=20insertions(+),=2021=20deletions(-)=0A=0Adiff=20= --git=20a/lisp/outline.el=20b/lisp/outline.el=0Aindex=20= a4ce9afb44..b9806bc187=20100644=0A---=20a/lisp/outline.el=0A+++=20= b/lisp/outline.el=0A@@=20-402,6=20+402,8=20@@=20outline-invisible-p=0A=20= If=20POS=20is=20nil,=20use=20`point'=20instead."=0A=20=20=20(eq=20= (get-char-property=20(or=20pos=20(point))=20'invisible)=20'outline))=0A=20= =0A+(define-error=20'outline-before-first-heading=20"Before=20first=20= heading")=0A+=0A=20(defun=20outline-back-to-heading=20(&optional=20= invisible-ok)=0A=20=20=20"Move=20to=20previous=20heading=20line,=20or=20= beg=20of=20this=20line=20if=20it's=20a=20heading.=0A=20Only=20visible=20= heading=20lines=20are=20considered,=20unless=20INVISIBLE-OK=20is=20= non-nil."=0A@@=20-412,7=20+414,7=20@@=20outline-back-to-heading=0A=20=09=20= =20(while=20(not=20found)=0A=20=09=20=20=20=20(or=20(re-search-backward=20= (concat=20"^\\(?:"=20outline-regexp=20"\\)")=0A=20=09=09=09=09=20=20=20=20= nil=20t)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(error=20= "Before=20first=20heading"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(signal=20'outline-before-first-heading=20nil))=0A=20=09=20=20=20=20= (setq=20found=20(and=20(or=20invisible-ok=20(not=20= (outline-invisible-p)))=0A=20=09=09=09=20=20=20=20=20(point)))))=0A=20=09= (goto-char=20found)=0A@@=20-1167,19=20+1169,21=20@@=20outline-cycle=0A=20= `Headings=20only'=20means=20show=20sub=20headings=20but=20not=20their=20= bodies.=0A=20`Show=20all'=20means=20show=20all=20subheadings=20and=20= their=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= (outline-before-first-heading=20nil)))=0A=20=0A=20(defvar-local=20= outline--cycle-buffer-state=20'show-all=0A=20=20=20"Internal=20variable=20= used=20for=20tracking=20buffer=20cycle=20state.")=0A@@=20-1189,13=20= +1193,7=20@@=20outline-cycle-buffer=0A=20=20=20(interactive)=0A=20=20=20= (pcase=20outline--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=_7B4AB68D-810C-4604-B476-F5B9D37CDCE3--