unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 25049@debbugs.gnu.org
Cc: Christopher Genovese <genovese@cmu.edu>, tino.calancha@gmail.com
Subject: bug#25049: ibuffer bug when saving existing filter, with patches
Date: Wed, 30 Nov 2016 00:06:43 +0900	[thread overview]
Message-ID: <8737ianx4s.fsf@gmail.com> (raw)
In-Reply-To: <CAPum5FgXgmY32=zxWcCd9dscFvfjRRThXFCk3iM8aaA5+WgzZA@mail.gmail.com> (Christopher Genovese's message of "Mon, 28 Nov 2016 01:54:39 -0500")

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	other threads:[~2016-11-29 15:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-28  6:54 bug#25049: ibuffer bug when saving existing filter, with patches Christopher Genovese
2016-11-29 15:06 ` Tino Calancha [this message]
2016-11-29 16:09   ` Christopher Genovese
2016-11-29 23:49     ` Tino Calancha
2016-11-30  5:14       ` Christopher Genovese
2016-11-30  7:02         ` Tino Calancha
2016-11-30 14:07           ` npostavs
2016-11-30 15:03             ` Tino Calancha
2016-11-30 15:11               ` Tino Calancha
2016-11-30 16:31                 ` Christopher Genovese
2016-12-01  2:52                   ` Tino Calancha
2016-12-07 10:56           ` Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737ianx4s.fsf@gmail.com \
    --to=tino.calancha@gmail.com \
    --cc=25049@debbugs.gnu.org \
    --cc=genovese@cmu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).