# HG changeset patch # User Paul Eggert # Date 1295499772 28800 # Node ID 396b01a20bde788114cee5511ab584f64d85c982 # Parent aa1e27e3a554e440425219694afd0a16768d8b9f# Parent 75fec4affb13bab0f9d1aff462f3406980f29d55 Merge: omit auto-generated aclocal.m4 from repository diff -r 75fec4affb13 -r 396b01a20bde etc/NEWS --- a/etc/NEWS Wed Jan 19 21:00:40 2011 -0800 +++ b/etc/NEWS Wed Jan 19 21:02:52 2011 -0800 @@ -688,8 +688,6 @@ ** New function `read-char-choice' reads a restricted set of characters, discarding any inputs not inside the set. -** `y-or-n-p' and `yes-or-no-p' now accept format string arguments. - ** `image-library-alist' is renamed to `dynamic-library-alist'. The variable is now used to load all kind of supported dynamic libraries, not just image libraries. The previous name is still available as an diff -r 75fec4affb13 -r 396b01a20bde lisp/ChangeLog --- a/lisp/ChangeLog Wed Jan 19 21:00:40 2011 -0800 +++ b/lisp/ChangeLog Wed Jan 19 21:02:52 2011 -0800 @@ -1,3 +1,14 @@ +2011-01-20 Chong Yidong + + * subr.el (y-or-n-p): Revert 2011-01-07 change, removing ARGS. + + * files.el (find-alternate-file, basic-save-buffer) + (basic-save-buffer-2, revert-buffer, recover-file) + (kill-buffer-ask, abort-if-file-too-large) + (set-visited-file-name, write-file, backup-buffer) + (basic-save-buffer, save-some-buffers): + * dired-aux.el (dired-compress-file): Callers changed. + 2011-01-19 Glenn Morris * vc/vc-svn.el (vc-svn-after-dir-status, vc-svn-parse-status): diff -r 75fec4affb13 -r 396b01a20bde lisp/dired-aux.el --- a/lisp/dired-aux.el Wed Jan 19 21:00:40 2011 -0800 +++ b/lisp/dired-aux.el Wed Jan 19 21:02:52 2011 -0800 @@ -821,8 +821,8 @@ (let ((out-name (concat file ".gz"))) (and (or (not (file-exists-p out-name)) (y-or-n-p - "File %s already exists. Really compress? " - out-name)) + (format "File %s already exists. Really compress? " + out-name))) (not (dired-check-process (concat "Compressing " file) "gzip" "-f" file)) (or (file-exists-p out-name) diff -r 75fec4affb13 -r 396b01a20bde lisp/dired.el --- a/lisp/dired.el Wed Jan 19 21:00:40 2011 -0800 +++ b/lisp/dired.el Wed Jan 19 21:02:52 2011 -0800 @@ -3562,7 +3562,7 @@ ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff -;;;;;; dired-diff) "dired-aux" "dired-aux.el" "adcb55a439048f158f47c5c96b3dad09") +;;;;;; dired-diff) "dired-aux" "dired-aux.el" "b30af1396920c8bf22f3c83746bb73f9") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ diff -r 75fec4affb13 -r 396b01a20bde lisp/files.el --- a/lisp/files.el Wed Jan 19 21:00:40 2011 -0800 +++ b/lisp/files.el Wed Jan 19 21:02:52 2011 -0800 @@ -1558,8 +1558,8 @@ (unless (run-hook-with-args-until-failure 'kill-buffer-query-functions) (error "Aborted")) (when (and (buffer-modified-p) buffer-file-name) - (if (yes-or-no-p "Buffer %s is modified; save it first? " - (buffer-name)) + (if (yes-or-no-p (format "Buffer %s is modified; save it first? " + (buffer-name))) (save-buffer) (unless (yes-or-no-p "Kill and replace the buffer without saving it? ") (error "Aborted")))) @@ -1762,9 +1762,9 @@ OP-TYPE specifies the file operation being performed (for message to user)." (when (and large-file-warning-threshold size (> size large-file-warning-threshold) - (not (y-or-n-p "File %s is large (%dMB), really %s? " - (file-name-nondirectory filename) - (/ size 1048576) op-type))) + (not (y-or-n-p (format "File %s is large (%dMB), really %s? " + (file-name-nondirectory filename) + (/ size 1048576) op-type)))) (error "Aborted"))) (defun find-file-noselect (filename &optional nowarn rawfile wildcards) @@ -3584,8 +3584,8 @@ (let ((buffer (and filename (find-buffer-visiting filename)))) (and buffer (not (eq buffer (current-buffer))) (not no-query) - (not (y-or-n-p "A buffer is visiting %s; proceed? " - filename)) + (not (y-or-n-p (format "A buffer is visiting %s; proceed? " + filename))) (error "Aborted"))) (or (equal filename buffer-file-name) (progn @@ -3696,7 +3696,7 @@ (or buffer-file-name (buffer-name)))))) (and confirm (file-exists-p filename) - (or (y-or-n-p "File `%s' exists; overwrite? " filename) + (or (y-or-n-p (format "File `%s' exists; overwrite? " filename)) (error "Canceled"))) (set-visited-file-name filename (not confirm)))) (set-buffer-modified-p t) @@ -3750,8 +3750,8 @@ (and targets (or (eq delete-old-versions t) (eq delete-old-versions nil)) (or delete-old-versions - (y-or-n-p "Delete excess backup versions of %s? " - real-file-name)))) + (y-or-n-p (format "Delete excess backup versions of %s? " + real-file-name))))) (modes (file-modes buffer-file-name)) (context (file-selinux-context buffer-file-name))) ;; Actually write the back up file. @@ -4324,8 +4324,8 @@ ;; Signal an error if the user specified the name of an ;; existing directory. (error "%s is a directory" filename) - (unless (y-or-n-p "File `%s' exists; overwrite? " - filename) + (unless (y-or-n-p (format "File `%s' exists; overwrite? " + filename)) (error "Canceled"))) ;; Signal an error if the specified name refers to a ;; non-existing directory. @@ -4338,8 +4338,9 @@ (or (verify-visited-file-modtime (current-buffer)) (not (file-exists-p buffer-file-name)) (yes-or-no-p - "%s has changed since visited or saved. Save anyway? " - (file-name-nondirectory buffer-file-name)) + (format + "%s has changed since visited or saved. Save anyway? " + (file-name-nondirectory buffer-file-name))) (error "Save not confirmed")) (save-restriction (widen) @@ -4353,8 +4354,8 @@ (eq require-final-newline 'visit-save) (and require-final-newline (y-or-n-p - "Buffer %s does not end in newline. Add one? " - (buffer-name)))) + (format "Buffer %s does not end in newline. Add one? " + (buffer-name))))) (save-excursion (goto-char (point-max)) (insert ?\n)))) @@ -4416,9 +4417,10 @@ (if (not (file-exists-p buffer-file-name)) (error "Directory %s write-protected" dir) (if (yes-or-no-p - "File %s is write-protected; try to save anyway? " - (file-name-nondirectory - buffer-file-name)) + (format + "File %s is write-protected; try to save anyway? " + (file-name-nondirectory + buffer-file-name))) (setq tempsetmodes t) (error "Attempt to save to a file which you aren't allowed to write")))))) (or buffer-backed-up @@ -4609,7 +4611,7 @@ (progn (if (or arg (eq save-abbrevs 'silently) - (y-or-n-p "Save abbrevs in %s? " abbrev-file-name)) + (y-or-n-p (format "Save abbrevs in %s? " abbrev-file-name))) (write-abbrev-file nil)) ;; Don't keep bothering user if he says no. (setq abbrevs-changed nil) @@ -4784,8 +4786,8 @@ (list dir (if (directory-files dir nil directory-files-no-dot-files-regexp) (y-or-n-p - "Directory `%s' is not empty, really %s? " - dir (if trashing "trash" "delete")) + (format "Directory `%s' is not empty, really %s? " + dir (if trashing "trash" "delete"))) nil) (null current-prefix-arg)))) ;; If default-directory is a remote directory, make sure we find its @@ -4984,8 +4986,8 @@ (dolist (regexp revert-without-query) (when (string-match regexp file-name) (throw 'found t))))) - (yes-or-no-p "Revert buffer from file %s? " - file-name)) + (yes-or-no-p (format "Revert buffer from file %s? " + file-name))) (run-hooks 'before-revert-hook) ;; If file was backed up but has changed since, ;; we should make another backup. @@ -5105,7 +5107,7 @@ ;; to emulate what `ls' did in that case. (insert-directory-safely file switches) (insert-directory-safely file-name switches)))) - (yes-or-no-p "Recover auto save file %s? " file-name)) + (yes-or-no-p (format "Recover auto save file %s? " file-name))) (switch-to-buffer (find-file-noselect file t)) (let ((inhibit-read-only t) ;; Keep the current buffer-file-coding-system. @@ -5225,10 +5227,10 @@ (defun kill-buffer-ask (buffer) "Kill BUFFER if confirmed." - (when (yes-or-no-p - "Buffer %s %s. Kill? " (buffer-name buffer) - (if (buffer-modified-p buffer) - "HAS BEEN EDITED" "is unmodified")) + (when (yes-or-no-p (format "Buffer %s %s. Kill? " + (buffer-name buffer) + (if (buffer-modified-p buffer) + "HAS BEEN EDITED" "is unmodified"))) (kill-buffer buffer))) (defun kill-some-buffers (&optional list) diff -r 75fec4affb13 -r 396b01a20bde lisp/subr.el --- a/lisp/subr.el Wed Jan 19 21:00:40 2011 -0800 +++ b/lisp/subr.el Wed Jan 19 21:02:52 2011 -0800 @@ -2067,12 +2067,10 @@ nil)))))) (set-advertised-calling-convention 'sit-for '(seconds &optional nodisp) "22.1") -(defun y-or-n-p (prompt &rest args) +(defun y-or-n-p (prompt) "Ask user a \"y or n\" question. Return t if answer is \"y\". -The string to display to ask the question is obtained by -formatting the string PROMPT with arguments ARGS (see `format'). -The result should end in a space; `y-or-n-p' adds \"(y or n) \" -to it. +PROMPT is the string to display to ask the question. It should +end in a space; `y-or-n-p' adds \"(y or n) \" to it. No confirmation of the answer is requested; a single character is enough. Also accepts Space to mean yes, or Delete to mean no. \(Actually, it uses @@ -2091,7 +2089,7 @@ use-dialog-box) (setq answer (x-popup-dialog t `(,prompt ("yes" . act) ("No" . skip)))) - (setq prompt (concat (apply 'format prompt args) + (setq prompt (concat prompt (if (eq ?\s (aref prompt (1- (length prompt)))) "" " ") "(y or n) ")) diff -r 75fec4affb13 -r 396b01a20bde src/ChangeLog --- a/src/ChangeLog Wed Jan 19 21:00:40 2011 -0800 +++ b/src/ChangeLog Wed Jan 19 21:02:52 2011 -0800 @@ -1,3 +1,7 @@ +2011-01-20 Chong Yidong + + * fns.c (Fyes_or_no_p): Revert 2011-01-07 change, removing ARGS. + 2011-01-19 Paul Eggert Fix X11 compilation failure. diff -r 75fec4affb13 -r 396b01a20bde src/fns.c --- a/src/fns.c Wed Jan 19 21:00:40 2011 -0800 +++ b/src/fns.c Wed Jan 19 21:02:52 2011 -0800 @@ -2450,24 +2450,23 @@ /* Anything that calls this function must protect from GC! */ -DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, MANY, 0, +DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0, doc: /* Ask user a yes-or-no question. Return t if answer is yes. -The string to display to ask the question is obtained by -formatting the string PROMPT with arguments ARGS (see `format'). -The result should end in a space; `yes-or-no-p' adds -\"(yes or no) \" to it. +PROMPT is the string to display to ask the question. It should end in +a space; `yes-or-no-p' adds \"(yes or no) \" to it. The user must confirm the answer with RET, and can edit it until it has been confirmed. Under a windowing system a dialog box will be used if `last-nonmenu-event' -is nil, and `use-dialog-box' is non-nil. -usage: (yes-or-no-p PROMPT &rest ARGS) */) - (int nargs, Lisp_Object *args) +is nil, and `use-dialog-box' is non-nil. */) + (Lisp_Object prompt) { register Lisp_Object ans; + Lisp_Object args[2]; struct gcpro gcpro1; - Lisp_Object prompt = Fformat (nargs, args); + + CHECK_STRING (prompt); #ifdef HAVE_MENUS if (FRAME_WINDOW_P (SELECTED_FRAME ()) @@ -2488,7 +2487,10 @@ } #endif /* HAVE_MENUS */ - prompt = concat2 (prompt, build_string ("(yes or no) ")); + args[0] = prompt; + args[1] = build_string ("(yes or no) "); + prompt = Fconcat (2, args); + GCPRO1 (prompt); while (1) diff -r 75fec4affb13 -r 396b01a20bde src/gtkutil.h