Trouble setting up M2 with emacs through ssh

78 views
Skip to first unread message

Rebecca R.G.

unread,
Oct 26, 2016, 9:36:59 PM10/26/16
to Macaulay2
Hello,

I am attempting to run Macaulay2 on a remote computer using SSH (computer is running Ubuntu 14.04). I am able to run M2 from the command line, and used the setupEmacs() command, but when I try M-x M2 in emacs, I get [No match]. I checked the .emacs file, which contains the text
(load "~/.emacs-Macaulay2" t)

My guess is that Macaulay2 isn't where emacs is expecting to find it, but I was unable to find the file M2-init.el; it wasn't in ~, and I was denied permission to search higher up. Is this something I could still fix on my own, or will I need to get someone with more access to the computing cluster to help me with this? Is there something else I can try?

I did try C-h v and looked at the load-path, which got me:

load-path is a variable defined in `C source code'.
Its value is
("/etc/emacs24" "/etc/emacs" "/usr/local/share/emacs/24.3/site-lisp" "/usr/local/share/emacs/site-lisp" "/usr/share/\
emacs/24.3/site-lisp" "/usr/share/emacs/site-lisp" "/usr/share/emacs/24.3/lisp" "/usr/share/emacs/24.3/lisp/vc" "/us\
r/share/emacs/24.3/lisp/url" "/usr/share/emacs/24.3/lisp/textmodes" "/usr/share/emacs/24.3/lisp/progmodes" "/usr/sha\
re/emacs/24.3/lisp/play" "/usr/share/emacs/24.3/lisp/org" "/usr/share/emacs/24.3/lisp/nxml" "/usr/share/emacs/24.3/l\
isp/net" "/usr/share/emacs/24.3/lisp/mh-e" "/usr/share/emacs/24.3/lisp/mail" "/usr/share/emacs/24.3/lisp/language" "\
/usr/share/emacs/24.3/lisp/international" "/usr/share/emacs/24.3/lisp/gnus" "/usr/share/emacs/24.3/lisp/eshell" "/us\
r/share/emacs/24.3/lisp/erc" "/usr/share/emacs/24.3/lisp/emulation" "/usr/share/emacs/24.3/lisp/emacs-lisp" "/usr/sh\
are/emacs/24.3/lisp/cedet" "/usr/share/emacs/24.3/lisp/calendar" "/usr/share/emacs/24.3/lisp/calc" "/usr/share/emacs\
/24.3/lisp/obsolete" "/usr/share/emacs/24.3/leim")

This variable may be risky if used as a file-local variable.


Thanks for your help!

--Rebecca R.G.

Daniel R. Grayson

unread,
Oct 28, 2016, 7:02:31 AM10/28/16
to Macaulay2
The first thing is to find out whether the file

    ~/.emacs-Macaulay2

exists.  Does it?  If it doesn't exist, no error message will be printed.

If it does exist, it contains the expression

    (load "M2-init")

will load M2-init.el and print an error message if it doesn't exist.  So does it print an error message when you start emacs?
All the error messages are recorded in the buffer named *Messages* .

Rebecca R.G.

unread,
Oct 28, 2016, 2:03:55 PM10/28/16
to Macaulay2
Thanks for the response! The message buffer says:

("emacs")
make-directory: File exists: /home/rirebhuh/.emacs.d/
call-interactively: End of buffer
byte-code: Beginning of buffer
byte-code: End of buffer
call-interactively: Beginning of buffer
byte-code: Beginning of buffer

--Rebecca R.G.

Daniel R. Grayson

unread,
Nov 1, 2016, 3:54:15 AM11/1/16
to Macaulay2
Okay, there are no interesting error messages.

What does the shell command " ls -l ~/.emacs-Macaulay2 " show?

Rebecca R.G.

unread,
Nov 1, 2016, 11:37:38 AM11/1/16
to Macaulay2
It shows:

-rw-r--r-- 1 rirebhuh rirebhuh 992 Oct 26 12:32 /home/rirebhuh/.emacs-Macaulay2

Daniel R. Grayson

unread,
Nov 3, 2016, 9:13:08 AM11/3/16
to Macaulay2



Let's try this:

In ~/.emacs change

(load "~/.emacs-Macaulay2")

to 

(load "~/.emacs-Macaulay2" t)

In ~/.emacs-Macaulay2 make sure it's the line

(load "M2-init")

that is uncommented and not the line

(load "M2-init" t)

Then start emacs again and see if there is any error message this time.

When I do this I get this in the *Messages* buffer:

Loading .emacs
Loading image-file...done
Loading autorevert...done
Loading grep...done
warning: MAIL undefined in environment
An edit-server process is already running
Loading /Users/dan/emacs/coqdebug.el (source)...done
Loading ~/.emacs.d/lisp/PG/generic/proof-site...done
Loaded .emacs
Loading /Users/dan/.emacs-Macaulay2...
Loading /Applications/Macaulay2-1.9.2/share/emacs/site-lisp/M2-init.el (source)...done
Loading /Users/dan/.emacs-Macaulay2...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set [2 times]

Notice that for both .emacs and .emacs-Macaulay2, a message announces the start and end of loading.

Actually, now I notice that the contents of your *Messages* buffer, which was this:

("emacs")
make-directory: File exists: /home/rirebhuh/.emacs.d/
call-interactively: End of buffer
byte-code: Beginning of buffer
byte-code: End of buffer
call-interactively: Beginning of buffer
byte-code: Beginning of buffer

, does not mention ~/.emacs at all.  It's almost as though that file does not exist.  But you said it does.

Is it "emacs" or a variant of "emacs" that you are using?

Here's the documentation of how "emacs" finds its init file; perhaps you are doing something unusual.

51.4.4 How Emacs Finds Your Init File
-------------------------------------

Normally Emacs uses the environment variable ‘HOME’ (*note HOME: General
Variables.) to find ‘.emacs’; that’s what ‘~’ means in a file name.  If
‘.emacs’ is not found inside ‘~/’ (nor ‘.emacs.el’), Emacs looks for
‘~/.emacs.d/init.el’ (which, like ‘~/.emacs.el’, can be byte-compiled).

   However, if you run Emacs from a shell started by ‘su’, Emacs tries
to find your own ‘.emacs’, not that of the user you are currently
pretending to be.  The idea is that you should get your own editor
customizations even if you are running as the super user.

   More precisely, Emacs first determines which user’s init file to use.
It gets your user name from the environment variables ‘LOGNAME’ and
‘USER’; if neither of those exists, it uses effective user-ID.  If that
user name matches the real user-ID, then Emacs uses ‘HOME’; otherwise,
it looks up the home directory corresponding to that user name in the
system’s data base of users.

Becca R.G.

unread,
Nov 3, 2016, 9:54:28 AM11/3/16
to Macaulay2
It looks like ~/.emacs and ~/.emacs-Macaulay2 already have those changes in place, but are not being called by emacs when it starts up. I suspect that I might need to edit ~/.emacs.d instead, but am getting a permission denied message. I've contacted the research computing people here to see if they need to change something on their end. Thanks for the help! This does narrow it down a lot.

--Rebecca R.G.

Becca R.G.

unread,
Nov 3, 2016, 10:21:29 AM11/3/16
to Macaulay2
The research computing people changed a few permissions and it's working now. Thanks for your help in finding the problem!
Reply all
Reply to author
Forward
0 new messages