From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Eure Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#3175: 23.0.92; [PATCH] Improve SQL-mode UX Date: Thu, 30 Apr 2009 18:58:19 -0700 Message-ID: Reply-To: Ian Eure , 3175@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: multipart/mixed; boundary=Apple-Mail-1-842894919 X-Trace: ger.gmane.org 1241143935 19498 80.91.229.12 (1 May 2009 02:12:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 May 2009 02:12:15 +0000 (UTC) To: emacs-pretest-bug@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 01 04:12:05 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LziEO-0007NB-S6 for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 May 2009 04:12:05 +0200 Original-Received: from localhost ([127.0.0.1]:44545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LziEN-0007yZ-HJ for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Apr 2009 22:12:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LziEJ-0007yR-UW for bug-gnu-emacs@gnu.org; Thu, 30 Apr 2009 22:11:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LziEE-0007y6-R0 for bug-gnu-emacs@gnu.org; Thu, 30 Apr 2009 22:11:59 -0400 Original-Received: from [199.232.76.173] (port=59294 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LziEE-0007y3-LQ for bug-gnu-emacs@gnu.org; Thu, 30 Apr 2009 22:11:54 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43365) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LziED-0002Ac-TQ for bug-gnu-emacs@gnu.org; Thu, 30 Apr 2009 22:11:54 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n412Bp7u020883; Thu, 30 Apr 2009 19:11:52 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n41257ds018440; Thu, 30 Apr 2009 19:05:07 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Ian Eure Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 01 May 2009 02:05:06 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 3175 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.124114312016279 (code B ref -1); Fri, 01 May 2009 02:05:06 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 1 May 2009 01:58:40 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n411waDP016271 for ; Thu, 30 Apr 2009 18:58:37 -0700 Original-Received: from mail.gnu.org ([199.232.76.166]:58524 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1Lzi1L-0003SJ-J3 for emacs-pretest-bug@gnu.org; Thu, 30 Apr 2009 21:58:35 -0400 Original-Received: from mail.digg.com ([64.191.203.36]:40741) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lzi1K-0006nq-WC for emacs-pretest-bug@gnu.org; Thu, 30 Apr 2009 21:58:35 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.digg.com (Postfix) with ESMTP id 78677A8507B for ; Thu, 30 Apr 2009 18:58:33 -0700 (PDT) X-Virus-Scanned: amavisd-new at Original-Received: from mail.digg.com ([127.0.0.1]) by localhost (mail.digg.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id puUyPbibALTt for ; Thu, 30 Apr 2009 18:58:27 -0700 (PDT) Original-Received: from [192.168.2.230] (unknown [166.129.51.192]) by mail.digg.com (Postfix) with ESMTP id 4F03AA84F23 for ; Thu, 30 Apr 2009 18:58:25 -0700 (PDT) X-Mailer: Apple Mail (2.930.3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 30 Apr 2009 22:11:59 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:27581 gmane.emacs.pretest.bugs:24353 Archived-At: --Apple-Mail-1-842894919 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit 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. --Apple-Mail-1-842894919 Content-Disposition: attachment; filename=sql-ux.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="sql-ux.diff" Content-Transfer-Encoding: quoted-printable diff=20--git=20a/lisp/progmodes/sql.el=20b/lisp/progmodes/sql.el=0Aindex=20= da0794b..ab2b884=20100644=0A---=20a/lisp/progmodes/sql.el=0A+++=20= b/lisp/progmodes/sql.el=0A@@=20-771,6=20+771,7=20@@=20Based=20on=20= `comint-mode-map'.")=0A=20=0A=20(defvar=20sql-mode-map=0A=20=20=20(let=20= ((map=20(make-sparse-keymap)))=0A+=20=20=20=20(define-key=20map=20(kbd=20= "C-c=20C-t")=20'sql-set-sqli-buffer)=0A=20=20=20=20=20(define-key=20map=20= (kbd=20"C-c=20C-c")=20'sql-send-paragraph)=0A=20=20=20=20=20(define-key=20= map=20(kbd=20"C-c=20C-r")=20'sql-send-region)=0A=20=20=20=20=20= (define-key=20map=20(kbd=20"C-c=20C-s")=20'sql-send-string)=0A@@=20= -1917,7=20+1918,9=20@@=20anything.=20=20The=20name=20of=20the=20major=20= mode=20is=20SQL.=0A=20=0A=20In=20this=20SQL=20buffer=20(SQL=20mode),=20= you=20can=20send=20the=20region=20or=20the=20entire=0A=20buffer=20to=20= the=20interactive=20SQL=20buffer=20(SQLi=20mode).=20=20The=20results=20= are=0A-appended=20to=20the=20SQLi=20buffer=20without=20disturbing=20your=20= SQL=20buffer."=0A+appended=20to=20the=20SQLi=20buffer=20without=20= disturbing=20your=20SQL=20buffer.=0A+=0A+You=20may=20change=20the=20SQLi=20= buffer=20by=20calling=20\\[sql-set-sqli-buffer]."=0A=20=20=20= (interactive)=0A=20=20=20(describe-function=20'sql-help))=0A=20=0A@@=20= -2148,7=20+2151,10=20@@=20Every=20newline=20in=20STRING=20will=20be=20= preceded=20with=20a=20space=20and=20a=20backslash."=0A=20;;;=20Sending=20= the=20region=20to=20the=20SQLi=20buffer.=0A=20=0A=20(defun=20= sql-send-region=20(start=20end)=0A-=20=20"Send=20a=20region=20to=20the=20= SQL=20process."=0A+=20=20"Send=20a=20region=20to=20the=20SQL=20process.=0A= +=0A+The=20region=20is=20sent=20to=20the=20process=20in=20the=20buffer=20= referred=20to=20in=0A+`sql-buffer',=20and=20may=20be=20changed=20with=20= \\[sql-set-sqli-buffer]."=0A=20=20=20(interactive=20"r")=0A=20=20=20(if=20= (buffer-live-p=20sql-buffer)=0A=20=20=20=20=20=20=20(save-excursion=0A@@=20= -2160,10=20+2166,14=20@@=20Every=20newline=20in=20STRING=20will=20be=20= preceded=20with=20a=20space=20and=20a=20backslash."=0A=20=09(if=20= sql-pop-to-buffer-after-send-region=0A=20=09=20=20=20=20(pop-to-buffer=20= sql-buffer)=0A=20=09=20=20(display-buffer=20sql-buffer)))=0A-=20=20=20=20= (message=20"No=20SQL=20process=20started.")))=0A+=20=20=20=20(message=20= (substitute-command-keys=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "No=20SQL=20process=20started.=20Try=20\\[sql-set-sqli-buffer]."))))=0A=20= =0A=20(defun=20sql-send-paragraph=20()=0A-=20=20"Send=20the=20current=20= paragraph=20to=20the=20SQL=20process."=0A+=20=20"Send=20the=20current=20= paragraph=20to=20the=20SQL=20process.=0A+=0A+The=20paragraph=20is=20sent=20= to=20the=20process=20in=20the=20buffer=20referred=20to=20in=0A= +`sql-buffer',=20and=20may=20be=20changed=20with=20= \\[sql-set-sqli-buffer]."=0A=20=20=20(interactive)=0A=20=20=20(let=20= ((start=20(save-excursion=0A=20=09=09=20(backward-paragraph)=0A@@=20= -2174,12=20+2184,18=20@@=20Every=20newline=20in=20STRING=20will=20be=20= preceded=20with=20a=20space=20and=20a=20backslash."=0A=20=20=20=20=20= (sql-send-region=20start=20end)))=0A=20=0A=20(defun=20sql-send-buffer=20= ()=0A-=20=20"Send=20the=20buffer=20contents=20to=20the=20SQL=20process."=0A= +=20=20"Send=20the=20buffer=20contents=20to=20the=20SQL=20process.=0A+=0A= +The=20buffer=20is=20sent=20to=20the=20process=20in=20the=20buffer=20= referred=20to=20in=0A+`sql-buffer',=20and=20may=20be=20changed=20with=20= \\[sql-set-sqli-buffer]."=0A=20=20=20(interactive)=0A=20=20=20= (sql-send-region=20(point-min)=20(point-max)))=0A=20=0A=20(defun=20= sql-send-string=20(str)=0A-=20=20"Send=20a=20string=20to=20the=20SQL=20= process."=0A+=20=20"Send=20a=20string=20to=20the=20SQL=20process.=0A+=0A= +The=20string=20is=20sent=20to=20the=20process=20in=20the=20buffer=20= referred=20to=20in=0A+`sql-buffer',=20and=20may=20be=20changed=20with=20= \\[sql-set-sqli-buffer]."=0A=20=20=20(interactive=20"sSQL=20Text:=20")=0A= =20=20=20(if=20(buffer-live-p=20sql-buffer)=0A=20=20=20=20=20=20=20= (save-excursion=0A@@=20-2189,7=20+2205,8=20@@=20Every=20newline=20in=20= STRING=20will=20be=20preceded=20with=20a=20space=20and=20a=20backslash."=0A= =20=20=20=20=20=20=20=20=20(if=20sql-pop-to-buffer-after-send-region=0A=20= =20=20=20=20=20=20=20=20=20=20=20=20(pop-to-buffer=20sql-buffer)=0A=20=20= =20=20=20=20=20=20=20=20=20(display-buffer=20sql-buffer)))=0A-=20=20=20=20= (message=20"No=20SQL=20process=20started.")))=0A+=20=20=20=20(message=20= (substitute-command-keys=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "No=20SQL=20process=20started.=20Try=20\\[sql-set-sqli-buffer]."))))=0A=20= =0A=20(defun=20sql-toggle-pop-to-buffer-after-send-region=20(&optional=20= value)=0A=20=20=20"Toggle=20`sql-pop-to-buffer-after-send-region'.=0A@@=20= -2266,6=20+2283,8=20@@=20you=20must=20tell=20Emacs.=20=20Here's=20how=20= to=20do=20that=20in=20your=20`~/.emacs'=20file:=0A=20=20=20= (run-mode-hooks=20'sql-mode-hook)=0A=20=20=20;;=20Catch=20changes=20to=20= sql-product=20and=20highlight=20accordingly=0A=20=20=20= (sql-highlight-product)=0A+=20=20(setq=20mode-line-process=20'((:eval=20= (when=20sql-buffer=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(concat=20"=20= >=20"=20(buffer-name=20sql-buffer))))))=0A=20=20=20(add-hook=20= 'hack-local-variables-hook=20'sql-highlight-product=20t=20t))=0A=20=0A=20= =0C=0A= --Apple-Mail-1-842894919 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-1-842894919--