Mercurial > emacs
comparison lisp/subr.el @ 90789:c0409ee15cee
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 670-674)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 209-210)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-185
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 21 Mar 2007 13:33:07 +0000 |
parents | 52a7f3f50b89 8693ff852e51 |
children | 4ef881a120fe |
comparison
equal
deleted
inserted
replaced
90788:a12805fdabe8 | 90789:c0409ee15cee |
---|---|
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 | 55 |
56 (defmacro def-edebug-spec (symbol spec) | 56 (defmacro def-edebug-spec (symbol spec) |
57 "Set the `edebug-form-spec' property of SYMBOL according to 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 | 58 Both SYMBOL and SPEC are unevaluated. The SPEC can be 0, t, a symbol |
59 \(naming a function), or a list." | 59 \(naming a function), or a list." |
60 `(put (quote ,symbol) 'edebug-form-spec (quote ,spec))) | 60 `(put (quote ,symbol) 'edebug-form-spec (quote ,spec))) |
61 | 61 |
62 (defmacro lambda (&rest cdr) | 62 (defmacro lambda (&rest cdr) |
63 "Return a lambda expression. | 63 "Return a lambda expression. |
97 (list 'car | 97 (list 'car |
98 (list 'prog1 listname | 98 (list 'prog1 listname |
99 (list 'setq listname (list 'cdr listname))))) | 99 (list 'setq listname (list 'cdr listname))))) |
100 | 100 |
101 (defmacro when (cond &rest body) | 101 (defmacro when (cond &rest body) |
102 "If COND yields non-nil, do BODY, else return nil." | 102 "If COND yields non-nil, do BODY, else return nil. |
103 When COND yields non-nil, eval BODY forms sequentially and return | |
104 value of last one, or nil if there are none. | |
105 | |
106 \(fn COND BODY ...)" | |
103 (declare (indent 1) (debug t)) | 107 (declare (indent 1) (debug t)) |
104 (list 'if cond (cons 'progn body))) | 108 (list 'if cond (cons 'progn body))) |
105 | 109 |
106 (defmacro unless (cond &rest body) | 110 (defmacro unless (cond &rest body) |
107 "If COND yields nil, do BODY, else return nil." | 111 "If COND yields nil, do BODY, else return nil. |
112 When COND yields nil, eval BODY forms sequentially and return | |
113 value of last one, or nil if there are none. | |
114 | |
115 \(fn COND BODY ...)" | |
108 (declare (indent 1) (debug t)) | 116 (declare (indent 1) (debug t)) |
109 (cons 'if (cons cond (cons nil body)))) | 117 (cons 'if (cons cond (cons nil body)))) |
110 | 118 |
111 (defvar --dolist-tail-- nil | 119 (defvar --dolist-tail-- nil |
112 "Temporary variable used in `dolist' expansion.") | 120 "Temporary variable used in `dolist' expansion.") |
1893 EXIT-CHAR it is swallowed; otherwise it is then available as | 1901 EXIT-CHAR it is swallowed; otherwise it is then available as |
1894 input (as a command if nothing else). | 1902 input (as a command if nothing else). |
1895 Display MESSAGE (optional fourth arg) in the echo area. | 1903 Display MESSAGE (optional fourth arg) in the echo area. |
1896 If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there." | 1904 If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there." |
1897 (or exit-char (setq exit-char ?\s)) | 1905 (or exit-char (setq exit-char ?\s)) |
1898 (let ((momentary-overlay (make-overlay pos pos nil t))) | 1906 (let ((inhibit-read-only t) |
1899 (overlay-put momentary-overlay 'before-string | 1907 ;; Don't modify the undo list at all. |
1900 (propertize string 'face 'momentary)) | 1908 (buffer-undo-list t) |
1909 (modified (buffer-modified-p)) | |
1910 (name buffer-file-name) | |
1911 insert-end) | |
1901 (unwind-protect | 1912 (unwind-protect |
1902 (progn | 1913 (progn |
1903 ;; If the message end is off screen, recenter now. | |
1904 (if (< (window-end nil t) (+ pos (length string))) | |
1905 (recenter (/ (window-height) 2))) | |
1906 ;; If that pushed message start off the screen, | |
1907 ;; scroll to start it at the top of the screen. | |
1908 (save-excursion | 1914 (save-excursion |
1915 (goto-char pos) | |
1916 ;; To avoid trouble with out-of-bounds position | |
1917 (setq pos (point)) | |
1918 ;; defeat file locking... don't try this at home, kids! | |
1919 (setq buffer-file-name nil) | |
1920 (insert-before-markers string) | |
1921 (setq insert-end (point)) | |
1922 ;; If the message end is off screen, recenter now. | |
1923 (if (< (window-end nil t) insert-end) | |
1924 (recenter (/ (window-height) 2))) | |
1925 ;; If that pushed message start off the screen, | |
1926 ;; scroll to start it at the top of the screen. | |
1909 (move-to-window-line 0) | 1927 (move-to-window-line 0) |
1910 (if (> (point) pos) | 1928 (if (> (point) pos) |
1911 (goto-char pos) | 1929 (progn |
1912 (recenter 0))) | 1930 (goto-char pos) |
1931 (recenter 0)))) | |
1913 (message (or message "Type %s to continue editing.") | 1932 (message (or message "Type %s to continue editing.") |
1914 (single-key-description exit-char)) | 1933 (single-key-description exit-char)) |
1915 (let (char) | 1934 (let (char) |
1916 (if (integerp exit-char) | 1935 (if (integerp exit-char) |
1917 (condition-case nil | 1936 (condition-case nil |
1927 ;; list. | 1946 ;; list. |
1928 (setq char (read-event)) | 1947 (setq char (read-event)) |
1929 (or (eq char exit-char) | 1948 (or (eq char exit-char) |
1930 (eq char (event-convert-list exit-char)) | 1949 (eq char (event-convert-list exit-char)) |
1931 (setq unread-command-events (list char)))))) | 1950 (setq unread-command-events (list char)))))) |
1932 (delete-overlay momentary-overlay)))) | 1951 (if insert-end |
1952 (save-excursion | |
1953 (delete-region pos insert-end))) | |
1954 (setq buffer-file-name name) | |
1955 (set-buffer-modified-p modified)))) | |
1933 | 1956 |
1934 | 1957 |
1935 ;;;; Overlay operations | 1958 ;;;; Overlay operations |
1936 | 1959 |
1937 (defun copy-overlay (o) | 1960 (defun copy-overlay (o) |