GNU bug report logs -
#10772
24.0.93; [patch] Convert tcl-auto-fill-mode to use define-minor-mode
Previous Next
Reported by: William Stevenson <yhvh2000 <at> gmail.com>
Date: Thu, 9 Feb 2012 06:51:01 UTC
Severity: minor
Tags: fixed, patch
Found in version 24.0.93
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #11 received at 10772 <at> debbugs.gnu.org (full text, mbox):
> -(defun tcl-auto-fill-mode (&optional arg)
> - "Like `auto-fill-mode', but sets `comment-auto-fill-only-comments'."
> - (interactive "P")
> - (auto-fill-mode arg)
> - (if auto-fill-function
> - (set (make-local-variable 'comment-auto-fill-only-comments) t)
> - (kill-local-variable 'comment-auto-fill-only-comments)))
> +(define-minor-mode tcl-auto-fill-mode
> + "Like `auto-fill-mode', but sets `comment-auto-fill-only-comments'.
> +Turning the mode on or off runs `tcl-auto-fill-mode-hook'."
> + :init-value nil
> + (cond ((null tcl-auto-fill-mode)
> + ;; Turn mode off
> + (auto-fill-mode 0)
> + (kill-local-variable 'comment-auto-fill-only-comments))
> + (t
> + ;; Turn mode on
> + (auto-fill-mode)
> + (set (make-local-variable 'comment-auto-fill-only-comments) t))))
The problem with this approach is that it creates new possible states,
e.g. if the user enables tcl-auto-fill-mode and then disables
auto-fill-mode.
Maybe we could use an approach like the one I used for
(binary-)overwrite-mode.
Stefan
This bug report was last modified 8 years and 46 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.