Stefan Monnier <[EMAIL PROTECTED]> 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")))
      1000
    (- (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 ...)
       1000
     len)))


-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to