GNU bug report logs -
#25049
ibuffer bug when saving existing filter, with patches
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Wed, 07 Dec 2016 19:56:39 +0900
with message-id <87shq0gg7s.fsf <at> gmail.com>
and subject line Re: bug#25049: ibuffer bug when saving existing filter, with patches
has caused the debbugs.gnu.org bug report #25049,
regarding ibuffer bug when saving existing filter, with patches
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
25049: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25049
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Hello,
In at least Emacs 25+, the function 'ibuffer-save-filters'
handles saving existing filters and new filters inconsistently.
Specifically, at the following point in the original function:
(ibuffer-aif (assoc name ibuffer-saved-filters)
(setcdr it filters)
(push (list name filters) ibuffer-saved-filters))
the setcdr (existing filters) and the push (new filters)
save different formats for the variable, with the latter
having an extra layer of parentheses.
As a specific example of failure, using the current default
value of 'ibuffer-saved-filters'
(("gnus"
((or
(mode . message-mode)
(mode . mail-mode)
(mode . gnus-group-mode)
(mode . gnus-summary-mode)
(mode . gnus-article-mode))))
("programming"
((or
(mode . emacs-lisp-mode)
(mode . cperl-mode)
(mode . c-mode)
(mode . java-mode)
(mode . idl-mode)
(mode . lisp-mode)))))
and doing
(ibuffer-save-filters "foo" '((name . "foo") (derived-mode . text-mode)))
(ibuffer-save-filters "gnus" '((filename . ".")
(or (derived-mode . prog-mode)
(mode . "compilation-mode"))))
gives the following incorrect value for `ibuffer-saved-filters'
(("foo"
((name . "foo")
(derived-mode . text-mode)))
("gnus"
(filename . ".")
(or
(derived-mode . prog-mode)
(mode . "compilation-mode")))
("programming"
((or
(mode . emacs-lisp-mode)
(mode . cperl-mode)
(mode . c-mode)
(mode . java-mode)
(mode . idl-mode)
(mode . lisp-mode)))))
because the "foo" and "gnus" entries have different formats,
the latter not consistent with later code to access it
(e.g., in 'ibuffer-included-in-filter-p-1' and 'ibuffer-decompose-filter').
There are two immediate paths for fixing this:
1. Change the setcdr to add the extra level of nesting.
2. Change the format of 'ibuffer-saved-filters' to remove
the level of testing, change the push (list->cons) and
the later accesses (cadr->cdr).
The first is very simple, but the extra level of nesting
is unsightly, inconsistent with the structure of filter groups,
and mildly annoying when writing filters by hand. The
second is fairly simple, requiring only a few more small changes,
but introduces the complication of changing an existing
variable's format. (For what it's worth, I prefer the second.)
I have attached a patch file with patches for three commits
as follows:
1/3: The very simple fix corresponding to choice 1 above.
2/3: The simple fix corresponding to choice 2 above.
3/3: Some extra support added for handling the change
in format for 'ibuffer-saved-filters'.
Let me know if you need any further information.
Thanks, Chris
[Message part 4 (text/html, inline)]
[ibuffer-saved-filters-bug.patch (text/x-diff, attachment)]
[Message part 6 (message/rfc822, inline)]
Tino Calancha <tino.calancha <at> gmail.com> writes:
> If we don't get further comments to address in 1 week, then let's
> push this fix to the master branch.
Pushed to master branch as commit 20f5a5b.
This bug report was last modified 8 years and 167 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.