[Top][All Lists]

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

bug#31446: 26.1; sql-interactive-mode buffer naming is broken

From: Eli Zaretskii
Subject: bug#31446: 26.1; sql-interactive-mode buffer naming is broken
Date: Fri, 18 May 2018 23:24:31 +0300

> From: Filipp Gunbin <address@hidden>
> Cc: address@hidden,  address@hidden
> 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

The original code was

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

This is now
                          ((zerop new-name)
                          ((stringp new-name)
                           (if (string-prefix-p "SQL" new-name t)
                             (concat "*SQL: " new-name "*")))
                          ((eq new-name '(4))
                           (sql-rename-buffer new-name)
                           (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.

reply via email to

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