1

I am a newbies in Singular. I just downloaded Singular4-0-2_64.dmg, mounted the image, right-ckick, show the package contents, then moved the contents folder to the Applications directory. double-clicking Contents/MacOS/Singular (or Esingular) I have Singular running in a terminal (or via emacs in a terminal). But when I try M-x singular in a running emacs, it says "cannot open load file : no such file or directory, singular".

Then I copied .emacs-general and .emacs-singular to the home directory. Adding the following lines to .emacs

(setq load-path (cons "" load-path)) (autoload 'singular "singular" "Start Singular using default values." t) (autoload 'singular-other "singular" "Ask for arguments and start Singular." t)

changing singular-emacs-home-directory into /Applications/Singular.app/Contents/share/singular/emacs/ it still doesn't work. Also when I replace .emacs with .emacs-singular, replacing the above directory, it gives the error: Warning (initialization): An error occurred while loading `/Users/Me/.emacs':

Symbol's value as variable is void: /Applications/Singular.app/Contents/share/singular/emacs

Am I not finding the right singular-emacs-home-directroty or is there any other problem?

I appreciate your help.

Also I must mention that I am a user of emacs for Macaulay2. For that I have changed .emacs and .emacs-Macaulay2 in order to teach emacs where to look for M2. Is there anything similar to be done for Singular? Shall I have a file .emacs-singular somewhere?

Thanks for your help.

  • Start by locating the file `singular.el` and place that inside your `load-path`, then restart Emacs. From a brief glimpse at the manual -- https://www.singular.uni-kl.de/Manual/4-0-2/sing_23.htm -- it says there are more `elisp` files that will be needed. So, perhaps consider copying them all over to your `load-path` to avoid repeated requests by Emacs for additional files. Or, you could set the path to wherever it is that all the Singular `elisp` files are located. That is your ticket -- find the directory where the `elisp` files for Singular are located. – lawlist Feb 06 '16 at 18:00
  • I don't use Singular, but just downloaded the source code for version `singular-4.0.3.tar.gz` and peeked inside and found: `cmd-cmpl.el`; `ex-cmpl.el`; `hlp-cmpl.el`; `lib-cmpl.el`; `singular.el`; `singular.xpm`. Those all need to be in your load path, and the path to the xpm may need to be adjusted inside one or more of those `elisp` files. – lawlist Feb 06 '16 at 18:36
  • Thanks. I located those files in /Applications/Singular.app/Contents/share/singular/emacs directory. There are two more files in that dir: .emacs-singular and .emacs-general. I copy the content of .emacs-singular below this comment. It includes load path to all of those elisp files. But then-as you've mentioned- I should set the path to that directory. Could I ask how I can do that? – pink-panther Feb 06 '16 at 21:40
  • .emacs-singular content is here: [https://github.com/Singular/Sources/blob/ec3d9a4cd4ac241b8dec6377b20f0658bf3f1341/emacs/.emacs-singular] – pink-panther Feb 06 '16 at 21:43
  • By default, Emacs does not just read `.emacs-general` or `.emacs-singular` -- even if they are in the home directory. Instead, Emacs reads things automatically in the home directory such as the `.emacs` file. Check the value of `load-path` to see if it really contains the path to the `*.el` files you want to use. The error you mentioned in the question -- "*cannot open load file : no such file or directory, singular*" -- is 99.99999999 percent probability that `singular.el` is not located in the `load-path`. Type: `M-x describe-variable RET load-path RET` Consider using `.emacs` instead. – lawlist Feb 06 '16 at 21:50
  • I actually copied .emacs-singular to the home dir and then renamed it to .emacs. It includes: ; load singular.el from `singular-emacs-home-directory' (load-file (concat singular-emacs-home-directory "singular.el")) ; load .emacs-general from home or `singular-emacs-home-directory' (if (file-exists-p "~/.emacs-general") (load-file "~/.emacs-general") (if (file-exists-p (concat singular-emacs-home-directory ".emacs-general")) (load-file (concat singular-emacs-home-directory ".emacs-general")))) – pink-panther Feb 06 '16 at 22:01
  • When I replace singular-emacs-home-directory with the directory that includes those elisp files, then I get the error: Warning (initialization): An error occurred while loading `/Users/Me/.emacs': Symbol's value as variable is void: /Applications/Singular.app/Contents/share/singular/emacs – pink-panther Feb 06 '16 at 22:03
  • Btw, you are right, checking the value of load-path, it doesn't contain those elisp files. – pink-panther Feb 06 '16 at 22:07
  • So, open up your `/Users/Me/.emacs` and see where it is that you specified `/Applications/Singular.app/Contents/share/singular/emacs` -- Emacs is tell you that is a **no no** :) – lawlist Feb 06 '16 at 22:28
  • Here is the part of /Users/Me/.emacs that I've specified that directory: ; load singular.el from `/Applications/Singular.app/Contents/share/singular/emacs' (load-file (concat /Applications/Singular.app/Contents/share/singular/emacs "singular.el")) ; load .emacs-general from home or `/Applications/Singular.app/Contents/share/singular/emacs' (if (file-exists-p "~/.emacs-general") (load-file "~/.emacs-general") (if (file-exists-p (concat /Applications/Singular.app/Contents/share/singular/emacs ".emacs-general")) (load-file (concat /Applications/Singular.app/Contents/share/sin – pink-panther Feb 07 '16 at 08:07
  • What about moving those lisp files to ~/.emacs.d/ directory? Does that change anything? – pink-panther Feb 07 '16 at 08:11
  • You need to double-quote the path and add a forward slash at the end -- because Emacs does not know it is a string -- Emacs thinks the path is something like BIRD or DOG or FISH, which have not yet been defined as variables. `(load-file (concat "/Applications/Singular.app/Contents/share/singular/emacs/" "singular.el"))` **or** simply `(load-file "/Applications/Singular.app/Contents/share/singular/emacs/singular.el")` The `.emacs.d` is not technically in the `load-path` -- people usually add a sub-directory -- e.g., `/lisp` and then put stuff in there and add it to the `load-path`. – lawlist Feb 07 '16 at 08:30
  • I double quoted the path and put a slash. Now I get the error: Wrong type argument: symbolp, /Applications/Singular.app/Contents/share/singular/emacs/ – pink-panther Feb 07 '16 at 09:11
  • I checked other parts of the .emacs file and fixed other loaded paths and don't get anymore that error when I run emacs. However, M-x singular does not start singular!!! Any idea? – pink-panther Feb 07 '16 at 10:13

1 Answers1

1

Here are some basic settings that assume the Singular.app has been installed to the /Applications folder. I chose to set the absolute path to the executable, instead of setting the PATH in Emacs. The PATH in Emacs on OSX is (by default) not the same as what one would generally except to see in let's say Terminal.app. [But, setting the PATH is beyond the scope of this basic answer.]

My personal preference is to have all of the lisp and configuration files in a custom directory for purposes of editing and backup up. This limited example just leaves everything where they are.

In the Emacs master branch (February 7, 2016), there is no built-in variable named current-menubar -- the configuration files are looking for the existence of that variable. I did not spend the time to debug the built-in configuration files to find out what version of Emacs they were designed for, and I did not spend the time to make the Singular elisp libraries compatible with the latest Emacs master branch.

Add the following lines of code to the .emacs file in the home directory, save the file, and restart Emacs. Then type M-x singular RET

(add-to-list 'load-path "/Applications/Singular.app/Contents/share/singular/emacs/")
(require 'singular)
(setq singular-emacs-home-directory "/Applications/Singular.app/Contents/share/singular/emacs/")
(defvar current-menubar nil)
(setq singular-executable-default "/Applications/Singular.app/Contents/MacOS/Singular")
(load-file "/Applications/Singular.app/Contents/share/singular/emacs/.emacs-general")
(load-file "/Applications/Singular.app/Contents/share/singular/emacs/.emacs-singular")
lawlist
  • 13,099
  • 3
  • 49
  • 158
  • I added the code to .emacs. Now [M-x singular] opens a new emacs window and also Singular running in terminal. But I want singular to be running in an emacs buffer. For that I changed the 5th line in the above code into [(setq singular-executable-default "/Applications/Singular.app/Contents/MacOS/ESingular")], but no success. Any idea? – pink-panther Feb 08 '16 at 12:07
  • I investigated just enough about this issue to ascertain how to load the built-in libraries, however, I did not dig into the code to find out what makes it tick. I'm not even sure how it is supposed to work -- sorry. Perhaps you could Google around for a tutorial with pictures to give you a better idea of what the `elisp` libraries are used for. When investigating an error in Emacs, it is helpful to set `(setq debug-on-error t)` so that Emacs generates a more useful backtrace buffer. – lawlist Feb 08 '16 at 16:25