Lute Kamstra <[EMAIL PROTECTED]> writes: > David Kastrup <[EMAIL PROTECTED]> writes: > >> Lute Kamstra <[EMAIL PROTECTED]> writes: >> >>> In (Emacs) Lisp mode, outline-regexp is ";;;;* [^ \t\n]\\|(" and >>> outline-level is lisp-outline-level: >>> >>> (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". >> >> Why is that strange? outline-regexp is not even consulted when >> ;###autoload is found, so I don't see how it would come into play >> here. >> >>> Shall I commit the patch below? >> >>> *** lisp/emacs-lisp/lisp-mode.el 1 Feb 2005 15:48:50 -0000 1.171 >>> --- lisp/emacs-lisp/lisp-mode.el 13 Feb 2005 11:03:02 -0000 >>> *************** >>> *** 212,223 **** >>> >>> (defun lisp-outline-level () >>> "Lisp mode `outline-level' function." >>> ! (if (looking-at "(\\|;;;###autoload") >>> 1000 >>> - (looking-at outline-regexp) >>> (- (match-end 0) (match-beginning 0)))) >>> >>> - >>> --- 212,221 ---- >>> >>> (defun lisp-outline-level () >>> "Lisp mode `outline-level' function." >>> ! (if (eq (following-char) ?\() >>> 1000 >>> (- (match-end 0) (match-beginning 0)))) >> >> The patch is completely nonsensical. It returns rubbish in almost all >> cases since it is the "looking-at" that established match-end and >> match-beginning in the first place. > > The variables outline-regexp and outline-level are used by Outline > minor mode. Did you take a look at their docstrings? Outline minor > mode searches for matches of outline-regexp and at each match the > function in outline-level is called to determine the nesting level: > > ,----[ C-h v outline-level RET ] > | outline-level's value is outline-level > | > | *Function of no args to compute a header's nesting level in an outline. > | It can assume point is at the beginning of a header line and that the match > | data reflects the `outline-regexp'. > | > | Defined in `outline'. > `---- > > Does my patch make more sense now?
Ok, I did not realize that those functions were essentially hook functions, sorry. However, I find that within a Lisp buffer I have outline-regexp's value is ";;;;* [^ \n]\\|(" Local in buffer loaddefs.el; global value is "[*\f]+" *Regular expression to match the beginning of a heading. Any line whose beginning matches this regexp is considered to start a heading. Note that Outline mode only checks this regexp at the start of a line, so the regexp need not (and usually does not) start with `^'. The recommended way to set this is with a Local Variables: list in the file it applies to. See also `outline-heading-end-regexp'. You can customize this variable. Defined in `outline'. [back] and this just barely manages to avoid matching ;;;###autoload. I am not sure whether this really is intentional. Especially in light of the lisp-outline-level definition. So while I have no clue about the matter at hand, I would just want to suggest that it might be possible from the look of the previous code that outline-regexp was intended to also match ;;;###autoload, or at least that it was considered a valid possibility for a user customization of outline-regexp in Lisp mode. In either case it would not be wrong to keep the check. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel