Live data from Hacker News

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

news.ycombinator.com

21–30 of 60 posts

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

#22
post #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.

The default is 72, in my understanding, because of the historical use of email.

As folks successively quote each other in a thread, the prepending of '>' to the quoted text requires something narrower than 80, else it'll hit the 80-chars-wide limit and wrap.

72 would allow 4 or 8 quote-levels, depending on if your client decides to insert spaces around the '>'.

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

#24
;; Easymacs sets some common Windows key bindings like ctrl-c to copy, ctrl-s to save, etc. (load "c:/Otech/programs/easymacs/easymacs.el")

(defun init-streamfocus () (interactive)

;; Slime is for starting or connecting to SBCL ;; To start: C-x slime RET (add-to-list 'load-path "c:/Otech/sf/lib/slime")

;;(setq inferior-lisp-program "C:/Otech/programs/sbcl-1.0.9/sbcl")

                                        ;(setq inferior-lisp-program "C:/Program Files/LispWorks/lispworks-4450")
(add-hook 'lisp-mode-hook (lambda () (slime-mode t))) (add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t))) ;; (defun lw-start () ;; (interactive) ;; (shell-command (concat "C:/Program Files/LispWorks/lispworks-4450.exe -multiprocessing " ;; "-init c:/Otech/swank.lisp&")))

;;;For SBCL on Windows ;(setq inferior-lisp-program "sbcl") ;(add-to-list 'load-path "C:/Program Files/Steel Bank Common Lisp/1.0.22/sbcl.exe")

;;For Allegro on Windows (setq inferior-lisp-program "allegro") (add-to-list 'load-path "C:/Program Files/acl81/allegro.exe")

(require 'slime) (slime-setup '(slime-fancy slime-banner))

;;allegro (global-set-key "\C-cs" 'slime-selector) (setq slime-complete-symbol-fancy t) (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)

(setq slime-multiprocessing t) ;; choose one of the below based on Express or non-Express usage ;(setq slime-lisp* "alisp.exe") (setq slime-lisp "allegro.exe")

  ;;(setq *slime-lisp* "allegro-express.exe")
  (setq *slime-port* 4005)
  
  (global-set-key
   [(f5)]
   '(lambda ()
      (interactive)
      (shell-command 
       (format "%s +B +cm -L c:/.slime.lisp -- -p %s --ef %s &"
               *slime-lisp* *slime-port*
               slime-net-coding-system))
      (delete-other-windows)
      (while (not (ignore-errors (slime-connect "localhost" *slime-port*)))
        (sleep-for 0.2))))  
  
  (let* ((cygwin-root "c:/cygwin")
         (cygwin-bin (concat cygwin-root "/bin")))
                                        ;(setenv "HOME" (concat cygwin-root "/home/frederick"))
    (setenv "PATH" (concat cygwin-bin ";" (getenv "PATH")))
    (setq exec-path (cons cygwin-bin exec-path)))
  (setq shell-file-name "bash")
  (setq explicit-shell-file-name "bash")
  
  (push ".fasl" completion-ignored-extensions)
  (push ".git" completion-ignored-extensions)

  ;;--------------------------------------
;;;; For remote slime ;; see http://a1k0n.net/blah/archives/2005/11/04/T18_00_44/index.ht... (require 'tramp) (defvar cayenne-path "/sshx:streamfocus@cayenne:") (defvar current-tramp-path nil)

  (defun slime-connect-to-host (path port)
    (setq *current-tramp-path* path)
    (setq slime-translate-from-lisp-filename-function
          (lambda (f)
            (if *current-tramp-path*
                (concat *current-tramp-path* f)
              f)))
    (setq slime-translate-to-lisp-filename-function
          (lambda (f)
            (if *current-tramp-path*
                (substring f (length *current-tramp-path*))
              f)))
    (slime-connect "localhost" port))
  
  (defun cayenne-slime ()
    (interactive)
    (slime-connect-to-host *cayenne-path* 4006))
  
  (defun cayenne-find-file ()
    (interactive)
    (find-file (concat *cayenne-path* "/home/streamfocus/sf/")))
  
  
;;;; TRAMP remote editing. See notes for NTEmacs on http://www.emacswiki.org/cgi-bin/wiki/TrampMode (setq tramp-default-method "sshx") ;;;; SLIME settings to edit remote files on rembrandt ;(push (list "^cayenne$" ; (lambda (emacs-filename) ; (subseq emacs-filename (length "/cayenne:"))) ; (lambda (lisp-filename) ; (concat "/cayenne:" lisp-filename))) ; slime-filename-translations)

  ;; http://www.emacswiki.org/cgi-bin/wiki/NTEmacsWithCygwin
  (let* ((cygwin-root "c:/cygwin")
         (cygwin-bin (concat cygwin-root "/bin")))
                                        ;(setenv "HOME" (concat cygwin-root "/home/fred"))
    (setenv "PATH" (concat cygwin-bin ";" (getenv "PATH")))
    (setq exec-path (cons cygwin-bin exec-path)))
  (setq shell-file-name "bash")
  (setq explicit-shell-file-name "bash")
  )
(defun init-clojure () "Inits slime for streamfocus" (interactive) ;; clojure-mode (add-to-list 'load-path "C:/Otech/programs/clojure/clojure-mode") (require 'clojure-mode)

  ;; swank-clojure
  (add-to-list 'load-path "C:/Otech/programs/clojure/swank-clojure")
  (require 'swank-clojure-autoload)
  ;(swank-clojure-config
   (setq swank-clojure-jar-path "C:/Otech/programs/clojure/clojure/clojure.jar")
   
   (setq swank-clojure-extra-classpaths
         (list "C:/Otech/programs/clojure/clojure-contrib/clojure-contrib.jar"))
   ;)
  
  ;; slime
  (eval-after-load "slime"
    '(progn (slime-setup '(slime-repl))))
  
  (add-to-list 'load-path "C:/Otech/programs/clojure/slime")
  (require 'slime)
  (slime-setup) ;;;type alt-x and slime to start repl
  )

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

#27
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.blogspot.com/2009/02/sending-mail-w...

I think this is the most important one

(setq visible-bell t) ; annoying beeps off

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

#28
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".

Seems the keybindings skip direct to the semantics in your brain, without passing through verbose names; C-w would "kill" the text.

Still, your lapse is pretty good. Sometimes I can't even name the keys -- but my fingers know :)

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

#29
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".

C-S-t in Firefox will bring it back. Don't know if the content of the text field remains though.

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

#30
I am completely surprised no one has linked to technomancy's emacs-start-kit: https://github.com/technomancy/emacs-starter-kit

Clone that as your emacs.d, add a .el file named the same as your logged in user, and add your specific preferences there. (I like to have it include stuff in a jmhodges directory in emacs.d, of course.)

On that note, my own fork of it with very minor personal changes: https://github.com/jmhodges/emacs-starter-kit

Post reply on HN