emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: outline-regexp


From: Andreas Roehler
Subject: Re: outline-regexp
Date: Thu, 07 Dec 2006 14:44:37 +0100
User-agent: Thunderbird 1.5.0.4 (X11/20060516)

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








reply via email to

[Prev in Thread] Current Thread [Next in Thread]