GNU bug report logs -
#69420
29.2; iSQL point/process-mark fix
Previous Next
Reported by: Gary Hollis <ghollisjr <at> gmail.com>
Date: Tue, 27 Feb 2024 05:04:01 UTC
Severity: normal
Found in version 29.2
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Date: Mon, 26 Feb 2024 23:56:05 -0500
> From: Gary Hollis <ghollisjr <at> 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?
This bug report was last modified 1 year and 86 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.