* outline-regexp) using ";; *+ " for elisp code
@ 2021-05-11 3:11 Christopher Dimech
2021-05-11 7:05 ` Joost Kremers
0 siblings, 1 reply; 11+ messages in thread
From: Christopher Dimech @ 2021-05-11 3:11 UTC (permalink / raw)
To: Help Gnu Emacs
I am hoping to have headline levels using comment loni followed by stars.
I mould need some adaptation to get the regular expression right, becouse
";; *+ " does not do the job.
(add-hook 'emacs-lisp-mode-hook #'outline-minor-mode)
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(set (make-local-variable 'outline-regexp) ";; *+ ")))
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: outline-regexp) using ";; *+ " for elisp code
2021-05-11 3:11 outline-regexp) using ";; *+ " for elisp code Christopher Dimech
@ 2021-05-11 7:05 ` Joost Kremers
2021-05-11 7:11 ` Christopher Dimech
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Joost Kremers @ 2021-05-11 7:05 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs
On Tue, May 11 2021, Christopher Dimech wrote:
> I am hoping to have headline levels using comment loni followed by stars.
>
> I mould need some adaptation to get the regular expression right, becouse
> ";; *+ " does not do the job.
* is special in regexes. You'll need to quote it.
--
Joost Kremers
Life has its moments
^ permalink raw reply [flat|nested] 11+ messages in thread
* outline-regexp) using ";; *+ " for elisp code
2021-05-11 7:05 ` Joost Kremers
@ 2021-05-11 7:11 ` Christopher Dimech
2021-05-11 7:16 ` Christopher Dimech
2021-05-11 7:59 ` Christopher Dimech
2 siblings, 0 replies; 11+ messages in thread
From: Christopher Dimech @ 2021-05-11 7:11 UTC (permalink / raw)
To: Joost Kremers; +Cc: help-gnu-emacs
> Sent: Tuesday, May 11, 2021 at 7:05 PM
> From: "Joost Kremers" <joostkremers@fastmail.fm>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: outline-regexp) using ";; *+ " for elisp code
>
>
> On Tue, May 11 2021, Christopher Dimech wrote:
> > I am hoping to have headline levels using comment loni followed by stars.
> >
> > I mould need some adaptation to get the regular expression right, becouse
> > ";; *+ " does not do the job.
>
> * is special in regexes. You'll need to quote it.
Thanks
";; \\*+ "
> --
> Joost Kremers
> Life has its moments
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* outline-regexp) using ";; *+ " for elisp code
2021-05-11 7:05 ` Joost Kremers
2021-05-11 7:11 ` Christopher Dimech
@ 2021-05-11 7:16 ` Christopher Dimech
2021-05-11 7:59 ` Christopher Dimech
2 siblings, 0 replies; 11+ messages in thread
From: Christopher Dimech @ 2021-05-11 7:16 UTC (permalink / raw)
To: Joost Kremers; +Cc: help-gnu-emacs
Have tried the following, but the regexp is not taking effect when I call
"Hide body".
In my elisp file I have used
;;; ** alpha-bounds
--------
(add-hook 'emacs-lisp-mode-hook #'outline-minor-mode)
;; set regularity condition
(setq rgc ";;; \\*+ ")
;;(setq rgc ";;; \\([A-Za-z]\\|[IVXLCDMivxlcdm0-9]+\\) | ")
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(set (make-local-variable 'outline-regexp) rgc)))
> Sent: Tuesday, May 11, 2021 at 7:05 PM
> From: "Joost Kremers" <joostkremers@fastmail.fm>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: outline-regexp) using ";; *+ " for elisp code
>
>
> On Tue, May 11 2021, Christopher Dimech wrote:
> > I am hoping to have headline levels using comment loni followed by stars.
> >
> > I mould need some adaptation to get the regular expression right, becouse
> > ";; *+ " does not do the job.
>
> * is special in regexes. You'll need to quote it.
>
> --
> Joost Kremers
> Life has its moments
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* outline-regexp) using ";; *+ " for elisp code
2021-05-11 7:05 ` Joost Kremers
2021-05-11 7:11 ` Christopher Dimech
2021-05-11 7:16 ` Christopher Dimech
@ 2021-05-11 7:59 ` Christopher Dimech
2021-05-11 8:19 ` Joost Kremers
2 siblings, 1 reply; 11+ messages in thread
From: Christopher Dimech @ 2021-05-11 7:59 UTC (permalink / raw)
To: Joost Kremers; +Cc: help-gnu-emacs
Any reason why using rgc does not work, whereas things are good when I use
the string directly in the call "make-local-variable"?
(setq-local rgc ";;; \\*+ ")
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(set (make-local-variable 'outline-regexp) rgc)))
> Sent: Tuesday, May 11, 2021 at 7:05 PM
> From: "Joost Kremers" <joostkremers@fastmail.fm>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: outline-regexp) using ";; *+ " for elisp code
>
>
> On Tue, May 11 2021, Christopher Dimech wrote:
> > I am hoping to have headline levels using comment loni followed by stars.
> >
> > I mould need some adaptation to get the regular expression right, becouse
> > ";; *+ " does not do the job.
>
> * is special in regexes. You'll need to quote it.
>
> --
> Joost Kremers
> Life has its moments
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: outline-regexp) using ";; *+ " for elisp code
2021-05-11 7:59 ` Christopher Dimech
@ 2021-05-11 8:19 ` Joost Kremers
2021-05-11 8:32 ` Christopher Dimech
2021-05-11 8:48 ` Christopher Dimech
0 siblings, 2 replies; 11+ messages in thread
From: Joost Kremers @ 2021-05-11 8:19 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs
On Tue, May 11 2021, Christopher Dimech wrote:
> Any reason why using rgc does not work, whereas things are good when I use
> the string directly in the call "make-local-variable"?
>
> (setq-local rgc ";;; \\*+ ")
Where is this call? =setq-local= sets the variable's value in the buffer in
which it is executed. If this call is in your init file, it's not going to have
any effect on your Emacs session.
In your init file, you'll want =defvar= or =defvar-local=. (Note, the =local= part
here does not have the same meaning as the =local= part in =setq-local=. See the
doc strings for details.)
--
Joost Kremers
Life has its moments
^ permalink raw reply [flat|nested] 11+ messages in thread
* outline-regexp) using ";; *+ " for elisp code
2021-05-11 8:19 ` Joost Kremers
@ 2021-05-11 8:32 ` Christopher Dimech
2021-05-11 8:48 ` Christopher Dimech
1 sibling, 0 replies; 11+ messages in thread
From: Christopher Dimech @ 2021-05-11 8:32 UTC (permalink / raw)
To: Joost Kremers; +Cc: help-gnu-emacs
You are right, setq-local does not take effect. How does defvar solve the problem?
(setq-local rgc ";;; \\*+ ")
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(set (make-local-variable 'outline-regexp) rgc)))
> Sent: Tuesday, May 11, 2021 at 8:19 PM
> From: "Joost Kremers" <joostkremers@fastmail.fm>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: outline-regexp) using ";; *+ " for elisp code
>
>
> On Tue, May 11 2021, Christopher Dimech wrote:
> > Any reason why using rgc does not work, whereas things are good when I use
> > the string directly in the call "make-local-variable"?
> >
> > (setq-local rgc ";;; \\*+ ")
>
> Where is this call? =setq-local= sets the variable's value in the buffer in
> which it is executed. If this call is in your init file, it's not going to have
> any effect on your Emacs session.
>
> In your init file, you'll want =defvar= or =defvar-local=. (Note, the =local= part
> here does not have the same meaning as the =local= part in =setq-local=. See the
> doc strings for details.)
>
> --
> Joost Kremers
> Life has its moments
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* outline-regexp) using ";; *+ " for elisp code
2021-05-11 8:19 ` Joost Kremers
2021-05-11 8:32 ` Christopher Dimech
@ 2021-05-11 8:48 ` Christopher Dimech
2021-05-11 10:29 ` Joost Kremers
1 sibling, 1 reply; 11+ messages in thread
From: Christopher Dimech @ 2021-05-11 8:48 UTC (permalink / raw)
To: Joost Kremers; +Cc: help-gnu-emacs
> Sent: Tuesday, May 11, 2021 at 8:19 PM
> From: "Joost Kremers" <joostkremers@fastmail.fm>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: outline-regexp) using ";; *+ " for elisp code
>
>
> On Tue, May 11 2021, Christopher Dimech wrote:
> > Any reason why using rgc does not work, whereas things are good when I use
> > the string directly in the call "make-local-variable"?
> >
> > (setq-local rgc ";;; \\*+ ")
>
> Where is this call? =setq-local= sets the variable's value in the buffer in
> which it is executed. If this call is in your init file, it's not going to have
> any effect on your Emacs session.
>
> In your init file, you'll want =defvar= or =defvar-local=. (Note, the =local= part
> here does not have the same meaning as the =local= part in =setq-local=. See the
> doc strings for details.)
defvar-local is buffer-local variable. I would think that I could use defvar as
the setting rather than a buffer-local variable, as the value would be the same for
all elisp files.
Have also tried doing the same for texinfo files. Though outline-miner-mode is not
taking effect.
(add-hook 'texinfo-mode-hook #'outline-minor-mode)
> --
> Joost Kremers
> Life has its moments
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: outline-regexp) using ";; *+ " for elisp code
2021-05-11 8:48 ` Christopher Dimech
@ 2021-05-11 10:29 ` Joost Kremers
2021-05-11 11:22 ` Christopher Dimech
0 siblings, 1 reply; 11+ messages in thread
From: Joost Kremers @ 2021-05-11 10:29 UTC (permalink / raw)
To: Christopher Dimech; +Cc: help-gnu-emacs
On Tue, May 11 2021, Christopher Dimech wrote:
> defvar-local is buffer-local variable. I would think that I could use defvar
> as the setting rather than a buffer-local variable, as the value would be the
> same for all elisp files.
=defvar= and =defvar-local= define global variables. The difference is that
variables defined with =defvar-local= become buffer-local whenever they are set
(with =setq=). But the value set with the =defvar-local= expression itself is
the default value, which is the value that applies in buffers that do not have
their own local value for said variable. (You can set a default value explicitly
with =setq-default=.)
--
Joost Kremers
Life has its moments
^ permalink raw reply [flat|nested] 11+ messages in thread
* outline-regexp) using ";; *+ " for elisp code
2021-05-11 10:29 ` Joost Kremers
@ 2021-05-11 11:22 ` Christopher Dimech
2021-05-11 14:15 ` Jean Louis
0 siblings, 1 reply; 11+ messages in thread
From: Christopher Dimech @ 2021-05-11 11:22 UTC (permalink / raw)
To: Joost Kremers; +Cc: help-gnu-emacs
Hi Joost,
Could you assist with another capability. I would like to use a keybinding
to cycle the folding of headers only.
"H-<left>" fold
"H-<right>" unfold
Regards
Christopher
> Sent: Tuesday, May 11, 2021 at 10:29 PM
> From: "Joost Kremers" <joostkremers@fastmail.fm>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: outline-regexp) using ";; *+ " for elisp code
>
>
> On Tue, May 11 2021, Christopher Dimech wrote:
> > defvar-local is buffer-local variable. I would think that I could use defvar
> > as the setting rather than a buffer-local variable, as the value would be the
> > same for all elisp files.
>
> =defvar= and =defvar-local= define global variables. The difference is that
> variables defined with =defvar-local= become buffer-local whenever they are set
> (with =setq=). But the value set with the =defvar-local= expression itself is
> the default value, which is the value that applies in buffers that do not have
> their own local value for said variable. (You can set a default value explicitly
> with =setq-default=.)
>
>
>
> --
> Joost Kremers
> Life has its moments
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-05-11 14:15 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-11 3:11 outline-regexp) using ";; *+ " for elisp code Christopher Dimech
2021-05-11 7:05 ` Joost Kremers
2021-05-11 7:11 ` Christopher Dimech
2021-05-11 7:16 ` Christopher Dimech
2021-05-11 7:59 ` Christopher Dimech
2021-05-11 8:19 ` Joost Kremers
2021-05-11 8:32 ` Christopher Dimech
2021-05-11 8:48 ` Christopher Dimech
2021-05-11 10:29 ` Joost Kremers
2021-05-11 11:22 ` Christopher Dimech
2021-05-11 14:15 ` Jean Louis
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.