Emacs 26.2.90 is out!

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Emacs 26.2.90 is out!

Nicolas Petton-2
Hi!

The first pretest for what will be the 26.2 release of Emacs (the
extensible text editor) is available at

  https://alpha.gnu.org/gnu/emacs/pretest/emacs-26.2.90.tar.xz

You can get the PGP signature at

  https://alpha.gnu.org/gnu/emacs/pretest/emacs-26.2.90.tar.xz.sig

The tarball is signed with the following GPG key, which can be found on
PGP key servers

  D405AA2C862C54F17EEE6BE0E8BCD7866AFCF978

Please give it as much testing as you can.

As always, if you encounter problems building or using Emacs,
send a report to [hidden email] with full details
(if possible, use M-x report-emacs-bug).

Thanks for helping to test Emacs.

Cheers,
Nico

signature.asc (493 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Emacs 26.2.90 is out!

Nicolas Petton-2
Nicolas Petton <[hidden email]> writes:

I wrote:

> The first pretest for what will be the 26.2 release of Emacs (the

But of course I meant to write:

> The first pretest for what will be the 26.3 release of Emacs (the

Sorry for the confusion.

Cheers,
Nico

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Emacs 26.2.90 is out!

Phillip Lord-3
In reply to this post by Nicolas Petton-2

And windows binaries available.

https://alpha.gnu.org/gnu/emacs/pretest/windows/emacs-26/

Nicolas Petton <[hidden email]> writes:

> Hi!
>
> The first pretest for what will be the 26.2 release of Emacs (the
> extensible text editor) is available at
>
>   https://alpha.gnu.org/gnu/emacs/pretest/emacs-26.2.90.tar.xz
>
> You can get the PGP signature at
>
>   https://alpha.gnu.org/gnu/emacs/pretest/emacs-26.2.90.tar.xz.sig
>
> The tarball is signed with the following GPG key, which can be found on
> PGP key servers
>
>   D405AA2C862C54F17EEE6BE0E8BCD7866AFCF978
>
> Please give it as much testing as you can.
>
> As always, if you encounter problems building or using Emacs,
> send a report to [hidden email] with full details
> (if possible, use M-x report-emacs-bug).
>
> Thanks for helping to test Emacs.
>
> Cheers,
> Nico

Reply | Threaded
Open this post in threaded view
|

stream.el (was: Emacs 26.2.90 is out!)

Michael Heerdegen
In reply to this post by Nicolas Petton-2
Hi,

while you're here - completely different story:

how should we proceed if we want to make fixes/changes to stream.el and
the other Elisp stuff you maintain?  The last time we tried to contact
you was some days ago when Noam and I discussed the fix for Bug#30626.
We got no reply to our questions - did these mails go through?

If you are short on time - I don't mind, happens to most of us sooner or
later.  But is it ok if we just fix bugs in your libs, or continue
developing them?  Do you plan to continue maintaining these files?

Thanks,

Michael.

Reply | Threaded
Open this post in threaded view
|

Re: stream.el (was: Emacs 26.2.90 is out!)

Nicolas Petton-2
Michael Heerdegen <[hidden email]> writes:

> Hi,

Hi Michael,

> how should we proceed if we want to make fixes/changes to stream.el and
> the other Elisp stuff you maintain?  The last time we tried to contact
> you was some days ago when Noam and I discussed the fix for Bug#30626.
> We got no reply to our questions - did these mails go through?

I've been short on time lately, but I definitely plan to keep
maintaining those packages.

> But is it ok if we just fix bugs in your libs, or continue developing
> them?  Do you plan to continue maintaining these files?

It's ok to fix them, but I'd like to stay involved at least.

Cheers,
Nico

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Enhance seq-min and seq-max (was: stream.el)

Michael Heerdegen
Nicolas Petton <[hidden email]> writes:

> It's ok to fix them, but I'd like to stay involved at least.

Ok, great.

I would like to extend seq-min and seq-max to allow (a) arbitrary
comparison functions and (b) key functions like in cl, so that you can
find e.g. the longest string in a sequence of strings.  I miss this
functionality, AFAIK cl-lib also can't do it.

Like this, maybe?


From 3cbaf1316de41687a6a3a6d67e4cc773769999c3 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <[hidden email]>
Date: Fri, 10 May 2019 15:08:57 +0200
Subject: [PATCH] WIP: Enhance seq-min and seq-max

---
 lisp/emacs-lisp/seq.el | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 3413cd1513..ddd8f3161c 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -451,15 +451,35 @@ seq-group-by
    (seq-reverse sequence)
    nil))

-(cl-defgeneric seq-min (sequence)
+(cl-defgeneric seq-min (sequence &optional predicate key)
   "Return the smallest element of SEQUENCE.
-SEQUENCE must be a sequence of numbers or markers."
-  (apply #'min (seq-into sequence 'list)))
-
-(cl-defgeneric seq-max (sequence)
+With PREDICATE given, use it to compare elements.  The default is
+`<'.
+With function KEY given, call it on the individual elements and
+compare the results instead of the elements."
+  (if predicate
+      (seq-reduce
+       (if key
+           (lambda (x y)
+             (if (funcall predicate (funcall key y) (funcall key x)) y x))
+         (lambda (x y) (if (funcall predicate y x) y x)))
+       sequence (car sequence))
+    (apply #'min (seq-into sequence 'list))))
+
+(cl-defgeneric seq-max (sequence &optional predicate key)
   "Return the largest element of SEQUENCE.
-SEQUENCE must be a sequence of numbers or markers."
-  (apply #'max (seq-into sequence 'list)))
+With PREDICATE given, use it to compare elements.  The default is
+`<'.
+With function KEY given, call it on the individual elements and
+compare the results instead of the elements."
+  (if predicate
+      (seq-reduce
+       (if key
+           (lambda (x y)
+             (if (funcall predicate (funcall key x) (funcall key y)) y x))
+         (lambda (x y) (if (funcall predicate x y) y x)))
+       sequence (car sequence))
+    (apply #'max (seq-into sequence 'list))))

 (defun seq--count-successive (pred sequence)
   "Return the number of successive elements for which (PRED element) is non-nil in SEQUENCE."
--
2.20.1



I made it so that if the result is ambiguous (e.g. multiple strings with
equal length), the first one is returned, but that is not explicitly
documented.

Regards,

Michael.
Reply | Threaded
Open this post in threaded view
|

Re: Enhance seq-min and seq-max (was: stream.el)

Eli Zaretskii
> From: Michael Heerdegen <[hidden email]>
> Date: Sat, 15 Jun 2019 02:25:06 +0200
> Cc: Emacs Devel <[hidden email]>
>
> I would like to extend seq-min and seq-max to allow (a) arbitrary
> comparison functions and (b) key functions like in cl, so that you can
> find e.g. the longest string in a sequence of strings.  I miss this
> functionality, AFAIK cl-lib also can't do it.

If this is pushed, please update the documentation as well.

Thanks.

Reply | Threaded
Open this post in threaded view
|

Re: Enhance seq-min and seq-max

Michael Heerdegen
Eli Zaretskii <[hidden email]> writes:

> If this is pushed, please update the documentation as well.

The manual?  I would have forgotten that, didn't remember that seq.el
was already mentioned there.  Thanks for the hint.

Michael.


Reply | Threaded
Open this post in threaded view
|

Re: Enhance seq-min and seq-max

Michael Heerdegen
In reply to this post by Michael Heerdegen
Michael Heerdegen <[hidden email]> writes:

> Like this, maybe?

Here is an update.  I improved the documentation and optimized the code
to avoid repeated calls of the KEY function on the same element.  There
are now more cases, but the code should be more efficient.

If this is accepted, I will care about the update of the manual.


From 8c870d37e9f6c67f6eb1566cb1307465675b4d8a Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <[hidden email]>
Date: Fri, 10 May 2019 15:08:57 +0200
Subject: [PATCH] WIP: Enhance seq-min and seq-max

---
 lisp/emacs-lisp/seq.el | 62 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 55 insertions(+), 7 deletions(-)

diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 3413cd1513..b681adb393 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -451,15 +451,63 @@ seq-group-by
    (seq-reverse sequence)
    nil))

-(cl-defgeneric seq-min (sequence)
+(cl-defgeneric seq-min (sequence &optional predicate key)
   "Return the smallest element of SEQUENCE.
-SEQUENCE must be a sequence of numbers or markers."
-  (apply #'min (seq-into sequence 'list)))
-
-(cl-defgeneric seq-max (sequence)
+With PREDICATE given, use it to compare elements.
+With function KEY given, call it with the individual elements as
+arguments and compare the results instead of the elements.
+
+PREDICATE doesn't need to define a total order.  The return value is
+always the first element X of SEQUENCE so that for no following Y
+
+  (funcall PREDICATE (funcall KEY Y) (funcall KEY X))
+
+yields non-nil, where PREDICATE defaults to #'< and KEY to
+#'identity."
+  (if predicate
+      (if key
+          (let ((first (car sequence)))
+            (cdr (seq-reduce
+                  (lambda (key-x-and-x y)
+                    (let ((key-y-and-y (cons (funcall key y) y)))
+                      (if (funcall predicate (car key-y-and-y) (car key-x-and-x))
+                          key-y-and-y
+                        key-x-and-x)))
+                  (cdr sequence)
+                  (cons (funcall key first) first))))
+        (seq-reduce
+         (lambda (x y) (if (funcall predicate y x) y x))
+         (cdr sequence) (car sequence)))
+    (apply #'min (seq-into sequence 'list))))
+
+(cl-defgeneric seq-max (sequence &optional predicate key)
   "Return the largest element of SEQUENCE.
-SEQUENCE must be a sequence of numbers or markers."
-  (apply #'max (seq-into sequence 'list)))
+With PREDICATE given, use it to compare elements.
+With function KEY given, call it with the individual elements as
+arguments and compare the results instead of the elements.
+
+PREDICATE doesn't need to define a total order.  The return value is
+always the first element X of SEQUENCE so that for no following Y
+
+  (funcall PREDICATE (funcall KEY X) (funcall KEY Y))
+
+yields non-nil, where PREDICATE defaults to #'< and KEY to
+#'identity."
+  (if predicate
+      (if key
+          (let ((first (car sequence)))
+            (cdr (seq-reduce
+                  (lambda (key-x-and-x y)
+                    (let ((key-y-and-y (cons (funcall key y) y)))
+                      (if (funcall predicate (car key-x-and-x) (car key-y-and-y))
+                          key-y-and-y
+                        key-x-and-x)))
+                  (cdr sequence)
+                  (cons (funcall key first) first))))
+        (seq-reduce
+         (lambda (x y) (if (funcall predicate x y) y x))
+         (cdr sequence) (car sequence)))
+    (apply #'max (seq-into sequence 'list))))

 (defun seq--count-successive (pred sequence)
   "Return the number of successive elements for which (PRED element) is non-nil in SEQUENCE."
--
2.20.1




Thanks,

Michael.
Reply | Threaded
Open this post in threaded view
|

Re: Enhance seq-min and seq-max

Eli Zaretskii
In reply to this post by Michael Heerdegen
> From: Michael Heerdegen <[hidden email]>
> Cc: [hidden email],  [hidden email]
> Date: Sun, 16 Jun 2019 01:00:38 +0200
>
> Eli Zaretskii <[hidden email]> writes:
>
> > If this is pushed, please update the documentation as well.
>
> The manual?

Yes.  But also NEWS, as I think this change is worthy of being
mentioned there.

> I would have forgotten that, didn't remember that seq.el was already
> mentioned there.  Thanks for the hint.

You are welcome.  Thanks for working on this.

Reply | Threaded
Open this post in threaded view
|

Re: Enhance seq-min and seq-max

Nicolas Petton-2
In reply to this post by Michael Heerdegen
Michael Heerdegen <[hidden email]> writes:

> Michael Heerdegen <[hidden email]> writes:

Hi Michael,

>> Like this, maybe?

I like the idea!  In addition to documentation, could you also add
unit tests? (for seq.el, I like when my unit tests test multiple
sequence types).

I left some comments below.

> +  (if predicate
         ^^^^^^^^^
What if `predicate' is nil but `key' is non-nil?
> +      (if key
> +          (let ((first (car sequence)))
                           ^^^
                           You cannot use `car' here
> +            (cdr (seq-reduce
> +                  (lambda (key-x-and-x y)
> +                    (let ((key-y-and-y (cons (funcall key y) y)))
> +                      (if (funcall predicate (car key-y-and-y) (car key-x-and-x))
> +                          key-y-and-y
> +                        key-x-and-x)))
> +                  (cdr sequence)
                      ^^^
                      You cannot use `cdr' either
> +                  (cons (funcall key first) first))))
> +        (seq-reduce
> +         (lambda (x y) (if (funcall predicate y x) y x))
> +         (cdr sequence) (car sequence)))
> +    (apply #'min (seq-into sequence 'list))))
                     ^^^^^^^^^^^^^^^^^^^^^^^
                     I think your version of `seq-min' will break when
                     `predicate' is used for all sequence types but lists,
                     since you don't convert the sequence, but use `car'
                     and `cdr'.

Thanks!
Nico

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Enhance seq-min and seq-max

Michael Heerdegen
Nicolas Petton <[hidden email]> writes:

> In addition to documentation, could you also add unit tests? (for
> seq.el, I like when my unit tests test multiple sequence types).

Sure.

> I left some comments below.
>
> > +  (if predicate
>          ^^^^^^^^^
> What if `predicate' is nil but `key' is non-nil?

Then it does nonsense.  Ok, we get one more case.  I wonder if I should
rather give one general definition in the function body and handle the
four cases (KEY/PREDICATE given/not given) in a compiler macro.  Then in
compiled code there would be no runtime tests and it would be optimized
for the respective case.

> > +    (apply #'min (seq-into sequence 'list))))
>                      ^^^^^^^^^^^^^^^^^^^^^^^ I think your version of
>                      `seq-min' will break when `predicate' is used for
>                      all sequence types but lists, since you don't
>                      convert the sequence, but use `car' and `cdr'.

Correct.  I changed it to use seq-first and seq-rest instead of car/cdr
- an intermediate conversion step is not necessary I think.


Thanks,

Michael.

Reply | Threaded
Open this post in threaded view
|

Re: Enhance seq-min and seq-max

Nicolas Petton-2
Michael Heerdegen <[hidden email]> writes:

>> I left some comments below.
>>
>> > +  (if predicate
>>          ^^^^^^^^^
>> What if `predicate' is nil but `key' is non-nil?
>
> Then it does nonsense.  Ok, we get one more case.

If it's documented, I'm fine with it.

> I wonder if I should rather give one general definition in the
> function body and handle the four cases (KEY/PREDICATE given/not
> given) in a compiler macro.  Then in compiled code there would be no
> runtime tests and it would be optimized for the respective case.

As you wish, but depending on what exactly you have in mind, it might be
better not to do it, so that `seq-min' and `seq-max' can still easily be
overwritten for custom seq types.

Nico

signature.asc (497 bytes) Download Attachment