GNU bug report logs -
#59165
29.0.50; [PATCH] Ibuffer directory filter not buffer aware
Previous Next
Reported by: Gabriel <gabriel376 <at> hotmail.com>
Date: Thu, 10 Nov 2022 09:28:02 UTC
Severity: normal
Tags: confirmed, patch
Found in versions 29.0.50, 27.1
Fixed in version 29.1
Done: Stefan Kangas <stefankangas <at> gmail.com>
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 59165 in the body.
You can then email your comments to 59165 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#59165
; Package
emacs
.
(Thu, 10 Nov 2022 09:28:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Gabriel <gabriel376 <at> hotmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 10 Nov 2022 09:28: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)]
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.
[0001-Make-ibuffer-directory-filter-buffer-aware.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59165
; Package
emacs
.
(Thu, 10 Nov 2022 09:37:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 59165 <at> debbugs.gnu.org (full text, mbox):
> From: Gabriel <gabriel376 <at> hotmail.com>
> 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 <at> gnu.org
:
bug#59165
; Package
emacs
.
(Fri, 11 Nov 2022 00:50:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 59165 <at> debbugs.gnu.org (full text, mbox):
tags 59165 + confirmed
found 59165 27.1
thanks
Gabriel <gabriel376 <at> hotmail.com> 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 ’/a/b/c.d’, this matches
against ’/a/b’. For a buffer not associated with a file, this
matches against the value of ‘default-directory’ in that 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 <at> hotmail.com>
> 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
Added tag(s) confirmed.
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 11 Nov 2022 00:51:02 GMT)
Full text and
rfc822 format available.
bug Marked as found in versions 27.1.
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 11 Nov 2022 00:51:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59165
; Package
emacs
.
(Fri, 25 Nov 2022 01:17:03 GMT)
Full text and
rfc822 format available.
Message #18 received at 59165 <at> debbugs.gnu.org (full text, mbox):
close 59165 29.1
thanks
Stefan Kangas <stefankangas <at> gmail.com> 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 ’/a/b/c.d’, this matches
> against ’/a/b’. For a buffer not associated with a file, this
> matches against the value of ‘default-directory’ in that 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!
bug marked as fixed in version 29.1, send any further explanations to
59165 <at> debbugs.gnu.org and Gabriel <gabriel376 <at> hotmail.com>
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 25 Nov 2022 01:17:04 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 23 Dec 2022 12:24:18 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 190 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.