From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69420: 29.2; iSQL point/process-mark fix Date: Tue, 27 Feb 2024 10:13:26 +0200 Message-ID: <864jduuxy1.fsf@gnu.org> References: <2110e7d1-153c-412a-a0dc-37531a0b6d84@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15964"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69420@debbugs.gnu.org To: Gary Hollis , Michael Mauger Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 27 09:15:05 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rescD-0003zx-Co for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Feb 2024 09:15:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1resbl-0004if-HF; Tue, 27 Feb 2024 03:14:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1resbk-0004iU-Pa for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2024 03:14:36 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1resbk-0001Ay-HS for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2024 03:14:36 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1resc9-0007iy-Rv for bug-gnu-emacs@gnu.org; Tue, 27 Feb 2024 03:15:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Feb 2024 08:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69420 X-GNU-PR-Package: emacs Original-Received: via spool by 69420-submit@debbugs.gnu.org id=B69420.170902165329541 (code B ref 69420); Tue, 27 Feb 2024 08:15:01 +0000 Original-Received: (at 69420) by debbugs.gnu.org; 27 Feb 2024 08:14:13 +0000 Original-Received: from localhost ([127.0.0.1]:60745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1resbM-0007gK-4x for submit@debbugs.gnu.org; Tue, 27 Feb 2024 03:14:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1resbK-0007g5-ST for 69420@debbugs.gnu.org; Tue, 27 Feb 2024 03:14:11 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1resao-00010W-Ks; Tue, 27 Feb 2024 03:13:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=3NAMIJeUq7kvJ1M+SIbU27IEBSLbA5w0f6BHs58ymRE=; b=qqS6DpSpjE7LUuUBJf6m 4mKjauJJ6jkgRf0/dS877dRhhQISKydKK8g2QG2m94Uko3Fh0+Mu78sZl3AmQRkm4OdJP02+GpN5j xLqllB0Ew1XXD3eLweMADWAjbee/ID3MdFdWqhqB0faXMsQ4DlxCwXs07UM6TYoQUryAR7T8F983i GsfqJjhkXBWi8HEynuGX+ifGhuYnVtpKtLP7HVj2E8Dr47FrtP4M835K98cvgbQK9V6mrYk2iFc7a H3ta+ajAfOgbBohdXHIpdMuLdrM6WQwyTuw4yoEsizzWiYX3geCgI6xM3Bql3SglPV21Tx35uIvqg qGPEawojLbJLlg==; In-Reply-To: <2110e7d1-153c-412a-a0dc-37531a0b6d84@gmail.com> (message from Gary Hollis on Mon, 26 Feb 2024 23:56:05 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280718 Archived-At: > Date: Mon, 26 Feb 2024 23:56:05 -0500 > From: Gary Hollis > > 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?