unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
To: 19452@debbugs.gnu.org
Subject: bug#19452: 24.4; sql-connect fails in first invocation: "Attempt to set a constant symbol: nil"
Date: Mon, 25 Jul 2016 23:12:47 +0300	[thread overview]
Message-ID: <c295b183-8ca9-60ad-ae07-77555dc45d15@gmail.com> (raw)
In-Reply-To: <CANYPdHB2F2MEfcwyZOY2K2gZWJ89YgEVmZhkDCf4xFgPwiX6Cw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

Ok, this bug has been bugging me long enough.

What happens is that there's a dynamic let block that looks like this:

(eval `(let ((,param-var ',rem-params))
                          (sql-product-interactive ',sql-product 
',new-name))))

Here's the code that sets param-var:

(setq param-var
           (sql-get-product-feature sql-product :sqli-login nil t))

It uses global variable sql-product. The default sql-product is ansi and 
running the above for it results in nil. Running "(let ((nil ..." leads 
to this error. In the same function there is a block that sets it to a 
proper value based on the current connection, but it is executed after 
param-var is already set. That's why the second time works.


I've attached a simple patch that just reorders code within sql-connect.

-- 
Best Regards,
Nikolay Kudryavtsev


[-- Attachment #2: 19452.patch --]
[-- Type: text/plain, Size: 1386 bytes --]

diff --git lisp/progmodes/sql.el lisp/progmodes/sql.el
index fd59f46..a6e7ec4 100644
--- lisp/progmodes/sql.el
+++ lisp/progmodes/sql.el
@@ -4040,6 +4040,12 @@ sql-connect
           (if connect-set
               ;; Set the desired parameters
               (let (param-var login-params set-params rem-params)
+                ;; Set the parameters and start the interactive session
+                (mapc
+                 #'(lambda (vv)
+                     (set-default (car vv) (eval (cadr vv))))
+                 (cdr connect-set))
+                (setq-default sql-connection connection)

                 ;; :sqli-login params variable
                 (setq param-var
@@ -4069,13 +4075,6 @@ sql-connect
                            (unless (member token set-params)
                              (if plist (cons token plist) token)))))

-                ;; Set the parameters and start the interactive session
-                (mapc
-                 #'(lambda (vv)
-                     (set-default (car vv) (eval (cadr vv))))
-                 (cdr connect-set))
-                (setq-default sql-connection connection)
-
                 ;; Start the SQLi session with revised list of login parameters
                 (eval `(let ((,param-var ',rem-params))
                          (sql-product-interactive ',sql-product ',new-name))))

  reply	other threads:[~2016-07-25 20:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-27  6:45 bug#19452: 24.4; sql-connect fails in first invocation: "Attempt to set a constant symbol: nil" JuanLeon Lahoz
2016-07-25 20:12 ` Nikolay Kudryavtsev [this message]
2016-07-25 20:56   ` Nicolas Petton
2016-07-26 13:19     ` Nikolay Kudryavtsev
2016-07-26 15:11       ` Nicolas Petton
2016-07-26 15:38         ` Eli Zaretskii
2016-07-26 16:41           ` Nicolas Petton
2016-07-31 12:50         ` Nikolay Kudryavtsev
2016-11-29 21:01 ` bug#19452: status? root
2016-12-02  9:55   ` Eli Zaretskii
2016-12-13 11:06     ` root

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=c295b183-8ca9-60ad-ae07-77555dc45d15@gmail.com \
    --to=nikolay.kudryavtsev@gmail.com \
    --cc=19452@debbugs.gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).