bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25049: ibuffer bug when saving existing filter, with patches


From: Christopher Genovese
Subject: bug#25049: ibuffer bug when saving existing filter, with patches
Date: Tue, 29 Nov 2016 11:09:28 -0500

> 1) (eval-when-compiler (require 'subr-x)) is missing

Ah, sorry. I went back to master and then added in the changes,
but I missed that this time.  Thanks.

> 3) When `ibuffer-old-saved-filters-warning' is shown i miss
>    that the buffer displaying it has the key binding
>    `TAB' for `forward-button'.
>    It might be a smarter way to do this, but i just put the buffer
>    in help-mode as follows:

That works for me.

> 4) [minor comment] It's not very common in Emacs to
> call a var `old-format-detected?'.  Adding 'p' instead
> of '?' or even not suffix at all looks more usual.

OK, makes sense. I had thought of the -p convention
as being for predicate functions, and I do like the
readability of the '?'.  But I get it.

> 5)
> Please, start sentences in capital letters.  Imperative
> form verb is prefered than pasive.

Understood.


Do you want me to submit a new patch with these changes?

(And I know owe you new patches for the other changes, which I have
not forgotten. I'm just a bit behind but hope to submit those
today.)

Thanks again, Chris



On Tue, Nov 29, 2016 at 10:06 AM, Tino Calancha <tino.calancha@gmail.com> wrote:
Christopher Genovese <genovese@cmu.edu> writes:


> In at least Emacs 25+, the function 'ibuffer-save-filters'
> handles saving existing filters and new filters inconsistently.
Thank you for the bug report and the extensive analysis!
Below i add some comments.

> 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 also prefer the larger fix 2.

> I have attached a patch file with patches for three commits

1) (eval-when-compiler (require 'subr-x)) is missing

2) We might want to add :version "26.1" into
   `ibuffer-saved-filter' definition.

3) When `ibuffer-old-saved-filters-warning' is shown i miss
   that the buffer displaying it has the key binding
   `TAB' for `forward-button'.
   It might be a smarter way to do this, but i just put the buffer
   in help-mode as follows:

@@ -11,12 +11,15 @@
     (let ((fixed (ibuffer-update-saved-filters-format ibuffer-saved-filters)))
       (prog1
           (setq ibuffer-saved-filters (cdr fixed))
-        (when-let (old-format-detected? (car fixed))
+        (when-let ((old-format-detected? (car fixed))
+                   (buffer-name "*Warnings*"))
+          (with-current-buffer (get-buffer-create buffer-name)
+            (help-mode))
           (let ((warning-series t)
                 (updated-form
                  (with-output-to-string
                    (pp `(setq ibuffer-saved-filters ',ibuffer-saved-filters)))))
             (display-warning
              'ibuffer
-             (format ibuffer-old-saved-filters-warning updated-form))))))))
-
+             (format ibuffer-old-saved-filters-warning updated-form))
+            nil buffer-name))))))

4) [minor comment] It's not very common in Emacs to
call a var `old-format-detected?'.  Adding 'p' instead
of '?' or even not suffix at all looks more usual.

5)
>* lisp/ibuf-ext.el (ibuffer-saved-filters): removed extra
                                             ^^^^^^^
>nesting level in the alist values and updated docstring.
>(ibuffer-save-filters): removed extra level of nesting
                         ^^^^^^^
>in saved filter alist values when saving new filters.
Please, start sentences in capital letters.  Imperative
form verb is prefered than pasive.

removed extra nesting --> Remove extra nesting

Thank you
Tino


reply via email to

[Prev in Thread] Current Thread [Next in Thread]