# HG changeset patch # User Jason Rumney # Date 1249224964 0 # Node ID 9fb3df55079fd30f69c78f5473398e457fc93045 # Parent bfd41b5caadd1cee7f994b53288d0d55d727ca75 (read-file-name): Treat confirm options to MUSTMATCH as nil when invoking x-file-dialog. (Bug#3969) diff -r bfd41b5caadd -r 9fb3df55079f lisp/ChangeLog --- a/lisp/ChangeLog Sun Aug 02 14:20:02 2009 +0000 +++ b/lisp/ChangeLog Sun Aug 02 14:56:04 2009 +0000 @@ -1,3 +1,8 @@ +2009-08-02 Jason Rumney + + * minibuffer.el (read-file-name): Treat confirm options to + MUSTMATCH as nil when invoking x-file-dialog. (Bug#3969) + 2009-08-02 Chong Yidong * font-lock.el (font-lock-string-face, font-lock-builtin-face) diff -r bfd41b5caadd -r 9fb3df55079f lisp/minibuffer.el --- a/lisp/minibuffer.el Sun Aug 02 14:20:02 2009 +0000 +++ b/lisp/minibuffer.el Sun Aug 02 14:56:04 2009 +0000 @@ -1134,7 +1134,8 @@ If this command was invoked with the mouse, use a graphical file dialog if `use-dialog-box' is non-nil, and the window system or X toolkit in use provides a file dialog box. For graphical file -dialogs, any non-nil value of MUSTMATCH is equivalent to t. +dialogs, any the special values of MUSTMATCH; `confirm' and +`confirm-after-completion' are treated as equivalent to nil. See also `read-file-name-completion-ignore-case' and `read-file-name-function'." @@ -1180,7 +1181,16 @@ default-filename))) ;; If DEFAULT-FILENAME not supplied and DIR contains ;; a file name, split it. - (let ((file (file-name-nondirectory dir))) + (let ((file (file-name-nondirectory dir)) + ;; When using a dialog, revert to nil and non-nil + ;; interpretation of mustmatch. confirm options + ;; need to be interpreted as nil, otherwise + ;; it is impossible to create new files using + ;; dialogs with the default settings. + (dialog-mustmatch + (and (not (eq mustmatch 'confirm)) + (not (eq mustmatch 'confirm-after-completion)) + mustmatch))) (when (and (not default-filename) (not (zerop (length file)))) (setq default-filename file) @@ -1189,7 +1199,8 @@ (setq default-filename (expand-file-name default-filename dir))) (setq add-to-history t) - (x-file-dialog prompt dir default-filename mustmatch + (x-file-dialog prompt dir default-filename + dialog-mustmatch (eq predicate 'file-directory-p))))) (replace-in-history (eq (car-safe file-name-history) val)))