emacs-diffs
[Top][All Lists]
Advanced

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

master 5a82d4c: prepend newline in sqli buffer


From: Lars Ingebrigtsen
Subject: master 5a82d4c: prepend newline in sqli buffer
Date: Sun, 16 May 2021 10:32:26 -0400 (EDT)

branch: master
commit 5a82d4ce5add6d5eb3c5071537eef950e583e699
Author: Ingo Lohmar <ingo.lohmar@posteo.net>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    prepend newline in sqli buffer
    
    (sql-remove-continuation-prompt, sql-send-string): Move newline
    insertion.
    
    Previously, the preoutput filter `sql-remove-continuation-prompt'
    inserted a leading newline in the interactive SQL buffer if it decided
    that is has to remove continuation prompts and that it had found all
    it was looking for.
    
    1) This filter function was a doubtful place to do that (arguably, its
       name does not suggest any action like this).
    2) The behavior worked inconsistently, eg, when sending a single-line
       "SELECT" statement, because it only ran when the filter function
       needed to remove any prompts (for example, not when sending a
       region without newlines).
    
       This can lead to misaligned table headers, which explains why
       emacswiki and stackoverflow both present several fixes to this
       behavior.
---
 lisp/progmodes/sql.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 65a4094..83cb77e 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -3723,8 +3723,7 @@ to avoid deleting non-prompt output."
 
           ;; If we've found all the expected prompts, stop looking
           (if (= sql-output-newline-count 0)
-              (setq sql-output-newline-count nil
-                    oline (concat "\n" oline))
+              (setq sql-output-newline-count nil)
 
             ;; Still more possible prompts, leave them for the next pass
             (setq sql-preoutput-hold oline
@@ -3769,6 +3768,8 @@ to avoid deleting non-prompt output."
            (with-current-buffer sql-buffer
               (when sql-debug-send
                 (message ">>SQL> %S" s))
+              (insert "\n")
+              (comint-set-process-mark)
 
              ;; Send the string (trim the trailing whitespace)
              (sql-input-sender (get-buffer-process (current-buffer)) s)



reply via email to

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