Emacs 25 and list-buffers behavior - emacs

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))

Related

Emacs OSX 10.13 configuration issue

Recently I pass to Emacs org because is really convenient to me to write note there.
So I installed all packages I needed (principally ORG and EVIL) but I didn't understand how to setup everything.
I installed emacs from brew without using cask, I linked it, and I'm sure that I'm using the version that I installed (26.1).
So in my ~/ folder I have a .emacs file in which I set up evil mode, and I have a /.emacs.d/ in which I have a lot of file. The problem is: whatever I wrote in a ~/.emacs.d/init.el seems doesn't effect emacs.
So I said "whatever, I'm going on github and I installed some complete configurations and then I customized them myself". I tried to install these two configurations.
https://github.com/hrs/dotfiles
https://github.com/larstvei/dot-emacs?files=1
But for some reason, after doing exactly what they say on README.org
nothing happens.
In particular the second link, after install and open emacs said I need to have ~/.cask/.cask.el but I don't have it.
Advice?

Have two emacs. Want to use spacemacs with one and leave the other intact

I have emacs24 and emacs25 on my machine. I want to use spacemacs with emacs24 and keep emacs25...well...as emacs. When I install spacemacs my ~/.emacs and ~/.emacs.d are changed. Both emacs start using spacemacs, which I do not want. Is there a way to have a spacemacs and an emacs at the same time. Tried looking for a solution and came across a solution to keep separate config files. But how to make emacs look for a specific config file. By the way if you still haven't guessed...I'm a noob.
At one level, this is quite easy to do. However, at another, there can be some
complications, depending on what you really want to do.
Emacs supports a command line switch -l to tell emacs where to find the config
file. So, from a very simple perspective, you could just create two wrapper
scripts my-spacemacs.sh and my-plainemacs.sh and inside them have the scripts
call emacs with a specific -l /path/to/config. You can pass $* to pick up other
command line arguments if you want.
The potential problem with this approach is that emacs will still use .emacs.d
to store all sorts of other information, including possibly elpa packages and
this could cause problems. To be safer, it is better to keep things completely
separate.
If you don't need to run both versions at the same time, the easy solution is to
have to separate directories, such as ~/.spacemacs-emacs.d and ~/plain-emacs.d
and then have a sym link called .emacs.d which points to whichever of the
versions you want to run. The two main problems with this approach is that you
need to reset the symbolic link whenever you want to change emacs flavors and
this won't work if you want to run both versions at the same time.
I guess we really need to know about your actual use case - why do you need two
different configurations? Knowing this could help identify a better approach.
As an example, I use org mode and babel to manage my emacs config. I have a
number of different versions and a simple script which I can run to generate
whichever init.el file I want from the different org files. I have a minimal.org
file, which has the most minimal emacs configuration I can bare and I have my
standard init.org which generates my working init.el and then I have an
experimental.org which is used to generate an init.el file which I use for
experimenting with new configurations or packages. It is trivial to switch
configurations, but I never need to run two different configurations at the same
time.
I often like to check out some of the other pre-cooked emacs setups, like
spacemacs, prelude, etc. for these, I just grab the current git version and use
a symbolic link to point .emacs.d at the root fo the git repo I want to
experiment with.
you can also use the following approach:
create a directory ~/spacemacs.
extract/copy the spacemacs .emacs.d into ~/spacemacs (so that it is ~/spacemacs/.emacs.d).
create a desktop link called Spacemacs (or menu entry) and enter the following command:
HOME=$HOME/spacemacs emacs
You can also start spacemacs from the shell with this command.
This way, you can run vanilla emacs and spacemacs simultaneously, each with its own configuration directory and elpa repository. The only disadvantage might be that you need to change a directory level upward to reach your real home directory, not the „fake” one set via the variable.
btw, this is how I run several emacs versions and configurations, as needed for diverse stuff.
The best solution seems to be using chemacs: https://github.com/plexus/chemacs

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 auto-complete broke after update: required 'popup' feature not provided

After updating outdated packages, auto-complete (and its dependencies like ac-slime) broke with the error "Required feature 'popup' is not provided". Inspection of the elpa directory revealed that popup is there. Recompilation of everything in elpa directory with byte-recompile-directory did not solve the problem (both popup.el and popup.elc are present but auto-complete still fails).
PS. Further inspection revealed that some other packages are failing because xml-prc is absent, but Emacs shows that it is installed and it is indeed is present in elpa directory.
What are my steps to make Emacs work again?
Since there are no other answers yet (I hope there will be a real one!), here is what have worked in meantime:
Basically, during the package update something has gone wrong -- don't know what exactly. Usually, byte-recompile-directory on elpa directory helps to sort out the issue: it recompiles all the package files and after restart Emacs is usually can load them without problems. This time, however, it didn't help. So I used a more drastic measure: I deleted elpa directory form ~/.emacs.d (or actually I moved it away), and restarted Emacs.
My .emacs file contains the list of packages that need to be installed if missing, so all the package re-installation happened automatically, I just needed to wait (circa 30 min) for Emacs to start.
(This is a well known trick, but if you interested, here is the source on github)
But this solution is not ideal, I was hoping for something cleaner.

org mode refile error

Since some time (but I didn't change anything in .emacs), I have some errors with emacs's behaviour :
Remember mode will not kill the temporary buffer on "Ctl-C Ctl-C"
Orgmode will not refile any entry
Both operations complain with error "Not bookmark format"
I restored an old .emacs to make sure that I didn't mess it up but the error persists.
Where can I investigate to find out the problem ?
I have Emacs 24.2.1 since end of august.
The built in orgmode version is 7.8.11 (I see 7.9.2 is out ...)
It's always best to start debugging problems such as this by seeing if the problem still happens when you ignore your init file altogether - try starting emacs with --no-init-file and seeing if you still get the problem. If you don't then it's clearly something in your init file.
You can also get odd behaviour if you've got a local install of Org-mode in addition to the one bundled with Emacs itself - eg if you pull in a newer one through ELPA. If you have a local install through ELPA then you can try uninstalling the Org-mode package and trying again using the built-in Org-mode.
I have something similar to the following in my init file to make it switch to the ELPA-installed Org-mode to avoid such problems (this variant is untested so forgive me if it's not quite right):
(package-initialize) ; load and initialise ELPA-installed packages
(org-reload) ; restart Org-mode with the ELPA package
I filed a bug to the emacs team and they found out that the error comes from a corrupted bookmark file.
I removed my ~/.emacs.d/bookmark file (it was empty) and everything is fine now.