comparison lisp/subr.el @ 83532:b19aaf4ab0ee

Merged from emacs@sv.gnu.org. Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-331 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-332 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-333 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-334 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-335 Add note about "link" button-class to etc/TODO * emacs@sv.gnu.org/emacs--devo--0--patch-336 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-337 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-338 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-339 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-340 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-341 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-342 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-343 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-344 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-345 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-346 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-347 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-348 Update for ERC 5.1.3. * emacs@sv.gnu.org/emacs--devo--0--patch-349 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-350 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/gnus--rel--5.10--patch-111 Update from CVS: texi/gnus.texi (Summary Buffer Lines): Fix typo. * emacs@sv.gnu.org/gnus--rel--5.10--patch-112 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-113 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-114 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-572
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 14 Jul 2006 05:56:32 +0000
parents 46b1096093f5 dbb73e0b716b
children 02e39decdc84
comparison
equal deleted inserted replaced
83531:a387c138b28e 83532:b19aaf4ab0ee
50 (defmacro 1value (form) 50 (defmacro 1value (form)
51 "Evaluate FORM, expecting a constant return value. 51 "Evaluate FORM, expecting a constant return value.
52 This is the global do-nothing version. There is also `testcover-1value' 52 This is the global do-nothing version. There is also `testcover-1value'
53 that complains if FORM ever does return differing values." 53 that complains if FORM ever does return differing values."
54 form) 54 form)
55
56 (defmacro def-edebug-spec (symbol spec)
57 "Set the `edebug-form-spec' property of SYMBOL according to SPEC.
58 Both SYMBOL and SPEC are unevaluated. The SPEC can be 0, t, a symbol
59 \(naming a function), or a list."
60 `(put (quote ,symbol) 'edebug-form-spec (quote ,spec)))
55 61
56 (defmacro lambda (&rest cdr) 62 (defmacro lambda (&rest cdr)
57 "Return a lambda expression. 63 "Return a lambda expression.
58 A call of the form (lambda ARGS DOCSTRING INTERACTIVE BODY) is 64 A call of the form (lambda ARGS DOCSTRING INTERACTIVE BODY) is
59 self-quoting; the result of evaluating the lambda expression is the 65 self-quoting; the result of evaluating the lambda expression is the
1691 (unless (numberp n) 1697 (unless (numberp n)
1692 (message "Please enter a number.") 1698 (message "Please enter a number.")
1693 (sit-for 1) 1699 (sit-for 1)
1694 t))) 1700 t)))
1695 n)) 1701 n))
1702
1703 (defun sit-for (seconds &optional nodisp obsolete)
1704 "Perform redisplay, then wait for SECONDS seconds or until input is available.
1705 SECONDS may be a floating-point value.
1706 \(On operating systems that do not support waiting for fractions of a
1707 second, floating-point values are rounded down to the nearest integer.)
1708
1709 If optional arg NODISP is t, don't redisplay, just wait for input.
1710 Redisplay does not happen if input is available before it starts.
1711
1712 Value is t if waited the full time with no input arriving, and nil otherwise.
1713
1714 An obsolete, but still supported form is
1715 \(sit-for SECONDS &optional MILLISECONDS NODISP)
1716 where the optional arg MILLISECONDS specifies an additional wait period,
1717 in milliseconds; this was useful when Emacs was built without
1718 floating point support.
1719
1720 \(fn SECONDS &optional NODISP)"
1721 (when (or obsolete (numberp nodisp))
1722 (setq seconds (+ seconds (* 1e-3 nodisp)))
1723 (setq nodisp obsolete))
1724 (unless nodisp
1725 (redisplay))
1726 (or (<= seconds 0)
1727 (let ((timer (timer-create))
1728 (echo-keystrokes 0))
1729 (if (catch 'sit-for-timeout
1730 (timer-set-time timer (timer-relative-time
1731 (current-time) seconds))
1732 (timer-set-function timer 'with-timeout-handler
1733 '(sit-for-timeout))
1734 (timer-activate timer)
1735 (push (read-event) unread-command-events)
1736 nil)
1737 t
1738 (cancel-timer timer)
1739 nil))))
1696 1740
1697 ;;; Atomic change groups. 1741 ;;; Atomic change groups.
1698 1742
1699 (defmacro atomic-change-group (&rest body) 1743 (defmacro atomic-change-group (&rest body)
1700 "Perform BODY as an atomic change group. 1744 "Perform BODY as an atomic change group.