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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 21 May 2018 18:45:42 +0300

> Date: Tue, 22 May 2018 00:09:36 +1200
> From: Phil Sainty <[email-masked]>
> Cc: [email-masked], [email-masked], bug-gnu-emacs
>  <bug-gnu-emacs-bounces+psainty=[email-masked]>, "Michael R. Mauger"
>  <[email-masked]>
> 
> (eq new-name '(4)) is never true, so it falls through to
> (format "*SQL: %s*" new-name) when a prefix arg is supplied.

Right, thanks.

> I *think* we'd want (consp new-name) for that test (especially as
> it ought to cover multiple uses of C-u), *however* doing this then
> triggers error "Current buffer is not a SQL interactive buffer" in
> `sql-rename-buffer', as this is happening *before* the call to the
> :sqli-comint-func function which creates the buffer.

Right, so we need to pull the relevant stuff out of that function.

> I've briefly tested Filipp's suggestion, but that seemed to result in
> just *SQL* as a buffer name regardless of the prefix argument, rather
> than causing it to prompt for the name (however that might turn out to
> be sane in conjunction with the additional changes I've made below?)
> 
> The following is working from initial/cursory testing, but it needs
> more testing/confirmation at minimum.

Thanks, I tried fixing it in a slightly different way, please take a
look.  I'd like to avoid releasing Emacs 26.1 with sql.el that was
broken by latest changes.