emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117842: (sql-show-sqli-buffer): Display the buffer


From: Sam Steingold
Subject: [Emacs-diffs] trunk r117842: (sql-show-sqli-buffer): Display the buffer instead of its name
Date: Mon, 08 Sep 2014 12:31:59 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117842
revision-id: address@hidden
parent: address@hidden
committer: Sam Steingold <address@hidden>
branch nick: trunk
timestamp: Mon 2014-09-08 08:31:54 -0400
message:
  (sql-show-sqli-buffer): Display the buffer instead of its name
  
  and bind the command to C-c C-z.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/sql.el          sql.el-20091113204419-o5vbwnq5f7feedwu-1303
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-08 12:27:19 +0000
+++ b/lisp/ChangeLog    2014-09-08 12:31:54 +0000
@@ -2,6 +2,8 @@
 
        * progmodes/sql.el (sql-send-line-and-next): New command,
        bound to C-c C-n.
+       (sql-show-sqli-buffer): Display the buffer instead of its name and
+       bind the command to C-c C-z.
 
 2014-09-08  Glenn Morris  <address@hidden>
 

=== modified file 'lisp/progmodes/sql.el'
--- a/lisp/progmodes/sql.el     2014-09-08 12:27:19 +0000
+++ b/lisp/progmodes/sql.el     2014-09-08 12:31:54 +0000
@@ -1223,6 +1223,7 @@
     (define-key map (kbd "C-c C-b") 'sql-send-buffer)
     (define-key map (kbd "C-c C-n") 'sql-send-line-and-next)
     (define-key map (kbd "C-c C-i") 'sql-product-interactive)
+    (define-key map (kbd "C-c C-z") 'sql-show-sqli-buffer)
     (define-key map (kbd "C-c C-l a") 'sql-list-all)
     (define-key map (kbd "C-c C-l t") 'sql-list-table)
     (define-key map [remap beginning-of-defun] 'sql-beginning-of-statement)
@@ -3060,17 +3061,18 @@
             (run-hooks 'sql-set-sqli-hook)))))))
 
 (defun sql-show-sqli-buffer ()
-  "Show the name of current SQLi buffer.
+  "Display the current SQLi buffer.
 
-This is the buffer SQL strings are sent to.  It is stored in the
-variable `sql-buffer'.  See `sql-help' on how to create such a buffer."
+This is the buffer SQL strings are sent to.
+It is stored in the variable `sql-buffer'.
+I
+See also `sql-help' on how to create such a buffer."
   (interactive)
-  (if (or (null sql-buffer)
-          (null (buffer-live-p (get-buffer sql-buffer))))
-      (user-error "%s has no SQLi buffer set" (buffer-name (current-buffer)))
-    (if (null (get-buffer-process sql-buffer))
-       (user-error "Buffer %s has no process" sql-buffer)
-      (user-error "Current SQLi buffer is %s" sql-buffer))))
+  (unless (and sql-buffer (buffer-live-p (get-buffer sql-buffer)))
+    (sql-set-sqli-buffer))
+  (unless (get-buffer-process sql-buffer)
+    (user-error "Buffer %s has no process" sql-buffer))
+  (display-buffer sql-buffer))
 
 (defun sql-make-alternate-buffer-name ()
   "Return a string that can be used to rename a SQLi buffer.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]