bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10772: 24.0.93; [patch] Convert tcl-auto-fill-mode to use define-min


From: Stefan Monnier
Subject: bug#10772: 24.0.93; [patch] Convert tcl-auto-fill-mode to use define-minor-mode
Date: Sun, 12 Feb 2012 00:12:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux)

> --8<---------------cut here---------------start------------->8---
> (set (make-local-variable 'normal-auto-fill-function) 'foo-do-auto-fill)
> --8<---------------cut here---------------end--------------->8---

> These 3 modes (and some others from cursory checking) don't define
> foo-auto-fill-mode and just let the user call auto-fill-mode - which
> makes me wonder if defining tcl-auto-fill-mode is the right thing to do
> anyway.

Actually, thinking about it some more, maybe tcl-auto-fill-mode should
be renamed (it has nothing specific to Tcl) and I think it could be
implemented along the lines of (100% untested):

  (define-minor-mode auto-fill-noncode-mode
    :variable
    ((and auto-fill-function comment-auto-fill-only-comments)
     . (lambda (x)
         (auto-fill-mode (if x 1 -1))
         (if auto-fill-function
             (set (make-local-variable 'comment-auto-fill-only-comments) t)
           (kill-local-variable 'comment-auto-fill-only-comments)))))

-- Stefan





reply via email to

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