unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Function `lisp-outline-level' in `emacs-lisp/lisp-mode.el'.
@ 2002-07-10 18:12 Lute Kamstra
       [not found] ` <200207111201.g6BC1UV16952@aztec.santafe.edu>
  0 siblings, 1 reply; 2+ messages in thread
From: Lute Kamstra @ 2002-07-10 18:12 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-11 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-10 18:12 Function `lisp-outline-level' in `emacs-lisp/lisp-mode.el' Lute Kamstra
     [not found] ` <200207111201.g6BC1UV16952@aztec.santafe.edu>
2002-07-11 15:17   ` Lute Kamstra

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).