GNU bug report logs -
#58904
[PATCH] Handle buffer streams that operate on lines, pages, etc.
Previous Next
Reported by: Philip Kaludercic <philipk <at> posteo.net>
Date: Sun, 30 Oct 2022 21:32:02 UTC
Severity: wishlist
Tags: patch
Done: Philip Kaludercic <philipk <at> posteo.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 58904 in the body.
You can then email your comments to 58904 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58904
; Package
emacs
.
(Sun, 30 Oct 2022 21:32:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Philip Kaludercic <philipk <at> posteo.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 30 Oct 2022 21:32:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Tags: patch
Tags: patch
The commentary for stream.el mentions that the following streams are
supported:
> ;; - buffers (by character)
> ;; - buffers (by line)
> ;; - buffers (by page)
But I couldn't find anything beyond charachter-streams. The following
patch would implement that and more, by re-using thingatpt to define any
kind of stream one would want.
In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.30, cairo version 1.16.0) of 2022-10-30 built on heron
Repository revision: 2a4f37fe520b4f18295cff6671f289a47c1578df
Repository branch: feature/package+vc
System Description: Guix System
Configured using:
'configure --with-pgtk --with-imagemagick
PKG_CONFIG_PATH=/gnu/store/ssg343s6ldqdwh30136pnawhbgd0cb6i-profile/lib/pkgconfig:/gnu/store/ssg343s6ldqdwh30136pnawhbgd0cb6i-profile/share/pkgconfig'
[0001-Handle-buffer-streams-that-operate-on-lines-pages-et.patch (text/patch, attachment)]
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Sat, 12 Nov 2022 20:34:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58904
; Package
emacs
.
(Thu, 24 Nov 2022 19:41:01 GMT)
Full text and
rfc822 format available.
Message #10 received at 58904 <at> debbugs.gnu.org (full text, mbox):
Philip Kaludercic <philipk <at> posteo.net> writes:
> Tags: patch
>
> The commentary for stream.el mentions that the following streams are
> supported:
>
>> ;; - buffers (by character)
>> ;; - buffers (by line)
>> ;; - buffers (by page)
>
> But I couldn't find anything beyond charachter-streams. The following
> patch would implement that and more, by re-using thingatpt to define any
> kind of stream one would want.
Copying in Nicolas Petton, in case he has any comments.
> In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.30, cairo version 1.16.0) of 2022-10-30 built on heron
> Repository revision: 2a4f37fe520b4f18295cff6671f289a47c1578df
> Repository branch: feature/package+vc
> System Description: Guix System
>
> Configured using:
> 'configure --with-pgtk --with-imagemagick
> PKG_CONFIG_PATH=/gnu/store/ssg343s6ldqdwh30136pnawhbgd0cb6i-profile/lib/pkgconfig:/gnu/store/ssg343s6ldqdwh30136pnawhbgd0cb6i-profile/share/pkgconfig'
>
>>From 1593ba1da6a5caad7f74603ce9f8d5bf1e55de77 Mon Sep 17 00:00:00 2001
> From: Philip Kaludercic <philipk <at> posteo.net>
> Date: Sun, 30 Oct 2022 22:28:25 +0100
> Subject: [PATCH] Handle buffer streams that operate on lines, pages, etc.
>
> * stream.el (stream): Add optional argument THING.
>
> This is promised by the package commentary but apparently wasn't
> actually implemented.
> ---
> stream.el | 48 ++++++++++++++++++++++++++++++++++--------------
> 1 file changed, 34 insertions(+), 14 deletions(-)
>
> diff --git a/stream.el b/stream.el
> index eb81b14220..d8d4bfc3c7 100644
> --- a/stream.el
> +++ b/stream.el
> @@ -1,6 +1,6 @@
> ;;; stream.el --- Implementation of streams -*- lexical-binding: t -*-
>
> -;; Copyright (C) 2016-2020 Free Software Foundation, Inc.
> +;; Copyright (C) 2016-2020, 2022 Free Software Foundation, Inc.
>
> ;; Author: Nicolas Petton <nicolas <at> petton.fr>
> ;; Keywords: stream, laziness, sequences
> @@ -120,22 +120,42 @@ SEQ can be a list, vector or string."
> (car list)
> (stream (cdr list)))))
>
> -(cl-defmethod stream ((buffer buffer) &optional pos)
> +(cl-defmethod stream ((buffer buffer) &optional pos thing)
> "Return a stream of the characters of the buffer BUFFER.
> -BUFFER may be a buffer or a string (buffer name).
> -The sequence starts at POS if non-nil, `point-min' otherwise."
> +BUFFER may be a buffer or a string (buffer name). The sequence
> +starts at POS if non-nil, `point-min' otherwise. By default the
> +stream will consist of characters. If THING is non-nil, it must
> +be a symbol supported by `thing-at-point' and `forward-thing'
> +that will be used to extract and navigate through things.
> +Examples include \\='line, \\='page, or \\='defun."
> (with-current-buffer buffer
> (unless pos (setq pos (point-min)))
> - (if (>= pos (point-max))
> - (stream-empty))
> - (stream-cons
> - (with-current-buffer buffer
> - (save-excursion
> - (save-restriction
> - (widen)
> - (goto-char pos)
> - (char-after (point)))))
> - (stream buffer (1+ pos)))))
> + (cond
> + ((>= pos (point-max))
> + (stream-empty))
> + ((not (null thing))
> + (with-current-buffer buffer
> + (let ((this (save-excursion
> + (save-restriction
> + (widen)
> + (goto-char pos)
> + (thing-at-point thing))))
> + (next (save-excursion
> + (save-restriction
> + (widen)
> + (goto-char pos)
> + (forward-thing thing)
> + (point)))))
> + (stream-cons this (stream buffer next thing)))))
> + ((null thing)
> + (stream-cons
> + (with-current-buffer buffer
> + (save-excursion
> + (save-restriction
> + (widen)
> + (goto-char pos)
> + (char-after (point)))))
> + (stream buffer (1+ pos)))))))
>
> (declare-function iter-next "generator")
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#58904
; Package
emacs
.
(Thu, 07 Sep 2023 20:37:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 58904 <at> debbugs.gnu.org (full text, mbox):
Philip,
Stefan Kangas <stefankangas <at> gmail.com> writes:
> Philip Kaludercic <philipk <at> posteo.net> writes:
>
>> The commentary for stream.el mentions that the following streams are
>> supported:
(That's the `stream' package on GNU ELPA, to be clear.)
>>> ;; - buffers (by character)
>>> ;; - buffers (by line)
>>> ;; - buffers (by page)
>>
>> But I couldn't find anything beyond charachter-streams. The following
>> patch would implement that and more, by re-using thingatpt to define any
>> kind of stream one would want.
>
> Copying in Nicolas Petton, in case he has any comments.
Nicolas didn't seem to have any comments, so please go ahead and install
this if you think it makes sense.
I guess you could also bump the version, if you think that makes sense.
>> -;; Copyright (C) 2016-2020 Free Software Foundation, Inc.
>> +;; Copyright (C) 2016-2020, 2022 Free Software Foundation, Inc.
It's okay to write it like this: 2016-2023
Reply sent
to
Philip Kaludercic <philipk <at> posteo.net>
:
You have taken responsibility.
(Fri, 08 Sep 2023 07:47:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Philip Kaludercic <philipk <at> posteo.net>
:
bug acknowledged by developer.
(Fri, 08 Sep 2023 07:47:03 GMT)
Full text and
rfc822 format available.
Message #18 received at 58904-done <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefankangas <at> gmail.com> writes:
> Philip,
>
> Stefan Kangas <stefankangas <at> gmail.com> writes:
>
>> Philip Kaludercic <philipk <at> posteo.net> writes:
>>
>>> The commentary for stream.el mentions that the following streams are
>>> supported:
>
> (That's the `stream' package on GNU ELPA, to be clear.)
>
>>>> ;; - buffers (by character)
>>>> ;; - buffers (by line)
>>>> ;; - buffers (by page)
>>>
>>> But I couldn't find anything beyond charachter-streams. The following
>>> patch would implement that and more, by re-using thingatpt to define any
>>> kind of stream one would want.
>>
>> Copying in Nicolas Petton, in case he has any comments.
>
> Nicolas didn't seem to have any comments, so please go ahead and install
> this if you think it makes sense.
>
> I guess you could also bump the version, if you think that makes sense.
Done and done.
>>> -;; Copyright (C) 2016-2020 Free Software Foundation, Inc.
>>> +;; Copyright (C) 2016-2020, 2022 Free Software Foundation, Inc.
>
> It's okay to write it like this: 2016-2023
That change was made by `copyright-update', but I have updated it
manually.
--
Philip Kaludercic
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 06 Oct 2023 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 217 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.