I have Emacs running via Cygwin istall. In Emacs I have installed (via package-install) powershell package; however, when I run M-x powershell I get the following error:
Searching for program: no such file or directory, c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
The problem here is that instead of c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe the path to PowerShell.exe should be /cygdrive/c/windows/system32/WindowsPowerShell/v1.0/powershell.exe
My question is: how do I configure package powershell to point to the right path?
You can set the variable powershell-location-of-exe, either directly with setq in your .emacs file:
(setq powershell-location-of-exe "/cygdrive/c/windows/system32/WindowsPowerShell/v1.0/powershell.exe")
or through M-x customize-option.
Here is how I do it. It handles different cygwin drive prefixes (I have mine set to / in /etc/fstab):
(when (eq system-type 'cygwin)
(setq powershell-location-of-exe
(s-trim (shell-command-to-string "which powershell.exe"))))
s-trim is from the s.el library which is available on ELPA, you will need to add (require 's) at the top of your .emacs if you don't already have it. It is necessary because which seems to return a string with a trailing newline, though there is probably a built in Emacs function to get rid of that, I don't know it :-(
Related
I am a newbies in Singular. I just downloaded Singular4-0-2_64.dmg, mounted the image, right-ckick, show the package contents, then moved the contents folder to the Applications directory. double-clicking Contents/MacOS/Singular (or Esingular) I have Singular running in a terminal (or via emacs in a terminal). But when I try M-x singular in a running emacs, it says "cannot open load file : no such file or directory, singular".
Then I copied .emacs-general and .emacs-singular to the home directory. Adding the following lines to .emacs
(setq load-path (cons "" load-path))
(autoload 'singular "singular"
"Start Singular using default values." t)
(autoload 'singular-other "singular"
"Ask for arguments and start Singular." t)
changing singular-emacs-home-directory into /Applications/Singular.app/Contents/share/singular/emacs/ it still doesn't work.
Also when I replace .emacs with .emacs-singular, replacing the above directory, it gives the error:
Warning (initialization): An error occurred while loading `/Users/Me/.emacs':
Symbol's value as variable is void: /Applications/Singular.app/Contents/share/singular/emacs
Am I not finding the right singular-emacs-home-directroty or is there any other problem?
I appreciate your help.
Also I must mention that I am a user of emacs for Macaulay2. For that I have changed .emacs and .emacs-Macaulay2 in order to teach emacs where to look for M2. Is there anything similar to be done for Singular? Shall I have a file .emacs-singular somewhere?
Thanks for your help.
Here are some basic settings that assume the Singular.app has been installed to the /Applications folder. I chose to set the absolute path to the executable, instead of setting the PATH in Emacs. The PATH in Emacs on OSX is (by default) not the same as what one would generally except to see in let's say Terminal.app. [But, setting the PATH is beyond the scope of this basic answer.]
My personal preference is to have all of the lisp and configuration files in a custom directory for purposes of editing and backup up. This limited example just leaves everything where they are.
In the Emacs master branch (February 7, 2016), there is no built-in variable named current-menubar -- the configuration files are looking for the existence of that variable. I did not spend the time to debug the built-in configuration files to find out what version of Emacs they were designed for, and I did not spend the time to make the Singular elisp libraries compatible with the latest Emacs master branch.
Add the following lines of code to the .emacs file in the home directory, save the file, and restart Emacs. Then type M-x singular RET
(add-to-list 'load-path "/Applications/Singular.app/Contents/share/singular/emacs/")
(require 'singular)
(setq singular-emacs-home-directory "/Applications/Singular.app/Contents/share/singular/emacs/")
(defvar current-menubar nil)
(setq singular-executable-default "/Applications/Singular.app/Contents/MacOS/Singular")
(load-file "/Applications/Singular.app/Contents/share/singular/emacs/.emacs-general")
(load-file "/Applications/Singular.app/Contents/share/singular/emacs/.emacs-singular")
Windows 7. Emacs 24.3.1. Git 1.8.1.msysgit.1. I have the following in my equivalent .emacs file:
(if (equal system-type 'windows-nt)
(progn (setq explicit-shell-file-name
"C:/Program Files (x86)/Git/bin/sh.exe")
(setq shell-file-name "bash")
(setq explicit-sh.exe-args '("--login" "-i"))
(setenv "SHELL" shell-file-name)
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)))
This works great when I want to do M-x shell: I can pop open a shell and type "ls".
However, M-x shell-command is failing. When I try to run "ls" via shell-command (which should print its output in the *Shell Command Output* buffer, according to C-h f shell-command), I get a single error message:
"Searching for program: permission denied, bash"
There are some very old suggestions on the Google about call-process and many questions on StackOverflow about getting the shell to work in Emacs. Please note that M-x shell works great, and what I'd like to work is shell-command.
(Reason: https://github.com/donkirkby/live-py-plugin#installing-the-emacs-mode)
Try setting both variables to point to the same executable and make sure the path is in exec-path:
(setq explicit-shell-file-name
"C:/Program Files (x86)/Git/bin/bash.exe")
(setq shell-file-name explicit-shell-file-name)
(add-to-list 'exec-path "C:/Program Files (x86)/Git/bin")
I know this is an older question, but I found it while I was searching for help on the same issue, so here's the solution I use for my particular use case, in case it helps someone in the future.
I sync up my .emacs.d between all computers I use emacs on, which includes both Linux & Windows machines. I inserted this into my init.el file to automatically deal with this issue appropriately in a Windows environment:
;; Set Windows-specific preferences if running in a Windows environment.
(defun udf-windows-setup () (interactive)
;; The variable `git-shell-path' contains the path to the `Git\bin'
;; file on my system. I install this in
;; `%USERPROFILE%\LocalAppInfo\apps\Git\bin'.
(setq git-shell-path
(concat (getenv "USERPROFILE") "\\LocalAppInfo\\apps\\Git\\bin"))
(setq git-shell-executable
(concat git-shell-path "\\bash.exe"))
(add-to-list 'exec-path git-shell-path)
(setenv "PATH"
(concat git-shell-path ";"
(getenv "PATH")))
(message "Windows preferences set."))
(if (eq system-type 'windows-nt)
(udf-windows-setup))
Please note that the variable git-shell-path will need to be defined based on where you have git installed on your system. I install it in %USERPROFILE%\LocalAppInfo\apps\Git on the one Windows machine where I use it.
Using GitBash you can use the lein script instead of the lein.bat script. Put the lein script into a directory called bin in your user account on windows. GitBash should have that bin directory on its executable PATH, so you can run lein anywhere.
With this approach you do not need any configuration in Emacs Lisp.
See my full answer
I am trying to make a stand-alone Racket executable on the Windows platform. How do I go about running raco from the windows command line? I'm not familiar with it.
If I use the documentation and enter the following command into cmd.exe:
raco exe --gui main.rkt
cmd.exe tells me:
'raco' is not recognized as an internal or external command, operable program or batch file.
Substituting in raco.exe tells me the same thing.
I also tried typing:
'C:\Program Files\Racket\raco.exe' exe --gui .\main.rkt
into powershell and it gave me an Unexpected token 'exe' in expression or statement error.
For the first problem: you need to add to windows' %PATH% (an environment variable) the path to the executable. For the second problem: check the correct syntax for the exe command, and/or the "--gui" modifier, they're being misused. For instance, try this after solving the first problem:
$ raco.exe exe main.rkt
The above will create an executable main.exe file.
Download and install Racket, which includes DrRacket. (Of course, you’re welcome to use your preferred text editor, but the tutorials will assume you’re using DrRacket.)
Update the PATH environment variable on your system to include the directory that holds the racket application. On Mac OS and Linux, this path will be something like "/path/to/racket/bin". On Windows, it’ll be something like "C:\Program Files\Racket". Then, from the terminal, you’ll be able to run racket and raco (see raco: Racket Command-Line Tools).
Windows users who haven’t altered your PATH before: don’t panic. To add the Racket command-line programs to your Windows 10 PATH, click the Windows search box, type the word path, and then click on Edit the system environment variables. Click on the Environment Variables button. In the top window, which contains your user variables, find Path and double-click it to open. Click the New button and either use the Browse button to select your Racket directory, or manually enter its path. Restart your Windows terminal (either the Command Prompt or PowerShell) and now racket and raco should work.
I am trying to use Emacs 24.2 with Tramp on windows 7 to remotely edit files on a linux server. I installed the Putty suit program and OpenSSH. I also placed the plink.exe in the putty suit into the bin folder under the emacs 24 folder, and added the folder emacs24/bin into the PATH environment variable.
However, when I try to access the remote file from emacs with the command in the minibuffer: /username#host:filename, I get the following error message from emacs: plink is not recognized as an internal or external command. It seems that emacs cannot find the plink program. But, when I try to run plink in windows cmd, it can find the plink program. Also, I can ssh to the remote server in windows cmd.
Can anyone tell me what's my problem? Do I need to install cygwin to make it work? Thanks a lot.
To get tramp with plink to work, I had to add my PuTTY path to my system search path.
On Windows 10:
control panel >> System & Security >> System >> advanced system settings >> enviroment variables
To PATH I appended the PuTTY path: C:\Program Files (x86)\PuTTY
I'm guessing the key is that from PowerShell or the command prompt, you need to be able to run plink without specifying the path.
I was able to resolve this and I did not have to install cygwin.
Try adding the path where putty was installed to your exec-path variable in emacs. Execute the following elisp code in emacs or put it in your .emacs file. Make sure the slashes are forward, not backslashes, as Emacs and Windows use different conventions.
(add-to-list 'exec-path "C:/Program Files (x86)/PuTTy")
check what exec-path is set to by typing C-h v exec-path
For F# mode in emacs, one need the following line in .emacs.
The problem is that because of space between file path, C-c C-s doesn't work.
(setq fsharp-compiler "C:/Program Files/Microsoft F#/v4.0/fsc.exe")
I had to copy the F# compilers to the directory that doesn't have space in its file path.
(setq fsharp-compiler "C:/app/fsharp/fsc.exe")
How to run a process that has a space in its path name with emacs?
First, make sure you have a recent version of the F# mode (that was a bug fixed in June). Then, follow the instructions in the README file!
This line is given as an example:
(setq fsharp-compiler "\"c:\\Program Files\\Microsoft F#\\v4.0\\Fsc.exe\"")
Have you tried using %20 in place of space?
So the statement becomes
(setq fsharp-compiler "C:/Program Files/Microsoft%20F#/v4.0/fsc.exe")
I haven't tried it though but it works with the file import.
like the following works,
[[file:C:\Users\siddh\Downloads\Google%20Chrome\joker#.jpg]]
this also works
[[file:C:\Users\siddh\Downloads\Google Chrome\joker#.jpg]]
Just sharing my input. Hope it helps.