Live data from Hacker News

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

news.ycombinator.com

41–50 of 60 posts

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

#42

Some key ones (setq transient-mark-mode t) ; visually show region (setq line-number-mode t) ; show line numbers (setq global-font-lock-mode 1) ; everything should use font (windmove-default-keybindings) ; shift-arrow key moves to window in that direction I set up `webjump' to search online API documentation http://justinsboringpage.blogspot.com/2009/05/emacs-searchin... I like to send gmail http://justinsboringpage.b…

I used to set transient-mark-mode to t myself. But being able to set a mark and use C-xC-x to switch the cursor and the mark point is too powerful. It allows you to set a mark, go edit something else, and then go back to where you were.

Granted, you could probably do that with transient mark mode, but seeing everything highlighted would be too annoying.

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

#43
post #4

Most important: ;; Don't mix tabs and spaces (setq-default indent-tabs-mode nil) ;; Use "newline-and-indent" when you hit the Enter key so ;; you don't need to keep using TAB to align each line. (global-set-key "\C-m" 'newline-and-indent) ;; Get rid of the with duplicate file names (require 'uniquify) (setq uniquify-buffer-name-style 'post-forward-angle-brackets) And then a whole bunch of autoload statements for diff…

uniquify is awesome!

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

#44
I use anything: http://www.emacswiki.org/emacs/Anything

And then I have this in my .emacs:

    (require 'anything-config)
    (global-set-key "\C-c\C-a" 'anything)
    (global-set-key "\C-c\C-e" 'anything-for-files)
I try to get in the habit of using C-cC-e instead of C-xC-f or C-x b. Anything is just too useful as a file/buffer finder.

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

#45
My emacs setup consists of several files, a structure that I shamelessly copied from one and only Stevey Yegge, a true emacs fanatic.

Now, I used to work for Google and most people there let you see their own home directories and I used that as an opportunity to learn from Stevey's setup.

There are a lot of customization going on and I should do a separate blog post about the setup. Here are I just cherry-picked some recent configuration favorites of mine:

  ;; 
  ;; Superb way to move between Emacs windows
  ;; Shift+arrow keys
  (windmove-default-keybindings)

 ;; Resize emacs according to the display resoluton
 (defun set-frame-size-according-to-resolution ()
   (interactive)
   (if window-system
   (progn
     (if (> (x-display-pixel-width) 1900)
         (add-to-list 'default-frame-alist (cons 'width 260))
       (add-to-list 'default-frame-alist (cons 'width 80)))
     (add-to-list 'default-frame-alist 
                  (cons 'height (/ (- (x-display-pixel-height) 50) (frame-char-height))))
     (add-to-list 'default-frame-alist 
                  (cons 'top 10))
     (add-to-list 'default-frame-alist 
                  (cons 'left 5)))))

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

#47
i put third party .el files in .emacs.d and then set the load path in the first line of my .emacs file

   (setq load-path (append load-path (list "/Users/diN0bot/.emacs.d")))
some useful .el's auto-save-list/ highlight-current-line.el auto_save_list/ psvn.el backup-file-list/ pycomplete.el cpp-font-lock.el python-mode.el django-mode.el vc-.el doctest-mode.el zenburn.el

rebindings are useful, such ctrl-q for M-x goto-line: (global-set-key "\C-q" 'goto-line)

I cribbed the following from someone else, but i find it most awesome:

; ===== Put auto-save, backup files in one place ===

;; Put autosave files (ie #foo#) in one place, not ;; scattered all over the file system! (defvar autosave-dir (concat "/Users/diN0bot/.emacs.d/auto-save-list/"))

(make-directory autosave-dir t)

(defun auto-save-file-name-p (filename) (string-match "^#.*#$" (file-name-nondirectory filename)))

(defun make-auto-save-file-name () (concat autosave-dir (if buffer-file-name (concat "#" (file-name-nondirectory buffer-file-name) "#") (expand-file-name (concat "#%" (buffer-name) "#")))))

;; Put backup files (ie foo~) in one place too. (The backup-directory-alist ;; list contains regexp=>directory mappings; filenames matching a regexp are ;; backed up in the corresponding directory. Emacs will mkdir it if necessary.) (defvar backup-dir (concat "/Users/diN0bot/.emacs.d/backup-file-list/")) (setq backup-directory-alist (list (cons "." backup-dir)))

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

#48
post #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".

Firemacs, Firefox extension which gives emacs keybindings.

https://addons.mozilla.org/en-US/firefox/addon/4141

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

#49
post #44

I use anything: http://www.emacswiki.org/emacs/Anything And then I have this in my .emacs: (require 'anything-config) (global-set-key "\C-c\C-a" 'anything) (global-set-key "\C-c\C-e" 'anything-for-files) I try to get in the habit of using C-cC-e instead of C-xC-f or C-x b. Anything is just too useful as a file/buffer finder.

Near as I can tell, there is only one reason not to simply rebind C-x C-f to anything-for-files: it doesn't create files. That's fixable:

    (defun anything-for-files-create-if-not-found ()
  "Just like anything for files, but gives the option to create a file."
  (interactive)
  (anything '(anything-c-source-ffap-line
              anything-c-source-ffap-guesser
	      anything-c-source-regular-filename-completion
              anything-c-source-recentf
	      anything-c-source-file-not-found
              anything-c-source-buffers+
              anything-c-source-bookmarks
              anything-c-source-file-cache
              anything-c-source-files-in-current-dir+
              anything-c-source-mac-spotlight)))
Post reply on HN