Emacs haskell-mode: "Searching for program: no such file or directory, ghci" - emacs24

For some reason emacs is not able to find my ghci. I am running Ubuntu 16.04, and followed the instructions in this tutorial to the book.
Using which ghci I get the path /opt/ghc/7.10.3/bin/ghci. And executing M-: exec-path and M-: (getenv "PATH") I can see that path correctly printed.
I have tried to explicitly set the PATH variable in emacs like this, which changes nothing since as far as I could tell it was already there. From this answer.
(setenv "PATH" "/usr/local/bin:/usr/bin:/bin:/opt/cabal/1.22/bin/cabal:/opt/ghc/7.10.3/bin/ghci")
(setq exec-path (split-string (getenv "PATH") path-separator)
The same thing happens when I use
(custom-set-variables '(haskell-process-type 'cabal-repl)) namely the error: "Searching for program: no such file or directory, cabal"
I would greatly appreciate help. :) I have no idea what to do, and I haven't found any answers on the internet.

The issue was that I was adding the path to the actual executable, rather than the folder in which the executable sits.
So:
/opt/cabal/1.22/bin/cabal
should be
/opt/cabal/1.22/bin/
and:
/opt/ghc/7.10.3/bin/ghci
should be
/opt/ghc/7.10.3/bin/

Related

Lua require does not work but file is in the trace

I'm trying to require files in Lua, in one case it is working, but when I want to simplify the requirements in updating the LUA PATH the file is not found, but it is in the trace!
To reproduce my require problem I did the test with the package.searchpath function, which takes the required key and the Lua path in arguments.
So the code :
print('MY LUA PATH')
local myLuaPath = "?;?.lua;D:\\Projets\\wow-addon\\HeyThere\\?;D:\\Projets\\wow-addon\\HeyThere\\src\\HeyThere\\?;D:\\Projets\\wow-addon\\HeyThere\\test\\HeyThere\\?"
print(myLuaPath)
print('package search core.add-test')
print(package.searchpath('core.add-test', myLuaPath))
print('package search test.HeyThere.core.add-test')
print(package.searchpath('test.HeyThere.core.add-test', myLuaPath))
The result :
MY LUA PATH
?;?.lua;D:\Projets\wow-addon\HeyThere\?;D:\Projets\wow-addon\HeyThere\src\HeyThere\?;D:\Projets\wow-addon\HeyThere\test\HeyThere\?
package search core.add-test
nil no file 'core\add-test'
no file 'core\add-test.lua'
no file 'D:\Projets\wow-addon\HeyThere\core\add-test'
no file 'D:\Projets\wow-addon\HeyThere\src\HeyThere\core\add-test'
no file 'D:\Projets\wow-addon\HeyThere\test\HeyThere\core\add-test'
package search test.HeyThere.core.add-test
test\HeyThere\core\add-test.lua
So the first try with 'core.add-test' should work with the 'D:\Projets\wow-addon\HeyThere\test\HeyThere\?' value in the path but fails...
In the trace, there is the file I want!
no file 'D:\Projets\wow-addon\HeyThere\test\HeyThere\core\add-test'
But with the same LUA PATH but starting in a parent folder the file is found... Second test with 'test.HeyThere.core.add-test' found from the 'D:\Projets\wow-addon\HeyThere\?'
-> test\HeyThere\core\add-test.lua
Can someone explains to me why it doesn't work the first time?
EDIT :
My current directory is D:\Projets\wow-addon\HeyThere
My lua.exe is in D:\Projets\wow-addon\HeyThere\bin\lua but is added to my PATH variable (I'm on Windows)
I set the LUA_PATH environment variable and execute
lua "test\test-suite.lua" -v
The code inside test-suite.lua is the test code described above
As #EgorSkriptunoff suggested, adding file extansion in the path resolve the problem...
Ex:
Wrong path D:\Projets\wow-addon\HeyThere\?
Good path D:\Projets\wow-addon\HeyThere\?.lua
The extension should be in the path variable because in the require the dot is replace and used as a folder separator.

Lua io.write() not working

I am using a luvit Lua environment to run my lua code through my control panel. I am looking to write to a .txt file, but with the simple code that i am running, its not working.
The reason I wish to write to a .txt file is to log notices from my Discord Bot I am working on in the Discordia library.
I have a folder called MezzaBOT. In this file i have a write.lua file and also a log.txt file. I have this simple code in my write.lua file:
io.output('log.txt')
io.write('hello\n')
io.close()
I then run in my command promt with Luvit environment:
>luvit Desktop\mezzabot\write.lua
I don't get any errors but the log.txt file continues to stay empty. Am I missing a line in my code, or do i need to access log.txt differently?
edit: my new code is the following
file = io.open('log.txt')
file:write('hello', '\n')
file:close()
and it is not making a new line for each time with \n
edit B:
Ok, i found my problem, its creating a log.txt in my C:\Users\PC.
One other problem is when writing, its not making a new line with the \n. Can someone please help me?
Lua, by default, opens files in read mode. You need to explicitly open a file in write mode if you want to write to it (see manual)
file = io.open('log.txt', 'w')
file:write('hello', '\n')
file:close()
Should work :)

Setting a default editor in Pry

I'm asking about setting a default editor for Pry to use. I'm working on a Rails
app. I created a file named ".pryrc" immediately inside my working directory.
In this file, I wrote this line of code (based on what I read on Github :
Pry.config.editor = proc { |file, line| "sublime +#{line} #{file}" }
This doesn't seem to work. when I try the command ".sublime company.rb", I 'd get
this error:
Error: there was a problem executing system command: sublime company.rb
Can someone tell me what I'm doing wrong please?
Change the configuration to:
Pry.config.editor = proc { |file, line| "sublime #{file}:#{line}" }
You start the editor in Pry by using the edit command.
For example to open test.rb at line 30 use:
edit test.rb:30
See here for more details
For those who have the same problem as mine.Perhaps, you have trouble launching the editor even outside Pry. First thing, make sure to check if the sublime command exists in ur PATH. if not, you probably need to create a symlink between the command and the corresponding path to your app within /usr/local/bin. For more information, see here.

Clang_complete not worrking

unfortunately I can't manage to make clang_complete work and I could need your help.
I've already compiled vim 7.4 with python support. Here is the output of vim --version | grep python:
+cryptv +linebreak +python/dyn +viminfo
-cscope +lispindent +python3/dyn +vreplace
I followed this guide: https://vtluug.org/wiki/Clang_Complete
Please note that I've started from a clean installation (i.e. no other plugins and no further entries in my .vimrc (except for those shown in the guide above)).
According to the tutorials I've seen so far everything should be working.
However, if I try to get code completion for the following example nothing happens. If I press <c-x><x-u> I receive the error "completefunc not set".
#include <string>
int main()
{
std::string s;
s.
}
Moreover, I've installed the newest version of clang from source and it in my $PATH.
Is there a way to verify that clang_complete is actually installed?
What might cause this problem?
Any help is much appreciated.
Add
filetype plugin indent on
to your vimrc, its missing from the vimrc snippet in the link. This tells vim to do filetype detection and fire autocommands related to those file types. Without it you won't run the following autocommands.
au FileType c,cpp,objc,objcpp call <SID>ClangCompleteInit()
au FileType c.*,cpp.*,objc.*,objcpp.* call <SID>ClangCompleteInit()
Which probably initalize ClangComplete.

Pylons + mod_wsgi -> ImportError: No module named paste.deploy

I'm following the example here: http://code.google.com/p/modwsgi/wiki/IntegrationWithPylons
however, it doesn't work - I get "ImportError: No module named paste.deploy" in the apache error log. Googling in this case helps not - I see some stuff about permissions, but all my permissions are fine. Where does paste.deploy really come from? It comes from PasteDeploy-1.3.4-py2.6.egg in site-packages, installed in my pylonsdevenv directory, right? Well, then how is apache supposed to know about that directory? Does the actual pylons project have to be in the pylonsdevenv directory?
thanks!
I added:
import site
site.addsitedir('/<yadayada>/pylonsdevenv/lib/python2.6/site-packages')
to the top of my wsgi file, and then set debug = False in my development.ini file (and later, deployment.ini file, I presume), that seemed to work...
If you can import (from paste.deploy import loadapp) manually it has to be a problem with sys.path. Also make sure that apache uses proper python interpreter. I have something like this in my "passanger_wsgi.py" on Dreamhost:
INTERP = "/home/myuser/bin/python"
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
cwd = os.getcwd()
sys.path.append(os.getcwd())
sys.path.append('/home/myuser/blog')
You can try put some debug and check which paths are inside "sys.path".
Hope this helps.

Resources