Display line numbers in emacs, and more

Display line numbers in emacs

Add the following to the end of your ~/.emacs file:

(global-linum-mode t)

Increase/Set font size in Emacs

(set-face-attribute 'default nil :height 100)[/code]
The default is 1/10, so height of 100=10.

So for font size 12:
(set-face-attribute 'default nil :height 120)


Remove split window in Emacs on opening up:

;; open with single window
(setq inhibit-startup-screen t)
(add-hook 'emacs-startup-hook 'delete-other-windows)[/code]


My emacs file has the following:
;; open with single window
(setq inhibit-startup-screen t)
(add-hook 'emacs-startup-hook 'delete-other-windows)
;; line number each line on left
(global-linum-mode t)
;; Set font size 12
(set-face-attribute 'default nil :height 120)

System copy and paste in Emacs:

I'm going to plaguarize Chris Conway's  StackOverflow post and quote this here:

Let's be careful with our definitions here

  • An Emacs copy is the command kill-ring-save (usually bound to META-W).
  • system copy is what you typically get from pressing CTRL-C (or choosing "Edit->Copy" in a application window).
  • An X copy is "physically" highlighting text with the mouse cursor.
  • An Emacs paste is the command yank (usually bound to CTRL-Y).
  • system paste is what you typically get from pressing CTRL-V (or choosing "Edit-Paste" in an application window).
  • An X paste is pressing the "center mouse button" (simulated by pressing the left and right mouse buttons together).

In my case (on GNOME):

  • Both Emacs and system copy usually work with X paste.
  • X copy usually works with Emacs paste.
  • To make system copy work with Emacs paste and Emacs copy work with system paste, you need to add (setq x-select-enable-clipboard t) to your .emacs. Or try
    META-X set-variable RET x-select-enable-clipboard RET t [/code]

I think this is pretty standard modern Unix behavior.

It's also important to note (though you say you're using Emacs in a separate window) that when Emacs is running in a console, it is completely divorced from the system and X clipboards: cut and paste in that case is mediated by the terminal. For example, "Edit->Paste" in your terminal window should act exactly as if you typed the text from the clipboard into the Emacs buffer.

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.