From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Bash Script Editing Mode? Date: Thu, 07 Aug 2008 23:20:08 +0200 Organization: Informatimago Message-ID: <87hc9w1q0n.fsf@hubble.informatimago.com> References: <361d08d2-b456-49c9-a578-53d1aaaf0b0f@a8g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1218145315 22760 80.91.229.12 (7 Aug 2008 21:41:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Aug 2008 21:41:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 07 23:42:46 2008 Return-path: Envelope-to: geh-help-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 1KRDFf-0003i9-0T for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Aug 2008 23:42:31 +0200 Original-Received: from localhost ([127.0.0.1]:33622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRDEi-0007pH-PN for geh-help-gnu-emacs@m.gmane.org; Thu, 07 Aug 2008 17:41:32 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!newsfeed.straub-nv.de!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed4-a.proxad.net!nnrp10-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:ONgT0mX67e+LkMOBh2RZywl+n+o= Original-Lines: 79 Original-NNTP-Posting-Date: 07 Aug 2008 23:10:09 MEST Original-NNTP-Posting-Host: 88.182.134.169 Original-X-Trace: 1218143409 news-3.free.fr 31874 88.182.134.169:32987 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:160915 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56259 Archived-At: formido writes: > There's a shell mode, but it has a prompt and doesn't help you > incrementally create a shell script as efficiently as it could, unless > I'm missing something. Is there any shell script mode that works more > like the elisp, python, or erlang repls, where you can execute your > choice of several lines at once and you can go back and edit and > execute the lines in situ? If I write a bash function, editing and > reloading the function is a painful process. I'm looking for something > a little bit like the Mac's BBEdit shell worksheets (only better). First, try to get your terminology straight. You want a shell-script-mode that be more like shell-mode, not a shell-mode that's a different shell-script-mode. That is, when you type M-x shell RET, you get a buffer that is in the shell-mode, where you can edit a shell command, and when you type RET, you get it executed. On the other hand, when you type C-x C-f ~/bin/new-script RET M-x shell-script-mode RET yo uget a buffer that is in the shell-script-mode, where you can edit a shell script, but indeed for now, you cannot have them executed from here. > I considered altering the usual shell mode, but it would take more > than slight edits, so I'm hoping something's already out there. For > example, one should be able to go back to a function, tweak it, and > reload with a minimum of keyboard fuss. Well, if you consider the shell mode, there's an easy way to get what you want: just edit your commands, one by one, and type RET to try them. When you're happy with the result, type: history RET and copy-and-paste all the commands to a shell script buffer, add some minor edits, including a #!/bin/bash on the first line, and voilą. But really, I would rather start from the shell-script-mode. What is missing, it's the parsing for shell-script "sexprs". That is, keys such as C-M-f are still bound to forward-sexp that parses a lisp sexp instead of a shell one. (The problem of course is that it's much harder to parse a shell expression). Anyways, you could implement some minimal parser. It'd need to know about continuation lines, <