unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* fix: auto-fill-mode converted to proper minor-mode
@ 2005-03-16  7:19 Sascha Wilde
  2005-03-16 12:15 ` Sascha Wilde
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Wilde @ 2005-03-16  7:19 UTC (permalink / raw)


Hi,

I enclosed a small patch to make auto-fill-mode a proper minor-mode.

Without this patch describe-mode won't work when auto-fill-mode is
used.

It's my first emacs patch, so I hope its not to worse...

cheers
sascha

diff -au emacs/lisp/ChangeLog emacs-patched20050315/lisp/ChangeLog
--- emacs/lisp/ChangeLog	2005-03-15 15:39:40.000000000 +0000
+++ emacs-patched20050315/lisp/ChangeLog	2005-03-15 19:03:28.000000000 +0000
@@ -1,3 +1,14 @@
+2005-03-15  Sascha Wilde  <swilde@sha-bang.de>
+
+	* simple.el (auto-fill-mode): converted to a proper minor-mode.
+	
+	* subr.el (minor-mode-list): removed auto-fill-mode
+
+	* bindings.el (minor-mode-alist): removed auto-fill-function, its
+	no langer neede with auto-fill-mode being defind using
+	define-minor-mode.
+	(mode-line-mode-menu): changed auto-fill-function to auto-fill-mode.
+
 2005-03-15  Juri Linkov  <juri@jurta.org>
 
 	* isearch.el (isearch-error): New variable.
Only in emacs-patched20050315/lisp: ChangeLog.~1.7100.~
diff -au emacs/lisp/bindings.el emacs-patched20050315/lisp/bindings.el
--- emacs/lisp/bindings.el	2005-03-15 18:48:45.000000000 +0000
+++ emacs-patched20050315/lisp/bindings.el	2005-03-15 16:26:22.000000000 +0000
@@ -430,7 +430,7 @@
 	      :button (:toggle . (bound-and-true-p auto-revert-mode))))
 (define-key mode-line-mode-menu [auto-fill-mode]
   `(menu-item ,(purecopy "Auto fill (Fill)") auto-fill-mode
-	      :button (:toggle . auto-fill-function)))
+	      :button (:toggle . auto-fill-mode)))
 (define-key mode-line-mode-menu [abbrev-mode]
   `(menu-item ,(purecopy "Abbrev (Abbrev)") abbrev-mode
 	      :button (:toggle . abbrev-mode)))
@@ -485,7 +485,6 @@
       (list
        (list 'abbrev-mode " Abbrev")
        '(overwrite-mode overwrite-mode)
-       (list 'auto-fill-function " Fill")
        ;; not really a minor mode...
        '(defining-kbd-macro " Def")))
 
diff -au emacs/lisp/simple.el emacs-patched20050315/lisp/simple.el
--- emacs/lisp/simple.el	2005-03-15 18:48:46.000000000 +0000
+++ emacs-patched20050315/lisp/simple.el	2005-03-15 17:12:05.000000000 +0000
@@ -3933,9 +3933,9 @@
   "The function to use for `auto-fill-function' if Auto Fill mode is turned on.
 Some major modes set this.")
 
-;; FIXME: turn into a proper minor mode.
+;; FIXME:
 ;; Add a global minor mode version of it.
-(defun auto-fill-mode (&optional arg)
+(define-minor-mode auto-fill-mode
   "Toggle Auto Fill mode.
 With arg, turn Auto Fill mode on if and only if arg is positive.
 In Auto Fill mode, inserting a space at a column beyond `current-fill-column'
@@ -3943,14 +3943,12 @@
 
 The value of `normal-auto-fill-function' specifies the function to use
 for `auto-fill-function' when turning Auto Fill mode on."
-  (interactive "P")
-  (prog1 (setq auto-fill-function
-	       (if (if (null arg)
-		       (not auto-fill-function)
-		       (> (prefix-numeric-value arg) 0))
-		   normal-auto-fill-function
-		   nil))
-    (force-mode-line-update)))
+  nil " Fill" nil
+  :group 'editing-basics
+  (setq auto-fill-function
+        (if auto-fill-mode
+            normal-auto-fill-function
+          nil)))
 
 ;; This holds a document string used to document auto-fill-mode.
 (defun auto-fill-function ()
diff -au emacs/lisp/subr.el emacs-patched20050315/lisp/subr.el
--- emacs/lisp/subr.el	2005-03-15 18:48:46.000000000 +0000
+++ emacs-patched20050315/lisp/subr.el	2005-03-15 16:24:38.000000000 +0000
@@ -2424,7 +2424,7 @@
 ;; add it here explicitly.
 ;; isearch-mode is deliberately excluded, since you should
 ;; not call it yourself.
-(defvar minor-mode-list '(auto-save-mode auto-fill-mode abbrev-mode
+(defvar minor-mode-list '(auto-save-mode abbrev-mode
 					 overwrite-mode view-mode
                                          hs-minor-mode)
   "List of all minor mode functions.")

^ permalink raw reply	[flat|nested] 3+ messages in thread
* fix: auto-fill-mode converted to proper minor-mode
@ 2005-03-15 19:16 Sascha Wilde
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Wilde @ 2005-03-15 19:16 UTC (permalink / raw)


Hi,

I enclosed a small patch to make auto-fill-mode a proper minor-mode.

Without this patch describe-mode won't work when auto-fill-mode is
used.

It's my first emacs patch, so I hope its not to worse...

ps: I send this pathch to bug-gnu-emacs@gnu.org a few hours ago,
because of the Information on http://directory.fsf.org/emacs.html but
I think it fits better here.  I added a Changelog Entry and put
everything in one unified diff since than...

cheers
sascha

diff -au emacs/lisp/ChangeLog emacs-patched20050315/lisp/ChangeLog
--- emacs/lisp/ChangeLog	2005-03-15 15:39:40.000000000 +0000
+++ emacs-patched20050315/lisp/ChangeLog	2005-03-15 19:03:28.000000000 +0000
@@ -1,3 +1,14 @@
+2005-03-15  Sascha Wilde  <swilde@sha-bang.de>
+
+	* simple.el (auto-fill-mode): converted to a proper minor-mode.
+	
+	* subr.el (minor-mode-list): removed auto-fill-mode
+
+	* bindings.el (minor-mode-alist): removed auto-fill-function, its
+	no langer neede with auto-fill-mode being defind using
+	define-minor-mode.
+	(mode-line-mode-menu): changed auto-fill-function to auto-fill-mode.
+
 2005-03-15  Juri Linkov  <juri@jurta.org>
 
 	* isearch.el (isearch-error): New variable.
Only in emacs-patched20050315/lisp: ChangeLog.~1.7100.~
diff -au emacs/lisp/bindings.el emacs-patched20050315/lisp/bindings.el
--- emacs/lisp/bindings.el	2005-03-15 18:48:45.000000000 +0000
+++ emacs-patched20050315/lisp/bindings.el	2005-03-15 16:26:22.000000000 +0000
@@ -430,7 +430,7 @@
 	      :button (:toggle . (bound-and-true-p auto-revert-mode))))
 (define-key mode-line-mode-menu [auto-fill-mode]
   `(menu-item ,(purecopy "Auto fill (Fill)") auto-fill-mode
-	      :button (:toggle . auto-fill-function)))
+	      :button (:toggle . auto-fill-mode)))
 (define-key mode-line-mode-menu [abbrev-mode]
   `(menu-item ,(purecopy "Abbrev (Abbrev)") abbrev-mode
 	      :button (:toggle . abbrev-mode)))
@@ -485,7 +485,6 @@
       (list
        (list 'abbrev-mode " Abbrev")
        '(overwrite-mode overwrite-mode)
-       (list 'auto-fill-function " Fill")
        ;; not really a minor mode...
        '(defining-kbd-macro " Def")))
 
diff -au emacs/lisp/simple.el emacs-patched20050315/lisp/simple.el
--- emacs/lisp/simple.el	2005-03-15 18:48:46.000000000 +0000
+++ emacs-patched20050315/lisp/simple.el	2005-03-15 17:12:05.000000000 +0000
@@ -3933,9 +3933,9 @@
   "The function to use for `auto-fill-function' if Auto Fill mode is turned on.
 Some major modes set this.")
 
-;; FIXME: turn into a proper minor mode.
+;; FIXME:
 ;; Add a global minor mode version of it.
-(defun auto-fill-mode (&optional arg)
+(define-minor-mode auto-fill-mode
   "Toggle Auto Fill mode.
 With arg, turn Auto Fill mode on if and only if arg is positive.
 In Auto Fill mode, inserting a space at a column beyond `current-fill-column'
@@ -3943,14 +3943,12 @@
 
 The value of `normal-auto-fill-function' specifies the function to use
 for `auto-fill-function' when turning Auto Fill mode on."
-  (interactive "P")
-  (prog1 (setq auto-fill-function
-	       (if (if (null arg)
-		       (not auto-fill-function)
-		       (> (prefix-numeric-value arg) 0))
-		   normal-auto-fill-function
-		   nil))
-    (force-mode-line-update)))
+  nil " Fill" nil
+  :group 'editing-basics
+  (setq auto-fill-function
+        (if auto-fill-mode
+            normal-auto-fill-function
+          nil)))
 
 ;; This holds a document string used to document auto-fill-mode.
 (defun auto-fill-function ()
diff -au emacs/lisp/subr.el emacs-patched20050315/lisp/subr.el
--- emacs/lisp/subr.el	2005-03-15 18:48:46.000000000 +0000
+++ emacs-patched20050315/lisp/subr.el	2005-03-15 16:24:38.000000000 +0000
@@ -2424,7 +2424,7 @@
 ;; add it here explicitly.
 ;; isearch-mode is deliberately excluded, since you should
 ;; not call it yourself.
-(defvar minor-mode-list '(auto-save-mode auto-fill-mode abbrev-mode
+(defvar minor-mode-list '(auto-save-mode abbrev-mode
 					 overwrite-mode view-mode
                                          hs-minor-mode)
   "List of all minor mode functions.")

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

end of thread, other threads:[~2005-03-16 12:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-16  7:19 fix: auto-fill-mode converted to proper minor-mode Sascha Wilde
2005-03-16 12:15 ` Sascha Wilde
  -- strict thread matches above, loose matches on Subject: below --
2005-03-15 19:16 Sascha Wilde

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).