all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Mauger via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: ghollisjr@gmail.com, michael@mauger.com, 69420@debbugs.gnu.org
Subject: bug#69420: 29.2; iSQL point/process-mark fix
Date: Sun, 21 Apr 2024 21:33:16 +0000	[thread overview]
Message-ID: <JlL4q_VY4eAPjikV2Lq6XaCFr42uqj6t8KqT-kl50nf5Vy9gpwEcgzzgn4mmxwGfcfYWqkE0-WcpqMeYJxSnufTdOHCN0ENteicV5KUTk-o=@protonmail.com> (raw)
In-Reply-To: <86le6rye7v.fsf@gnu.org>

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?





  parent reply	other threads:[~2024-04-21 21:33 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
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 [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='JlL4q_VY4eAPjikV2Lq6XaCFr42uqj6t8KqT-kl50nf5Vy9gpwEcgzzgn4mmxwGfcfYWqkE0-WcpqMeYJxSnufTdOHCN0ENteicV5KUTk-o=@protonmail.com' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=69420@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=ghollisjr@gmail.com \
    --cc=michael@mauger.com \
    --cc=mmauger@protonmail.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.