unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#3175: 23.0.92; [PATCH] Improve SQL-mode UX
@ 2009-05-01  1:58 Ian Eure
  2012-04-11 12:52 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Eure @ 2009-05-01  1:58 UTC (permalink / raw)
  To: emacs-pretest-bug

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

The user experience when using sql-mode is somewhat lacking. In  
particular, the behaviors when using a SQLi buffer could be more  
helpful.

The attached patch:
  - Adds a default binding (C-c C-t) to sql-set-sqli-buffer
  - Directs the user to the function if they attempt to call sql-send- 
* with an unusable sql-buffer.
  - Updates sql-help to mention sql-set-sqli-buffer.


[-- Attachment #2: sql-ux.diff --]
[-- Type: application/octet-stream, Size: 3910 bytes --]

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index da0794b..ab2b884 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -771,6 +771,7 @@ Based on `comint-mode-map'.")
 
 (defvar sql-mode-map
   (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-c C-t") 'sql-set-sqli-buffer)
     (define-key map (kbd "C-c C-c") 'sql-send-paragraph)
     (define-key map (kbd "C-c C-r") 'sql-send-region)
     (define-key map (kbd "C-c C-s") 'sql-send-string)
@@ -1917,7 +1918,9 @@ anything.  The name of the major mode is SQL.
 
 In this SQL buffer (SQL mode), you can send the region or the entire
 buffer to the interactive SQL buffer (SQLi mode).  The results are
-appended to the SQLi buffer without disturbing your SQL buffer."
+appended to the SQLi buffer without disturbing your SQL buffer.
+
+You may change the SQLi buffer by calling \\[sql-set-sqli-buffer]."
   (interactive)
   (describe-function 'sql-help))
 
@@ -2148,7 +2151,10 @@ Every newline in STRING will be preceded with a space and a backslash."
 ;;; Sending the region to the SQLi buffer.
 
 (defun sql-send-region (start end)
-  "Send a region to the SQL process."
+  "Send a region to the SQL process.
+
+The region is sent to the process in the buffer referred to in
+`sql-buffer', and may be changed with \\[sql-set-sqli-buffer]."
   (interactive "r")
   (if (buffer-live-p sql-buffer)
       (save-excursion
@@ -2160,10 +2166,14 @@ Every newline in STRING will be preceded with a space and a backslash."
 	(if sql-pop-to-buffer-after-send-region
 	    (pop-to-buffer sql-buffer)
 	  (display-buffer sql-buffer)))
-    (message "No SQL process started.")))
+    (message (substitute-command-keys
+              "No SQL process started. Try \\[sql-set-sqli-buffer]."))))
 
 (defun sql-send-paragraph ()
-  "Send the current paragraph to the SQL process."
+  "Send the current paragraph to the SQL process.
+
+The paragraph is sent to the process in the buffer referred to in
+`sql-buffer', and may be changed with \\[sql-set-sqli-buffer]."
   (interactive)
   (let ((start (save-excursion
 		 (backward-paragraph)
@@ -2174,12 +2184,18 @@ Every newline in STRING will be preceded with a space and a backslash."
     (sql-send-region start end)))
 
 (defun sql-send-buffer ()
-  "Send the buffer contents to the SQL process."
+  "Send the buffer contents to the SQL process.
+
+The buffer is sent to the process in the buffer referred to in
+`sql-buffer', and may be changed with \\[sql-set-sqli-buffer]."
   (interactive)
   (sql-send-region (point-min) (point-max)))
 
 (defun sql-send-string (str)
-  "Send a string to the SQL process."
+  "Send a string to the SQL process.
+
+The string is sent to the process in the buffer referred to in
+`sql-buffer', and may be changed with \\[sql-set-sqli-buffer]."
   (interactive "sSQL Text: ")
   (if (buffer-live-p sql-buffer)
       (save-excursion
@@ -2189,7 +2205,8 @@ Every newline in STRING will be preceded with a space and a backslash."
         (if sql-pop-to-buffer-after-send-region
             (pop-to-buffer sql-buffer)
           (display-buffer sql-buffer)))
-    (message "No SQL process started.")))
+    (message (substitute-command-keys
+              "No SQL process started. Try \\[sql-set-sqli-buffer]."))))
 
 (defun sql-toggle-pop-to-buffer-after-send-region (&optional value)
   "Toggle `sql-pop-to-buffer-after-send-region'.
@@ -2266,6 +2283,8 @@ you must tell Emacs.  Here's how to do that in your `~/.emacs' file:
   (run-mode-hooks 'sql-mode-hook)
   ;; Catch changes to sql-product and highlight accordingly
   (sql-highlight-product)
+  (setq mode-line-process '((:eval (when sql-buffer
+                                     (concat " > " (buffer-name sql-buffer))))))
   (add-hook 'hack-local-variables-hook 'sql-highlight-product t t))
 
 \f

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#3175: 23.0.92; [PATCH] Improve SQL-mode UX
  2009-05-01  1:58 bug#3175: 23.0.92; [PATCH] Improve SQL-mode UX Ian Eure
@ 2012-04-11 12:52 ` Lars Magne Ingebrigtsen
  2012-04-12  2:29   ` Michael Mauger
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-04-11 12:52 UTC (permalink / raw)
  To: Ian Eure; +Cc: Michael R. Mauger, 3175

Ian Eure <ian@digg.com> writes:

> The user experience when using sql-mode is somewhat lacking. In
> particular, the behaviors when using a SQLi buffer could be more
> helpful.
>
> The attached patch:
>  - Adds a default binding (C-c C-t) to sql-set-sqli-buffer
>  - Directs the user to the function if they attempt to call sql-send- 
> * with an unusable sql-buffer.
>  - Updates sql-help to mention sql-set-sqli-buffer.

This looks reasonable to me.  Michael?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#3175: 23.0.92; [PATCH] Improve SQL-mode UX
  2012-04-11 12:52 ` Lars Magne Ingebrigtsen
@ 2012-04-12  2:29   ` Michael Mauger
  2016-02-29  3:43     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Mauger @ 2012-04-12  2:29 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen, Ian Eure; +Cc: 3175@debbugs.gnu.org

> From: Lars Magne Ingebrigtsen <larsi@gnus.org>
>To: Ian Eure <ian@digg.com> 
>Cc: 3175@debbugs.gnu.org; Michael R. Mauger <mmaug@yahoo.com> 
>Sent: Wednesday, April 11, 2012 8:52 AM
>Subject: Re: bug#3175: 23.0.92; [PATCH] Improve SQL-mode UX
> 
>Ian Eure <ian@digg.com> writes:
>
>> The user experience when using sql-mode is somewhat lacking. In
>> particular, the behaviors when using a SQLi buffer could be more
>> helpful.
>>
>> The attached patch:
>>  - Adds a default binding (C-c C-t) to sql-set-sqli-buffer
>>  - Directs the user to the function if they attempt to call sql-send- 
>> * with an unusable sql-buffer.
>>  - Updates sql-help to mention sql-set-sqli-buffer.
>
>This looks reasonable to me.  Michael?
>


I want to hesitate on this one a little.  I've significantly rewritten sql.el to
properly handle login parameters and sql-buffer.  I would suggest waiting
for Emacs 24.1 (or grab the version of sql.el from 24.1) and try it out.

I had encountered some issues with sql-buffer not being set properly before
but I believe I've corrected the issue.  I haven't had the problem in quite a while
and I often have multiple sql interactive sessions active.  

I would be interested in understanding the sequence of user actions that is 
leading to a problem.  My own interaction doesn't lead to an issue, but I'd be
intrigued by other hackers approach.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#3175: 23.0.92; [PATCH] Improve SQL-mode UX
  2012-04-12  2:29   ` Michael Mauger
@ 2016-02-29  3:43     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-29  3:43 UTC (permalink / raw)
  To: Michael Mauger; +Cc: Ian Eure, 3175

Michael Mauger <michael@mauger.com> writes:

> I want to hesitate on this one a little.  I've significantly rewritten sql.el to
> properly handle login parameters and sql-buffer.  I would suggest waiting
> for Emacs 24.1 (or grab the version of sql.el from 24.1) and try it out.

Ok; closing.  If this is still a problem in the current Emacs, please
reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-29  3:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-01  1:58 bug#3175: 23.0.92; [PATCH] Improve SQL-mode UX Ian Eure
2012-04-11 12:52 ` Lars Magne Ingebrigtsen
2012-04-12  2:29   ` Michael Mauger
2016-02-29  3:43     ` Lars Ingebrigtsen

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).