GNU bug report logs - #31446
26.1; sql-interactive-mode buffer naming is broken

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Mon, 14 May 2018 05:56:02 UTC

Severity: normal

Found in version 26.1

Done: Michael Mauger <mmauger <at> protonmail.com>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 31446 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Filipp Gunbin <fgunbin <at> fastmail.fm>
Cc: psainty <at> orcon.net.nz, 31446 <at> debbugs.gnu.org
Subject: Re: bug#31446: 26.1; sql-interactive-mode buffer naming is broken
Date: Fri, 18 May 2018 23:24:31 +0300
> From: Filipp Gunbin <fgunbin <at> fastmail.fm>
> Cc: psainty <at> orcon.net.nz,  31446 <at> debbugs.gnu.org
> Date: Fri, 18 May 2018 21:03:00 +0300
> 
> Your patch, while it may have fixed the bug, introduces some logic on
> setting buffer name - so we could get undesired behaviour change.

AFAIK, the logic was already there, I just fixed it to behave more
reasonably.

The original code was

                         (if (and new-name (string-prefix-p "SQL" new-name t))
                             new-name
                           (concat "SQL: " new-name))))

This is now
                         (cond
                          ((zerop new-name)
                           "*SQL*")
                          ((stringp new-name)
                           (if (string-prefix-p "SQL" new-name t)
                               new-name
                             (concat "*SQL: " new-name "*")))
                          ((eq new-name '(4))
                           (sql-rename-buffer new-name)
                           sql-alternate-buffer-name)
                          (t
                           (format "*SQL: %s*" new-name)))))

which (a) avoids concatenating a string and a list '(4); (b) avoids
calling string-prefix-p with 2nd arg not a string, something that
works only by sheer luck; (c) calls sql-rename-buffer to choose the
buffer name, because that function implements the logic of naming the
buffer, and duplicating that sounds redundant; (d) does something
reasonable when new-name is neither a string nor a prefix arg nor nil.

And that is the only thing that I changed.




This bug report was last modified 6 years and 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.