[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/generic.el
From: |
Lute Kamstra |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/generic.el |
Date: |
Sun, 03 Apr 2005 16:32:23 -0400 |
Index: emacs/lisp/generic.el
diff -c emacs/lisp/generic.el:1.33 emacs/lisp/generic.el:1.34
*** emacs/lisp/generic.el:1.33 Thu Mar 31 23:16:20 2005
--- emacs/lisp/generic.el Sun Apr 3 20:32:22 2005
***************
*** 185,191 ****
;;;###autoload
(defmacro define-generic-mode (mode comment-list keyword-list
font-lock-list auto-mode-list
! function-list &optional docstring)
"Create a new generic mode MODE.
MODE is the name of the command for the generic mode; it need not
--- 185,192 ----
;;;###autoload
(defmacro define-generic-mode (mode comment-list keyword-list
font-lock-list auto-mode-list
! function-list &optional docstring
! &rest custom-keyword-args)
"Create a new generic mode MODE.
MODE is the name of the command for the generic mode; it need not
***************
*** 216,221 ****
--- 217,227 ----
FUNCTION-LIST is a list of functions to call to do some
additional setup.
+ The optional CUSTOM-KEYWORD-ARGS are pairs of keywords and
+ values. They will be passed to the generated `defcustom' form of
+ the mode hook variable MODE-hook. You can specify keyword
+ arguments without specifying a docstring.
+
See the file generic-x.el for some examples of `define-generic-mode'."
(declare (debug (sexp def-form def-form def-form form def-form
&optional stringp))
***************
*** 224,234 ****
--- 230,254 ----
;; Backward compatibility.
(when (eq (car-safe mode) 'quote)
(setq mode (eval mode)))
+
+ (when (and docstring (not (stringp docstring)))
+ ;; DOCSTRING is not a string so we assume that it's actually the
+ ;; first keyword of CUSTOM-KEYWORD-ARGS.
+ (push docstring custom-keyword-args)
+ (setq docstring nil))
+
(let* ((mode-name (symbol-name mode))
(pretty-name (capitalize (replace-regexp-in-string
"-mode\\'" "" mode-name)))
(mode-hook (intern (concat mode-name "-hook"))))
+ (unless (plist-get custom-keyword-args :group)
+ (setq custom-keyword-args
+ (plist-put custom-keyword-args
+ :group `(or (custom-current-group)
+ ',(intern (replace-regexp-in-string
+ "-mode\\'" "" mode-name))))))
+
`(progn
;; Add a new entry.
(add-to-list 'generic-mode-list ,mode-name)
***************
*** 240,248 ****
(defcustom ,mode-hook nil
,(concat "Hook run when entering " pretty-name " mode.")
:type 'hook
! :group (or (custom-current-group)
! ',(intern (replace-regexp-in-string
! "-mode\\'" "" mode-name))))
(defun ,mode ()
,(or docstring
--- 260,266 ----
(defcustom ,mode-hook nil
,(concat "Hook run when entering " pretty-name " mode.")
:type 'hook
! ,@custom-keyword-args)
(defun ,mode ()
,(or docstring
***************
*** 373,379 ****
imenu-case-fold-search t))
;; This generic mode is always defined
! (define-generic-mode default-generic-mode (list ?#) nil nil nil nil)
;; A more general solution would allow us to enter generic-mode for
;; *any* comment character, but would require us to synthesize a new
--- 391,397 ----
imenu-case-fold-search t))
;; This generic mode is always defined
! (define-generic-mode default-generic-mode (list ?#) nil nil nil nil :group
'generic)
;; A more general solution would allow us to enter generic-mode for
;; *any* comment character, but would require us to synthesize a new
- [Emacs-diffs] Changes to emacs/lisp/generic.el,
Lute Kamstra <=
- [Emacs-diffs] Changes to emacs/lisp/generic.el, Lute Kamstra, 2005/04/05
- [Emacs-diffs] Changes to emacs/lisp/generic.el, Lute Kamstra, 2005/04/05
- [Emacs-diffs] Changes to emacs/lisp/generic.el, Lute Kamstra, 2005/04/11
- [Emacs-diffs] Changes to emacs/lisp/generic.el, Lute Kamstra, 2005/04/11
- [Emacs-diffs] Changes to emacs/lisp/generic.el, Lute Kamstra, 2005/04/13