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: Tino Calancha
Subject: bug#25049: ibuffer bug when saving existing filter, with patches
Date: Wed, 30 Nov 2016 00:06:43 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

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]