Activate a single ELPA package out of many - emacs

I want to start Emacs from a clean state and activate only one package in ~/.emacs.d/elpa/, not all of them. Specifically, I need to load a bleeding-edge version of Org-mode, while clean Emacs loads the built-in version. How do I do that?

To run Emacs from a clean state, provide a -Q option:
emacs -Q
Then run command eval-expression, usually M-:, and enter the following Lisp expression:
(let ((package-load-list '((org t)))) (package-initialize))
package-load-list variable holds packages that will load and activate when package-initialize is called. It's a list of pairs in the form of (PACKAGE VERSION). You can put t instead of VERSION, and the newest version will be loaded.

emacs -Q -l ~/.emacs.d/elpa/org-bleedingedge/org-autoloads.el
should do it. Of course, if that "org" package requires others, it won't magically handle those dependencies.

You might find that How to start up emacs with different configurations covers this. Create a new Emacs sandbox, install any packages you need, and you can run it side-by-side with your normal configuration.

Related

Common Lisp auto completion in emacs

Update
Apparently, the auto-complete package is not the culprit.
Emacs fails to download melpa archive.
A quick google search indicates that this is a reappearing problem both on windows and unix machines.
As there are already threads concerning failed to download 'melpa' archive (none of which helped unfortunately) this thread may or may not be closed.
Inital Question
I'm trying to set up emacs for Common Lisp.
I installed sbcl and the slime package.
Some time ago I used to have auto completion for Common Lisp keywords in emacs such that - while typing - it suggested a word via a greyed out completion (TAB for acceptance) or via drop down or both. (I can't remember exactly.)
I'm struggling to get this working again.
At https://github.com/purcell/ac-slime it is suggested to first install auto-complete but when I type package-list-packages there is no such package. (But there are plenty named auto-complete-*).
(I set up Melpa with:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/")))
The provided link http://cx4a.org/software/auto-complete/ is dead as well.M-x install-package [RET] auto-complete [RET] also fails. Emacs says: [No match]
So my question is:
If there is no auto-complete package anymore, what is a good way to set up Common Lisp auto completion in emacs in the way mentioned above (greyed out word or dropdown)?
The current home-page for auto-complete is https://github.com/auto-complete/auto-complete
Installing it should be enough to allow you to use ac-slime (there is also a completion version using company).
Here is how I got it to work.
Download the .ZIP archive with repository here.
Unzip
Run M-x package-install-file
On the prompt, specify the path to the downloaded repository and the file named auto-complete.el.
Make sure that installation returns something along the lines of "Successful"
Add this line to your Emacs initialization file (.emacs):
(ac-config-default)
To auto-complete in SLIME, follow similar step to install ac-slime (requires SLIME and Auto-complete)
P.S. There is another package called company (stands for Complete Anything), which is quite good as an alternative. I am trying it out now. Getting it to work was very simple.

Emacs 25 and list-buffers behavior

Can someone help me make sense of list-buffer (aka Ctrlx - Ctrlb) behavior in emacs 25?
The behavior I'm used to seeing is that it opens the buffer list in another Emacs window (virtual Emacs window), splitting out a second window to do so, if necessary. In some versions it hasn't always been very deterministic which other window it used (if I had more than 2 up), but I could at least count on it not using the one the cursor was in.
I recently installed 25.0.50.1 to get around a remote file open bug (worked!), and now it isn't always doing this. Very often it opens the buffer list in the same window my cursor was in. Often it works the way it used to. I can't figure out any rhyme or reason behind which it choses to do.
Can someone enlighten me as to the algorithm it is using now? It makes managing multiple emacs Windows for reference viewing nearly impossible when I can't predict which window gets replaced.
I would guess your primary concern is to have a convenient way to switch buffer, not to understand the emacs' source code, so I would strongly recommend to check helm package out: http://tuhdo.github.io/helm-intro.html
It will take about 10 to 20 minutes to install and follow the tutorial, and it is well worth. I promise.
After installing helm and enabling it, the key sequence for you is Ctrl-x b: Shows open buffers, recently opened files
You will get a power pack of many other tools to work in emacs. I had the same problem with switching buffers, and seemingly 'chaotic' buffer popup. After helm installation, the problem is minimized to invisible because it is so easy to switch to the buffers you want.
Update:
To deal package installation errors and package compatibility:
M-x list-load-path-shadows to see if there is any conflicting packages. And since you may not have many external packages, I suggest backup ~/.emacs.d and have a new empty one. Also, most of the case when install packages, I try to use emacs package manager. Benefits of using package manger:
help check dependencies
avoid to manual download and unpack.
can do batch update of installed packages
Following is a workflow of enabling melpa repo and installing packages
M-x customize-group RET package
# Click or move cursor to and enter: Package Archives
# Insert the melpa repository.
Archive name: melpa
URL or directory name: http://stable.melpa.org/packages/
#Save above settings and then you can use the following to install packages:
M-x list-packages RET
f to filer package names
i to mark for installation
x for execution of installation
u for unmark package at cursor.
# to avoid using load-path repeatedly,
# I have this in my .emacs before any 'require' command:
; Set path recursively to one folder
(let ((default-directory "~/.emacs.d/elpa/"))(normal-top-level-add-subdirs-to-load-path))

how to install a package on emacs that supports multiple cursors a'la sublime

I am new to emacs and am looking for an emacs package that supports multiple cursors a'la sublime. I have tried to install magnars/multiple-cursors but without success. I can't even install the package directly. The following code does not work for me .
M-x package-install multiple-cursors
(emacs says no match, but in the ~/.emacs.d/elpa/archives/marmalade/archive-contents file, I can find references to that package.)
I have the required repositories in init.el and also run M-x package-refresh-contents
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "https://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
I then installed the package via a package that requires it (in my case I installed clj-refactor, this brings in the dependency to multiple-cursors. When I eval (require 'multiple-cursors) I get the following error
File error: Cannot open load file, no such file or directory, multiple-cursors
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.
This is strange because in the folder ~/.emacs.d/elpa/multiple-cursors-20141026.503 contains the file multiple-cursors.el
I got very used to that sublime feature and would really appreciate to use multiple cursors in emacs. Has anyone has a similar problem with the mentioned package or knows how to solve it? A link to a similar package would also be appreciated.
Thank you
Edit:
I Use emacs for mac v24.3.1
Edit:
I have just noticed that I don't need to eval (require 'multiple-cursors). The package is indeed installed (via the dependency) and I use it, great! The question remains why I can't directly install it.

Changing the initialization location of Emacs

I used to take the Programming languages course on Coursera and for the sake of the course i installed SML-Mode.
Now, I'd want to set up a Clojure environment in Emacs but instead of initializing Emacs from ~/.emacs.d, it initializes from the Users/karthik/Documents/sml-mode/sml-mode-startup
I deleted the sml-mode folder and on Emacs startup it shows me a warning about the files not being present. How I do point Emacs to load Emacs Live from the home folder.
I'm an Emacs newbie.
One easy way to do it, is
save you closure settings in /some/dir/my-closure-settings.el and call emacs as the following (to learn about -q -l , try emacs --help )
$ emacs -q -l /some/dir/my-closure-settings.el
or even placing an alias in bashrc,
$ alias closure-emacs='emacs -q -l /some/dir/my-closure-settings.el'
$ closure-emacs # will start emacs with your closure settings.
As you progress in learning some elisp, you will want to do it in one folder.
Assuming you installed Emacs yourself, and this SML-mode was an independent package, then I would speculated that it may have modified your site-start.el.
See if running emacs --no-site-file makes a difference.
If that's the issue, you can visit the file with:
M-: (find-library site-run-file) RET
You might also check:
C-hv user-emacs-directory RET
when running emacs in various ways:
emacs
emacs --no-site-file
emacs -q
emacs -Q
Unless it's a custom binary, at some point it should tell you "~/.emacs.d/"
Installing SML-mode does not change the place of the main initialization file, which is one of ~/.emacs or ~/.emacs.d/init.el. So look at those files (which ever of the two is present), and if none is present, then just create it and add what you need in it.
BTW, it looks like you're using an old sml-mode package (the newer one doesn't have an sml-mode-startup.el file). So please try and make sure the documentation that pointed you to that mode is updated: nowaday sml-mode should be installed from GNU ELPA, i.e. via M-x package-list or M-x package-install.

Emacs - Can't get Flymake to work with JSHint

I'm trying to get JSHint to work with Flymake.
jshint is indeed installed in /opt/bin and works. /opt/bin is in Emacs' exec-path.
I've followed the directions on the EmacsWiki and have this in my init.el:
(defun flymake-jshint-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "jshint" (list local-file))))
(setq flymake-err-line-patterns
(cons '("^ [[:digit:]]+ \\([[:digit:]]+\\),\\([[:digit:]]+\\): \\(.+\\)$"
nil 1 2 3)
flymake-err-line-patterns))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.js\\'" flymake-jshint-init))
When I open JavaScript files, my modeline appears as:
[(Javascript Flymake* AC)]
This is odd because the * usually doesn't appear when I'm using Flymake with C++ or Python. According to the Flymake docs, Flymake* means "Flymake is currently running." However, Flymake isn't showing any errors.
I've checked the *Messages* buffer but it only lists a few lines of Fontifying foo.js... (regexps...................). No errors.
Other suggestions?
Try using M-: to execute (setq flymake-log-level 3), which will cause flymake to print debug info into *Messages*.
Here's how I use flymake with jslint, which works nicely for me -- that code might give you a clue about what's going wrong for you.
You might also consider js2-mode, which provides some language-aware lint-like warnings without resorting to running an external process.
I found a project called jshint-mode and tried that. It created a buffer called *jshint-mode* which revealed the error: JSHint couldn't find the formidable module.
I ran M-x setenv in Emacs to set NODE_PATH so that jshint could find the formidable library. I also set NODE_PATH in /etc/profile.
jshint-mode did not work for me (I use Linux Mint 14 'Nadia') -- I was getting errors with "flymake's configuration" when it runs curl to talk to the Node.js instance running the jshint script. This was perplexing, and I'm not familiar with ELisp to go around messing with the .el files.
I solved this by instead going straight to the Emacs flymake project fork on github which now has support for jshint built-in (it needs to be installed as npm -g install jshint which in turn requires you to install npm and node.js if you haven't already). This made things work.
One more caveat: on my Linux box, node was an executable already existing in /usr/sbin and I had to make a symbolic link named node in /usr/local/bin to override the former. This was necessary as the Node.js binary for Linux Mint (possibly Ubuntu as well, I haven't checked) is named nodejs instead and will cause many scripts written assuming a binary name of node to fail. You can test this by typing node: if it is the pre-existing binary it generally returns to the prompt silently, but if it is Node.js it prompts you with a > (you can Ctrl-D to quit out of there)