From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: Setting up user defined texinfo headlines using outline-heading-alist Date: Thu, 13 May 2021 20:35:51 +0200 Message-ID: References: <878s4m5mbj.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16417"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: Yuri Khan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 13 20:36:27 2021 Return-path: Envelope-to: geh-help-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 1lhGCA-000475-Nx for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 13 May 2021 20:36:26 +0200 Original-Received: from localhost ([::1]:38108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhGC9-0002Ip-Nc for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 13 May 2021 14:36:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhGBg-0002D6-Gc for help-gnu-emacs@gnu.org; Thu, 13 May 2021 14:35:56 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:38465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhGBe-0000h9-0w for help-gnu-emacs@gnu.org; Thu, 13 May 2021 14:35:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620930951; bh=iQkI/6NpAOIU6nqKtYPn7KRXthMYDSm6eCjtHLdNYH0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=SWyA2G10snkc65PZ35nAINocEAgQ5JXf6kmI+57+DOgodvR8hmIGhY01713tIjvLQ 6PnHWBE6F66eSF1IBwtmQUSj2b5q/TS6erQzarKyJS6Ak60BhSSzVjNflVCtHPm0H4 a+kWVZCC8vsUkZF+12RZk/Nv/mgJvMp9h+oulISI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs03.server.lan [172.19.170.169]) (via HTTP); Thu, 13 May 2021 20:35:51 +0200 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:mQRxGX/XBF2MafHpC1saDXhn0sTlXaIx0xRqMVdDaRQVpuWWUDlBXuk+PkmavU6QS1bDY FjMSdwwQ1smf/4bB4tPsS8jv1FH6+2A5pD+/RLbxAsfP1tN0r1uQafdY0o0CYz4nDWt4ZZXPSZr2 /nBjnccV/84dMhxdNRJlH6jfmobEERnYbQ4CLPSz6hijuA5Uac9E14vnu81JiJbV+ESCZZuz82w8 0ANv9h+mHzRP6VKlsTjsClzUu5TEX3BSVAipoi1l3nszMY3/B8tNstwedH6j5/q+oY74jKYuMz5j xw= X-UI-Out-Filterresults: notjunk:1;V03:K0:yRB1eamT7aQ=:p5fh4LMKGpc21cMtonYVa9 R2AAAGIl7kqVC0XkOe6QbWoC6CGDVeJ2cOhPnNQ2ne5eYRa1jDocL+4tsQq5Cz5ucZwGvXVRf DIG230BYp3QbfpstsDJ7UnlwySH6wH80Ar1CmAF+xBVCa9ZGpduXcPkt7EVRhXUOavXFLLEvg 0uD4sBkh4b4+TLFd6Pk9OZWgZ2pSu4cdcYWD8PmSrYr2biYacUZjmGg4pr8h5a2fIrUwk0H2u 55lyN1dmgiIKGCKEsKdKquvXtqKqxTdTlkoxn606+BzSSwLiiUYTXH4UWaHioAyG0HpAXdMk6 r7iNlVsaREvTnsWtqO7GZCo4zCUMqJ/MzCtCxy/c9VXScdhVrhvcdtT1Y5l7cA89xJksaF6u3 KyGm92AOyUvVhoAm11QVjdiVT+1QfukboFXOa1NpF9WXSgnzaWhk4Lj0fbzjsSZawmzs9O/aI cmU/bw3e+sp+UpvphevWqgEfi0bnpsfWnEbiKqCGz/YxmSxkBiIbkb/VS2CHMByHScOzYCvk1 XTflACTnM3VAjr7uQJeH7lmFYL/auZ00BwLDu8xP/XdAt0YatjjFGlIRPR5T/yuyFCrDp1oMX jlg0kC3TkUGemSIqEBOnN689sqO6KqjfB6bdXnCrAmeE5ej6ksKMBMC67WwhPTEi/DkPN3Ujq c5Hq7ovwZ3CUHfjnDmhXMg+MfLPQACmNhJY1ZiYbDCRP1JQRwAntp/U6KesWcMHm7j7VplXnH HO/sRhgUm9Z9wf5eWmB3db1sFbLGmrfXb2VrUv3GZkhzIK/8VE2JjpnfUls/EssYd+oQDniP Received-SPF: pass client-ip=212.227.15.19; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129754 Archived-At: > Sent: Friday, May 14, 2021 at 4:05 AM > From: "Yuri Khan" > To: "Christopher Dimech" > Cc: "Help Gnu Emacs" > Subject: Re: Setting up user defined texinfo headlines using outline-hea= ding-alist > > On Thu, 13 May 2021 at 22:10, Christopher Dimech wrot= e: >=20 > > I have followed your suggestion of using a function that sets outline-= heading-alist > > using texinfo-mode-hook=2E > > > > Have included the following setup (see code section), yet I am still g= etting > > > > @node uchapter-amcoh > > @unnumbered 6 @ Ameliorating Waveform Coherency=2E=2E=2E > > > > whenever I hit "C-C @ C-t" (Hide Body)=2E Should I not get @usec and= @usubsec > > showing up as well? >=20 > Now that you gave a recipe, I was able to reproduce it=2E I saved your > test=2Etexi and put your code into /tmp/20210513/=2Eemacs and started > Emacs as =E2=80=9CHOME=3D=2E emacs test=2Etexi=E2=80=9D=2E This way, my = own config does not > affect the reproduction=2E >=20 > I pressed C-c @ C-t, and, yes, everything after the first heading got > collapsed=2E So next I pressed C-c @ C-h to see what other commands are > available=2E I spotted C-c @ C-a (outline-show-all) as the way to expand > it all back, and C-c @ C-n (outline-next-visible-heading) as a > reasonable way to check what Emacs thinks are your headings=2E And, > predictably, starting at the top, it stopped on @unnumbered, and then > at the bottom of the buffer=2E Which means it does not detect @usec as a > heading=2E >=20 > Next, I went to read the docstring on outline-next-visible-heading=2E An= d it says: >=20 > A heading line is one that starts with a =E2=80=98*=E2=80=99 (or tha= t > =E2=80=98outline-regexp=E2=80=99 matches)=2E >=20 > So next let=E2=80=99s see what outline-regexp is: >=20 > outline-regexp is a variable defined in =E2=80=98outline=2Eel=E2=80= =99=2E > Its value is "[*^L]+" > [=E2=80=A6] > Regular expression to match the beginning of a heading=2E > Any line whose beginning matches this regexp is considered to > start a heading=2E > Note that Outline mode only checks this regexp at the start of a lin= e, > so the regexp need not (and usually does not) start with =E2=80=98^= =E2=80=99=2E >=20 > So let=E2=80=99s change your hook function to set that: >=20 > (defun instate-texinfo-hdlevels () > (setq-local outline-heading-alist texinfo-hdlevels) > (setq-local outline-regexp > (concat (regexp-opt (mapcar 'car texinfo-hdlevels)) "\= \>"))) >=20 > Now I press C-M-x within the above source to update the function > definition, switch to test=2Etexi, and press M-x normal-mode RET to > reapply the major mode, which reruns all its hooks, which sets the > variables as needed=2E Now, C-c @ C-n from the top goes through > @unnumbered, @usec, @usec, @usubsec, @usec, @usubsec, bottom; and C-c > @ C-t leaves all custom headings visible: >=20 > @node uchapter-amcoh > @unnumbered 6 @ Ameliorating Waveform Coherency=2E=2E=2E > @usec{@value{seclb}, Abductive Reasoning}=2E=2E=2E > @usec{@value{seclb}, Parsimony over Complexity}=2E=2E=2E > @usubsec{@value{seclb}, The Claerbout Conjecture}=2E=2E=2E > @usec{@value{seclb}, Correlograms in Helioseismology}=2E=2E=2E > @usubsec{@value{seclb}, Solar Magnetic Cycle and the Interface Dynam= o}=2E=2E=2E >=20 > Now I save the modified =2Eemacs and restart this Emacs instance to see > if my solution works when applied from the init file=2E It does, so I am > confident enough to post it=2E Yes, your code works=2E Nevertheless, I find all this extremely confusing= =2E For instance: 1=2E outline=2Eel does not state how to set a user defined outline-regexp = or guide=20 you to a particular implementation such as texinfo=2Eel 2=2E texinfo=2Eel uses a convoluted way to set outline-heading-alist and o= utline-regexp=2E 2a=2E Firstly texinfo=2Eel tries to play around with texinfo-section-list,= excluding the initial "@" fog texinfo-commands=2E The implementation certainly does= not watch the example on how to set up outline-heading-alist as described in the doc= string of outline-heading-alist in "outline=2Eel"=2E 2b=2E outline-heading-alist provides the following example:=20 (setq outline-heading-alist \\=3D'((\"@chapter\" =2E 2) (\"@section\" =2E 3) (\"@subsection\" = =2E 4) (\"@subsubsection\" =2E 5) (\"@unnumbered\" =2E 2) (\"@unnumberedsec\" =2E 3) (\"@unnumberedsubsec\" =2E 4) (\"@unnumberedsubsubsec\" =2E 5) (\"@appendix\" =2E 2) (\"@appendixsec\" =2E 3)=2E=2E=2E (\"@appendixsubsec\" =2E 4) (\"@appendixsubsubsec\" =2E 5) =2E= =2E)) This is not a real working example because of the additional "=2E=2E=2E" a= nd "=2E=2E" in the declaration=2E Consequently, the code rather than helping others see how to set things up= , confuses them because of the inconsistencies described=2E=20 So again, I do not understand how to set outline-heading-alist for a user = who wants to define his own headers=2E I also fail to understand how to visualise any differences between differe= nt heading levels=2E It is then very easy to tell a user to learn more elisp, rather than convi= nce a developer to be consistent and write in ways that assist in the reuse of t= heir=20 code=2E =20 > Next you might want to read the full docstring for outline-regexp, as > it tells you the recommended way to set it so that it travels with > your file rather than lives in your personal configuration=2E You might > also see if setting outline-heading alist the same way works=2E >