[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adaptive fill getting prefix wrong -- how to fix?
From: |
Richard C. Cobbe |
Subject: |
Re: Adaptive fill getting prefix wrong -- how to fix? |
Date: |
Sun, 23 Jul 2006 07:47:32 -0400 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, usg-unix-v) |
martin rudalics <rudalics@gmx.at> writes:
> > I'm seeing some undesired behavior in emacs-lisp mode that involves
> > adaptive fill, and I'm hoping someone can tell me how to fix this. As
> > an example of the problem, consider the following excerpt from my
> > .emacs file:
> >
> > ;; override default binding of return as newline-and-indent, which is
> > ;; distracting in text mode.
> > (add-hook 'text-mode-hook
> > '(lambda () (define-key text-mode-map (kbd "RET") 'newline)))
> >
> > I have auto-fill and adaptive fill enabled but otherwise at their
> > default settings. The end of the (lambda ...) expression extends
> > beyond my fill column, so if I put point at the end of the line and
> > hit space, it refills:
> >
> > ;; override default binding of return as newline-and-indent, which is
> > ;; distracting in text mode.
> > (add-hook 'text-mode-hook
> > '(lambda () (define-key text-mode-map (kbd "RET")
> > ;; 'newline)))
> >
> > That's not right -- it's commented out the end of the function, including
> > the close parens. Clearly adaptive fill is inferring the fill prefix
> > incorrectly. What I want to happen is for the 'newline))) to be
> > uncommented and appropriately indented -- 2 spaces in from the (define-key.
> >
> > Is this a misconfiguration on my part, or am I stuck with this behavior?
>
> This happens because `do-auto-fill' does a `backward-paragraph' when you
> type the space, goes to the ";; override ..." and detects an
> `adaptive-fill-regexp' there - the semicolon. Please remove the
> semicolon from `adaptive-fill-regexp' (it's customizable). If you want
> to modify this for emacs-lisp mode only, consider doing this in
> `emacs-lisp-mode-hook'. If this breaks comment filling, it might be
> necessary to change `lisp-mode-auto-fill' appropriately.
Worked like a charm, thanks!
Richard