From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Giorgos Keramidas Newsgroups: gmane.emacs.help Subject: Re: How to open a file in sh-mode Date: Thu, 14 Aug 2008 17:23:04 +0300 Message-ID: <8763q3y8tz.fsf@kobe.laptop> References: <38b2ab8a0808140053g6261aeafmd74692199cea07eb@mail.gmail.com> <200808141016.12117.henrikau@stud.ntnu.no> <38b2ab8a0808140203s53c339f3k70d5887d42a4de2f@mail.gmail.com> <200808141203.22315.henrikau@stud.ntnu.no> <874p5nwzri.fsf@kobe.laptop> <38b2ab8a0808140601p3f524769oe0fdb80c6db60bb@mail.gmail.com> <87myjfvi9v.fsf@kobe.laptop> <38b2ab8a0808140648s4486ba20l428b40704efc95af@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1218723836 20532 80.91.229.12 (14 Aug 2008 14:23:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Aug 2008 14:23:56 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Francis Moreau" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 14 16:24:44 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 1KTdkk-00044W-3U for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Aug 2008 16:24:38 +0200 Original-Received: from localhost ([127.0.0.1]:38000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTdjn-0003f5-K0 for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Aug 2008 10:23:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KTdjX-0003d4-Er for help-gnu-emacs@gnu.org; Thu, 14 Aug 2008 10:23:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KTdjU-0003cp-S4 for help-gnu-emacs@gnu.org; Thu, 14 Aug 2008 10:23:22 -0400 Original-Received: from [199.232.76.173] (port=57674 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KTdjU-0003cm-Oq for help-gnu-emacs@gnu.org; Thu, 14 Aug 2008 10:23:20 -0400 Original-Received: from igloo.linux.gr ([62.1.205.36]:52561) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KTdjT-00074S-WE for help-gnu-emacs@gnu.org; Thu, 14 Aug 2008 10:23:20 -0400 Original-Received: from kobe.laptop (adsl11-42.kln.forthnet.gr [77.49.138.42]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id m7EEN5bp012571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 14 Aug 2008 17:23:12 +0300 Original-Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id m7EEN5Al054397; Thu, 14 Aug 2008 17:23:05 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Original-Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id m7EEN5kr054366; Thu, 14 Aug 2008 17:23:05 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) In-Reply-To: <38b2ab8a0808140648s4486ba20l428b40704efc95af@mail.gmail.com> (Francis Moreau's message of "Thu, 14 Aug 2008 15:48:57 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) X-MailScanner-ID: m7EEN5bp012571 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.827, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.57, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 1) 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:56621 Archived-At: On Thu, 14 Aug 2008 15:48:57 +0200, Francis Moreau wrote: > On Thu, Aug 14, 2008 at 3:27 PM, Giorgos Keramidas wrote: >> On Thu, 14 Aug 2008 15:01:02 +0200, Francis Moreau wrote: >>> >>> >>> ("emacs" "--eval" "\"(setq-default" "default-major-mode" "'sh-mode)\"" >>> "/tmp/bash-fc-247955888988243") >> >> See how the command-line arguments have been split in multiple places by >> the shell that evaluated $FCEDIT? > > hmm not really. > > Could you tell me what's wrong here ? IOW how emacs have been launched? It has been launched with the following command-line arguments: arg[0] = "emacs" arg[1] = "--eval" arg[2] = "\"(setq-default" arg[3] = "default-major-mode" arg[4] = "'sh-mode)\"" arg[5] = "/tmp/bash-fc-247955888988243" The shell that launched $FCEDIT as an editor, looked at its value, saw that it had space characters in it, and split the $FCEDIT value to several separate arguments at every unquoted space. Try firing up Emacs with the following two commands, and look at the *Messages* buffer to spot the difference: emacs -nw "foo" "bar" emacs -nw "foo bar" The first should display: ("emacs" "-nw" "foo" "bar") but the second should display: ("emacs" "-nw" "foo bar") It may be possible to quote FCEDIT's value in some complex manner to achieve the effect of second list, where the s-exp passed to --eval is a single entry in the command-line argument list. Is it worth all the trouble to get it `right'? My own personal preference at this point is to say `No, not really. I can write a shell wrapper, and be done with it in half a minute or so' :-)