[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69420: 29.2; iSQL point/process-mark fix
From: |
Michael Mauger |
Subject: |
bug#69420: 29.2; iSQL point/process-mark fix |
Date: |
Sun, 21 Apr 2024 21:33:16 +0000 |
On Saturday, March 9th, 2024 at 3:57 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> Ping! Michael, any comments?
>
Sorry for the delay--the fix looks reasonable. I'm unable to do any real
testing right now, and I don't use the `sql-send-*` myself and have a limited
setup currently.
I'm recovering from cardiac surgery, along with a severe hamstring injury in
Sep '23, which has kept me out of commission for much of the last six months.
I'm slowly crawling out of the hole and hope to be back bt LibrePlanet in early
May.
> > 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?