all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Filipp Gunbin <fgunbin@fastmail.fm>
To: Eli Zaretskii <eliz@gnu.org>
Cc: psainty@orcon.net.nz, 31446@debbugs.gnu.org
Subject: bug#31446: 26.1; sql-interactive-mode buffer naming is broken
Date: Mon, 21 May 2018 02:53:08 +0300	[thread overview]
Message-ID: <m2fu2lq3yz.fsf@fastmail.fm> (raw)
In-Reply-To: <8336yoiuf4.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 18 May 2018 23:24:31 +0300")

On 18/05/2018 23:24 +0300, Eli Zaretskii wrote:

>> From: Filipp Gunbin <fgunbin@fastmail.fm>
>> Cc: psainty@orcon.net.nz,  31446@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.

That looks reasonable, but, as I wrote earlier, why implement
name-choosing logic here, if it's in `sql-comint' already.  Even if some
of such logic was here before the fix, it doesn't necessarily mean that
was right.

>                           ((eq new-name '(4))
>                            (sql-rename-buffer new-name)
>                            sql-alternate-buffer-name)

`sql-alternate-buffer-name' not always matches the effective name set by
`sql-rename-buffer'..

I'll test my suggestion tomorrow and will write about the result, if you
don't mind.

Filipp





  parent reply	other threads:[~2018-05-20 23:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14  5:54 bug#31446: 26.1; sql-interactive-mode buffer naming is broken Phil Sainty
2018-05-18  9:49 ` Eli Zaretskii
2018-05-18 12:19   ` Eli Zaretskii
2018-05-18 15:44     ` Filipp Gunbin
2018-05-18 16:04       ` Eli Zaretskii
2018-05-18 18:03         ` Filipp Gunbin
2018-05-18 20:24           ` Eli Zaretskii
     [not found]             ` <831se6hjnh.fsf@gnu.org>
2018-05-20 22:17               ` Phil Sainty
2018-05-21  2:35                 ` Eli Zaretskii
2018-05-21 12:09                   ` Phil Sainty
2018-05-21 15:45                     ` Eli Zaretskii
2018-05-21 22:08                       ` Phil Sainty
2018-05-22  2:37                         ` Eli Zaretskii
2018-05-22  4:01                           ` Phil Sainty
2018-05-20 23:53             ` Filipp Gunbin [this message]
2018-05-21 14:55               ` Eli Zaretskii
2018-05-22 11:27                 ` Filipp Gunbin
2018-05-22 16:42                   ` Eli Zaretskii
2018-05-22 19:15                     ` Filipp Gunbin
2018-05-23 13:48                       ` Michael Mauger
2018-05-29  7:52                         ` Filipp Gunbin
2018-05-29 14:36                           ` Michael Mauger
2018-05-29 16:49                             ` Eli Zaretskii
2018-05-29 19:48                             ` Filipp Gunbin
2018-05-29 23:32                             ` Phil Sainty
2018-05-30  2:51                               ` Michael Mauger
2018-05-30 16:43                                 ` Eli Zaretskii
2018-06-02 23:47                                   ` Michael Mauger
2018-06-03 16:30                                     ` Eli Zaretskii
2018-06-03 20:47                                       ` Michael Mauger
2018-06-04  2:32                                         ` Eli Zaretskii
2018-06-04 10:16                                     ` Phil Sainty
2018-06-04 17:45                                     ` Filipp Gunbin
2019-04-25  1:13 ` bug#31446: " Michael Mauger

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

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

  git send-email \
    --in-reply-to=m2fu2lq3yz.fsf@fastmail.fm \
    --to=fgunbin@fastmail.fm \
    --cc=31446@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=psainty@orcon.net.nz \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.