Emacs tramp errors - emacs

When I try to open a file on another machine using tramp 2.1.9, it logs me into the machine and shows the file, but then this appears in the minibuffer:
File mode specification error: (wrong-number-of-arguments #[(filename) "\306^H!\205!^#\307^H!^Y\310 !^Z\311 !^[\312 !^\\313 !^]\314
^K^L\315$-\207" [filename v method user host localname tramp-tramp-file-p tramp-dissect-file-name tramp-file-name-method tramp-file-name-user tramp-file-name-host tramp-file-name-localname tramp-make-tramp-file-name ""] 5 ("/usr/local/share/emacs/s\
ite-lisp/tramp.elc" . 133124)] 3)
Directory-local variables error: (wrong-number-of-arguments #[(filename) "\306^H!\205!^#\307^H!^Y\310 !^Z\311 !^[\312 !^\\313 !^]\314
^K^L\315$-\207" [filename v method user host localname tramp-tramp-file-p tramp-dissect-file-name tramp-file-name-method tramp-file-name-user tramp-file-name-host tramp-file-name-localname tramp-make-tramp-file-name ""] 5 ("/usr/local/share/emacs/s\
ite-lisp/tramp.elc" . 133124)] 3)
Error: (wrong-number-of-arguments #[(filename) \306^H!\205!^#\307^H!^Y\310 !^Z\311 !^[\312 !^\\313 !^]\314
^K^L\315$-\207 [filename v method user host localname tramp-tramp-file-p tramp-dissect-file-name tramp-file-name-method tramp-file-name-user tramp-file-name-host tramp-file-name-localname tramp-make-tramp-file-name ] 5 (/usr/local/share/emacs/site-\
lisp/tramp.elc . 133124)] 3)
And I can't move around the file. Anyone experienced this? The only tramp-related lines in my .emacs file are:
(require 'tramp)
(setq tramp-default-method "ssh")

It looks like your shell prompt is appearing in that error string. If the remote shell prompt is an issue, I'm a little surprised that tramp gets as far as loading the file. But, one easy way to diagnose whether the remote shell prompt is an issue is to temporarily move aside your .bashrc (or whatever shell customizations you have that /bin/sh would load).
Here's the tramp manual on remote shell setup.
As for a solution (if the prompt is an issue), I have accumulated a set of conditions for falling back to a simple prompt (but I no longer recall which tests are used to avoid particular issues).
if [ "$TERM" == "vt100" -o "$TERM" == "dumb" -o "$EMACS" == "t" ]; then
export PS1="\h [\W]> "
else
...set fancy prompt here...
fi
(I also test for ! -z "$PS1" before doing any shell customizations, but I'm pretty sure the tramp shell is interactive.)

Related

Flycheck warning in Emacs’ *Messages* buffer are not displayed correctly

The following is an example of how my flycheck errors show up on emacs:
Method name "createQATask" doesn't conform to
'[a-z_][a-z0-9_]{2,30}$' pattern [invalid-name]
Here are the checkers I’m running (checked through C-c ! v):
Syntax checkers for buffer __manifest__.py in python-mode:
First checker to run:
python-flake8
- may enable: yes
- executable: Found at /usr/bin/python3
- configuration file: Not found
- `flake8' module: Found at "/home/devdesk4/.local/lib/python3.5/site-packages/flake8/__init__.py"
- next checkers: python-pylint, python-mypy
Checkers that may run as part of the first checker's chain:
python-pylint
- may enable: yes
- executable: Found at /usr/bin/python3
- configuration file: Found at "/home/devdesk4/.pylintrc"
- `pylint' module: Found at "/home/devdesk4/.local/lib/python3.5/site-packages/pylint/__init__.py"
- next checkers: python-mypy
Checkers that could run if selected:
python-pycompile select
- may enable: yes
- executable: Found at /usr/bin/python3
- next checkers: python-mypy
I’ve tried disabling python-pylint’s configuration file, but the behavior still remains. I’ve also tried a minimal .emacs configuration which only contained the following:
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")
("melpa-stable" . "https://stable.melpa.org/packages/")))
(use-package flycheck
:ensure t
:init
(global-flycheck-mode t))
Are those symbols (", ') not being displayed properly, or is this some sort of default flycheck configuration that I can override?
April 25, 2020 Update (Possible Solution)
Weirdly, I executed pip install --upgrade pylint just to check if I really had the latest version of pylint, and it upgraded from 2.3.0 to 2.4.4, and that fixed the issue.
However, this solution conflicts with using https://pypi.org/project/pylint-odoo/, because it reverts me back to version 2.3.0 which has those html-escape sequences.
Same-day update
It’s confirmed to be an upstream bug in Pylint.
The following is an example of how my flycheck errors show up on emacs:
Method name "createQATask" doesn't conform to '[a-z_][a-z0-9_]{2,30}$' pattern [invalid-name]
The linter evidentially believes it should be producing HTML output.
By the looks of it you are running all of python-flake8, python-pylint, and python-mypy. I suggest that you firstly test them one at a time to establish which one is producing that output, and then look at the documentation for that tool to find out how to prevent it from generating HTML.

idris-mode – Buffer *idris-repl* has no process

I'm trying to get idris-mode to work. I am using HEAD from both idris-dev and idris-mode. Whenever I execute C-l (idris-load-file) I get this error
Debugger entered--Lisp error: (file-error "make client process failed" "connection refused" :name "Idris Ideslave" :buffer "*idris-connection*" :host "127.0.0.1" :service 0 :nowait nil)
make-network-process(:name "Idris Ideslave" :buffer "*idris-connection*" :host "127.0.0.1" :service 0 :nowait nil)
open-network-stream("Idris Ideslave" "*idris-connection*" "127.0.0.1" 0)
(setq idris-connection (open-network-stream "Idris Ideslave" (idris-buffer-name :connection) "127.0.0.1" port))
.............snipped
Whenever I try M-x idris-repl it states Buffer *idris-repl* has no process.
The result from this thread was to update the projects from git. However I'm using the most up-to-date versions from each project.
edit: running make also fails, but that's probably a different issue. If I manually checkout 0.9.16, make will pass but the same issue above persists.
edit: I do not have this installed locally, I am running it out of a cabal sandbox. In idris-settings.el I changed idris-interpreter-path to the full path of idris. Also, when I run idris outside of emacs I get errors about not finding prelude or builtins. If I add -i path/to/idris/libs/prelude then everything works. But adding "-i path/to/idris/libs/prelude" to idris-interpreter-flags in idris-settings.el does not help
I've sort of solved this. For idris-interpreter-flags you must give each actual argument as a separate string (which is common, I should have known). So, if I set idris-interpreter-flags to '("-i" "/path/to/idris/libs/prelude") then all is good. So I have to add the path for each of the libraries' directories that idris comes with.
How does this work? Is this normal to require? Is it because I'm not running this as a true cabal installed package that it doesn't pick up on the libraries?

Flycheck-Google-Cpplint is not Configured Correctly

I am trying to install flycheck-google-cpplint in my emacs. But I get this error:
(flycheck-mode 1)
(eval-after-load 'flycheck
'(progn
(require 'flycheck-google-cpplint)
(flycheck-add-next-checker 'c/c++-cppcheck
'c/c++-googlelint 'append)))
(custom-set-variables
'(flycheck-googlelint-verbose "3")
'(flycheck-googlelint-filter "-whitespace,+whitespace/braces"))
But this does not work. I get the following error:
Error: (user-error "Configured syntax checker c/c++-googlelint cannot be used")
I don't know why. I installed cpplint and it works fine if I used it from the command line. Any suggestion?
flycheck-google-lint uses cpplint. You have to tell emacs where to find the cpplint.py executable in order to run the syntax check.
You can find the cpplint file here.
Then, you need to add this to your init emacs file:
(custom-set-variables
'(flycheck-c/c++-googlelint-executable "/path/to/cpplint.py"))

How do I change directory in command line with Clojure?

What I'm looking for is this kind of command line interaction at the Windows command line:
C:\temp1>clj some_script.clj
C:\temp2>
Where some_script.clj contains something like:
(cd "c:\\temp2")
So the question is - how do I implement the function cd? Have experimented with clojure.java.shell, but it does not look like the lib I need. This might be a simple question, the problem might be that I'm not fluent in Java?!
You can't do this in Java, so you can't do it in Clojure. See Changing the current working directory in Java?
clojure can do this.
You only need to change a dynamic global variable called *sh-dir*. run the following code in your repl:
(use '[clojure.java.sh])
(sh "ls")
=> {:exit 0, :out "LICENSE\nREADME.md\nauto_deploy.iml\ndoc\nproject.clj\nresources\nsrc\ntarget\ntest\n", :err ""}
(binding [*sh-dir* "c:/"] (sh "ls"))
{:exit 0,
:out "$360Section
$GetCurrent
$Recycle.Bin
Boot
Documents and Settings
ImbaMallLog.txt
Intel
MSOCache
OEMSY
PerfLogs
Program Files
Program Files (x86)
ProgramData
Python27
Recovery
System Volume Information
Users
Windows
apache-ant-1.9.3
bootmgr
hiberfil.sys
inetpub
pagefile.sys
",
:err ""}
see the doc for more info. you can use (alter-var-root #'clojure.java.shell/*sh-dir* (constantly "the-cd-path")) to change it constantly. Thanks for isaac telling me about this.
Hope this helps.

Eval not working on unexpanded macro quote

In common lisp I can do this:
src-> (defmacro macro-hello ()
`"hello")
(eval '(macro-hello))
no problem.
In clojure:
(defmacro macro-hello []
`"hello")
(eval '(macro-hello))
gives me an error. Have I done something wrong?
Clojure Error:
Exception in thread "main" java.lang.Exception: Unable to resolve symbol: macro-hello in this context (NO_SOURCE_FILE:12)
at clojure.lang.Compiler.analyze(Compiler.java:4340)
at clojure.lang.Compiler.analyze(Compiler.java:4286)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:2767)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:4498)
at clojure.lang.Compiler.analyze(Compiler.java:4325)
at clojure.lang.Compiler.analyze(Compiler.java:4286)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:3862)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:3697)
at clojure.lang.Compiler$FnMethod.access$1100(Compiler.java:3574)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2963)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:4494)
at clojure.lang.Compiler.analyze(Compiler.java:4325)
at clojure.lang.Compiler.eval(Compiler.java:4530)
at clojure.core$eval__3990.invoke(core.clj:1728)
at com.yourcompany.defpackage$_main__4.invoke(defpackage.clj:12)
at clojure.lang.AFn.applyToHelper(AFn.java:171)
at clojure.lang.AFn.applyTo(AFn.java:164)
at com.yourcompany.defpackage.main(Unknown Source)
Caused by: java.lang.Exception: Unable to resolve symbol: macro-hello in this context
at clojure.lang.Compiler.resolveIn(Compiler.java:4682)
at clojure.lang.Compiler.resolve(Compiler.java:4628)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:4605)
at clojure.lang.Compiler.analyze(Compiler.java:4307)
... 17 more
Java Result: 1
[Edited]: added ending double quote
Your code works for me.
user> (defmacro macro-hello [] `"hello")
#'user/macro-hello
user> (eval '(macro-hello))
"hello"
This is via bleeding-edge Clojure. "Unable to resolve symbol" means it can't find the macro called macro-hello in the current namespace. Are you running this from the REPL or in a source file? I typed your statements at a REPL literally.
Not sure if this is a cause of problems for you, but please note the difference between ` and ' in Clojure. ` does namespace resolution and ' doesn't.
user> `macro-hello
user/macro-hello
user> 'macro-hello
macro-hello
This is different from Common Lisp's behavior. Backtick-quoting a String like `"hello" doesn't make much sense, since Strings don't belong to namespaces, but it also doesn't hurt anything.
(I'm assuming you made a typo in your Clojure code, with the missing double-quote.)
I like to work out of /opt on Mac and Linux boxes. To get the Clojure source. (% is Unix prompt)
% cd /opt
% git clone git://github.com/richhickey/clojure.git; #From Unix command line, you'll have an /opt/clojure dir
% cd /opt/clojure
% /opt/netbeans-6.7.1/java2/ant/bin/ant; # Run ant. It ships with Netbeans.
% cd /opt; # mkdir /opt if it's not there.
% git clone git://github.com/richhickey/clojure-contrib.git; # Get contrib
% /opt/netbeans-6.7.1/java2/ant/bin/ant -Dclojure.jar=../clojure/clojure.jar ; # Tell ant where clojure.jar is located
I rename jars to clojure.jar and clojure-contrib.jar
Copy these jars to your Netbean's project lib directory.