Live data from Hacker News

Ask HN: What's in your .emacs file?

news.ycombinator.com

11–20 of 60 posts

Re: Ask HN: What's in your .emacs file?

#11
post #5

178 lines of crap accumulated over about 20 years. I think I only use an indent variable setting, one key binding, and a handful of language autoloads. delete-delete-delete save-buffer Much better.

ditto. I recall spending many late nights optimizing my dot emacs file and it accumulated tons of cruft. Now it is very abbreviated, wait no that was a dream - Just looked at it, still tons of junk that I don't use. Most of what I use is buffer saving (desktop), hot-keys, turn off scrollbars, and mapping odd file extension to modes. Guess I should go through and clean house again.

Re: Ask HN: What's in your .emacs file?

#12
my emacs.d still needs a few tweaks but I'm convinced it always will.

most useful parts: replacing fundamental mode with text-mode as the default mode when a new buffer is open.

(setq default-major-mode 'text-mode)

turn auto fill (automatic line wraping) and flyspell (spellchecking) on by default

(add-hook 'text-mode-hook 'turn-on-auto-fill)

(add-hook 'text-mode-hook 'turn-on-flyspell)

also I find yasnippet http://code.google.com/p/yasnippet/ wonderful for coding html mockups and django templates.

my github repo if anyone cares to take a peek: http://github.com/bmac/emacs

Re: Ask HN: What's in your .emacs file?

#13
http://github.com/markhepburn/dotemacs

Lots of cruft (roughly 10 years worth), although I did recently start to refactor.

Most notable: it's fairly portable and relocatable, thanks to a snippet I cooked up (probably not original, but I haven't seen it else-where): http://everythingtastesbetterwithchilli.com/initialisation-f... (check it out anywhere and just symlink init.el to ~/.emacs, it figures out all paths from there. It'll also load platform-specific code, if you need that).

I try and make it lazier by combining autoload and eval-after-load, which helps with startup time.

On an organisational point (still work to be done here!), init.el mostly just loads a bunch of other files, which are roughly grouped by task or mode. Github has been a huge boon, combined with submodules to track a lot of third-party extensions.

I don't change many key bindings (most notable is the Yegge-suggested C-w for backward-kill-word), but I do have a /lot/ of extensions installed. I'm a fairly heavy user, although almost exclusively as an editor (+ lisp or python interaction, etc) -- I don't use it as a mail client, browser, or anything along those lines. The furthest away I get is the occasional twitter or IRC usage.

While I'm rambling: I'd like to make all my key-binding specifications consistent. Currently I have a mix of string specifications, vectors, kbd macros, etc. Does anyone know what the canonical approach is these days? Extra reference: http://www.nongnu.org/emacs-tiny-tools/keybindings/ and http://www.emacswiki.org/emacs/KeyBindingNotation

Re: Ask HN: What's in your .emacs file?

#17
You'll want to check out dotfiles.com also, btw. I considered putting this in a separate link, but thought that since you asked, it wouldn't be too terrible to post here. There are a few things I include in every .emacs file I have across multiple shell accounts, and this is more or less the entirety of it:

  ;; how emacs behaves generally
  (setq scroll-step 1)
  (setq next-line-add-newlines nil)
  (setq search-highlight t)
  (setq-default indent-tabs-mode nil)

  ;; some niceties on the status bar
  (display-time)
  (setq column-number-mode t)
  (setq line-number-mode t)

  ;; other shortcuts
  (global-set-key "\C-^" 'enlarge-window)
  (global-set-key "\C-c\C-w" 'compare-windows)

  ;; fix broken backspace
  (global-set-key "\b" 'backward-delete-char)
  (global-set-key "\C-xt" 'term)

  ;; UTF-8 goodness
  (set-terminal-coding-system 'utf-8)
  (set-keyboard-coding-system 'utf-8)
  (prefer-coding-system 'utf-8)

  ;; I'm into Perl, but prefer cperl-mode over the default
  (defun modify-alist (alist-symbol key value &optional search-cdr)
    (let ((alist (symbol-value alist-symbol)))
      (while alist
        (if (eq (if search-cdr
                    (cdr (car alist))
                  (car (car alist))) key)
            (setcdr (car alist) value)
          (setq alist (cdr alist))))))
    
  (modify-alist 'interpreter-mode-alist 'perl-mode 'cperl-mode t)
  (modify-alist 'auto-mode-alist        'perl-mode 'cperl-mode t)

  ;; the one true indentation level
  (setq cperl-indent-level 4)

Re: Ask HN: What's in your .emacs file?

#19
post #12

my emacs.d still needs a few tweaks but I'm convinced it always will. most useful parts: replacing fundamental mode with text-mode as the default mode when a new buffer is open. (setq default-major-mode 'text-mode) turn auto fill (automatic line wraping) and flyspell (spellchecking) on by default (add-hook 'text-mode-hook 'turn-on-auto-fill) (add-hook 'text-mode-hook 'turn-on-flyspell) also I find yasnippet http://co…

Regarding newlines: in Emacs 23, I recommend visual-line-mode over auto-fill-mode, unless you actually need hard line breaks. For when you do want hard newlines, (setq-default fill-column 80). I never understood why the default is 72; it makes text files excessively narrow.

Re: Ask HN: What's in your .emacs file?

#20
I wrote a long article and at the last paragraph, I decided to edit a sentence, I selected the "region" and pressed C-w to remove it :-(

For uninitiated, C-w is "yank text", i.e. cut it, and Firefox it is "close current tab without warning".

Post reply on HN