[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69420: 29.2; iSQL point/process-mark fix
From: |
Eli Zaretskii |
Subject: |
bug#69420: 29.2; iSQL point/process-mark fix |
Date: |
Sat, 09 Mar 2024 10:57:40 +0200 |
Ping! Michael, any comments?
> Cc: 69420@debbugs.gnu.org
> Date: Tue, 27 Feb 2024 10:13:26 +0200
> From: Eli Zaretskii <eliz@gnu.org>
>
> > Date: Mon, 26 Feb 2024 23:56:05 -0500
> > From: Gary Hollis <ghollisjr@gmail.com>
> >
> > When the point is not at the very end of the iSQL buffer, the
> > process-mark is not kept in a reasonable state if sql-send-string is
> > called.
> >
> > Example to reproduce bug:
> > 1. Open a sql-mode buffer.
> > 2. Connect to a SQL database of choice.
> > 3. Move the point of the iSQL buffer to the top, e.g. with M-<
> > 4. Send good queries via sql-send-string, sql-send-region etc.
> > 5. In iSQL buffer, move point to end, e.g. with M->
> > 6. Enter a good query.
> >
> > Expected result: The new query successfully sends and sql process
> > returns output.
> > Actual result: Whatever contents had been output from the
> > sql-send-string, sql-send-region etc. will be sent along with the new query.
> >
> > To fix: a call to (end-of-buffer) can be placed within the
> > (save-excursion ...) context before sending any input in the
> > sql-send-string function, e.g.
> >
> > ;; from sql.el with fix for bug added with BUG FIX comment:
> > (defun sql-send-string (str)
> > "Send the string STR to the SQL process."
> > (interactive "sSQL Text: ")
> >
> > (let ((comint-input-sender-no-newline nil)
> > (s (replace-regexp-in-string "[[:space:]\n\r]+\\'" "" str)))
> > (if (sql-buffer-live-p sql-buffer)
> > (progn
> > ;; Ignore the hoping around...
> > (save-excursion
> > ;; Set product context
> > (with-current-buffer sql-buffer
> > (end-of-buffer) ; BUG FIX: correct point before sending input
> > (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)
> >
> > ;; Send a command terminator if we must
> > (sql-send-magic-terminator sql-buffer s sql-send-terminator)
> >
> > (when sql-pop-to-buffer-after-send-region
> > (message "Sent string to buffer %s" sql-buffer))))
> >
> > ;; Display the sql buffer
> > (sql-display-buffer sql-buffer))
> >
> > ;; We don't have no stinkin' sql
> > (user-error "No SQL process started"))))
> >
>
> Thanks.
>
> Michael, any comments or suggestions?
>
>
>
>
- bug#69420: 29.2; iSQL point/process-mark fix,
Eli Zaretskii <=