comparison lisp/subr.el @ 70901:cc60343f8fd6

(with-local-quit): When handling `quit' signal, make a chance for quit-flag to cause a quit.
author Richard M. Stallman <rms@gnu.org>
date Thu, 25 May 2006 00:18:55 +0000
parents b08d75867f7f
children fe6029063ab4
comparison
equal deleted inserted replaced
70900:3af45cb133b8 70901:cc60343f8fd6
1615 Optional DEFAULT is a default password to use instead of empty input. 1615 Optional DEFAULT is a default password to use instead of empty input.
1616 1616
1617 This function echoes `.' for each character that the user types. 1617 This function echoes `.' for each character that the user types.
1618 The user ends with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. 1618 The user ends with RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line.
1619 C-g quits; if `inhibit-quit' was non-nil around this function, 1619 C-g quits; if `inhibit-quit' was non-nil around this function,
1620 then it returns nil if the user types C-g. 1620 then it returns nil if the user types C-g, but quit-flag remains set.
1621 1621
1622 Once the caller uses the password, it can erase the password 1622 Once the caller uses the password, it can erase the password
1623 by doing (clear-string STRING)." 1623 by doing (clear-string STRING)."
1624 (with-local-quit 1624 (with-local-quit
1625 (if confirm 1625 (if confirm
2319 is allowed once again." 2319 is allowed once again."
2320 (declare (debug t) (indent 0)) 2320 (declare (debug t) (indent 0))
2321 `(condition-case nil 2321 `(condition-case nil
2322 (let ((inhibit-quit nil)) 2322 (let ((inhibit-quit nil))
2323 ,@body) 2323 ,@body)
2324 (quit (setq quit-flag t) nil))) 2324 (quit (setq quit-flag t)
2325 ;; This call is to give a chance to handle quit-flag
2326 ;; in case inhibit-quit is nil.
2327 ;; Without this, it will not be handled until the next function
2328 ;; call, and that might allow it to exit thru a condition-case
2329 ;; that intends to handle the quit signal next time.
2330 (eval '(ignore nil)))))
2325 2331
2326 (defmacro while-no-input (&rest body) 2332 (defmacro while-no-input (&rest body)
2327 "Execute BODY only as long as there's no pending input. 2333 "Execute BODY only as long as there's no pending input.
2328 If input arrives, that ends the execution of BODY, 2334 If input arrives, that ends the execution of BODY,
2329 and `while-no-input' returns t. Quitting makes it return nil. 2335 and `while-no-input' returns t. Quitting makes it return nil.