unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Christopher Dimech <dimech@gmx.com>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Setting up user defined texinfo headlines using outline-heading-alist
Date: Thu, 13 May 2021 17:10:14 +0200	[thread overview]
Message-ID: <trinity-9f4d3b6c-5c43-47a3-8d9d-c10c1829fc30-1620918614575@3c-app-mailcom-bs03> (raw)
In-Reply-To: <CAP_d_8XwjGzKBM3OPDRWcyGvHyVgitY-381AAAwmr8Rt_iPLTg@mail.gmail.com>

I have followed your suggestion of using a function that sets outline-heading-alist
using texinfo-mode-hook. 

Have included the following setup (see code section), yet I am still getting 

@node uchapter-amcoh
@unnumbered 6 @ Ameliorating Waveform Coherency...

whenever I hit  "C-C @ C-t" (Hide Body).  Should I not get @usec and @usubsec
showing up as well?


-------- code --------

(defvar texinfo-hdlevels
      '( ("@chapter" . 2)
	 ("@section" . 3)
	 ("@subsection" . 4)
	 ("@subsubsection" . 5)
	 ;; --------------------------------------------------
         ("@unnumbered" . 2)
	 ("@unnumberedsec" . 3)
	 ("@unnumberedsubsec" . 4)
	 ("@unnumberedsubsubsec" . 5)
         ;; --------------------------------------------------
         ("@appendix" . 2)
	 ("@appendixsec" . 3)
         ("@appendixsubsec" . 4)
	 ("@appendixsubsubsec" . 5)
         ;; --------------------------------------------------
	 ("@majorheading" 2)
         ;; --------------------------------------------------
	 ("@chapheading" 2)
	 ("@heading" 3)
	 ("@subheading" 4)
	 ("@subsubheading" 5)
         ;; --------------------------------------------------
	 ("@uchap" . 2)
	 ("@usec" . 2)
	 ("@usubsec" . 3)
	 ("@usubsubsec" . 4) ))

(defun instate-texinfo-hdlevels ()
    (setq-local outline-heading-alist texinfo-hdlevels))

(defun texinfo-hdlevels-hook ()
  "todo"
  (add-hook 'texinfo-mode-hook #'instate-texinfo-hdlevels))

(defun outline-hooks ()
   "todo"
   (add-hook 'emacs-lisp-mode-hook #'outline-minor-mode)
   (add-hook 'texinfo-mode-hook #'outline-minor-mode) )

(outline-hooks)
(texinfo-hdlevels-hook)

Regards
Christopher

> Sent: Friday, May 14, 2021 at 1:26 AM
> From: "Yuri Khan" <yuri.v.khan@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Setting up user defined texinfo headlines using outline-heading-alist
>
> On Thu, 13 May 2021 at 19:46, Christopher Dimech <dimech@gmx.com> wrote:
> 
> […]
> 
> Ha! Much better.
> 
> > Have modified my init file with the following code that resets "outline-heading-alist"
> > to include @usec, @usebsec as headings in addition to @unnumbered
> >
> > (defvar texinfo-hdlevels […])
> >
> > (setq-local outline-heading-alist texinfo-hdlevels)
> 
> If that’s all that you have in your init file, then the setq-local
> acts on the wrong buffer. It sets the local value of the variable
> ‘outline-heading-alist’ in whichever buffer that is current at the
> time your init file is executed, maybe *scratch* or something. But you
> actually want it to act on the buffer that visits your test.texi file.
> 
> To that end, put that setq-local in a hook that runs when you visit a
> .texi file:
> 
> (defun my-texinfo-outline ()
>   (setq-local outline-heading-alist texinfo-hdlevels))
> 
> (add-hook 'texinfo-mode-hook #'my-texinfo-outline)
> 
> This is a recurring pattern in Emacs configuration: If you have a
> general facility that works in various buffers regardless of their
> major mode, and you want it to behave differently depending on the
> major mode, you put configuration in a hook that is run by that major
> mode.
> 
>



  reply	other threads:[~2021-05-13 15:10 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 14:21 outline-heading-alist for elisp using ";; * " Christopher Dimech
2021-05-10 21:08 ` Philip Kaludercic
2021-05-11  1:55   ` Christopher Dimech
2021-05-11  3:00     ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-11  5:05       ` Christopher Dimech
2021-05-11 12:06         ` Jean Louis
2021-05-11 12:40           ` Christopher Dimech
2021-05-11 14:17             ` Jean Louis
2021-05-11 12:56           ` Christopher Dimech
2021-05-11 14:20             ` Jean Louis
2021-05-11 15:32               ` Christopher Dimech
2021-05-11 18:09                 ` Jean Louis
2021-05-12  1:46                   ` Christopher Dimech
2021-05-12  4:00                     ` Jean Louis
2021-05-13  3:33                       ` Christopher Dimech
2021-05-13  7:22                         ` Jean Louis
2021-05-13  7:41                           ` Christopher Dimech
2021-05-13 10:03                             ` Jean Louis
2021-05-13 10:22                               ` Christopher Dimech
2021-05-13 10:33                                 ` Jean Louis
2021-05-13 11:37                                   ` Christopher Dimech
2021-05-11 13:15           ` Christopher Dimech
2021-05-11 14:22             ` Jean Louis
2021-05-11 15:22               ` Christopher Dimech
2021-05-12  1:53       ` Christopher Dimech
2021-05-12 12:31         ` Stefan Monnier
2021-05-12 12:43           ` Christopher Dimech
2021-05-12 14:35             ` Yuri Khan
2021-05-12 14:52               ` Christopher Dimech
2021-05-13 12:29               ` Setting up user defined texinfo headlines using outline-heading-alist Christopher Dimech
2021-05-13 13:26                 ` Yuri Khan
2021-05-13 15:10                   ` Christopher Dimech [this message]
2021-05-13 16:05                     ` Yuri Khan
2021-05-13 18:29                       ` Jean Louis
2021-05-13 18:48                         ` Christopher Dimech
2021-05-13 19:01                         ` Yuri Khan
2021-05-13 18:35                       ` Christopher Dimech
2021-05-13 19:13                         ` Yuri Khan
2021-05-14  3:49                           ` Christopher Dimech
2021-05-14  3:56                             ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-14  5:25                               ` Christopher Dimech
2021-05-13 15:34                   ` Jean Louis
2021-05-11  2:52   ` outline-heading-alist for elisp using ";; * " Christopher Dimech
2021-05-11  4:50   ` Jean Louis
2021-05-11  5:17     ` Christopher Dimech
2021-05-11 20:54 ` Jeremie Juste

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-9f4d3b6c-5c43-47a3-8d9d-c10c1829fc30-1620918614575@3c-app-mailcom-bs03 \
    --to=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=yuri.v.khan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).