unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "João Távora" <joaotavora@gmail.com>, 62417@debbugs.gnu.org
Subject: bug#62417: ; Regression: 59ecf25fc860 is the first bad commit
Date: Sat, 25 Mar 2023 13:17:40 +0000	[thread overview]
Message-ID: <878rfl3r7v.fsf@posteo.net> (raw)
In-Reply-To: <83fs9tc7o9.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Mar 2023 15:55:02 +0300")

[-- Attachment #1: Type: text/plain, Size: 1932 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 62417@debbugs.gnu.org
>> From: João Távora <joaotavora@gmail.com>
>> Date: Fri, 24 Mar 2023 19:48:35 +0000
>> 
>> If the previous explanation is somehow hard to understand, here's a
>> hopefully simpler one with a repro which doesn't require SLY.  In Emacs
>> 28 the docstring for `display-buffer-alist` states (emphasis mine):
>> 
>>    If non-nil, this is an alist of elements (CONDITION . ACTION),
>>    where:
>>     
>>     CONDITION is either a regexp matching buffer names, or a
>>      function that takes two arguments - a buffer name and the
>>      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>      ACTION argument of `display-buffer' - and returns a boolean.
>> 
>> In Emacs 29, the docstring was changed to state:
>> 
>>     If non-nil, this is an alist of elements (CONDITION . ACTION),
>>     where:
>>      
>>      CONDITION is passed to `buffer-match-p', along with the buffer
>>       that is to be displayed and the ACTION argument of
>>       `display-buffer', to check if ACTION should be used.
>> 
>> Any code that was written for the Emacs 28 contract in mind like, for
>> example:
>> 
>>    (defun foop (buffer-name _alist) (string-match "foop" buffer-name))
>> 
>>    (add-to-list 'display-buffer-alist '(foop . display-buffer-other-frame))
>> 
>> Will now fail with an obscure error message.  I've checked "Incompatible
>> Lisp Changes in Emacs 29.1" in etc/NEWS and could not find a mention to
>> this, so I assume it was not intentional.
>> 
>> So it is most clearly a regression.
>
> There's something missing in the above description, since
> buffer-match-p accepts a function as its CONDITION argument, and calls
> that function with the buffer and ACTION.  

We would have to call the function with the buffer name instead of the
buffer object.  So the `buffer-match-p' fix would look like this:


[-- Attachment #2: Type: text/plain, Size: 727 bytes --]

diff --git a/lisp/subr.el b/lisp/subr.el
index 99ddd813867..3210ab05702 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -7140,8 +7140,8 @@ buffer-match-p
                        (string-match-p condition (buffer-name buffer)))
                       ((pred functionp)
                        (if (eq 1 (cdr (func-arity condition)))
-                           (funcall condition buffer)
-                         (funcall condition buffer arg)))
+                           (funcall condition (buffer-name buffer))
+                         (funcall condition (buffer-name buffer) arg)))
                       (`(major-mode . ,mode)
                        (eq
                         (buffer-local-value 'major-mode buffer)

[-- Attachment #3: Type: text/plain, Size: 464 bytes --]


I don't think I am a fan of this, as most of the time a buffer is more
immediately useful.  Perhaps João's initial change would be better in
that case, for the sake of backwards compatibility?  Or does it make
sense to mention this as an incompatible lisp change?

>                                            So it sounds like code
> written for Emacs 28 should still work.  What is missing here that
> explains the breakage?

-- 
Philip Kaludercic

  parent reply	other threads:[~2023-03-25 13:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24 13:16 bug#62417: 30.0.50; Regression: 59ecf25fc860 is the first bad commit João Távora
2023-03-24 15:22 ` João Távora
2023-03-24 16:05   ` Philip Kaludercic
2023-03-24 16:07     ` João Távora
2023-03-24 19:48       ` bug#62417: ; " João Távora
2023-03-25 12:55         ` Eli Zaretskii
2023-03-25 13:04           ` João Távora
2023-03-25 13:20             ` Eli Zaretskii
2023-03-25 13:56               ` João Távora
2023-03-25 14:13                 ` Eli Zaretskii
2023-03-25 14:15                   ` João Távora
2023-03-26 20:22                   ` João Távora
2023-03-26 21:23                     ` Philip Kaludercic
2023-03-27  2:24                     ` Eli Zaretskii
2023-03-27 12:06                       ` João Távora
2023-03-27 13:49                         ` Eli Zaretskii
2023-03-27 14:08                           ` João Távora
2023-03-27 15:20                             ` Eli Zaretskii
2023-03-27 16:33                               ` Eli Zaretskii
2023-03-27 16:42                                 ` João Távora
2023-03-27 17:09                                   ` Eli Zaretskii
2023-03-27 19:26                                     ` Philip Kaludercic
2023-03-28 11:11                                       ` Eli Zaretskii
2023-03-27 16:38                               ` João Távora
2023-03-25 13:17           ` Philip Kaludercic [this message]
2023-03-25 13:29             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rfl3r7v.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=62417@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).