unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: John Mastro <john.b.mastro@gmail.com>
To: 26317@debbugs.gnu.org
Subject: bug#26317: 26.0.50; Small incompatibility in ibuffer.el (ibuffer-compile-format)
Date: Thu, 30 Mar 2017 16:15:16 -0700	[thread overview]
Message-ID: <CAOj2CQTMwUC0e4cvJp4hxOcrTeUgVCTWPrMMeSFjakLyXtC0ug@mail.gmail.com> (raw)
In-Reply-To: <CAOj2CQRNBnpN+=kwca+_uBy6JNmA70Z8nsrtuXDKPwm-YJpLmg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 759 bytes --]

John Mastro <john.b.mastro@gmail.com> wrote:
> In commit 7e2a8b1, ibuffer.el was change to use `string-width' in a couple
> places where it previously used `length'. The result is that custom columns
> which can return nil, which worked in Emacs 25, will now cause an error.

I've attached a patch that fixes this. Rather than touching the calls to
`string-width' directly, it translates nil to the empty string. Either
way restores compatibility with Emacs 25, but translating nil to the
empty string seems preferable in that it saves later code from caring.

Even though it's a tiny change, I'm not a regular contributor or
particularly familiar with ibuffer's implementation, so any review is
appreciated. My copyright assignment is on file.

        John

[-- Attachment #2: 0001-Fix-a-small-incompatibility-in-ibuffer.patch --]
[-- Type: application/octet-stream, Size: 1038 bytes --]

From 81c03b3f37274ef2247903467ccbb7c8970ff976 Mon Sep 17 00:00:00 2001
From: John Mastro <john.b.mastro@gmail.com>
Date: Thu, 30 Mar 2017 16:01:41 -0700
Subject: [PATCH] Fix a small incompatibility in ibuffer

Translate nil values from column functions to the empty string, so that
subsequent calls to string-width don't signal an error (Bug#26317).
* lisp/ibuffer.el (ibuffer-compile-format): If a column function returns
nil, treat it like the empty string.
---
 lisp/ibuffer.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 66916b2..c83c213 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1689,7 +1689,7 @@ ibuffer-compile-format
 		    ;; generate a call to the column function.
 		    (ibuffer-aif (assq sym ibuffer-inline-columns)
 			(nth 1 it)
-		      `(,sym buffer mark)))
+		      `(or (,sym buffer mark) "")))
 		   ;; You're not expected to understand this.  Hell, I
 		   ;; don't even understand it, and I wrote it five
 		   ;; minutes ago.
-- 
2.10.2


  reply	other threads:[~2017-03-30 23:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 23:07 bug#26317: 26.0.50; Small incompatibility in ibuffer.el (ibuffer-compile-format) John Mastro
2017-03-30 23:15 ` John Mastro [this message]
2017-03-31  0:25   ` Mark Oteiza

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=CAOj2CQTMwUC0e4cvJp4hxOcrTeUgVCTWPrMMeSFjakLyXtC0ug@mail.gmail.com \
    --to=john.b.mastro@gmail.com \
    --cc=26317@debbugs.gnu.org \
    /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).