all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: emacsclient commandline
Date: Thu, 11 Sep 2008 20:45:28 +0300	[thread overview]
Message-ID: <gablfm$okl$1@aioe.org> (raw)
In-Reply-To: mailman.17151.1219243748.18990.help-gnu-emacs@gnu.org

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<space><CTRL+Enter> and emacs popup with 
opened file (if it already not opened I get error and quickly type 
<Enter>). 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 <gavenko_a@gmail.com>

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] ^<edit-files^>

:EOF


       reply	other threads:[~2008-09-11 17:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.17151.1219243748.18990.help-gnu-emacs@gnu.org>
2008-09-11 17:45 ` Oleksandr Gavenko [this message]
2008-09-12 13:18   ` emacsclient commandline rustom
2008-09-12 17:37     ` Oleksandr Gavenko
2008-08-20 14:49 Rustom Mody
2008-08-20 15:34 ` Lennart Borgman (gmail)
2008-08-21  5:50   ` Rustom Mody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='gablfm$okl$1@aioe.org' \
    --to=gavenkoa@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.