X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/0bb2392728c10748f3376f8cef6d9ca53e29f464..22bcf2046977620a7f37bbd4dff4be4a4fffc0ed:/lisp/cus-edit.el diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index d443d6c160..3d5ae69fe3 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -442,8 +442,8 @@ (set-keymap-parent map widget-keymap) (define-key map [remap self-insert-command] 'Custom-no-edit) (define-key map "\^m" 'Custom-newline) - (define-key map " " 'scroll-up) - (define-key map "\177" 'scroll-down) + (define-key map " " 'scroll-up-command) + (define-key map "\177" 'scroll-down-command) (define-key map "\C-c\C-c" 'Custom-set) (define-key map "\C-x\C-s" 'Custom-save) (define-key map "q" 'Custom-buffer-done) @@ -699,8 +699,6 @@ If `last', order groups after non-groups." (const :tag "none" nil)) :group 'custom-menu) -;;;###autoload (add-hook 'same-window-regexps (purecopy "\\`\\*Customiz.*\\*\\'")) - (defun custom-sort-items (items sort-alphabetically order-groups) "Return a sorted copy of ITEMS. ITEMS should be a `custom-group' property. @@ -1103,8 +1101,9 @@ then prompt for the MODE to customize." t))) ;;;###autoload -(defun customize-group (&optional group) - "Customize GROUP, which must be a customization group." +(defun customize-group (&optional group other-window) + "Customize GROUP, which must be a customization group. +If OTHER-WINDOW is non-nil, display in another window." (interactive (list (customize-read-group))) (when (stringp group) (if (string-equal "" group) @@ -1112,22 +1111,25 @@ then prompt for the MODE to customize." (setq group (intern group)))) (let ((name (format "*Customize Group: %s*" (custom-unlispify-tag-name group)))) - (if (get-buffer name) - (pop-to-buffer name) - (custom-buffer-create - (list (list group 'custom-group)) - name - (concat " for group " - (custom-unlispify-tag-name group)))))) + (cond + ((null (get-buffer name)) + (funcall (if other-window + 'custom-buffer-create-other-window + 'custom-buffer-create) + (list (list group 'custom-group)) + name + (concat " for group " + (custom-unlispify-tag-name group)))) + (other-window + (switch-to-buffer-other-window name)) + (t + (pop-to-buffer-same-window name))))) ;;;###autoload (defun customize-group-other-window (&optional group) "Customize GROUP, which must be a customization group, in another window." (interactive (list (customize-read-group))) - (let ((pop-up-windows t) - (same-window-buffer-names nil) - (same-window-regexps nil)) - (customize-group group))) + (customize-group group t)) ;;;###autoload (defalias 'customize-variable 'customize-option) @@ -1308,11 +1310,13 @@ Emacs that is associated with version VERSION of PACKAGE." (< minor1 minor2))))) ;;;###autoload -(defun customize-face (&optional face) +(defun customize-face (&optional face other-window) "Customize FACE, which should be a face name or nil. If FACE is nil, customize all faces. If FACE is actually a face-alias, customize the face it is aliased to. +If OTHER-WINDOW is non-nil, display in another window. + Interactively, when point is on text which has a face specified, suggest to customize that face, if it's customizable." (interactive (list (read-face-name "Customize face" "all faces" t))) @@ -1320,21 +1324,24 @@ suggest to customize that face, if it's customizable." (setq face (face-list))) (if (and (listp face) (null (cdr face))) (setq face (car face))) - (if (listp face) - (custom-buffer-create - (custom-sort-items - (mapcar (lambda (s) (list s 'custom-face)) face) - t nil) - "*Customize Faces*") - ;; If FACE is actually an alias, customize the face it is aliased to. - (if (get face 'face-alias) - (setq face (get face 'face-alias))) - (unless (facep face) - (error "Invalid face %S" face)) - (custom-buffer-create - (list (list face 'custom-face)) - (format "*Customize Face: %s*" - (custom-unlispify-tag-name face))))) + (let ((display-fun (if other-window + 'custom-buffer-create-other-window + 'custom-buffer-create))) + (if (listp face) + (funcall display-fun + (custom-sort-items + (mapcar (lambda (s) (list s 'custom-face)) face) + t nil) + "*Customize Faces*") + ;; If FACE is actually an alias, customize the face it is aliased to. + (if (get face 'face-alias) + (setq face (get face 'face-alias))) + (unless (facep face) + (error "Invalid face %S" face)) + (funcall display-fun + (list (list face 'custom-face)) + (format "*Customize Face: %s*" + (custom-unlispify-tag-name face)))))) ;;;###autoload (defun customize-face-other-window (&optional face) @@ -1344,10 +1351,7 @@ If FACE is actually a face-alias, customize the face it is aliased to. Interactively, when point is on text which has a face specified, suggest to customize that face, if it's customizable." (interactive (list (read-face-name "Customize face" "all faces" t))) - (let ((pop-up-windows t) - (same-window-buffer-names nil) - (same-window-regexps nil)) - (customize-face face))) + (customize-face face t)) (defalias 'customize-customized 'customize-unsaved) @@ -1533,7 +1537,7 @@ Optional NAME is the name of the buffer. OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where SYMBOL is a customization option, and WIDGET is a widget for editing that option." - (pop-to-buffer (custom-get-fresh-buffer (or name "*Customization*"))) + (pop-to-buffer-same-window (custom-get-fresh-buffer (or name "*Customization*"))) (custom-buffer-create-internal options description)) ;;;###autoload @@ -1545,11 +1549,8 @@ OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where SYMBOL is a customization option, and WIDGET is a widget for editing that option." (unless name (setq name "*Customization*")) - (let ((pop-up-windows t) - (same-window-buffer-names nil) - (same-window-regexps nil)) - (pop-to-buffer (custom-get-fresh-buffer name)) - (custom-buffer-create-internal options description))) + (switch-to-buffer-other-window (custom-get-fresh-buffer name)) + (custom-buffer-create-internal options description)) (defcustom custom-reset-button-menu nil "If non-nil, only show a single reset button in customize buffers. @@ -1724,7 +1725,7 @@ Otherwise use brackets." (unless group (setq group 'emacs)) (let ((name "*Customize Browser*")) - (pop-to-buffer (custom-get-fresh-buffer name))) + (pop-to-buffer-same-window (custom-get-fresh-buffer name))) (Custom-mode) (widget-insert (format "\ %s buttons; type RET or click mouse-1 @@ -3224,7 +3225,7 @@ Also change :reverse-video to :inverse-video." (if (not inactive) ;; Widget is alive, we don't have to do anything special (widget-default-delete widget) - ;; WIDGET is already deleted because we did so to inactivate it; + ;; WIDGET is already deleted because we did so to deactivate it; ;; now just get rid of the label we put in its place. (delete-region (car (cdr inactive)) (+ (car (cdr inactive)) (cdr (cdr inactive)))) @@ -4409,25 +4410,14 @@ if only the first line of the docstring is shown.")) (defun custom-file (&optional no-error) "Return the file name for saving customizations." - (let ((file - (or custom-file - (let ((user-init-file user-init-file) - (default-init-file - (if (eq system-type 'ms-dos) "~/_emacs" "~/.emacs"))) - (when (null user-init-file) - (if (or (file-exists-p default-init-file) - (and (eq system-type 'windows-nt) - (file-exists-p "~/_emacs"))) - ;; Started with -q, i.e. the file containing - ;; Custom settings hasn't been read. Saving - ;; settings there would overwrite other settings. - (if no-error - nil - (error "Saving settings from \"emacs -q\" would overwrite existing customizations")) - (setq user-init-file default-init-file))) - user-init-file)))) - (and file - (file-chase-links file)))) + (if (null user-init-file) + ;; Started with -q, i.e. the file containing Custom settings + ;; hasn't been read. Saving settings there won't make much + ;; sense. + (if no-error + nil + (error "Saving settings from \"emacs -q\" would overwrite existing customizations")) + (file-chase-links (or custom-file user-init-file)))) ;; If recentf-mode is non-nil, this is defined. (declare-function recentf-expand-file-name "recentf" (name))