Commit 94dfee0b authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(define-minor-mode): Simplify.

parent b6790c3e
...@@ -194,28 +194,20 @@ For example, you could write ...@@ -194,28 +194,20 @@ For example, you could write
Use the command `%s' to change this variable." pretty-name mode)) Use the command `%s' to change this variable." pretty-name mode))
(make-variable-buffer-local ',mode)) (make-variable-buffer-local ',mode))
(let ((curfile (or (and (boundp 'byte-compile-current-file) (let ((base-doc-string
byte-compile-current-file) (concat "Non-nil if %s is enabled.
load-file-name)) See the command `%s' for a description of this minor-mode."
base-doc-string) (if body "
(setq base-doc-string "Non-nil if %s is enabled.
See the command `%s' for a description of this minor-mode.
Setting this variable directly does not take effect; Setting this variable directly does not take effect;
use either \\[customize] or the function `%s'.") use either \\[customize] or the function `%s'."))))
(if (null body)
(setq base-doc-string "Non-nil if %s is enabled.
See the command `%s' for a description of this minor-mode."))
`(defcustom ,mode ,init-value `(defcustom ,mode ,init-value
,(format base-doc-string pretty-name mode mode) ,(format base-doc-string pretty-name mode mode)
,@set ,@set
,@initialize ,@initialize
,@group ,@group
,@type ,@type
,@(cond ,@(unless (eq require t) `(:require ,require))
((not (and curfile require)) nil) ,@(nreverse extra-keywords))))
((not (eq require t)) `(:require ,require)))
,@(nreverse extra-keywords))))
;; The actual function. ;; The actual function.
(defun ,mode (&optional arg ,@extra-args) (defun ,mode (&optional arg ,@extra-args)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment