From 8d3eb023633fd4f4131ef34ba9266daa3f05cfe4 Mon Sep 17 00:00:00 2001 From: Nicolas Petton Date: Fri, 14 Aug 2015 15:43:48 +0200 Subject: [PATCH] * lisp/emacs-lisp/stream.el: Fix stream-buffer initial position --- lisp/emacs-lisp/stream.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/stream.el b/lisp/emacs-lisp/stream.el index eed436a58b4..d5a5c9013c3 100644 --- a/lisp/emacs-lisp/stream.el +++ b/lisp/emacs-lisp/stream.el @@ -210,13 +210,15 @@ SEQ can be a list, vector or string." (car list) (stream-list (cdr list))))) + (defun stream-buffer (buffer-or-name &optional pos) "Return a stream of the characters of the buffer BUFFER-OR-NAME. BUFFER-OR-NAME may be a buffer or a string (buffer name). The sequence starts at POS if non-nil, 1 otherwise." - (unless pos (setq pos 1)) - (if (>= pos (point-max)) - (stream-empty) + (with-current-buffer buffer-or-name + (unless pos (setq pos (point-min))) + (if (>= pos (point-max)) + (stream-empty)) (stream-cons (with-current-buffer buffer-or-name (save-excursion -- 2.39.2