Cannot Open fi-site-init.el - emacs

Lately i've been trying to install ELI on my Linux computer!
I've followed the guide from http://www.franz.com/emacs/ to make it work! I've also searched for similar errors and found this thread http://ubuntuforums.org/showthread.php?t=1646855
However unlike the person in the forum I cannot load the fi-site-init.el file from the scratch buffer.
By opening emacs with the --debug-init flag i get the following error messege
Debugger entered--Lisp error: (file-error "Cannot open load file" "fi-site-init.el")
load("fi-site-init.el")
eval-buffer(#<buffer *load*> nil "/home/simon/.emacs" nil t) ; Reading at buffer position 82
load-with-code-conversion("/home/simon/.emacs" "/home/simon/.emacs" t t)
load("~/.emacs" t t)
#[nil "\205\264
What can be worth noticing is that in the guide they have
"/usr/local/acl82express/eli"
as the search path while i'm having
"/usr/Documents/acl82express/eli"
as path (since Allegro CL is installed there)
All in all this is what I've writed in the .emacs file
(push "/usr/Documents/acl82express/eli" load-path)
(load "fi-site-init.el")
(setq fi:common-lisp-image-name "/usr/Documents/acl82express/alisp")
(setq fi:common-lisp-image-file "/usr/Documents/acl82express/alisp.dxl")
(setq fi:common-lisp-directory "/usr/Documents/acl82express")
I am thankful for any help!
Simon Nyström

Documents is typically the name of the directory in the user home directory. It is customary to find it under /home/{user}/Documents where {user} is the currently logged in user. who am i | awk '{ print $1 }' - this is the way to find out, unless you forget :)
This directory is often times aliased with ~ (tilde) or $HOME environmental variable, so that when doing path expansion happens these "$HOME/Documents", "~/Documents" and "/home/{user}/Documents" will all point to the same directory.

Notice the leading "/"-symbol. I'm quite sure it'd have to be "/usr/Documents/acl82express/eli" for you.

Related

latex-preview-pane-update couldn't find "pdflatex" directory when emacs loading hello.tex

I run my hello.tex file. But it always has the warning:
Error running timer ‘latex-preview-pane-update’: (file-error
"Searching for program" "No such file or directory" "pdflatex")
I've checked .emacs file. I've been adding script in .emacs.
(setenv "PATH" "/Library/TeX/texbin:$PATH" t)
(latex-preview-pane-enable)
But it still dosen't work.
How can I do now?
You need to update the exec-path. Your solution should work with call-process-shell-command, but that uses call-process. So, you want something like
(cl-pushnew "/Library/TeX/texbin" exec-path :test #'equal)
Then, you can check the program is found with (executable-find "pdflatex").

eshell TRAMP find remote file with relative path (or at least less than the full Tramp path)?

I love eshell's TRAMP integration. With it I can do cd /ssh:foo:/etc to
ssh into a remote machine and visit its /etc/ directory. I can also do
find-file motd to open this file in my local emacs. However, what if I need to use sudo to change the file? I know I can give the
full path, like so:
find-file /sudo:foo:/etc/motd
but is there a way to open the file via TRAMPs sudo support, without having to type the full path?
I managed to came up with the following eshell alias that works for me:
alias sff 'find-file "${pwd}/$1"(:s/ssh/sudo/)'
It should be fairly obvious what it does. It prepends the working directory
path, but with the string ssh replaced by sudo. Thus it only works for
remote files accessed over ssh. I rarely edit files using sudo locally, so
that's not a problem for me. However, we can make it work for local files too, at the cost of complexity:
alias sff 'find-file "${pwd}/$1"(:s,^,/sudo::,:s,::/ssh:,:,)'
That is, prepend /sudo:: (which is how to sudo for local files) and
subsequently replace any ocurrence of ::/ssh: with :. (I would have just removed :/ssh:, but eshell's :s/// construct didn't accept an empty
replacement.)
I found an alternative answer that works very well over at EmacsWiki.
Using that you'd still open the file with find-file as usual, but then
invoke M-x sudo-edit-current-file (shown below) to re-open the file as root
using Tramp. I think this is a very elegant solution, because often I
initially just want to look at a file, then later find that I need to edit it.
Here's the function, in case it disappears from the page above:
(set-default 'tramp-default-proxies-alist (quote ((".*" "\\`root\\'" "/ssh:%h:"))))
(require 'tramp)
(defun sudo-edit-current-file ()
(interactive)
(let ((position (point)))
(find-alternate-file
(if (file-remote-p (buffer-file-name))
(let ((vec (tramp-dissect-file-name (buffer-file-name))))
(tramp-make-tramp-file-name
"sudo"
(tramp-file-name-user vec)
(tramp-file-name-host vec)
(tramp-file-name-localname vec)))
(concat "/sudo:root#localhost:" (buffer-file-name))))
(goto-char position)))

Error when loading emacs with emacs-live

When I start emacs I get the error
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-match("cmd\\.exe" nil)
(if (string-match "cmd\\.exe" tramp-encoding-shell) "/c" "-c")
eval((if (string-match "cmd\\.exe" tramp-encoding-shell) "/c" "-c"))
this appears to occur when loading the magit pack
eval-buffer(#<buffer *load*-330059> nil "c:/cygwin64/home/johnstonk/.emacs.d/emacs-live/packs/stable/git-pack/lib/magit/magit.el" nil t) ; Reading at buffer position 3100
I confirmed this occurs with a fresh git clone of emacs-live.
I tried removing the magit pack from loading in the live init file but I got the same error again when it loaded the clojure pack. Looks like a nil string error in tramp.
Does anyone know why?
Going through and loading the source code for tramp-sh.el I got the same (wrong-type-argument stringp nil) on the first line (require 'tramp)
So I loaded tramp.el (version 22.1) and got to the section
(defcustom tramp-encoding-shell
(if (memq system-type '(windows-nt))
(getenv "COMSPEC")...
I noticed that this system-type is getting set to windows-nt (As it should, I'm on windows7) but (getenv "COMSPEC") is returning nil. From what I googled elsewhere this COMSPEC environment variable is expected to exist on windows machines and point to the shell. Tramp uses the tramp-encoding-shell var for encoding and decoding commands on the local machine such as "~" -- at least according to tramps comments.
COMSPEC didn't exist as an system environment variable for me so I created it and pointed it to cmd.exe C:\Windows\System32\cmd.exe That fixed it for me.
Note don't set COMSPEC to powershell, I tried that first but got a nasty memory leak when I tried to use lein (keeps trying to create a server, fails, and tries again but doesn't clean up previous thread).

loading icicle-mode in emacs on startup by default

I would like to configure emacs so that the Icy mode is active by default. As suggested in "icicles-doc1.el", I added the following code at the end of my .emacs file:
(require 'icicles)
(icicle-mode 1)
When I run emacs, I get a *Warning* buffer:
Warning (initialization): An error occurred while loading `c:/Users/USER/AppData/Roaming/.emacs':
File error: Cannot open load file, icicles
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
When I do the debug option, a *Backtrace* buffer says something like:
Debugger entered--Lisp error: (file-error "Cannot open load file" "icicles")
require(icicles)
eval-buffer(# nil "c:/Users/USER/AppData/Roaming/.emacs" nil t) ;
Reading at buffer position 5062
load-with-code-conversion("c:/Users/USER/AppData/Roaming/.emacs"
"c:/Users/USER/AppData/Roaming/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
With or without those two lines in my .emacs that are causing the problem, icicle-mode seems to work fine when I do a M-x icicle-mode.
(file-error "Cannot open load file" "icicles") means that Emacs didn't know where to find library icicles.el[c]. You need to put the location of the Icicles files in variable load-path.
E.g, if your Icicles files are in directory /my/icicles/ then you need to do this (e.g., in your init file, ~/.emacs):
(add-to-list 'load-path "/my/icicles/")
Do that before you do (require 'icicles). That way, Emacs will know where to load Icicles from.
Given that the (require 'icicles) code is failing, but the M-x icy-mode is working, then it seems that someone has already set up your Emacs installation to include icicles via an autoload command, but didn't update the load-path to include the directory where icicles.el resides.
Replace those two lines with:
(icy-mode 1)
(which is the equivalent of M-x icy-mode when icicles has yet to be enabled)
If you want to use a different version of icicles, then you need to add the proper directory to the load path.

Open a file with su/sudo inside Emacs

Suppose I want to open a file in an existing Emacs session using su or sudo, without dropping down to a shell and doing sudoedit or sudo emacs. One way to do this is
C-x C-f /sudo::/path/to/file
but this requires an expensive round-trip through SSH. Is there a more direct way?
[EDIT] #JBB is right. I want to be able to invoke su/sudo to save as well as open. It would be OK (but not ideal) to re-authorize when saving. What I'm looking for is variations of find-file and save-buffer that can be "piped" through su/sudo.
The nice thing about Tramp is that you only pay for that round-trip to SSH when you open the first file. Sudo then caches your credentials, and Emacs saves a handle, so that subsequent sudo-opened files take much less time.
I haven't found the extra time it takes to save burdening, either. It's fast enough, IMO.
Tramp does not round-trip sudo via SSH, it uses a subshell. See the manual: https://www.gnu.org/software/tramp/#Inline-methods
Therefore, I recommend that you stick with TRAMP.
If you use helm, helm-find-files supports opening a file as root with C-c r.
Not really an answer to the original question, but here's a helper function to make doing the tramp/sudo route a bit easier:
(defun sudo-find-file (file-name)
"Like find file, but opens the file as root."
(interactive "FSudo Find File: ")
(let ((tramp-file-name (concat "/sudo::" (expand-file-name file-name))))
(find-file tramp-file-name)))
Your example doesn't start ssh at all, at least not with my version of TRAMP ("2.1.13-pre"). Both find-file and save-buffer work great.
At least for saving, a sudo-save package was written exactly for that kind of problem.
I recommend you to use advising commands. Put this function in your ~/.emacs
(defadvice ido-find-file (after find-file-sudo activate)
"Find file as root if necessary."
(unless (and buffer-file-name
(file-writable-p buffer-file-name))
(find-alternate-file (concat "/sudo:root#localhost:" buffer-file-name))))
(works only locally. Need to be updated to work correctly via tramp)
A little bit extended Burton's answer:
(defun sudo-find-file (file-name)
"Like find file, but opens the file as root."
(interactive "FSudo Find File: ")
(let ((tramp-file-name (concat "/sudo::" (expand-file-name file-name))))
(find-file tramp-file-name)))
(add-hook 'dired-mode-hook
(lambda ()
;; open current file as sudo
(local-set-key (kbd "C-x <M-S-return>") (lambda()
(interactive)
(message "!!! SUDO opening %s" (dired-file-name-at-point))
(sudo-find-file (dired-file-name-at-point))
))
)
)
Ugh. Perhaps you could open a shell in Emacs and exec sudo emacs.
The problem is that you presumably don't just want to open the file. You want to be able to save it later. Thus you need your root privs to persist, not just exist for opening the file.
Sounds like you want Emacs to become your window manager. It's bloated enough without that. :)
I find sudo edit function very useful for that. After opening a file, press s-e to have sudo access to edit/save the file.