* outline-regexp
@ 2006-12-04 13:38 Andreas Roehler
2006-12-04 15:04 ` outline-regexp Stefan Monnier
2006-12-06 14:23 ` outline-regexp Richard Stallman
0 siblings, 2 replies; 8+ messages in thread
From: Andreas Roehler @ 2006-12-04 13:38 UTC (permalink / raw)
Customizing `outline-regexp' in Emacs-Lisp-mode turned
out to be difficult:
Setting with `customize-variable' didn't have effect.
`describe-variable' told
,----
| outline-regexp is a variable defined in `outline.el'.
| Its value is
| ";;;\\(;* [^ \n]\\|###autoload\\)\\|("
| Local in buffer eil.el; global value is "[*\f]+"
`----
However, outline.el showed:
(defcustom outline-regexp "[*\^L]+"
whereas `customize-variable' displayed an entry
^[ \t]*(defun
(probably due to an earlier customization.)
AFAIS `outline-regexp' is set by a function
`lisp-mode-variables' in lisp-mode.el via `setq'
with the result, that's neither mentioned in
`load-history' nor listed in TAGS.
Given, I didn't oversee something important, it seems
worthwhile to re-consider this.
What about to drop setting in lisp-mode.el and let the
global value in effect instead? We would gain a
customization facility.
Thanks
__
Andreas Roehler
GNU Emacs 22.0.90.1 (i686-pc-linux-gnu, X toolkit,
Xaw3d scroll bars) of 2006-10-28
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: outline-regexp
2006-12-04 13:38 outline-regexp Andreas Roehler
@ 2006-12-04 15:04 ` Stefan Monnier
2006-12-04 15:54 ` outline-regexp Andreas Roehler
2006-12-05 5:09 ` outline-regexp Richard Stallman
2006-12-06 14:23 ` outline-regexp Richard Stallman
1 sibling, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2006-12-04 15:04 UTC (permalink / raw)
Cc: emacs-devel
> Customizing `outline-regexp' in Emacs-Lisp-mode turned
> out to be difficult:
outline-regexp is usually set by the major mode, not by the user.
It's no surprise that `customize' doesn't deal with it too well.
We should probably not use `defcustom' but `defvar' to define it.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: outline-regexp
2006-12-04 15:04 ` outline-regexp Stefan Monnier
@ 2006-12-04 15:54 ` Andreas Roehler
2006-12-05 5:09 ` outline-regexp Richard Stallman
1 sibling, 0 replies; 8+ messages in thread
From: Andreas Roehler @ 2006-12-04 15:54 UTC (permalink / raw)
Cc: emacs-devel
Stefan Monnier schrieb:
>> Customizing `outline-regexp' in Emacs-Lisp-mode turned
>> out to be difficult:
>
> outline-regexp is usually set by the major mode, not by the user.
> It's no surprise that `customize' doesn't deal with it too well.
> We should probably not use `defcustom' but `defvar' to define it.
>
>
> Stefan
>
AFAIU a `defcustom' for the setting major mode is needed.
Otherwise it would be overridden
by the mode as it happens now.
At least the setting form should be reported
somehow. The problem mentioned is the difficulty to
find the right place and way for changing.
Thanks
__
Andreas Roehler
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: outline-regexp
2006-12-04 15:04 ` outline-regexp Stefan Monnier
2006-12-04 15:54 ` outline-regexp Andreas Roehler
@ 2006-12-05 5:09 ` Richard Stallman
1 sibling, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2006-12-05 5:09 UTC (permalink / raw)
Cc: andreas.roehler, emacs-devel
outline-regexp is usually set by the major mode, not by the user.
It can also be set in a local variables list.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: outline-regexp
2006-12-04 13:38 outline-regexp Andreas Roehler
2006-12-04 15:04 ` outline-regexp Stefan Monnier
@ 2006-12-06 14:23 ` Richard Stallman
2006-12-07 13:44 ` outline-regexp Andreas Roehler
1 sibling, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2006-12-06 14:23 UTC (permalink / raw)
Cc: emacs-devel
The most useful way to specify outline-regexp is with a file local
variable. That is much more useful that customizing its default
value.
I think it is useful for that variable to show up in a custom buffer,
since it is meant to be set by the user. But we don't want the user
to actually customize it; instead, when it appears in a custom buffer,
it should say you should specify this with a file local variable.
Is there an easy way to do that?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: outline-regexp
2006-12-06 14:23 ` outline-regexp Richard Stallman
@ 2006-12-07 13:44 ` Andreas Roehler
2006-12-07 14:17 ` outline-regexp Stefan Monnier
2006-12-09 6:01 ` outline-regexp Richard Stallman
0 siblings, 2 replies; 8+ messages in thread
From: Andreas Roehler @ 2006-12-07 13:44 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman schrieb:
> The most useful way to specify outline-regexp is with a file local
> variable. That is much more useful that customizing its default
> value.
>
> I think it is useful for that variable to show up in a custom buffer,
> since it is meant to be set by the user. But we don't want the user
> to actually customize it; instead, when it appears in a custom buffer,
> it should say you should specify this with a file local variable.
>
> Is there an easy way to do that?
>
A first easy and helpful step could be to check in some
documentation mentioning the issue:
*** /usr/local/share/emacs/22.0.50/lisp/outline.el 2006-05-11
17:01:41.000000000 +0200
--- /home/speck/progarbeit/emacs/veraendert/outline.el 2006-12-07
13:49:38.000000000 +0100
***************
*** 48,53 ****
--- 48,57 ----
(defcustom outline-regexp "[*\^L]+"
"Regular expression to match the beginning of a heading.
Any line whose beginning matches this regexp is considered to start a
heading.
+
+ If the global value isn't into effect, probably it's set by the mode.
+ See lisp-mode.el for example how this is done.
+
Note that Outline mode only checks this regexp at the start of a line,
so the regexp need not (and usually does not) start with `^'.
The recommended way to set this is with a Local Variables: list
;;;;;;;;;;
Beside this:
Why not let `outline-regexp' go with the mode, although not through a
function as it's done now, but with defcustom.
It should be possible to
- use the mode-value (default)
- use the global-value be setting a boolean `use-mode-value' to nil.
- customize both.
Changed lisp-mode.el respectively, patch below.
GNU Emacs 22.0.90.1 (i686-pc-linux-gnu, X toolkit,
Xaw3d scroll bars) of 2006-10-28:
diff -c /home/speck/emacs/lisp/emacs-lisp/lisp-mode.el
/home/speck/progarbeit/emacs/veraendert/lisp-mode.el
*** /home/speck/emacs/lisp/emacs-lisp/lisp-mode.el 2006-07-05
09:47:41.000000000 +0200
--- /home/speck/progarbeit/emacs/veraendert/lisp-mode.el 2006-12-07
14:06:54.000000000 +0100
***************
*** 30,35 ****
--- 30,57 ----
;;; Code:
+
+
+ (defcustom outline-use-mode-regexp t
+ "If outline should use mode-specific customization.
+ If nil, global value of outline-regexp is used"
+
+ :type 'boolean
+ :group 'outlines)
+
+ (defcustom outline-emacs-lisp-regexp ";;;\\(;* [^
\t\n]\\|###autoload\\)\\|("
+ "Regular expression to match the beginning of a heading.
+ Any line whose beginning matches this regexp is considered to start a
heading.
+ Note that Outline mode only checks this regexp at the start of a line,
+ so the regexp need not (and usually does not) start with `^'.
+ The recommended way to set this is with a Local Variables: list
+ in the file it applies to. See also `outline-heading-end-regexp'."
+ :type '(regexp (const nil))
+ :group 'outlines)
+
+ (when outline-use-mode-regexp
+ (setq outline-regexp (eval outline-emacs-lisp-regexp)))
+
(defvar font-lock-comment-face)
(defvar font-lock-doc-face)
(defvar font-lock-keywords-case-fold-search)
***************
*** 216,223 ****
(setq indent-region-function 'lisp-indent-region)
(make-local-variable 'parse-sexp-ignore-comments)
(setq parse-sexp-ignore-comments t)
- (make-local-variable 'outline-regexp)
- (setq outline-regexp ";;;\\(;* [^ \t\n]\\|###autoload\\)\\|(")
(make-local-variable 'outline-level)
(setq outline-level 'lisp-outline-level)
(make-local-variable 'comment-start)
--- 238,243 ---
Regards
__
Andreas Roehler
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: outline-regexp
2006-12-07 13:44 ` outline-regexp Andreas Roehler
@ 2006-12-07 14:17 ` Stefan Monnier
2006-12-09 6:01 ` outline-regexp Richard Stallman
1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2006-12-07 14:17 UTC (permalink / raw)
Cc: rms, emacs-devel
> (defcustom outline-regexp "[*\^L]+"
> "Regular expression to match the beginning of a heading.
> Any line whose beginning matches this regexp is considered to start
> a heading.
> +
> + If the global value isn't into effect, probably it's set by the mode.
> + See lisp-mode.el for example how this is done.
> +
> Note that Outline mode only checks this regexp at the start of a line,
> so the regexp need not (and usually does not) start with `^'.
> The recommended way to set this is with a Local Variables: list
If the user sees this text via C-h v it will also give both the global and
the buffer-local value, thus making it fairly obvious what's going on.
Maybe `custom' should do similar: e.g. check whether the variable is locally
changed in some buffers and if so add a little blurb about the global
setting not taking effect in those buffers.
> Why not let `outline-regexp' go with the mode, although not through a
> function as it's done now, but with defcustom.
Heavy, clunky, inconvenient.
Just set the variable in your file-local block and be done with it.
Or if you want to change the setting in all emacs-lisp-mode buffers, then do
it the normal way:
(add-hook 'emacs-lisp-mode-hook
(lambda () (setq outline-regexp "my favorite setting")))
-- Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: outline-regexp
2006-12-07 13:44 ` outline-regexp Andreas Roehler
2006-12-07 14:17 ` outline-regexp Stefan Monnier
@ 2006-12-09 6:01 ` Richard Stallman
1 sibling, 0 replies; 8+ messages in thread
From: Richard Stallman @ 2006-12-09 6:01 UTC (permalink / raw)
Cc: emacs-devel
Why not let `outline-regexp' go with the mode, although not through a
function as it's done now, but with defcustom.
The way this is done now is that major modes can set `outline-regexp'
as a buffer-local variable.
Stefan suggested:
If the user sees this text via C-h v it will also give both the global and
the buffer-local value, thus making it fairly obvious what's going on.
Maybe `custom' should do similar: e.g. check whether the variable is locally
changed in some buffers and if so add a little blurb about the global
setting not taking effect in those buffers.
I think that is a good idea.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-12-09 6:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-04 13:38 outline-regexp Andreas Roehler
2006-12-04 15:04 ` outline-regexp Stefan Monnier
2006-12-04 15:54 ` outline-regexp Andreas Roehler
2006-12-05 5:09 ` outline-regexp Richard Stallman
2006-12-06 14:23 ` outline-regexp Richard Stallman
2006-12-07 13:44 ` outline-regexp Andreas Roehler
2006-12-07 14:17 ` outline-regexp Stefan Monnier
2006-12-09 6:01 ` outline-regexp Richard Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).