diff lisp/cus-edit.el @ 91204:53108e6cea98

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
author Miles Bader <miles@gnu.org>
date Thu, 06 Dec 2007 09:51:45 +0000
parents 880960b70474 005ad07af670
children c938ab6810a4
line wrap: on
line diff
--- a/lisp/cus-edit.el	Thu Dec 06 07:36:30 2007 +0000
+++ b/lisp/cus-edit.el	Thu Dec 06 09:51:45 2007 +0000
@@ -491,6 +491,14 @@
     map)
   "Local keymap for links in `custom-mode'.")
 
+(defvar custom-field-keymap
+  (let ((map (copy-keymap widget-field-keymap)))
+    (define-key map "\C-c\C-c" 'Custom-set)
+    (define-key map "\C-x\C-s" 'Custom-save)
+    map)
+  "Keymap used inside editable fields in customization buffers.")
+
+(widget-put (get 'editable-field 'widget-type) :keymap custom-field-keymap)
 
 ;;; Utilities.
 
@@ -4126,6 +4134,9 @@
 	   (setq user-init-file default-init-file))
 	 user-init-file))))
 
+;; If recentf-mode is non-nil, this is defined.
+(declare-function recentf-expand-file-name "recentf" (name))
+
 ;;;###autoload
 (defun custom-save-all ()
   "Save all customizations in `custom-file'."
@@ -4435,7 +4446,7 @@
 ;;; Toolbar and menubar support
 
 (easy-menu-define
-  Custom-mode-menu custom-mode-map
+  Custom-mode-menu (list custom-mode-map custom-field-keymap)
   "Menu used in customization buffers."
   (nconc (list "Custom"
 	       (customize-menu-create 'customize))
@@ -4473,15 +4484,6 @@
 	(widget-apply-action button event)
       (error "You can't edit this part of the Custom buffer"))))
 
-(defvar custom-field-keymap
-  (let ((map (copy-keymap widget-field-keymap)))
-    (define-key map "\C-c\C-c" 'Custom-set)
-    (define-key map "\C-x\C-s" 'Custom-save)
-    map)
-  "Keymap used inside editable fields in customization buffers.")
-
-(widget-put (get 'editable-field 'widget-type) :keymap custom-field-keymap)
-
 (defun Custom-goto-parent ()
   "Go to the parent group listed at the top of this buffer.
 If several parents are listed, go to the first of them."
@@ -4502,7 +4504,7 @@
   (if (eq (widget-get (widget-get widget :parent) :custom-state) 'modified)
       (message "To install your edits, invoke [State] and choose the Set operation")))
 
-(defun custom-mode ()
+(define-derived-mode custom-mode nil "Custom"
   "Major mode for editing customization buffers.
 
 The following commands are available:
@@ -4524,9 +4526,6 @@
 
 Entry to this mode calls the value of `custom-mode-hook'
 if that value is non-nil."
-  (kill-all-local-variables)
-  (setq major-mode 'custom-mode
-	mode-name "Custom")
   (use-local-map custom-mode-map)
   (easy-menu-add Custom-mode-menu)
   (set (make-local-variable 'tool-bar-map) custom-tool-bar-map)
@@ -4536,6 +4535,7 @@
   (setq widget-documentation-face 'custom-documentation)
   (make-local-variable 'widget-button-face)
   (setq widget-button-face custom-button)
+  (setq show-trailing-whitespace nil)
 
   ;; We need this because of the "More" button on docstrings.
   ;; Otherwise clicking on "More" can push point offscreen, which
@@ -4553,8 +4553,7 @@
     (set (make-local-variable 'widget-push-button-suffix) "")
     (set (make-local-variable 'widget-link-prefix) "")
     (set (make-local-variable 'widget-link-suffix) ""))
-  (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)
-  (run-mode-hooks 'custom-mode-hook))
+  (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t))
 
 (put 'custom-mode 'mode-class 'special)