Subject: bug#55088: 29.0.50; sql-buffer global value does not get set

From: Aaron Jensen <[email-masked]>
Date: Sat, 23 Apr 2022 23:47:56 -0400

M-x sql-postgres ; (or whatever)
Switch to scratch buffer
M-x sql-mode
C-c C-b

Expected: Send current buffer to postgres sqli
Actual: No SQL process started error

The docs of `sql-buffer' state: "The global value of sql-buffer is the name of the latest SQLi buffer
created."

I do not see any code that would do that. The only thing that sets it
upon creating a new interactive buffer is dependent upon that command
being run from an existing sql-mode buffer.

There is a `sql-set-sqli-buffer-generally' command, but it is not
invoked as far as I can tell.

In GNU Emacs 29.0.50 (build 1, aarch64-apple-darwin21.4.0, NS appkit-2113.40 Version 12.3.1 (Build 21E258))
 of 2022-04-20 built on aaron-m1.local
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.3.1

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
 --infodir=/opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/info/emacs
 --prefix=/opt/homebrew/Cellar/emacs-plus@29/29.0.50 --with-xml2
 --with-gnutls --with-native-compilation --without-dbus
 --without-imagemagick --with-modules --with-rsvg --with-ns
 --disable-ns-self-contained 'CFLAGS=-I/opt/homebrew/opt/gcc/include
 -I/opt/homebrew/opt/libgccjit/include -I/opt/homebrew/opt/gmp/include
 -I/opt/homebrew/opt/jpeg/include' 'LDFLAGS=-L/opt/homebrew/lib/gcc/11
 -I/opt/homebrew/opt/gcc/include -I/opt/homebrew/opt/libgccjit/include
 -I/opt/homebrew/opt/gmp/include -I/opt/homebrew/opt/jpeg/include''

Configured features:
ACL GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS XIM ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  global-flycheck-mode: t
  flycheck-mode: t
  pdf-occur-global-minor-mode: t
  company-posframe-mode: t
  company-prescient-mode: t
  company-tng-mode: t
  company-mode: t
  eval-sexp-fu-flash-mode: t
  eros-mode: t
  lispyville-mode: t
  lispy-mode: t
  elisp-def-mode: t
  sotlisp-mode: t
  speed-of-thought-mode: t
  org-roam-db-autosync-mode: t
  global-anzu-mode: t
  anzu-mode: t
  electric-pair-mode: t
  form-feed-mode: t
  dtrt-indent-mode: t
  evil-vimish-fold-mode: t
  vimish-fold-mode: t
  global-git-commit-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  transient-posframe-mode: t
  which-key-posframe-mode: t
  which-key-mode: t
  winner-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  global-auto-revert-mode: t
  recentf-mode: t
  better-jumper-mode: t
  better-jumper-local-mode: t
  repeat-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-evil-collection-unimpaired-mode: t
  evil-collection-unimpaired-mode: t
  global-evil-mc-mode: t
  evil-mc-mode: t
  evil-snipe-override-mode: t
  evil-snipe-mode: t
  evil-snipe-override-local-mode: t
  evil-snipe-local-mode: t
  global-evil-matchit-mode: t
  evil-matchit-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  shell-dirtrack-mode: t
  evil-mode: t
  evil-local-mode: t
  windmove-mode: t
  gcmh-mode: t
  mini-frame-mode: t
  vertico-mouse-mode: t
  vertico-mode: t
  prescient-persist-mode: t
  +popup-mode: t
  ws-butler-global-mode: t
  ws-butler-mode: t
  global-so-long-mode: t
  save-place-mode: t
  ns-auto-titlebar-mode: t
  nano-modeline-mode: t
  envrc-global-mode: t
  envrc-mode: t
  leader-key-leader-override-mode: t
  global-leader-key-leader-override-mode: t
  delete-selection-mode: t
  savehist-mode: t
  pixel-scroll-precision-mode: t
  xterm-mouse-mode: t
  override-global-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  window-divider-mode: t
  line-number-mode: t
  auto-fill-function: yas--auto-fill
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t