Mercurial > hg > xemacs-beta
comparison lisp/subr.el @ 2135:e6d43c299b9c
[xemacs-hg @ 2004-06-17 03:01:10 by james]
Synch with Emacs 21.3 derived.el, plus new stuff in subr.el to support it,
as well as some documentation.
author | james |
---|---|
date | Thu, 17 Jun 2004 03:01:17 +0000 |
parents | 124ce9dc008b |
children | 2f37290328b0 |
comparison
equal
deleted
inserted
replaced
2134:ab08d33c34e5 | 2135:e6d43c299b9c |
---|---|
519 (with-current-buffer standard-output | 519 (with-current-buffer standard-output |
520 (prog1 | 520 (prog1 |
521 (buffer-string) | 521 (buffer-string) |
522 (kill-buffer nil))))) | 522 (kill-buffer nil))))) |
523 | 523 |
524 ;; FSF 21.2. | 524 (defmacro with-local-quit (&rest body) |
525 "Execute BODY with `inhibit-quit' temporarily bound to nil." | |
526 `(condition-case nil | |
527 (let ((inhibit-quit nil)) | |
528 ,@body) | |
529 (quit (setq quit-flag t)))) | |
530 | |
531 ;; FSF 21.3. | |
525 | 532 |
526 ; (defmacro combine-after-change-calls (&rest body) | 533 ; (defmacro combine-after-change-calls (&rest body) |
527 ; "Execute BODY, but don't call the after-change functions till the end. | 534 ; "Execute BODY, but don't call the after-change functions till the end. |
528 ; If BODY makes changes in the buffer, they are recorded | 535 ; If BODY makes changes in the buffer, they are recorded |
529 ; and the functions on `after-change-functions' are called several times | 536 ; and the functions on `after-change-functions' are called several times |
533 ; If `before-change-functions' is non-nil, then calls to the after-change | 540 ; If `before-change-functions' is non-nil, then calls to the after-change |
534 ; functions can't be deferred, so in that case this macro has no effect. | 541 ; functions can't be deferred, so in that case this macro has no effect. |
535 | 542 |
536 ; Do not alter `after-change-functions' or `before-change-functions' | 543 ; Do not alter `after-change-functions' or `before-change-functions' |
537 ; in BODY." | 544 ; in BODY." |
545 ; (declare (indent 0) (debug t)) | |
538 ; `(unwind-protect | 546 ; `(unwind-protect |
539 ; (let ((combine-after-change-calls t)) | 547 ; (let ((combine-after-change-calls t)) |
540 ; . ,body) | 548 ; . ,body) |
541 ; (combine-after-change-execute))) | 549 ; (combine-after-change-execute))) |
550 | |
551 | |
552 (defvar delay-mode-hooks nil | |
553 "If non-nil, `run-mode-hooks' should delay running the hooks.") | |
554 (defvar delayed-mode-hooks nil | |
555 "List of delayed mode hooks waiting to be run.") | |
556 (make-variable-buffer-local 'delayed-mode-hooks) | |
557 (put 'delay-mode-hooks 'permanent-local t) | |
558 | |
559 (defun run-mode-hooks (&rest hooks) | |
560 "Run mode hooks `delayed-mode-hooks' and HOOKS, or delay HOOKS. | |
561 Execution is delayed if `delay-mode-hooks' is non-nil. | |
562 Major mode functions should use this." | |
563 (if delay-mode-hooks | |
564 ;; Delaying case. | |
565 (dolist (hook hooks) | |
566 (push hook delayed-mode-hooks)) | |
567 ;; Normal case, just run the hook as before plus any delayed hooks. | |
568 (setq hooks (nconc (nreverse delayed-mode-hooks) hooks)) | |
569 (setq delayed-mode-hooks nil) | |
570 (apply 'run-hooks hooks))) | |
571 | |
572 (defmacro delay-mode-hooks (&rest body) | |
573 "Execute BODY, but delay any `run-mode-hooks'. | |
574 Only affects hooks run in the current buffer." | |
575 `(progn | |
576 (make-local-variable 'delay-mode-hooks) | |
577 (let ((delay-mode-hooks t)) | |
578 ,@body))) | |
542 | 579 |
543 (defmacro with-syntax-table (table &rest body) | 580 (defmacro with-syntax-table (table &rest body) |
544 "Evaluate BODY with syntax table of current buffer set to a copy of TABLE. | 581 "Evaluate BODY with syntax table of current buffer set to a copy of TABLE. |
545 The syntax table of the current buffer is saved, BODY is evaluated, and the | 582 The syntax table of the current buffer is saved, BODY is evaluated, and the |
546 saved table is restored, even in case of an abnormal exit. | 583 saved table is restored, even in case of an abnormal exit. |