Open in emacs: No connection could be made because the target machine actively refuse it
Asked Answered
R

2

10

I have followed post to enable emacs in windows explorer by adding following registry:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Open In Emacs]

[HKEY_CLASSES_ROOT\*\shell\Open In Emacs\Command]
@="\"C:\\Unix-Bin\\emacs-24.3\\bin\\emacsclientw.exe\" -a \"C:\\Unix-Bin\\emacs-24.3\\bin\\runemacs.exe\" \"%1\""

Before today it works good. But today I find when to open file with "Open in Emacs" menu, following error will popup. And later the file is opened by emacs correctly.

No idea why following error come out.

Error :

C:\Unix-Bin\emacs-24.3\bin\emacsclientw.exe: connect: No connection could be made because the target machine actively refuse it.

enter image description here

Robbierobbin answered 15/8, 2014 at 1:34 Comment(2)
Have you changed your firewall settings, or installed a new anti-virus (so that something has closed the port emacs-server uses)?Chalcedony
Not sure. But I remember I haven't change firewall and no new anti-virus installed. Do you know how to check if emacs-server port closed or not?Robbierobbin
D
17

I had the same error message. In my case I had to delete the old connection: I removed

~/emacs.d/server/server

file and then it worked.

Dodwell answered 14/10, 2014 at 15:42 Comment(0)
R
0

Grab this bat file, then add these lines:

setlocal enableextensions enabledelayedexpansion
set serverfile="%userprofile%\.emacs.d\server\server"
if exist %serverfile% (
  set /p first= < %serverfile%
  for /f "tokens=2" %%a in ("!first!") do ( set server=%%a )
  tasklist /nh /fi "PID eq !server!" 2>&1 | findstr /C:"emacs.exe" >nul 2>&1
  if ERRORLEVEL 1  del /f %serverfile% 
)

after the @echo off line.

Resumption answered 3/11, 2016 at 16:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.