comparison lisp/cmdloop.el @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 3ecd8885ac67
children 023b83f4e54b
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
128 "*Non-nil means that errors will cause the region to be deactivated." 128 "*Non-nil means that errors will cause the region to be deactivated."
129 :type 'boolean 129 :type 'boolean
130 :group 'editing-basics) 130 :group 'editing-basics)
131 131
132 (defun command-error (error-object) 132 (defun command-error (error-object)
133 (let ((inhibit-quit t) 133 (let* ((old-debug-on-error debug-on-error)
134 (debug-on-error nil) 134 (inhibit-quit t)
135 (etype (car-safe error-object))) 135 (debug-on-error nil)
136 (etype (car-safe error-object)))
136 (setq quit-flag nil) 137 (setq quit-flag nil)
137 (setq standard-output t) 138 (setq standard-output t)
138 (setq standard-input t) 139 (setq standard-input t)
139 (setq executing-kbd-macro nil) 140 (setq executing-kbd-macro nil)
140 (and errors-deactivate-region 141 (and errors-deactivate-region
159 (t 'command-error))) 160 (t 'command-error)))
160 (display-error error-object t) 161 (display-error error-object t)
161 162
162 (if (noninteractive) 163 (if (noninteractive)
163 (progn 164 (progn
164 (message "%s exiting." emacs-program-name) 165 (if old-debug-on-error
166 (progn
167 (message "Backtrace:\n\n")
168 (backtrace)
169 (message "\n")))
170 (message "%s exiting\n." emacs-program-name)
165 (kill-emacs -1))) 171 (kill-emacs -1)))
166 t)) 172 t))
167 173
168 (defun describe-last-error () 174 (defun describe-last-error ()
169 "Redisplay the last error-message. See the variable `last-error'." 175 "Redisplay the last error-message. See the variable `last-error'."
454 (discard-input) 460 (discard-input)
455 (message "Please answer yes or no.") 461 (message "Please answer yes or no.")
456 (sleep-for 2)))) 462 (sleep-for 2))))
457 ans))) 463 ans)))
458 464
459 ;; these may be redefined later, but make the original def easily encapsulable 465 (defun yes-or-no-p (prompt)
460 (define-function 'yes-or-no-p 'yes-or-no-p-minibuf) 466 "Ask user a yes-or-no question. Return t if answer is yes.
461 (define-function 'y-or-n-p 'y-or-n-p-minibuf) 467 The question is asked with a dialog box or the minibuffer, as appropriate.
468 Takes one argument, which is the string to display to ask the question.
469 It should end in a space; `yes-or-no-p' adds `(yes or no) ' to it.
470 The user must confirm the answer with RET,
471 and can edit it until it as been confirmed."
472 (if (should-use-dialog-box-p)
473 (yes-or-no-p-dialog-box prompt)
474 (yes-or-no-p-minibuf prompt)))
475
476 (defun y-or-n-p (prompt)
477 "Ask user a \"y or n\" question. Return t if answer is \"y\".
478 Takes one argument, which is the string to display to ask the question.
479 The question is asked with a dialog box or the minibuffer, as appropriate.
480 It should end in a space; `y-or-n-p' adds `(y or n) ' to it.
481 No confirmation of the answer is requested; a single character is enough.
482 Also accepts Space to mean yes, or Delete to mean no."
483 (if (should-use-dialog-box-p)
484 (yes-or-no-p-dialog-box prompt)
485 (y-or-n-p-minibuf prompt)))
486
462 487
463 488
464 (defun read-char () 489 (defun read-char ()
465 "Read a character from the command input (keyboard or macro). 490 "Read a character from the command input (keyboard or macro).
466 If a mouse click or non-ASCII character is detected, an error is 491 If a mouse click or non-ASCII character is detected, an error is