all messages for Emacs-related lists mirrored at yhetil.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

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