What to do if I cannot find my emacs init file? - emacs

I am trying to add haskell-mode to emacs by following these instructions:
http://doc.gnu-darwin.org/haskell-mode/installation-guide.html
This involves that I add some code to my ~/.emacs init file. However, my issue is that I cannot locate my emacs init file. I tried using find commands to locate it, as so:
find . -name "*emacs*"
find . -name "~/.emacs"
However none of these appear to be very successful, as I get either too many results, or no results.
So, given my situation, since I cannot locate my ~/.emacs init file, does this mean it does not exist? In that case, would it be smart to create one myself using the emacs editor? If so, are there any outstanding things I should know before attempting to create one?

C-x C-f ~/.emacs will take you to it.
See the Emacs manual, nodes Init File and Find Init.

To open your emacs init file, type M-: (find-file user-init-file) RET. If you only want to see its path, you can use C-h v user-init-file RET.

You can also create it yourself, if I'm not wrong installing emacs doesn't create automatically the file all the times. Just type in the terminal with your text editor (vim, vi, nano, etc) of preference:
vim ~/.emacs
And edit it the way you want :-)

Related

How to set executable path for a package on a configuration file on Emacs?

I want to use "ediprolog" package on Emacs. I followed installation and usage instruction here https://www.metalevel.at/ediprolog/ and he says:
The two most important configuration options are:
ediprolog-system, either scryer (default) or swi
ediprolog-program, the path of the Prolog executable.
So I tried C-X , customize-group , ediprolog and checked the configuration file. The files looks like this:
To be honest I have no idea how, where can I edit to add the prolog executable path ~/.cargo/bin/scryer-prolog. In addition, Emacs says You can't edit this part of the Custom buffer when I tried to type something on the file.
And as I can expected, when I run ediprolog-dwim, "view-echo" says ediprolog-run-prolog: No prompt from: scryer-prolog, probably because I don't set the path on a configuration file.
I'm noob to Emacs and the package also, sorry about that, but I'm really struggling to achieve this step. Your comments must be really helpful for me. Thanks.
Try adding the path to the exec-path variable in emacs: when emacs forks off a subshell, this variable is added to the PATH that is passed to the subshell:
(add-to-list 'exec-path (expand-file-name (substitute-in-file-name "$HOME/.cargo/bin")))

Required feature ‘scheme’ was not provided (scheme REPL in emacs)

It's probably very easy but I simply can't get a running scheme REPL in emacs.
First I installed MIT scheme and added
(setq scheme-program-name "my/path/to/bin/mit-scheme.exe")
to my init.el. But when I typed M-x run-scheme RET I got the error
Required feature ‘scheme’ was not provided
So I installed quack and added (require 'quack) to my init.el
Now when I start emacs I get the same error:Required feature ‘scheme’ was not provided
Am I missing a step?
Update
Maybe it simply doesn't work under windows:
Running Scheme under gnu-emacs If you want to run Scheme as an
inferior process in gnu-emacs or xemacs (again, this is not an option
on Windows machines), then you'll need to:
Download the xscheme.elc file. This is a byte-compiled elisp file that tells emacs how to run and interact with MIT Scheme. (Source file
is xscheme.el in case you're interested.)
This file should replace the xscheme.elc file that comes with emacs. You'll have to find the appropriate directory on your system.
On my Mandrake Linux system, this is the directory:
/usr/share/emacs/21.3/lisp. (This step is not necessary if you are
running MIT/GNU Scheme from the CS department machines.)
Add the following line to your ~/.emacs file
(load-library "xscheme")
Source (from 2005): http://www.cs.rpi.edu/academics/courses/fall05/ai/scheme/starting.html
Following doesn't work either
Quick Setup
Here is the short list of instruction's for those of you who want to
get started in a hurry. An explanation of each step follows below.
Open up emacs (or any other editor) in you home directory.
Open up the file ".emacs" and add the following line: (set-variable (quote scheme-program-name) "stk")
Save the file. You only need to do steps 1-3 once. If you were editing the file in Emacs, restart Emacs.
Start up Emacs and type the following sequence of keys:
M-x
run-scheme
A new buffer will open up with stk started inside of it.
Source: http://www-users.cs.umn.edu/~gini/1901-07s/emacs_scheme/
The error "required feature scheme was not provided" means that the first "scheme.el" found in your load-path does not contain a provide statement. Either your Emacs installation is broken (unlikely), or (more likely) you've installed some random scheme.el that hides the default one. Find it and remove it. Eg try M-x list-load-path-shadows.

How to read org-mode documentation inside Emacs?

I installed Emacs 24.3.1 (using homebrew), which already comes with org-mode, but I can't find the documentation for org-mode within the Emacs built-in documentation (accessible via C-h i).
I can find the org-mode docs online here, but I'd prefer to read it directly in Emacs.
I find it very strange (in fact almost antithetical to the whole org-mode text orientation) to find myself having to read this documentation using a web browser, and not right inside Emacs.
Do I need to download and install this documentation separately in order to read it within Emacs? If so, where can I find the appropriate (texinfo?) files?
Or is this documentation already bundled by default with Emacs (and I just need to configure my current Emacs installation to be able to browse it through C-h i)?
Call up the info with C-h i.
Then call g (Info-goto-node).
Enter (org) at the prompt.
Or C-h o with the following code in your .emacs file:
(with-eval-after-load "org"
;; Display the Org mode manual in Info mode.
(define-key global-map (kbd "C-h o") 'org-info)) ; Not autoloaded!?
If you can access the Org mode documentation as others like abo-abo have described, you are all set. Read on if you still don't find it.
In your running emacs, look at the variable Info-directory-list. It's value may look somethng like this:
("/home/myself/.emacs.d/elpa/org-plus-contrib-20141222" "/usr/share/info/emacs-24" "/usr/share/info/" "/usr/share/info/")
The point here is there should be a directory which contains the Org mode documentation. Here it is the directory "/home/myself/.emacs.d/elpa/org-plus-contrib-20141222". You can look in that directory for a file called dir - which describes info files in this directory. In dir, a line like:
* Org Mode: (org). Outline-based notes management and organizer
says there is an info node describing Org Mode, and the top of that node is in the file org, in that directory. So you should make sure that file is in the directory.

Emacs update-file-autoloads failing

I'm trying to setup emacs to be my GO IDE by following this tutorial with this code . I'm running into problems when I have to have emacs generate a file
From within Emacs, run M-x update-file-autoloads, point it at the go-mode.el file and tell it to generate a go-mode-load.el file.
I get this error when I enter the path of the file (location ~/.emacs.d/go-mode/go-mode.el)
Opening output file: no such file or directory, /build/buildd/emacs23-23.3+1/debian/build-x/lisp/loaddefs.el
I did a locate on this file and see I do have it but not at the path specified path above
$ locate loaddefs.el
/usr/share/emacs/23.3/lisp/loaddefs.el
...
If I had to guess I would say some kind of path problem. Do I have to set a path variable somewhere?
I installed emacs through apt-get install emacs23
I'm on Ubuntu 12.04
Thanks
EDIT
The process I'm doing to get the error.
M-x update-file-autoloads Enter
Update autoloads for file: ~/.emacs.d/go-mode/go-mode.el Enter
Opening output file: no such file or directory, /build/buildd/emacs23-23.3+1/debian/build-x/lisp/loaddefs.el
I had the same problem and finally got it working. Open your scratch buffer (or any other empty file) and type in the following two lines
(setq generated-autoload-file "~/.emacs.d/go-mode/go-mode-load.el")
(update-file-autoloads "~/.emacs.d/go-mode/go-mode.el")
Then evaluate both lines by putting the cursor at then of each line and type in C-x C-e to evaluate the line before the cursor. Do this for both lines. Then make sure to open go-mode-load.el and save the buffer - apparently emacs does not do this by default.
Once you've done this you can continue to follow the instructions at http://www.honnef.co/posts/2013/03/writing_go_in_emacs/
Disclaimer: I am sure there is a better way to do this and lisp experts will shriek at my answer. I have no clue about lisp and how to use lisp in emacs. I just did an informed guess :-)
Just recently hit this while attempting to get go-mode.el set up on my raspberry pi. Luckily, I had already generated a go-mode-load.el file successfully on my Mac and was able to take a look at that.
In there I saw this comment:
;; To update this file, evaluate the following form
;; (let ((generated-autoload-file buffer-file-name)) (update-file-autoloads "go-mode.el"))
So I cd'ed into the directory where I had downloaded go-mode.el, then touched a new file called go-mode-load.el, opened it up in emacs, pasted in that line of code, evaluated it with C-x C-e and it worked like a charm.
EDIT
Wasn't able to get the generated file working until I added these lines to the end. As of writing this I haven't taken the time to figure out why they are needed but adding them fixed the problem:
(provide 'go-mode-load)
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; go-mode-load.el ends here
(Not an answer, but needs formatting)
Is there a local definition of `generated-autoload-file' in go-mode.el? If so, it will write there, so you need to remove that line.
;; update-file-autoloads docs
update-file-autoloads is an interactive compiled Lisp function in
`autoload.el'.
(update-file-autoloads FILE &optional SAVE-AFTER OUTFILE)
Update the autoloads for FILE.
If prefix arg SAVE-AFTER is non-nil, save the buffer too.
If FILE binds generated-autoload-file' as a file-local variable,
autoloads are written into that file. Otherwise, the autoloads
file is determined by OUTFILE. If called interactively, prompt
for OUTFILE; if called from Lisp with OUTFILE nil, use the
existing value ofgenerated-autoload-file'.
Return FILE if there was no autoload cookie in it, else nil.
Checkout the actual installation instructions from the go-mode-el GitHub webpage. It looks like there have been some changes which are not reflected in the tutorial.
Just try to either use ELPA or follow the manual instructions:
(add-to-list 'load-path "/place/where/you/put/it/")
(require 'go-mode-autoloads)

Emacs configuration for dirtree

I'm currently trying to get dirtree for Emacs working. I'm unfamiliar with configuration files and I'm having trouble getting it to work. Currently I have dirtree.el, along with the other required files, inside of my .emacs.d directory, and I've added the following lines to my .emacs file.
(add-to-list 'load-path "~/.emacs.d/")
(autoload 'dirtree "dirtree" "Add directory to tree view")
I don't get any errors when I open Emacs, but when I type M-x dirtree, I get a message saying there is no match. Can anyone see what I'm missing in order to get this to work correctly?
The dirtree that I'm using can be found at: http://www.emacswiki.org/emacs/dirtree.el
The error is in the autoload declaration suggested by the library. It does not include the interactive flag to tell Emacs that it is a command (interactive function), and only commands may be invoked via M-x.
The corrected declaration is:
(autoload 'dirtree "dirtree" "Add directory to tree view" t)
I've tried to load it on my machine. It seems that dirtree requires a second module called tree-mode (which I don't have installed). Did you install that one too? If not, you may have the same error.
By the way, you shouldn't have to add ~/.emacs.d to your load path; I'm reasonably sure it's there by default.