mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 07:46:51 -04:00
Fix bug when looping over intervals in another buffer (Bug#81652)
* lisp/emacs-lisp/cl-extra.el (cl--map-intervals): Add missing BUFFER argument to 'set-marker' calls (Bug#81652). * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-being-intervals/current-buffer) (cl-macs-loop-being-intervals/new-buffer): New regression tests.
This commit is contained in:
parent
9464675119
commit
ea6e7a01f9
|
|
@ -281,9 +281,10 @@ non-nil value.
|
|||
next2 (or next (with-current-buffer what
|
||||
(point-max))))
|
||||
(funcall func (prog1 (marker-position mark)
|
||||
(set-marker mark next2))
|
||||
(set-marker mark next2 what))
|
||||
(if mark2 (min next2 mark2) next2)))
|
||||
(set-marker mark nil) (if mark2 (set-marker mark2 nil)))
|
||||
(set-marker mark nil what)
|
||||
(if mark2 (set-marker mark2 nil what)))
|
||||
(or start (setq start 0))
|
||||
(or end (setq end (length what)))
|
||||
(while (< start end)
|
||||
|
|
|
|||
|
|
@ -482,11 +482,26 @@ collection clause."
|
|||
return (overlay-get o 'prop)))
|
||||
"test")))
|
||||
|
||||
(ert-deftest cl-macs-loop-being-intervals/current-buffer ()
|
||||
(should (equal (with-temp-buffer
|
||||
(insert "foo" (propertize "bar" 'prop t))
|
||||
(cl-loop for i being the intervals collect i))
|
||||
'((1 . 4) (4 . 7)))))
|
||||
|
||||
(ert-deftest cl-macs-loop-being-intervals/new-buffer ()
|
||||
(should (equal (with-temp-buffer
|
||||
(insert "foo" (propertize "bar" 'prop t))
|
||||
(let ((buffer (current-buffer)))
|
||||
(with-temp-buffer
|
||||
(cl-loop for i being the intervals of buffer
|
||||
collect i))))
|
||||
'((1 . 4) (4 . 7)))))
|
||||
|
||||
(ert-deftest cl-macs-loop-being-frames ()
|
||||
(should (eq (cl-loop with selected = (selected-frame)
|
||||
for frame being the frames
|
||||
when (eq frame selected)
|
||||
return frame)
|
||||
return frame)
|
||||
(selected-frame))))
|
||||
|
||||
(ert-deftest cl-macs-loop-being-windows ()
|
||||
|
|
|
|||
Loading…
Reference in a new issue