From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleksandr Gavenko Newsgroups: gmane.emacs.help Subject: Re: emacsclient commandline Date: Thu, 11 Sep 2008 20:45:28 +0300 Organization: Aioe.org NNTP Server Message-ID: References: Reply-To: gavenkoa@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1221158510 30706 80.91.229.12 (11 Sep 2008 18:41:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Sep 2008 18:41:50 +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 Sep 11 20: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 1Kdr6z-00061e-Au for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Sep 2008 20:41:49 +0200 Original-Received: from localhost ([127.0.0.1]:42343 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kdr5y-0005bn-L7 for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Sep 2008 14:40:46 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!aioe.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 89 Original-NNTP-Posting-Host: PFePz+PgNjzaSpuOfpcfqg.user.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) Original-Xref: news.stanford.edu gnu.emacs.help:162087 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:57430 Archived-At: Rustom Mody wrote: > I am trying to construct a command line such that: > > if emacs is running the client asks the server to raise-frame else it > calls runemacs. > > The command line Ive given is: > $ emacsclient -a runemacs -e "(raise-frame)" > > But this opens a file (or buffer) called '(raise-frame)' !! > > Of course just > $ emacsclient -e "(raise-frame)" > > raises the emacs frame alright but fails for the case of no server. > > Another minor point: > When emacsclient is used with the -a option and there is no server > running it pops up a window saying ERROR No error !! > I guess this is an error (in emacsclient) :-) > > Starting from the vbs file on the emacswiki Ive constructed my own > launch-emacs as below but I dont like the loop and the sql and all the > heavy stuff, hence this attempt. > > My launch-emacs-client.vbs > ------------------------ > Set objShell = WScript.CreateObject("WScript.Shell") > Set fso = CreateObject("Scripting.FileSystemObject") > > strComputer = "." > > Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") > > Set colItems = objWMIService.ExecQuery("Select * From Win32_Process") > Dim isRunning > isRunning = False > > For Each objItem in colItems > If InStr(objItem.CommandLine, "emacs.exe") Then > isRunning = True > End If > Next > > parent = fso.GetParentFolderName(WScript.ScriptFullName) > If WScript.Arguments.Count = 1 Then > If isRunning Then > callString = parent & "/emacsclientw.exe -n """ & > WScript.Arguments(0) & """" > Else > callString = parent & "/runemacs.exe """ & WScript.Arguments(0) & """" > End If > Else > If isRunning Then > callString = parent & "/emacsclientw.exe -n -e ""(raise-frame)""" > else > callString = parent & "/runemacs.exe" > End If > End if > objShell.Run(callString) > > On Windows I wrote e.bat. Usually at Total Commander or Far file manager I find file by cursor, type e and emacs popup with opened file (if it already not opened I get error and quickly type ). As for me `--no-wait' very useful not needed type C-x # and I can come back to the opened file later typing C-x b. @echo off REM Copyright (C) 2008 by Oleksandr Gavenko REM View file in emacs buffer using emacsclientw. REM If emacs not already running, run it. REM Put this file (e.bat) in your PATH. REM Name `e' because `edit'. if "%1" == "-h" goto usage if "%1" == "-help" goto usage if "%1" == "--help" goto usage %HOME%\..\bin\emacs\bin\emacsclientw.exe -a emacs -n "%*" goto EOF :usage @echo Win emacs run script. @echo Usage @echo e [-h^|--help] ^ :EOF