run sml console at emacs - searching for program: no such file or directory? - emacs

I installed SML on Ubuntu 12.04.
Here is more info:
nazar_art#nazar-desctop:~$ sml -version
Standard ML of New Jersey v110.75 [built: Mon Sep 2 23:36:16 2013]
And added to emacs this package:
M x list-packages + Enter
find sml-mode and install by mouse click.
But when I tried write easy .sml file I want to open sml console at emacs.
I press C c + C s => I see SML command: sml and press Enter.
And see this message:
Searching for program: no such file or directory
Instead of opening sml console.
I couldn't figure out why this happen?
How to solve this trouble?
Update:
Here is my which sml:
/usr/local/SML/bin/sml
and emacs version - GNU Emacs 24.3.1
Installed from here but only for emacs24, not for emacs-snapshot.

Option 4: Eval the following with: C-M-: (setq exec-path (cons "/usr/local/SML/bin" exec-path)) return/enter or put it into $home/.emacs to make it persist over all sessions.

Your problem is that the sml executable isn't on the PATH that Emacs sees.
And you can launch sml from bash probably because you modify path
in ~/.bashrc.
Option 1: modify PATH
In ~/.profile (you'll need to log out once):
export PATH=$PATH:/usr/local/SML/bin/
Option 2: create link
sudo ln -s /usr/local/SML/bin/sml /usr/bin/sml
Option 3: apt installs for me sml to /usr/bin/ (Emacs knows this path)
sudo apt-get install smlnj

Just elaborating on the steps mentioned by the Bleeding fingers:
Step1: Launch emacs from terminal.
step2: Press ctrl+x+f.
step3: You will get something in the bottom saying "Find a file:~/" then there write "/.emacs".
step4: Paste this line "setq exec-path (cons "/usr/local/SML/bin" exec-path))" in that.
step5: Press Ctrx+x+s to save the changes and then restart the emacs.

Related

Visual Studio Code, autopep8 doesn't run

On Windows 10.
I did this:
pip install autopep8
and in vscode user settings I have
"python.linting.pep8Enabled": true,
"python.formatting.provider": "autopep8",
When I run format document, or explicitly invoke autopep8 from the command pallette, the error is:
Error: Command failed: autopep8 c:\tca-backend\lambdas\utilities\NetMenuAPIUtil.py
'autopep8' is not recognized as an internal or external command,
operable program or batch file.
Clearly, vsc wants to invoke autopep8.exe but there is no exe. Just py. So I created a autopep8.bat which works when I test from the command line, but when run from vsc, it inserts the content of the batch file into the top of the document. (Yes, that's as strange as it sounds.)
All other Python-related operations work ok, including the ESLint extension.
VS code Python extension supports source code formatting using either autopep8 (the default), black, or yapf so you don't need to install python formatting tools by yourself.
The way I use formatting is to set a shortcut in vs code.
Go to File -> Preferences -> Keyboard Shortcuts, then search format. Set the shortcut as ctrl + shift + p which is the same as the shortcut of autopep8 or you can set any combination you prefer.
Click the shortcuts in your .py files then you will get the formatted code.
Ref: https://code.visualstudio.com/docs/python/editing
Since you are using VSCode on Windows, please click on the Terminal Section and type
pip install pep8
This will start installing pep8.
for me, the autopep8 doc installation isn't enough, still seeing this error, I had to follow this https://pip.pypa.io/en/latest/user_guide/#user-installs. it works like a charm.
I'm on windows so I used this:
py -m pip install –-user autopep8
You need to add this as a PATH under System Environment Variables:
c:\users\<username>\appdata\roaming\python\python39\site-packages
Then close and restart VS Code. Type autopep8 at a terminal prompt and you should see this:
C:\Foobar>autopep8
usage: autopep8 [-h] [--version] [-v] [-d] [-i] [--global-config filename] [--ignore-local-config] [-r] [-j n] [-p n] [-a] [--experimental] [--exclude globs] [--list-fixes] [--ignore errors] [--select errors]
[--max-line-length n] [--line-range line line] [--hang-closing] [--exit-code]
[files ...]
autopep8: error: incorrect number of arguments
I encountered an error message while trying to do same and below was what I did (in my terminal):
Install or upgrade pep8:
pip install --upgrade autopep8
Navigate to the folder/directory where the file you need formatted is, then use the following command:
autopep8 --in-place file_name
There you have it!
I encountered this same error running WSL: Ubuntu-20.04, well this was my solution:
$ pip --version
This will make you verify that you have python3 pip installed correctly in your distribution, if that's not the case, it will pop up an error:
Command 'pip' not found, but can be installed with:
apt install python3-pip
Just run the indicated command to installed it and then after that, run:
$ python3 -m pip install autopep8
Now everything should be working as it should, including the formatting autpep8.

Executing Clojure in Emacs with `cider-jack-in`

I'm trying to run Clojure emacs with cider package installed.
I use Emacs 24.5.1 on Mac OS X 10.10.4.
I downloaded lein script and copied the script in ~/Dropbox/bin.
I checked with lein repl that Clojure works fine.
cider package is installed with M-x package-install. I edited the ~/.emacs.d/init.el to specify the lein script: (add-to-list 'exec-path "~/Dropbox/bin") with the hint from Can't launch `lein` REPL in Emacs.
However, when I started emacs and run M-x cider-jack-in, I have this error message:
When I started lein repl and executed M-x cider-connect (http://xahlee.info/clojure/clojure_emacs_cider.html), I can have the cider-repl running in Emacs.
What might be wrong?
The quickest fix was to symbolically link lein to the path where Emacs can find it. This line of code fixed the issue.
sudo ln -s ~/Dropbox/bin/lein /usr/local/bin/lein
I summarized the steps to install the cider package for running Clojure on emacs without any errors or warnings.
cider - https://github.com/clojure-emacs/cider
Installation
Download lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
I copied the file ~/Dropbox/bin after making it executable.
It looks like that /usr/local/bin is not the path that Emacs finds the binary automatically, so I had to set it up.
Run sudo ln -s ~/Dropbox/bin/lein /usr/local/bin/lein
Update ~/.emacs.d/init.el to specify the location of lein script:
(add-to-list 'exec-path "/usr/local/bin")
Update ~/.lein/profiles.clj
Installation of cider-nrepl
{:user {:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]]}}
run lein deps
Errors and solutions
If error The lein executable (specified bycider-lein-command' or cider-boot-command') isn't on your exec-path occurs:
make the symbolic link, and update the init.el as is explained.
If error "Symbol's function definition is void: clojure-project-dir" occurs, it's because of the package version mismatch.
http://www.braveclojure.com/using-emacs-with-clojure/
delete the old packages in ~/emacs.d/elpa
clojure-mode
cider-*
Then, run package-install in Emacs
clojure-mode
cider
Now, all the warnings are gone.
References
Can't launch `lein` REPL in Emacs
Executing Clojure in Emacs with `cider-jack-in`
cider - https://github.com/clojure-emacs/cider
Added
For Mac OS X, brew install leiningen can install the lein, but this caused an issue as in How to upgrade nrepl version of leiningen?. This is the message from the lein brew.
nREPL server started on port 61216 on host 127.0.0.1 - nrepl://127.0.0.1:61216
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14
I had to use the lein from the lein site to get the correct version of tools.
Retrieving org/clojure/clojure/1.2.0/clojure-1.2.0.pom from central
nREPL server started on port 61279 on host 127.0.0.1 - nrepl://127.0.0.1:61279
REPL-y 0.3.7, nREPL 0.2.7
Clojure 1.7.0
Another easy solution is to just use homebrew. While homebrew is overkill just for installing lein, if you already use it, then all you need to do is run
brew update
brew install leiningen
and your done. I use homebrew to install emacs and some other useful apps, so I already have it on my system.

error when using load-theme from emacs

I am running emacs 24.4.50.1 and when I add the following line
(load-theme 'wombat t)
I get the following error when I try and start emacs:
Fatal error 6: Abort trap^[[>0;95;c/usr/local/bin/emacs: line 2: 676
Abort trap: 6
/usr/local/Cellar/emacs/HEAD/Emacs.app/Contents/MacOS/Emacs -nw "$#"
The same thing happens when I enter the command:
load-them <RET> wombat
I installed this via homebrew:
brew install emacs --HEAD --use-git-head --cocoa --with-gnutls
Which installed version 24.4.50.1
I uninstalled this and installed version 24.3.1 and the problem went away so it seems the issues is with the HEAD of emacs.

Matlab-emacs integration - Symbol's value as variable is void: letion

I am new to emacs and I was trying to install the Matlab mode for emacs following the instruction on this page:
matlab script editing
Everything compiled fine, but I ran into this error:
Symbol's value as variable is void: letion
When I did "emacs --init-debug" it gave me the following:
Debugger entered--Lisp error: (void-variable letion)
eval-buffer(#<buffer *load*> nil "/home/wjlee/.emacs" nil t) ; Reading at buffer position 404
load-with-code-conversion("/home/wjlee/.emacs" "/home/wjlee/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
I googled around a bit and some people said it's related to using older versions of emacs (emacs23 or older), however, I have emacs24.3.1, so I am not sure why this is still the case. Does anyone know how to fix this, please?
I decided to go a clean install of emacs24.3.1 again, without recompiling cedet and the matlab-emacs components, and somehow it works now... It seems like (from what I found on the web) although the newest version of CEDET is not bundled with emacs24, those that are already in there is enough for me to do the matlab-emacs integration.
Since I am very new to using all these, I'll just post what I found here:
To do a clean install of emacs24:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:cassou/emacs
sudo apt-get update
sudo apt-get purge emacs-snapshot-common emacs-snapshot-bin-common emacs-snapshot emacs-snapshot-el emacs-snapshot-gtk emacs23 emacs23-bin-common emacs23-common emacs23-el emacs23-nox emacs23-lucid auctex emacs24 emacs24-bin-common emacs24-common emacs24-common-non-dfsg
sudo apt-get install emacs24 emacs24-el emacs24-common-non-dfsg
sudo rm /etc/apt/sources.list.d/cassou-emacs-precise.list
Download matlab.el:
cvs -d:pserver:anonymous#matlab-emacs.cvs.sourceforge.net:/cvsroot/matlab-emacs login
cvs -z3 -d:pserver:anonymous#matlab-emacs.cvs.sourceforge.net:/cvsroot/matlab-emacs co -P matlab-emacs
And modify ~/.emacs:
(add-to-list 'load-path "~/.emacs.d/matlab-emacs")
(load-library "matlab-load")
I also found the following useful:
(custom-set-variables
'(matlab-shell-command-switches '("-nodesktop -nosplash")))
And some short-cuts:
Some useful short cuts to begin with:
C-c C-r : run region in matlab
C-c C-s : save and run the file in matlab
C-c C-c E : insert a matching END statment
M-TAB : symbol/variable completion based on the script
M-s : brings up matlab-shell (in a different buffer if available)
M-p, M-n : in matlab-shell (or any emacs shell) cycle through past commands

Emacs Autocomplete: the function `define-package` is not known

I am trying to install autocomplete mode on OS X 10.8.4 using emacs 24 installed through brew.
I have cloned autocomplete through git git mirror here and I'm following the build instructions build instructions here. I am getting an error during make install telling me that define-package (presumably some elisp) is undefined.
➜ auto-complete git:(master) make install
emacs -Q -L . -batch -l etc/install
Install to: ~/.emacs.d/
Installing to ~/.emacs.d/ from /Users/f/src/auto-complete/
In toplevel form:
auto-complete-config.el:31:1:Error: Cannot open load file: popup
In end of data:
auto-complete-pkg.el:5:1:Warning: the function `define-package' is not known
to be defined.
Wrote /Users/f/src/auto-complete/auto-complete-pkg.elc
In toplevel form:
auto-complete.el:51:1:Error: Cannot open load file: popup
83117999910111511510211710810812132105110115116971081081011003310106510010032116104101321021111081081111191051101033299111100101321161113212111111711432461011099799115581010409710010045116111451081051151163239108111971004511297116104323412647461011099799115461004734411040114101113117105114101323997117116111459911110911210810111610145991111101021051034110409799459911111010210510345100101102971171081164110
Anybody encounter this before / have a fix?
Install using Melpa or Marmalade via package.el. Auto-complete expects to be installed this way, and you'll also get updates installed very easily.
If you don't have package.el configured already, add the following to .emacs or .emacs.d/init.el
(setq package-archives
'(
("marmalade" . "http://marmalade-repo.org/packages/")
("elpa" . "http://tromey.com/elpa/")
("melpa" . "http://melpa.milkbox.net/packages/")
("gnu" . "http://elpa.gnu.org/packages/")
))
(package-initialize) ;; init elpa packages
Just run M-x package-list-packages (or M-x p-l-p TAB) and install auto-complete from the package list, mark packages with i use x to run the installation of marked packages.
Periodically, opening M-x package-list-packages and pressing U will mark installed packages for updating, press x to run the updates.
This is assuming Emacs 24.