diff options
| author | Stefan Monnier | 2020-05-11 00:18:14 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2020-05-11 00:18:14 -0400 |
| commit | 68b34c66319bbc314d505f1352ee8b28b00d69f2 (patch) | |
| tree | 97065d77d52df9439704ee5e13a47cc3a9b991aa | |
| parent | 5601eb231fe1467b2949d7cdc57d8fefb81540e2 (diff) | |
| download | emacs-68b34c66319bbc314d505f1352ee8b28b00d69f2.tar.gz emacs-68b34c66319bbc314d505f1352ee8b28b00d69f2.zip | |
* lisp/subr.el (dolist, dotimes, combine-change-calls): Cosmetic tweaks
(dolist, dotimes): Adjust comment since testing
`lexical-binding` is supposed to be reliable.
(combine-change-calls): Add debug and indent specs.
| -rw-r--r-- | lisp/subr.el | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index c8913145a18..324c59f13f7 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -257,10 +257,9 @@ Then evaluate RESULT to get return value, default nil. | |||
| 257 | ;; use dolist. | 257 | ;; use dolist. |
| 258 | ;; FIXME: This cost disappears in byte-compiled lexical-binding files. | 258 | ;; FIXME: This cost disappears in byte-compiled lexical-binding files. |
| 259 | (let ((temp '--dolist-tail--)) | 259 | (let ((temp '--dolist-tail--)) |
| 260 | ;; This is not a reliable test, but it does not matter because both | 260 | ;; This test does not matter much because both semantics are acceptable, |
| 261 | ;; semantics are acceptable, tho one is slightly faster with dynamic | 261 | ;; but one is slightly faster with dynamic scoping and the other is |
| 262 | ;; scoping and the other is slightly faster (and has cleaner semantics) | 262 | ;; slightly faster (and has cleaner semantics) with lexical scoping. |
| 263 | ;; with lexical scoping. | ||
| 264 | (if lexical-binding | 263 | (if lexical-binding |
| 265 | `(let ((,temp ,(nth 1 spec))) | 264 | `(let ((,temp ,(nth 1 spec))) |
| 266 | (while ,temp | 265 | (while ,temp |
| @@ -292,9 +291,9 @@ the return value (nil if RESULT is omitted). Its use is deprecated. | |||
| 292 | (let ((temp '--dotimes-limit--) | 291 | (let ((temp '--dotimes-limit--) |
| 293 | (start 0) | 292 | (start 0) |
| 294 | (end (nth 1 spec))) | 293 | (end (nth 1 spec))) |
| 295 | ;; This is not a reliable test, but it does not matter because both | 294 | ;; This test does not matter much because both semantics are acceptable, |
| 296 | ;; semantics are acceptable, tho one is slightly faster with dynamic | 295 | ;; but one is slightly faster with dynamic scoping and the other has |
| 297 | ;; scoping and the other has cleaner semantics. | 296 | ;; cleaner semantics. |
| 298 | (if lexical-binding | 297 | (if lexical-binding |
| 299 | (let ((counter '--dotimes-counter--)) | 298 | (let ((counter '--dotimes-counter--)) |
| 300 | `(let ((,temp ,end) | 299 | `(let ((,temp ,end) |
| @@ -4033,7 +4032,7 @@ the function `undo--wrap-and-run-primitive-undo'." | |||
| 4033 | (defmacro combine-change-calls (beg end &rest body) | 4032 | (defmacro combine-change-calls (beg end &rest body) |
| 4034 | "Evaluate BODY, running the change hooks just once. | 4033 | "Evaluate BODY, running the change hooks just once. |
| 4035 | 4034 | ||
| 4036 | BODY is a sequence of lisp forms to evaluate. BEG and END bound | 4035 | BODY is a sequence of Lisp forms to evaluate. BEG and END bound |
| 4037 | the region the change hooks will be run for. | 4036 | the region the change hooks will be run for. |
| 4038 | 4037 | ||
| 4039 | Firstly, `before-change-functions' is invoked for the region | 4038 | Firstly, `before-change-functions' is invoked for the region |
| @@ -4051,7 +4050,8 @@ change `before-change-functions' or `after-change-functions'. | |||
| 4051 | 4050 | ||
| 4052 | Additionally, the buffer modifications of BODY are recorded on | 4051 | Additionally, the buffer modifications of BODY are recorded on |
| 4053 | the buffer's undo list as a single \(apply ...) entry containing | 4052 | the buffer's undo list as a single \(apply ...) entry containing |
| 4054 | the function `undo--wrap-and-run-primitive-undo'. " | 4053 | the function `undo--wrap-and-run-primitive-undo'." |
| 4054 | (declare (debug t) (indent 2)) | ||
| 4055 | `(combine-change-calls-1 ,beg ,end (lambda () ,@body))) | 4055 | `(combine-change-calls-1 ,beg ,end (lambda () ,@body))) |
| 4056 | 4056 | ||
| 4057 | (defun undo--wrap-and-run-primitive-undo (beg end list) | 4057 | (defun undo--wrap-and-run-primitive-undo (beg end list) |