all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Adaptive fill getting prefix wrong -- how to fix?
@ 2006-07-20 16:05 Richard C. Cobbe
  0 siblings, 0 replies; 3+ messages in thread
From: Richard C. Cobbe @ 2006-07-20 16:05 UTC (permalink / raw)


Greetings, all.

I'm in the process of switching back to GNUEmacs after many years of using
XEmacs, so I can take advantage of the Carbon GNU Emacs build on my Mac.

GNU Emacs 22.0.50.1, based on the CVS version of June 16, 2006.

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?

Thanks,

Richard

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

* Re: Adaptive fill getting prefix wrong -- how to fix?
@ 2006-07-22 12:59 martin rudalics
  0 siblings, 0 replies; 3+ messages in thread
From: martin rudalics @ 2006-07-22 12:59 UTC (permalink / raw)


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

martin

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

* Re: Adaptive fill getting prefix wrong -- how to fix?
       [not found] <mailman.4366.1153643002.9609.help-gnu-emacs@gnu.org>
@ 2006-07-23 11:47 ` Richard C. Cobbe
  0 siblings, 0 replies; 3+ messages in thread
From: Richard C. Cobbe @ 2006-07-23 11:47 UTC (permalink / raw)


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

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

end of thread, other threads:[~2006-07-23 11:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.4366.1153643002.9609.help-gnu-emacs@gnu.org>
2006-07-23 11:47 ` Adaptive fill getting prefix wrong -- how to fix? Richard C. Cobbe
2006-07-22 12:59 martin rudalics
  -- strict thread matches above, loose matches on Subject: below --
2006-07-20 16:05 Richard C. Cobbe

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.