(tex-command-end): New variable.
[bpt/emacs.git] / lisp / cus-edit.el
index e53459e..1854512 100644 (file)
   :group 'external
   :group 'development)
 
+(defgroup convenience nil
+  "Convenience features for faster editing."
+  :group 'emacs)
+
 (defgroup programming nil
   "Support for programming in other languages."
   :group 'emacs)
@@ -828,21 +832,32 @@ are shown; the contents of those subgroups are initially hidden."
                                    (custom-unlispify-tag-name group))))))
 
 ;;;###autoload
-(defun customize-group-other-window (symbol)
-  "Customize SYMBOL, which must be a customization group."
-  (interactive (list (completing-read "Customize group: (default emacs) "
-                                     obarray 
-                                     (lambda (symbol)
-                                       (get symbol 'custom-group))
-                                     t)))
-
-  (when (stringp symbol)
-    (if (string-equal "" symbol)
-       (setq symbol 'emacs)
-      (setq symbol (intern symbol))))
-  (custom-buffer-create-other-window
-   (list (list symbol 'custom-group))
-   (format "*Customize Group: %s*" (custom-unlispify-tag-name symbol))))
+(defun customize-group-other-window (group)
+  "Customize GROUP, which must be a customization group."
+  (interactive (list (let ((completion-ignore-case t))
+                      (completing-read "Customize group: (default emacs) "
+                                       obarray 
+                                       (lambda (symbol)
+                                         (or (get symbol 'custom-loads)
+                                             (get symbol 'custom-group)))
+                                       t))))
+  (when (stringp group)
+    (if (string-equal "" group)
+       (setq group 'emacs)
+      (setq group (intern group))))
+  (or (get group 'custom-group)
+      (custom-load-symbol group))
+  (let ((name (format "*Customize Group: %s*"
+                     (custom-unlispify-tag-name group))))
+    (if (get-buffer name)
+       (let ((window (selected-window)))
+         (switch-to-buffer-other-window name)
+         (select-window window))
+      (custom-buffer-create-other-window
+       (list (list group 'custom-group))
+       name
+       (concat " for group "
+              (custom-unlispify-tag-name group))))))
 
 ;;;###autoload
 (defalias 'customize-variable 'customize-option)
@@ -858,19 +873,29 @@ are shown; the contents of those subgroups are initially hidden."
 ;;;###autoload
 (defun customize-changed-options (since-version)
   "Customize all user option variables whose default values changed recently.
-This means, in other words, variables defined with a `:version' option."
+This means, in other words, variables and groups defined with a `:version' 
+option."
   (interactive "sCustomize options changed, since version (default all versions): ")
   (if (equal since-version "")
       (setq since-version nil))
   (let ((found nil))
     (mapatoms (lambda (symbol)
-               (and (boundp symbol)
+               (and (or (boundp symbol)
+                        ;; For groups the previous test fails, this one
+                        ;; could be used to determine if symbol is a
+                        ;; group. Is there a better way for this?
+                        (get symbol 'group-documentation))
                     (let ((version (get symbol 'custom-version)))
                       (and version
                            (or (null since-version)
                                (customize-version-lessp since-version version))))
                     (setq found
-                          (cons (list symbol 'custom-variable) found)))))
+                          ;; We have to set the right thing here,
+                          ;; depending if we have a group or a
+                          ;; variable. 
+                          (if (get  symbol 'group-documentation)
+                              (cons (list symbol 'custom-group) found)
+                            (cons (list symbol 'custom-variable) found))))))
     (if (not found)
        (error "No user options have changed defaults in recent Emacs versions")
       (custom-buffer-create (custom-sort-items found t nil)
@@ -1771,7 +1796,8 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
   "Default form of displaying variable values."
   :type '(choice (const edit)
                 (const lisp))
-  :group 'custom-buffer)
+  :group 'custom-buffer
+  :version "20.3")
 
 (define-widget 'custom-variable 'custom
   "Customize variable."
@@ -2216,7 +2242,8 @@ Match frames with dark backgrounds.")
   :type '(choice (const all)
                 (const selected)
                 (const lisp))
-  :group 'custom-buffer)
+  :group 'custom-buffer
+  :version "20.3")
 
 (define-widget 'custom-face 'custom
   "Customize face."
@@ -2984,11 +3011,19 @@ you need to explicitly load that file for the settings to take effect."
   :type '(choice (const :tag "Your Emacs init file" nil) file)
   :group 'customize)
 
+(defun custom-file ()
+  "Return the file name for saving customizations."
+  (setq custom-file
+       (or custom-file
+           user-init-file
+           (read-file-name "File for customizations: "
+                           "~/" nil nil ".emacs"))))
+
 (defun custom-save-delete (symbol)
   "Delete the call to SYMBOL from `custom-file'.
 Leave point at the location of the call, or after the last expression."
   (let ((default-major-mode))
-    (set-buffer (find-file-noselect (or custom-file user-init-file))))
+    (set-buffer (find-file-noselect (custom-file))))
   (goto-char (point-min))
   (catch 'found
     (while t
@@ -3096,7 +3131,7 @@ Leave point at the location of the call, or after the last expression."
     (custom-save-faces)
     (save-excursion
       (let ((default-major-mode nil))
-       (set-buffer (find-file-noselect (or custom-file user-init-file))))
+       (set-buffer (find-file-noselect (custom-file))))
       (save-buffer))))
 
 ;;; The Customize Menu.