[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Function `lisp-outline-level' in `emacs-lisp/lisp-mode.el'.
From: |
Lute Kamstra |
Subject: |
Function `lisp-outline-level' in `emacs-lisp/lisp-mode.el'. |
Date: |
10 Jul 2002 20:12:14 +0200 |
User-agent: |
Gnus 5.9 on Emacs 21.2 |
Dear People,
I've been working on a substitute of the outline minor mode, so I
studied the implementation of this minor mode and its interaction with
some major modes. In `emacs-lisp/lisp-mode.el' (Emacs 21.2),
`outline-regexp' and `outline-level' are set as follows:
(setq outline-regexp ";;;;* \\|(")
(setq outline-level 'lisp-outline-level)
The function `lisp-outline-level' is defined as:
(defun lisp-outline-level ()
"Lisp mode `outline-level' function."
(if (looking-at "(")
1000
(looking-at outline-regexp)
(- (match-end 0) (match-beginning 0))))
I'm a bit surprised by this. It means that comments starting with
four semi-colons are less important then comments starting with three.
This is counter-intuitive to me. I don't know if there are people
that have a coding style that involves comments that start with more
than three semi-colons, but I doubt that they would deem such comments
subordinate to comments starting with three. The following definition
of `lisp-outline-level' would fix this problem:
(defun lisp-outline-level ()
"Lisp mode `outline-level' function."
(if (looking-at "(")
1000
(looking-at outline-regexp)
(- 100 (- (match-end 0) (match-beginning 0)))))
However, I do not like the fact that the number returned by the
function does not accurately reflect the level of the header in the
sense that the most important headers in a buffer are not assigned 1
and that there is a large gap in the range of the function. I would
prefer to give all comments starting with three or more semi-colons
the same level number an define `lisp-outline-level' like:
(defun lisp-outline-level ()
"Lisp mode `outline-level' function."
(if (looking-at "(")
2
1))
Regards,
Lute Kamstra.
--
Lute Kamstra <Lute.Kamstra@cwi.nl>
CWI department PNA4
Room M233 phone (+31) 20 592 4214
- Function `lisp-outline-level' in `emacs-lisp/lisp-mode.el'.,
Lute Kamstra <=