[Top][All Lists]

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

Re: lisp-outline-level.

From: David Kastrup
Subject: Re: lisp-outline-level.
Date: Sun, 13 Feb 2005 18:48:52 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> (defun lisp-outline-level ()
>>   "Lisp mode `outline-level' function."
>>   (if (looking-at "(\\|;;;###autoload")
>>       1000
>>     (looking-at outline-regexp)
>>     (- (match-end 0) (match-beginning 0))))
>> This is a bit strange as outline-regexp doesn't match
>> ";;;###autoload".  Shall I commit the patch below?
> Why did you assume that the ;;;###autoload thingy got there by mistake?
> Wouldn't it be better to fix outline-regexp?

Anyway, I find the original butt-ugly and inefficient.  Wouldn't it be
better to write

(defun lisp-outline-level ()
  "Lisp mode `outline-level' function."
  (if (save-match-data (looking-at "(\\|;;;###autoload")))
    (- (match-end 0) (match-beginning 0))))

or even (if preservation of match data is definitely not required)

(defun lisp-outline-level
  (let ((len (- (match-end 0) (match-beginning 0))))
    (if  (looking-at ...)

David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

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