bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18240: sql-postgres does not prompt for password


From: Michael Mauger
Subject: bug#18240: sql-postgres does not prompt for password
Date: Fri, 31 Oct 2014 20:37:30 +0000 (UTC)

I apologize for the delay,I've been off-line for a bit.  I was aware of the failure in some edge cases and I think I have a solution.  I've attached an elisp file that you should be able to require once sql.el has been loaded that overrides the function as it appears in sql.el.

Please give it a try and see if it corrects the behavior you see.

Thanks

Michael


On Monday, September 22, 2014 4:10 AM, Matthew Smiglarski <matthew.smiglarski@gmail.com> wrote:


This bug does not happen on the 24.3 release but does happen on 24.3.93.

The problem is with sql-interactive-remove-continuation-prompt, one of
the functions configured to be called by comint-output-filter.

It is caused by code introduced by this git revision.

commit 34499a8eb3c10db8c79a7aa87e1bbce0ae499fb6
Author: Michael Mauger <mmaug@yahoo.com>
Date:  Tue Jul 23 20:25:53 2013 -0400

One workaround is to type the password in anyway. Another workaround
is to remove some of the code with the following patch:

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 13d4178..2fd755d 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -3337,18 +3337,7 @@ to avoid deleting non-prompt output."
        (unless prompt-found
          (setq sql-output-newline-count nil
                oline (concat oline sql-preoutput-hold)
-                sql-preoutput-hold ""))
-
-        ;; Break up output by physical lines if we haven't hit the final prompt
-        (unless (and (not (string= oline ""))
-                    (string-match (sql-ends-with-prompt-re) oline)
-                    (>= (match-end 0) (length oline)))
-          (setq last-nl 0)
-          (while (string-match "\n" oline last-nl)
-            (setq last-nl (match-end 0)))
-          (setq sql-preoutput-hold (concat (substring oline last-nl)
-                                          sql-preoutput-hold)
-                oline (substring oline 0 last-nl))))))
+                sql-preoutput-hold "")))))
    oline)

This sql-interactive-remove-continuation-prompt function removes
continuation prompt (the prompt sent when halfway through a command)
and this improves the usability of multi-line SQL statements on the
interpreter.

There is another small bug with that code where the continuation line
sneaks through, throwing the alignment out.

By this, I mean the "template1->" prompt in the following examples:

template1=> select 42;
?column?
----------
      42
(1 row)

template1=> select
42;
template1->  ?column?
----------
      42
(1 row)

template1=> select
42,
43;
template1->  ?column? | ?column?
----------+----------
      42 |      43
(1 row)

That happens because of the following lines:

        ;; Add this text to what's left from the last pass
        (setq oline (concat sql-preoutput-hold oline)
              sql-preoutput-hold "")

I hope this helps.


Attachment: sql-interactive-remove-continuation-prompt.el
Description: Binary data


reply via email to

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