Mercurial > hg > xemacs-beta
comparison lisp/subr.el @ 883:1e9272790fe0
[xemacs-hg @ 2002-06-26 00:11:15 by youngs]
2002-06-24 John Paul Wallington <jpw@shootybangbang.com>
* obsolete.el (frame-parameter): New compatibility function.
(makehash): Ditto.
(buffer-local-value): Ditto.
(line-beginning-position): New compatibility alias for `point-at-bol'.
(line-end-position): New compatibility alias for `point-at-eol'.
* subr.el (with-temp-message): New function; sync with GNU Emacs 21.
(bound-and-true-p): Ditto.
(propertize): New function.
(delete-and-extract-region): Ditto.
2002-06-24 Jerry James <james@xemacs.org>
* code-files.el (load): Look for a binary module if no Lisp file
with the correct name is found.
author | youngs |
---|---|
date | Wed, 26 Jun 2002 00:11:16 +0000 |
parents | 64f38afaab2d |
children | 1b114504fa80 |
comparison
equal
deleted
inserted
replaced
882:f503f1607e8b | 883:1e9272790fe0 |
---|---|
483 (with-current-buffer ,temp-buffer | 483 (with-current-buffer ,temp-buffer |
484 (widen) | 484 (widen) |
485 (write-region (point-min) (point-max) ,temp-file nil 0))) | 485 (write-region (point-min) (point-max) ,temp-file nil 0))) |
486 (and (buffer-name ,temp-buffer) | 486 (and (buffer-name ,temp-buffer) |
487 (kill-buffer ,temp-buffer)))))) | 487 (kill-buffer ,temp-buffer)))))) |
488 | |
489 (defmacro with-temp-message (message &rest body) | |
490 "Display MESSAGE temporarily while BODY is evaluated. | |
491 The original message is restored to the echo area after BODY has finished. | |
492 The value returned is the value of the last form in BODY." | |
493 (let ((current-message (make-symbol "current-message")) | |
494 (temp-message (make-symbol "with-temp-message"))) | |
495 `(let ((,temp-message ,message) | |
496 (,current-message)) | |
497 (unwind-protect | |
498 (progn | |
499 (when ,temp-message | |
500 (setq ,current-message (current-message)) | |
501 (message "%s" ,temp-message)) | |
502 ,@body) | |
503 (and ,temp-message ,current-message | |
504 (message "%s" ,current-message)))))) | |
488 | 505 |
489 (defmacro with-temp-buffer (&rest forms) | 506 (defmacro with-temp-buffer (&rest forms) |
490 "Create a temporary buffer, and evaluate FORMS there like `progn'. | 507 "Create a temporary buffer, and evaluate FORMS there like `progn'. |
491 See also `with-temp-file' and `with-output-to-string'." | 508 See also `with-temp-file' and `with-output-to-string'." |
492 (let ((temp-buffer (make-symbol "temp-buffer"))) | 509 (let ((temp-buffer (make-symbol "temp-buffer"))) |
1106 "Do nothing and return nil. | 1123 "Do nothing and return nil. |
1107 This function accepts any number of arguments, but ignores them." | 1124 This function accepts any number of arguments, but ignores them." |
1108 (interactive) | 1125 (interactive) |
1109 nil) | 1126 nil) |
1110 | 1127 |
1128 ;; defined in lisp/bindings.el in GNU Emacs. | |
1129 (defmacro bound-and-true-p (var) | |
1130 "Return the value of symbol VAR if it is bound, else nil." | |
1131 `(and (boundp (quote ,var)) ,var)) | |
1132 | |
1133 ;; `propertize' is a builtin in GNU Emacs 21. | |
1134 (defun propertize (string &rest properties) | |
1135 "Return a copy of STRING with text properties added. | |
1136 First argument is the string to copy. | |
1137 Remaining arguments form a sequence of PROPERTY VALUE pairs for text | |
1138 properties to add to the result." | |
1139 (let ((str (copy-sequence string))) | |
1140 (add-text-properties 0 (length str) | |
1141 properties | |
1142 str) | |
1143 str)) | |
1144 | |
1145 ;; `delete-and-extract-region' is a builtin in GNU Emacs 21. | |
1146 (defun delete-and-extract-region (start end) | |
1147 "Delete the text between START and END and return it." | |
1148 (let ((region (buffer-substring start end))) | |
1149 (delete-region start end) | |
1150 region)) | |
1151 | |
1111 (define-function 'eval-in-buffer 'with-current-buffer) | 1152 (define-function 'eval-in-buffer 'with-current-buffer) |
1112 (make-obsolete 'eval-in-buffer 'with-current-buffer) | 1153 (make-obsolete 'eval-in-buffer 'with-current-buffer) |
1113 | 1154 |
1114 ;;; The real defn is in abbrev.el but some early callers | 1155 ;;; The real defn is in abbrev.el but some early callers |
1115 ;;; (eg lisp-mode-abbrev-table) want this before abbrev.el is loaded... | 1156 ;;; (eg lisp-mode-abbrev-table) want this before abbrev.el is loaded... |
1129 ;; "Non-nil if OBJECT can be called as a function." | 1170 ;; "Non-nil if OBJECT can be called as a function." |
1130 ;; (or (and (symbolp object) (fboundp object)) | 1171 ;; (or (and (symbolp object) (fboundp object)) |
1131 ;; (subrp object) | 1172 ;; (subrp object) |
1132 ;; (compiled-function-p object) | 1173 ;; (compiled-function-p object) |
1133 ;; (eq (car-safe object) 'lambda))) | 1174 ;; (eq (car-safe object) 'lambda))) |
1134 | |
1135 | |
1136 | 1175 |
1137 (defun function-interactive (function) | 1176 (defun function-interactive (function) |
1138 "Return the interactive specification of FUNCTION. | 1177 "Return the interactive specification of FUNCTION. |
1139 FUNCTION can be any funcallable object. | 1178 FUNCTION can be any funcallable object. |
1140 The specification will be returned as the list of the symbol `interactive' | 1179 The specification will be returned as the list of the symbol `interactive' |