Ask HN: What's in your .emacs file?
51–60 of 60 posts
Re: Ask HN: What's in your .emacs file?
#52 (defun my-git-root ()
(if buffer-file-name
(let* ((current-directory (file-name-directory buffer-file-name))
(git-directory (concat current-directory ".git")))
(while (and
current-directory
(not (file-exists-p git-directory)))
(setq current-directory (file-name-directory (substring current-directory 0 -1)))
(setq git-directory (concat current-directory ".git")))
current-directory)))
I also hated editing system files until I added this function, which I almost definitely cribbed from somewhere: (defun sudo-find-file (file-name)
(interactive "FFind file (sudo): ")
(find-file (concat "/sudo::" file-name)))
I got sick of having to context-switch to the browser when I needed to do a quick search, which is where these come in: (defun go-to-doc (base-url)
(let ((default (symbol-name (symbol-at-point))))
(browse-url (concat base-url (read-string "Search term: " nil nil default)))))
(defun rails-doc ()
(interactive)
(go-to-doc "http://apidock.com/rails/search?query="))
(defun ruby-doc ()
(interactive)
(go-to-doc "http://apidock.com/ruby/search?query="))
I really, really hope package.el is built-in soon: (when
(load
(expand-file-name "~/.emacs.d/elpa/package.el"))
(package-initialize))
and by far the most important line in the whole file: (server-start)Re: Ask HN: What's in your .emacs file?
#53Some 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?
#54Most 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…
;; 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) That's what C-j is for.
Re: Ask HN: What's in your .emacs file?
#55You'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)…
Re: Ask HN: What's in your .emacs file?
#56Re: Ask HN: What's in your .emacs file?
#57mine's in http://github.com/adlaiff6/df.git but I don't really expect you to read it
Re: Ask HN: What's in your .emacs file?
#58I 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/jmho…
Re: Ask HN: What's in your .emacs file?
#59178 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.
lines of crap accumulated over about 20 years I hear ya. One of the things I started doing lately is not moving any dotfiles automatically when I get a new machine. After 3 days of moaning, I go and dig out just the stuff that I have noticed I am missing. (I do the same for firefox plugins and so on). It has definitely helped with the historical crud.
Re: Ask HN: What's in your .emacs file?
#60Some 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.