diff options
| author | Richard M. Stallman | 2003-07-21 09:57:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-07-21 09:57:01 +0000 |
| commit | 4df623c0738b6a333dae9e170376f62f426b9d25 (patch) | |
| tree | d0f688781a34fce171536dd817a26e307b84fea4 | |
| parent | 3479c8063517133c84c42a7145f1876ca9dca7c2 (diff) | |
| download | emacs-4df623c0738b6a333dae9e170376f62f426b9d25.tar.gz emacs-4df623c0738b6a333dae9e170376f62f426b9d25.zip | |
(with-selected-window): Copy code form save-selected-window
so as to call select-window with norecord arg.
(dynamic-completion-table): Doc fix.
(lazy-completion-table): Doc fix.
| -rw-r--r-- | lisp/subr.el | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 0251180f8f9..702a960ca41 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1622,11 +1622,24 @@ See also `with-temp-buffer'." | |||
| 1622 | (defmacro with-selected-window (window &rest body) | 1622 | (defmacro with-selected-window (window &rest body) |
| 1623 | "Execute the forms in BODY with WINDOW as the selected window. | 1623 | "Execute the forms in BODY with WINDOW as the selected window. |
| 1624 | The value returned is the value of the last form in BODY. | 1624 | The value returned is the value of the last form in BODY. |
| 1625 | This does not alter the buffer list ordering. | ||
| 1625 | See also `with-temp-buffer'." | 1626 | See also `with-temp-buffer'." |
| 1626 | (declare (indent 1) (debug t)) | 1627 | (declare (indent 1) (debug t)) |
| 1627 | `(save-selected-window | 1628 | ;; Most of this code is a copy of save-selected-window. |
| 1628 | (select-window ,window 'norecord) | 1629 | `(let ((save-selected-window-window (selected-window)) |
| 1629 | ,@body)) | 1630 | (save-selected-window-alist |
| 1631 | (mapcar (lambda (frame) (list frame (frame-selected-window frame))) | ||
| 1632 | (frame-list)))) | ||
| 1633 | (unwind-protect | ||
| 1634 | (progn (select-window ,window 'norecord) | ||
| 1635 | ,@body) | ||
| 1636 | (dolist (elt save-selected-window-alist) | ||
| 1637 | (and (frame-live-p (car elt)) | ||
| 1638 | (window-live-p (cadr elt)) | ||
| 1639 | (set-frame-selected-window (car elt) (cadr elt)))) | ||
| 1640 | (if (window-live-p save-selected-window-window) | ||
| 1641 | ;; This is where the code differs from save-selected-window. | ||
| 1642 | (select-window save-selected-window-window 'norecord)))) | ||
| 1630 | 1643 | ||
| 1631 | (defmacro with-temp-file (file &rest body) | 1644 | (defmacro with-temp-file (file &rest body) |
| 1632 | "Create a new buffer, evaluate BODY there, and write the buffer to FILE. | 1645 | "Create a new buffer, evaluate BODY there, and write the buffer to FILE. |
| @@ -1783,11 +1796,14 @@ Value is what BODY returns." | |||
| 1783 | "Use function FUN as a dynamic completion table. | 1796 | "Use function FUN as a dynamic completion table. |
| 1784 | FUN is called with one argument, the string for which completion is required, | 1797 | FUN is called with one argument, the string for which completion is required, |
| 1785 | and it should return an alist containing all the intended possible | 1798 | and it should return an alist containing all the intended possible |
| 1786 | completions. This alist may be a full list of possible completions so that FUN | 1799 | completions. This alist may be a full list of possible completions so that FUN |
| 1787 | can ignore the value of its argument. If completion is performed in the | 1800 | can ignore the value of its argument. If completion is performed in the |
| 1788 | minibuffer, FUN will be called in the buffer from which the minibuffer was | 1801 | minibuffer, FUN will be called in the buffer from which the minibuffer was |
| 1789 | entered. `dynamic-completion-table' then computes the completion, see Info | 1802 | entered. |
| 1790 | node `(elisp)Programmed Completion'." | 1803 | |
| 1804 | The result of the `dynamic-completion-table' form is a function | ||
| 1805 | that can be used as the ALIST argument to `try-completion' and | ||
| 1806 | `all-completion'. See Info node `(elisp)Programmed Completion'." | ||
| 1791 | (let ((win (make-symbol "window")) | 1807 | (let ((win (make-symbol "window")) |
| 1792 | (string (make-symbol "string")) | 1808 | (string (make-symbol "string")) |
| 1793 | (predicate (make-symbol "predicate")) | 1809 | (predicate (make-symbol "predicate")) |
| @@ -1805,9 +1821,9 @@ node `(elisp)Programmed Completion'." | |||
| 1805 | "Initialize variable VAR as a lazy completion table. | 1821 | "Initialize variable VAR as a lazy completion table. |
| 1806 | If the completion table VAR is used for the first time (e.g., by passing VAR | 1822 | If the completion table VAR is used for the first time (e.g., by passing VAR |
| 1807 | as an argument to `try-completion'), the function FUN is called with arguments | 1823 | as an argument to `try-completion'), the function FUN is called with arguments |
| 1808 | ARGS. FUN must return the completion table that will be stored in VAR. If | 1824 | ARGS. FUN must return the completion table that will be stored in VAR. |
| 1809 | completion is requested in the minibuffer, FUN will be called in the buffer | 1825 | If completion is requested in the minibuffer, FUN will be called in the buffer |
| 1810 | from which the minibuffer was entered. The return value of | 1826 | from which the minibuffer was entered. The return value of |
| 1811 | `lazy-completion-table' must be used to initialize the value of VAR." | 1827 | `lazy-completion-table' must be used to initialize the value of VAR." |
| 1812 | (let ((str (make-symbol "string"))) | 1828 | (let ((str (make-symbol "string"))) |
| 1813 | `(dynamic-completion-table | 1829 | `(dynamic-completion-table |