From: Lute Kamstra <Lute.Kamstra@cwi.nl>
Subject: Function `lisp-outline-level' in `emacs-lisp/lisp-mode.el'.
Date: 10 Jul 2002 20:12:14 +0200 [thread overview]
Message-ID: <sgdhej7mozl.fsf@occarina.pna.cwi.nl> (raw)
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
next reply other threads:[~2002-07-10 18:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-10 18:12 Lute Kamstra [this message]
[not found] ` <200207111201.g6BC1UV16952@aztec.santafe.edu>
2002-07-11 15:17 ` Function `lisp-outline-level' in `emacs-lisp/lisp-mode.el' Lute Kamstra
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=sgdhej7mozl.fsf@occarina.pna.cwi.nl \
--to=lute.kamstra@cwi.nl \
/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.
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).