0
votes

I want emacs to start with specific settings by default. I found that I need to edit the .emacs file in my home directory and use LISP language. However I do get some errors. I need to have:

  1. Windows split by vertical line (I work in C++ with headers and source files)
  2. Column number mode
  3. Cua-mode enabled (to work with normal copy, cut & paste shortcuts)

That's what I have in my .emacs file:

(column-number-mode)
(load "cua-mode")
(CUA-mode t)
(split-window-right)

I'ver tried coding two middle settings in one - (cua-mode). It didn't work out well.

The column-number-mode works, cua does not load and my window is split horizontally (top and bottom window). Where is my error? Thanks for feedback.

1
What version of Emacs are you using? In 23.3.1, there is no split-window-right, just a split-window-horizontally and -vertically. (Just so we're not getting confused, the first splits into side-by-side windows) - Ulrich Schwarz
To elaborate on Ulrich Schwarz's comment, Emacs 24.1 introduced the following change: "split-window-vertically and split-window-horizontally renamed to split-window-below and split-window-right respectively. The old names are kept as aliases." - phils
That middle call should be (cua-mode 1) -- all lower case, and using a positive integer for the argument as per its documentation (C-h f cua-mode RET). cua-mode is autoloaded, so you shouldn't need the preceding call to load. - phils
Thank you, guys. I'm using Emacs 23.2.1. The split-window-horizontally made it for me ;) My problem is solved. - Kamil Kuczaj

1 Answers

0
votes

From the comments to the question:

if you're using Emacs 24.1 or later,

(column-number-mode)
(load "cua-mode")
(cua-mode t)
(split-window-right)

but if you're using an earlier version,

(column-number-mode)
(load "cua-mode")
(cua-mode t)
(split-window-horizontally)

By the way, the split-window-horizontally also works in later versions of Emacs (I'm using Emacs 25.2.1).