GNU bug report logs - #59165
29.0.50; [PATCH] Ibuffer directory filter not buffer aware

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Gabriel <gabriel376@HIDDEN>; Keywords: confirmed patch; Done: Stefan Kangas <stefankangas@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 29.1, send any further explanations to 59165 <at> debbugs.gnu.org and Gabriel <gabriel376@HIDDEN> Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 59165 <at> debbugs.gnu.org:


Received: (at 59165) by debbugs.gnu.org; 25 Nov 2022 01:16:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 24 20:16:09 2022
Received: from localhost ([127.0.0.1]:60683 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oyNK5-0008Ui-Fm
	for submit <at> debbugs.gnu.org; Thu, 24 Nov 2022 20:16:09 -0500
Received: from mail-oa1-f47.google.com ([209.85.160.47]:40600)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1oyNK3-0008Tz-1m
 for 59165 <at> debbugs.gnu.org; Thu, 24 Nov 2022 20:16:07 -0500
Received: by mail-oa1-f47.google.com with SMTP id
 586e51a60fabf-13bd19c3b68so3574800fac.7
 for <59165 <at> debbugs.gnu.org>; Thu, 24 Nov 2022 17:16:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=i6eFlZV8DpH/fswSUPlX/fowc9zgZs6dqmtRqLBUonU=;
 b=k2E/oFdhvsGMSEzdwLp7GVSF19UOQHGpW002OsKLLAmx0RmarJFiUz9bEolIU6+xsM
 8bx9iCH8RQEgZj3tKc6IfapdGQ5ioNpunBBrlBTVFPwdcnVq2NHkMtVbw2JF2JU8TPa9
 jSuDX/4Iao1R6WDWmlSbhU/e7pPY5td2e77hDoJIaziSpcu/8PFFbwGhwmQgMGwQkp1Z
 P60SbyaD2l8k/gVj52rpDzWwl6VVEEl3CspjfJprvevAMQFfm4nKNI/OkZOdPbC6s8iN
 K0vEOA3ChjIRltGdTBnXq0Z4pCE8zOCQ0mFxgqj0Bl5A+WjJYBTUDfgTKHkKDjRWkWoW
 zuhg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=i6eFlZV8DpH/fswSUPlX/fowc9zgZs6dqmtRqLBUonU=;
 b=PiapqWhL2LXk7p+d1lt/W64c719nBKWwzCOYAdoOMowVM9bsrEXlIxhbphyA4k/t2k
 cq2nny3LHHdKFa5nDqty+mcNSFkt2DcRXjen4yY5qrJVawixWnB4TiRV2IB0k/yuuSV+
 Akpi/nRc4WUTu9QQG36Wkyw4pI9nBqKvlODMKUR7eTQUDuQjdSmxIQ2vtx3Bz/oWAkoh
 sLSfc5AtnaqhZciDPi6YMdOuY2cYTPOGIGzTZQ6I9HoEW+NymVkq4nDGoUkprSm0COn+
 wRfYweLjdLW3K0kMBXGytZN91h8YJrzGlft4k8F5p+Qy5zAgZwItrOh5ACOi3WfmvXAo
 yhLw==
X-Gm-Message-State: ANoB5pngQTWpJpzpO+soAfAWCD1rvpkUoINPHS2hM6uphppvoNPlrNDE
 xOdA70rDLZMfyirRag8STUN5GVw2gsKzYol2K0o=
X-Google-Smtp-Source: AA0mqf7cd1cxVs36r4d0a/1tLrDB8k6WHDIcpdQfu9lmrmiy71BQAuwTNzz3/Bz+K/2i2PFYpMBWwv8eJpWzH6zsYCs=
X-Received: by 2002:a05:6870:cc89:b0:12b:fbe7:b793 with SMTP id
 ot9-20020a056870cc8900b0012bfbe7b793mr21917607oab.92.1669338961534; Thu, 24
 Nov 2022 17:16:01 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 24 Nov 2022 17:16:01 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkmmGRvER1JTUaP8bKnedNbV3zH_T-r-NLGHGL=Bk6J-8qg@HIDDEN>
 (Stefan Kangas's message of "Thu, 10 Nov 2022 16:49:49 -0800")
References: <SJ0PR06MB8609E4437601203C2F04925A8B019@HIDDEN>
 <CADwFkmmGRvER1JTUaP8bKnedNbV3zH_T-r-NLGHGL=Bk6J-8qg@HIDDEN>
X-Hashcash: 1:20:221125:gabriel376@HIDDEN::mJkEIQ5Hd+yOEZTD:1oYR
MIME-Version: 1.0
Date: Thu, 24 Nov 2022 17:16:01 -0800
Message-ID: <CADwFkm=5tZ0uQwjfMx-QNtB0f2CUtg4JD3YZ-==BwTed=KjJ4w@HIDDEN>
Subject: Re: bug#59165: 29.0.50;
 [PATCH] Ibuffer directory filter not buffer aware
To: Gabriel <gabriel376@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 59165
Cc: Christopher Genovese <genovese@HIDDEN>, 59165 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

close 59165 29.1
thanks

Stefan Kangas <stefankangas@HIDDEN> writes:

> I can verify that the patch below changes the behavior to work like you
> expect.  I don't know if it is the right thing to do, but the docstring
> seems to suggest that it is:
>
>     Limit current view to buffers with directory matching QUALIFIER.
>
>     For a buffer associated with file =E2=80=99/a/b/c.d=E2=80=99, this ma=
tches
>     against =E2=80=99/a/b=E2=80=99.  For a buffer not associated with a f=
ile, this
>     matches against the value of =E2=80=98default-directory=E2=80=99 in t=
hat buffer.
>
> So your patch looks right to me, but I've Cced Christopher Genovese in
> case he has anything to add.

No comments within 2 weeks, so I've pushed your patch to master (commit
75101583c3).  I'm consequently closing this bug report.

Thanks for the patch!




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#59165; Package emacs. Full text available.
bug Marked as found in versions 27.1. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) confirmed. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 59165 <at> debbugs.gnu.org:


Received: (at 59165) by debbugs.gnu.org; 11 Nov 2022 00:49:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 10 19:49:58 2022
Received: from localhost ([127.0.0.1]:44697 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1otIF3-0000ki-Rm
	for submit <at> debbugs.gnu.org; Thu, 10 Nov 2022 19:49:58 -0500
Received: from mail-oi1-f182.google.com ([209.85.167.182]:38542)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1otIF1-0000kO-Qt
 for 59165 <at> debbugs.gnu.org; Thu, 10 Nov 2022 19:49:56 -0500
Received: by mail-oi1-f182.google.com with SMTP id v81so3617123oie.5
 for <59165 <at> debbugs.gnu.org>; Thu, 10 Nov 2022 16:49:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=+H2Hs4MHEFvFR4SN/xFbI+6ZOEqUsxNP5xliRPJyjWc=;
 b=a/3jy5GOPIPoPuTG2tH8FDGsg4WxBetxok0pJqcVHK4PLJQFlKygqwo90RFmls8jB2
 UUibVYGspBbUzORx35j3jaImqmhF2LIWQi9OTJqZgreg+jEp0NATJ1H2pbZQWBSZXbc6
 Q8QHYj+B1hgWNw8dVHZGoCRSWXjMLcuygKAedv+YYzbArucmKXAFYzp4BEWusI7bGFSg
 8f+QfJ3HENWhIJF1sA41p0fBEi61VRNfnx4A/8dZCdISa/oiEs86Z2IDuXOMcCkrK5YK
 rIewiYkKQWNFWcqOwGNwHgGDV29A3FK311me9aqbQb/jVlFMnMSGPdUxYCHLY0horEzl
 5zyg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=+H2Hs4MHEFvFR4SN/xFbI+6ZOEqUsxNP5xliRPJyjWc=;
 b=HTcU+k1XV4lmXg7N6C+m9AtpaGECQ3Y6cYwOZfaQZjGftiomHQDWYYpprBxq/jk7L3
 M41IXbggLp8Da89oAStW6zocITIOWU3VFeVLq9qOWEpqs8ijpt5YvHOdRrJvaRgUl0q9
 AKDeQnZ+jnhbmCRqsysKYvY1jVXuhJxtdWEBiHxRheL3x92OGEML9MxVvpGEZWPPjZeO
 GHCc8bhbLhnSbHyaOt2aSzdqC06QXrUKias0yCR49zydCudtem2myD10o6faj7vxnoVl
 pzWszp46S5RyQQOkTWPbjIRCpeRqrB9eCUNWI62BNuUVpB/tFFfErdFsWo9L3ThR7wLS
 BlaQ==
X-Gm-Message-State: ACrzQf34KaWXy+XLj7MufFY3Mj1ueY7tmEKHzQ+U8fPgFk8PdEUUfoc4
 UwMvqt23XAJuoscilwXLyjbypqwQEatbEkWPpl8=
X-Google-Smtp-Source: AMsMyM4XodAbJ7Kdj/6pfWvloLLmjc6rXOfYRhuYYNmMjOrg10K49wCh62Xtq+hTwrsZd7P04Q9NqbYGKVt4iwtlF0k=
X-Received: by 2002:a54:410c:0:b0:35a:6524:3c1b with SMTP id
 l12-20020a54410c000000b0035a65243c1bmr2328381oic.199.1668127790105; Thu, 10
 Nov 2022 16:49:50 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Thu, 10 Nov 2022 16:49:49 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <SJ0PR06MB8609E4437601203C2F04925A8B019@HIDDEN>
References: <SJ0PR06MB8609E4437601203C2F04925A8B019@HIDDEN>
X-Hashcash: 1:20:221111:genovese@HIDDEN::Tx02Zubi41P7sbxQ:0FvV
MIME-Version: 1.0
Date: Thu, 10 Nov 2022 16:49:49 -0800
Message-ID: <CADwFkmmGRvER1JTUaP8bKnedNbV3zH_T-r-NLGHGL=Bk6J-8qg@HIDDEN>
Subject: Re: bug#59165: 29.0.50;
 [PATCH] Ibuffer directory filter not buffer aware
To: Gabriel <gabriel376@HIDDEN>, 59165 <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 59165
Cc: Christopher Genovese <genovese@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

tags 59165 + confirmed
found 59165 27.1
thanks

Gabriel <gabriel376@HIDDEN> writes:

> Description:
> The ibuffer directory filter is not buffer aware for buffers not
> visiting files. This bug seems to be introduced by commit 3ef18c7a213,
> which made the `default-directory` no longer run within
> `with-current-buffer`.
>
> Steps:
> 1. emacs -Q (29.0.50 master d04433b96215d7d3387573f19cc315de86f2341a)
> 2. M-x dired /home/myuser/foo
> 3. M-x compile ls -lha
> 4. M-x ibuffer
> 5. / F /home/myuser/foo
>
> Expected: filter is applied and two buffers are shown: `foo` and
> `*compilation*`.

I can reproduce this behavior, but I don't think I see how it could have
been introduced by commit 3ef18c7a213:

- I can reproduce it after reverting 3ef18c7a213
- I can reproduce it on Emacs 27.1

I therefore believe this behavior might have been there since the
directory filter was introduced in commit 35aaa6b6aa.

> Actual: only buffer `foo` is shown.
>
> Patch:
> Below there is a proposed patch. I did a quick inspection and could not
> find similar regressions in other ibuffer filters.

I can verify that the patch below changes the behavior to work like you
expect.  I don't know if it is the right thing to do, but the docstring
seems to suggest that it is:

    Limit current view to buffers with directory matching QUALIFIER.

    For a buffer associated with file =E2=80=99/a/b/c.d=E2=80=99, this matc=
hes
    against =E2=80=99/a/b=E2=80=99.  For a buffer not associated with a fil=
e, this
    matches against the value of =E2=80=98default-directory=E2=80=99 in tha=
t buffer.

So your patch looks right to me, but I've Cced Christopher Genovese in
case he has anything to add.

> From 94e2f3f37b1d807af50c9014b57d24661fb3c5bd Mon Sep 17 00:00:00 2001
> From: Gabriel do Nascimento Ribeiro <gabriel376@HIDDEN>
> Date: Thu, 10 Nov 2022 06:11:03 -0300
> Subject: [PATCH 1/1] Make ibuffer directory filter buffer aware
>
> * lisp/ibuf-ext.el (define-ibuffer-filter): Make ibuffer directory
>   filter buffer aware for buffer not visiting files.
> ---
>  lisp/ibuf-ext.el | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
> index 6b5cccec51..adffef4325 100644
> --- a/lisp/ibuf-ext.el
> +++ b/lisp/ibuf-ext.el
> @@ -1336,10 +1336,12 @@ directory
>  matches against the value of `default-directory' in that buffer."
>    ( :description "directory name"
>      :reader (read-from-minibuffer "Filter by directory name (regex): "))
> -  (if-let ((it (with-current-buffer buf (ibuffer-buffer-file-name))))
> -      (when-let ((dirname (file-name-directory it)))
> -        (string-match qualifier dirname))
> -    (when default-directory (string-match qualifier default-directory)))=
)
> +  (with-current-buffer buf
> +    (if-let* ((filename (ibuffer-buffer-file-name))
> +              (dirname (file-name-directory filename)))
> +        (string-match qualifier dirname)
> +      (when default-directory
> +        (string-match qualifier default-directory)))))
>
>  ;;;###autoload (autoload 'ibuffer-filter-by-size-gt  "ibuf-ext")
>  (define-ibuffer-filter size-gt
> --
> 2.34.1




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#59165; Package emacs. Full text available.

Message received at 59165 <at> debbugs.gnu.org:


Received: (at 59165) by debbugs.gnu.org; 10 Nov 2022 09:36:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 10 04:36:33 2022
Received: from localhost ([127.0.0.1]:41898 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ot3z7-0004Iz-8j
	for submit <at> debbugs.gnu.org; Thu, 10 Nov 2022 04:36:33 -0500
Received: from eggs.gnu.org ([209.51.188.92]:57236)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1ot3z4-0004Im-VI
 for 59165 <at> debbugs.gnu.org; Thu, 10 Nov 2022 04:36:31 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1ot3yy-0003bH-F2; Thu, 10 Nov 2022 04:36:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=bvc4kw4MheWiAix5sPd/q4T+7qh2wcwrNyKe/ek8+oQ=; b=n+ZDfvmT2bU/
 6xdI3qvV+RzdrXz20OsWOajLfB6mXHeg5/GejfbK3Ap8KF3kAiy8Kx3gh/rWcie7uDm8e6dl+JRuD
 xQcfPv40zU3BUr/bDvIRVDGhXLTUUz8f+bdBFxJGtY9QAA/fgXWybW1XdXSD4btV+22Gyuu98lbjG
 NRc/mQr5VOHhdb+p13CqOVvJmeSBQZBrP26/o6FIt1iriXzqzypvybLJ/3qpnuoHKM7oKqN7mOIGm
 LwzWwXSMFCnAm7gCa7VxpDbQzPH4eEfTueqIg5PDDq2XvY4B3xfc5k4snoObyfTC/EF3HGTvci9lr
 KtVePXqLgNY06deeydizIA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1ot3ys-0004C3-Rv; Thu, 10 Nov 2022 04:36:21 -0500
Date: Thu, 10 Nov 2022 11:36:18 +0200
Message-Id: <83h6z7rw19.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Gabriel <gabriel376@HIDDEN>, Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <SJ0PR06MB8609E4437601203C2F04925A8B019@HIDDEN>
 (message from Gabriel on Thu, 10 Nov 2022 06:22:23 -0300)
Subject: Re: bug#59165: 29.0.50;
 [PATCH] Ibuffer directory filter not buffer aware
References: <SJ0PR06MB8609E4437601203C2F04925A8B019@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 59165
Cc: 59165 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Gabriel <gabriel376@HIDDEN>
> Date: Thu, 10 Nov 2022 06:22:23 -0300
> 
> Description:
> The ibuffer directory filter is not buffer aware for buffers not
> visiting files. This bug seems to be introduced by commit 3ef18c7a213,
> which made the `default-directory` no longer run within
> `with-current-buffer`.
> 
> Steps:
> 1. emacs -Q (29.0.50 master d04433b96215d7d3387573f19cc315de86f2341a)
> 2. M-x dired /home/myuser/foo
> 3. M-x compile ls -lha
> 4. M-x ibuffer
> 5. / F /home/myuser/foo
> 
> Expected: filter is applied and two buffers are shown: `foo` and
> `*compilation*`.
> 
> Actual: only buffer `foo` is shown.
> 
> Patch:
> Below there is a proposed patch. I did a quick inspection and could not
> find similar regressions in other ibuffer filters.

Stefan, can you please look into this?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#59165; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Nov 2022 09:27:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 10 04:27:39 2022
Received: from localhost ([127.0.0.1]:41887 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ot3qU-000450-RG
	for submit <at> debbugs.gnu.org; Thu, 10 Nov 2022 04:27:39 -0500
Received: from lists.gnu.org ([209.51.188.17]:41872)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gabriel376@HIDDEN>) id 1ot3qS-00044s-VQ
 for submit <at> debbugs.gnu.org; Thu, 10 Nov 2022 04:27:37 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <gabriel376@HIDDEN>)
 id 1ot3qS-000203-KN
 for bug-gnu-emacs@HIDDEN; Thu, 10 Nov 2022 04:27:36 -0500
Received: from mail-dm6nam12acsn2080b.outbound.protection.outlook.com
 ([2a01:111:f400:fe59::80b]
 helo=NAM12-DM6-obe.outbound.protection.outlook.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <gabriel376@HIDDEN>)
 id 1ot3qQ-00080Y-9X
 for bug-gnu-emacs@HIDDEN; Thu, 10 Nov 2022 04:27:36 -0500
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=dMYDx9qG9x6bAIV9tORRuTbPc2YPIufN2EoeSJeW8JMZQ2z+bMGLG9L6te7RAeUhGNwMG0//bVs2eo7o7OV70KzarPAS19HP92gx9WXxtgGU5F/TPKkTxIX6ObVegElxOM9ET3kpJE6foxq3HcK34hV8v/X4UuArfRy9597UQJiOh74iVofFE2c+zinm4smZgPCC5UAZFzsIeDRIcPXPpUp51k7rnQO5oL5FZFrcaK6qy903/MmBDRzzn28/OVrNYMpEmr1UUYKbk5ziLLu8d+BfZUiuOSVTNlYXopL+4O4Fa3TcICASiMROsdkUCOQEkkQh2N/yl3xyzNed49hP1w==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=6orlE5qj952ZQXhI0uOe5uuvQsF7fNatAZb4ZdYsNpQ=;
 b=P8DabObkIVuRjFDu8k5WswZqE6G0Vc2aRbsqsjqMbFSQFXQ+bE05W320x6IYGJTyqXoyuDr/jPmg0S2B09I/wkPQDgWr+F3t6bg7J9/oKbsdR1aWEDC12dGdsRp7RkIWA5D5QxxQnKHCmUWCBoRO1vRyt/ZTaUETNvgmPiQ7jwyMGHVrVefB02AA+iycPjPVU7FFX3PXFgWjpcsj4un49ZdKnRSUZPEJhwvpZ5prKG374mqusVcUIqu9Elr15Hry0T+99coS+p/xCgFPQEeYJ+8NZPGJYUP6b+cbOKEPKdaKo/lGGotW1e2mJe1PjCea7IN15ucP1enzIysd31AuHA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=6orlE5qj952ZQXhI0uOe5uuvQsF7fNatAZb4ZdYsNpQ=;
 b=s5aOn6LZTjTLnDHNRvSNcAYfhQr//+Ce9hiZ46VTvoKyIBDC5dzsNWLHQaTEXxFG5FXpc5/SOTMtkUWAvEMzl4tldFJE7+OXlBVVQifhWapBpRm83CvkMxRFOOW1SJhfdRZnrW3vkhTaPJiRrJH/LV95I843znTbfTNBvK8gdOySrgoFhDmtCHp0gdyHrZRvpTAHqtk+NW1/u5gElMeEslq7Zu0uk0+BDH4P9yl0ZRNbribpv9pW+rn87leTZyKSPSkmyENXhIxJzhHSrx9UBQl0u3bY+lqhneV9cxWpwKeu1kCGEEVyI9qLnbVQB5oxG0ksG7vSV8+Vzs4UXlMeYw==
Received: from SJ0PR06MB8609.namprd06.prod.outlook.com (2603:10b6:a03:40c::11)
 by BYAPR06MB6040.namprd06.prod.outlook.com (2603:10b6:a03:d0::26)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.13; Thu, 10 Nov
 2022 09:22:30 +0000
Received: from SJ0PR06MB8609.namprd06.prod.outlook.com
 ([fe80::33ae:d3a7:24ae:5c6f]) by SJ0PR06MB8609.namprd06.prod.outlook.com
 ([fe80::33ae:d3a7:24ae:5c6f%4]) with mapi id 15.20.5813.011; Thu, 10 Nov 2022
 09:22:30 +0000
From: Gabriel <gabriel376@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.50; [PATCH] Ibuffer directory filter not buffer aware
Date: Thu, 10 Nov 2022 06:22:23 -0300
Message-ID: <SJ0PR06MB8609E4437601203C2F04925A8B019@HIDDEN>
Content-Type: multipart/mixed; boundary="=-=-="
X-TMN: [8I/YY4vSien2UlPswFiClX7AZSsw9jXkRke6/aZiqrcUc7wbTModpfQgawa1PupQ]
X-ClientProxiedBy: CP6P284CA0009.BRAP284.PROD.OUTLOOK.COM
 (2603:10d6:103:1aa::13) To SJ0PR06MB8609.namprd06.prod.outlook.com
 (2603:10b6:a03:40c::11)
X-Microsoft-Original-Message-ID: <87fserqi40.fsf@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: SJ0PR06MB8609:EE_|BYAPR06MB6040:EE_
X-MS-Office365-Filtering-Correlation-Id: 71684854-4d06-4fde-f925-08dac2fd16a9
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: sCTTIFwE2u9+B6aY+ypckkNnY0Bnf9o0S90/OQwhvkFyAAcpH+MJMLGQAr6kkGhcueTZ3fyHrWAmoSMvVaciK6Wo4t5CYLuAJzKT3fdvUn3HZ8lVOwSbTdpzHbejzjaTIn+WKbwS6AOMlsU0IzqdG16gXcRmxIO6ATjqNoYp7Q6Te8C7uWtQUpdWdrz9q6OogN/zE/2+hu8VAYMwaA/INhoJwuLTt2vuZTJpTCpqoQXwCWEmNMjErYh7Hydi2BZPXZejqnGh9QS+2yDjKwvdv698zCSpBRmItb3VC5YRmgn09UNbWFJNMeTTr/Ox7LKW4zFePV8+uwHkVS0qvVyEk9HfqAPcjv2iHGvS8wUpxfo9oyjzYBlJYfvkveqzAXL3c+Ahk16VlXQQJ+mkOnRU6dkLYtgiaj9PdeHGa8sJ25s+1EBRd2waztHBAHogLyviutLHf0Beo2dpzPb88JK5U9wsEfXIAbXAUqpQGrXrY/NAh9QowPu3UnIBoQqbB9AQZCQrNcLSstPwuU+rKpbxv18/lbI1KxnzrPyRrDpXaAHFNsfS1XaTxUD6rV09ZRakm1qLPbNzVD0FnpDUgV2j5H7saf3b1YgvyegYZupl0rdLE0ftZDzuq5gdiPxzBcW4
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?rfxlknr3cgvNQQbl5k9ILXwgPv2/cj9n5GDpeSXq07yZsuJDHJZJDS30LOB1?=
 =?us-ascii?Q?YO7Z82fRm5SeCFaHscKl0nXavFw3S+bOnh30s1EpfeM/jTaOV+aWqtDWCe+W?=
 =?us-ascii?Q?5YgMNN0d+yOZgUAeigV8n65sonb5Qbh5VH4JaEyWX3f+ePJmRmvK1VSjjFQd?=
 =?us-ascii?Q?QH471y+xlheqBz6smSX5XWMKdipk92HQBmiRgfpAyi5NIBOIVReJ2We568Ml?=
 =?us-ascii?Q?NwVaX2H8uelmTUVNNA5c5JySfvR0YVq2g4cTyG0fULIDbGOjyl/+COh1HI5N?=
 =?us-ascii?Q?aBgJuopjLx1ub1oyzFPaaccC9WYl9j07Dp/KCVsg96ehxioErVyPU3qJECct?=
 =?us-ascii?Q?OGdgQmGDhmZSzH4OdHlMHQKpu581wv9Hxh2VgI3MVuARYqUlpRQM/rVnGfY9?=
 =?us-ascii?Q?K2vHNR7sIQEhIoFfmiUid6ani/UeqRSVZzATd4KOgS2dtYWRA69C3IRshhJA?=
 =?us-ascii?Q?BcpslVHJngctji9RvbCn62t+GbbVJkveMkBHzoa/foFWf/8V4QBM7tft81Fj?=
 =?us-ascii?Q?Mw1GFlij7fVfMmJmVNTiTSwq8+/46MILom+ZxxSMoswPCVS9kb7MmG/f4E96?=
 =?us-ascii?Q?kjCG/fqeNIChfe2YkMlU681VLF2Tz7kZyBH2NCtbTbdPyn6EUJV1ngl03qyo?=
 =?us-ascii?Q?zdet5txLU64aSf/LJmmwEB1t7g+blyn+LZKXzqfwXt255+qoct/5+m2llkUj?=
 =?us-ascii?Q?p65IVFFtRn0EbtJMKV9HGIxui6aJS2MeUs2b+reQ6xm2LL7S/g6sebUqAMh1?=
 =?us-ascii?Q?K/dCaTlJJ5V6abJ/dA2UK79nGfsFdH8Kk6JiYfHXp7u50q4Da4xO7c+j4rHi?=
 =?us-ascii?Q?qCYVx5MhZRrQY5qYq/svZey6nnmBeOpSs1b3Es7xWBwbT1hRe2tUys+RRlrJ?=
 =?us-ascii?Q?elG/WOoJeXFveEIcaKU0obo4udcv8Bl0BuLVYf9l3hdTDgK/TAF1Qalq7hHY?=
 =?us-ascii?Q?QAdlHMrFl0UhJpMgT8Eu0GsueOJtIqKDDbRhTX24SSGQyGUNYByrmjDbhsL9?=
 =?us-ascii?Q?9m397a7UaZBsHr/Cz+NWtSjA2jPRAgaBGhJhA9F3YVGbLQ/avTsUzsvTnGn3?=
 =?us-ascii?Q?sco4xlw0Om1Z49H12bZwlZHQtCbRNAvt9wxVPfFMX9xLYSdMnU1lMc4tjt8f?=
 =?us-ascii?Q?nMkqt0/ZBkKw2X01NI/hctjOtptlY6t0VLn7+TIqLK+H9W2fvj380xlJHblm?=
 =?us-ascii?Q?qq+3d1HurhaNT6Lce8bVp8J2F+sINH3sUEJz57iOCbFIsFUMuzEcsjuqstkW?=
 =?us-ascii?Q?QLdCg5acQ2PVxjav/ITrV/hK8VeYFwSzYspcR5RLDpmJ/eGEACmdtNk5vmE+?=
 =?us-ascii?Q?+TH7O4jiWCGUazIhtXJl+dSyFLnxNbUIRNabOXfHo9B+FA=3D=3D?=
X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-89723.templateTenant
X-MS-Exchange-CrossTenant-Network-Message-Id: 71684854-4d06-4fde-f925-08dac2fd16a9
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR06MB8609.namprd06.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2022 09:22:30.6987 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR06MB6040
Received-SPF: pass client-ip=2a01:111:f400:fe59::80b;
 envelope-from=gabriel376@HIDDEN;
 helo=NAM12-DM6-obe.outbound.protection.outlook.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.4 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

--=-=-=
Content-Type: text/plain

Description:
The ibuffer directory filter is not buffer aware for buffers not
visiting files. This bug seems to be introduced by commit 3ef18c7a213,
which made the `default-directory` no longer run within
`with-current-buffer`.

Steps:
1. emacs -Q (29.0.50 master d04433b96215d7d3387573f19cc315de86f2341a)
2. M-x dired /home/myuser/foo
3. M-x compile ls -lha
4. M-x ibuffer
5. / F /home/myuser/foo

Expected: filter is applied and two buffers are shown: `foo` and
`*compilation*`.

Actual: only buffer `foo` is shown.

Patch:
Below there is a proposed patch. I did a quick inspection and could not
find similar regressions in other ibuffer filters.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-Make-ibuffer-directory-filter-buffer-aware.patch

From 94e2f3f37b1d807af50c9014b57d24661fb3c5bd Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <gabriel376@HIDDEN>
Date: Thu, 10 Nov 2022 06:11:03 -0300
Subject: [PATCH 1/1] Make ibuffer directory filter buffer aware

* lisp/ibuf-ext.el (define-ibuffer-filter): Make ibuffer directory
  filter buffer aware for buffer not visiting files.
---
 lisp/ibuf-ext.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 6b5cccec51..adffef4325 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1336,10 +1336,12 @@ directory
 matches against the value of `default-directory' in that buffer."
   ( :description "directory name"
     :reader (read-from-minibuffer "Filter by directory name (regex): "))
-  (if-let ((it (with-current-buffer buf (ibuffer-buffer-file-name))))
-      (when-let ((dirname (file-name-directory it)))
-        (string-match qualifier dirname))
-    (when default-directory (string-match qualifier default-directory))))
+  (with-current-buffer buf
+    (if-let* ((filename (ibuffer-buffer-file-name))
+              (dirname (file-name-directory filename)))
+        (string-match qualifier dirname)
+      (when default-directory
+        (string-match qualifier default-directory)))))
 
 ;;;###autoload (autoload 'ibuffer-filter-by-size-gt  "ibuf-ext")
 (define-ibuffer-filter size-gt
-- 
2.34.1


--=-=-=--




Acknowledgement sent to Gabriel <gabriel376@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#59165; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 25 Nov 2022 01:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.