From: Eli Zaretskii <eliz@gnu.org>
To: Gary Hollis <ghollisjr@gmail.com>, Michael Mauger <michael@mauger.com>
Cc: 69420@debbugs.gnu.org
Subject: bug#69420: 29.2; iSQL point/process-mark fix
Date: Tue, 27 Feb 2024 10:13:26 +0200 [thread overview]
Message-ID: <864jduuxy1.fsf@gnu.org> (raw)
In-Reply-To: <2110e7d1-153c-412a-a0dc-37531a0b6d84@gmail.com> (message from Gary Hollis on Mon, 26 Feb 2024 23:56:05 -0500)
> 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?
next prev parent reply other threads:[~2024-02-27 8:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 4:56 bug#69420: 29.2; iSQL point/process-mark fix Gary Hollis
2024-02-27 8:13 ` Eli Zaretskii [this message]
2024-03-09 8:57 ` Eli Zaretskii
2024-03-21 8:34 ` Eli Zaretskii
2024-04-06 8:55 ` Eli Zaretskii
2024-04-18 8:56 ` Eli Zaretskii
2024-04-21 21:33 ` Michael Mauger via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 5:40 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=864jduuxy1.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=69420@debbugs.gnu.org \
--cc=ghollisjr@gmail.com \
--cc=michael@mauger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).