Ask HN: What is your .emacs file like?
What are some good ways to get work done using Emacs? Ideally I would like to minimize the code I actually write as much as possible. How do you make emacs automate your work?
7 comments
;; Shows last used files in menu on emacs startup
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
;; Improves buffer names (gets rid of <2> <3> etc names when filenames
;; are identical).
(require 'uniquify)
;; Copies from line above with meta-n, useful for some programming
;; languages that force such structures.
(fset 'prevlinecolcopy
[up ?\C- right ?\M-w left down ?\C-y])
(global-set-key (kbd "M-n") 'prevlinecolcopy)What I really love about emacs is that it is so easy to move keys around and to assign function to keys. For example, I find this really useful on my MacBook Air keyboard:
(Probably already default in Aquamacs, but I prefer to use the 'real' Emacs.app)
;; Map option-up/down do page-up/down
(global-set-key (kbd "ESC <up>") 'scroll-down)
(global-set-key (kbd "ESC <down>") 'scroll-up)
Now option up/down do paging. Win.(Probably already default in Aquamacs, but I prefer to use the 'real' Emacs.app)
https://github.com/duncan-bayne/ubuntu-setup/blob/master/con...
Nothing really special: adds a bunch of modes that I use, tweaks clipboard behaviour & appearance, displays column data & full pathname, plus opens & renames a bunch of terminals.
Oh yeah, there's a VB.NET mode in there too. That was fun.
Nothing really special: adds a bunch of modes that I use, tweaks clipboard behaviour & appearance, displays column data & full pathname, plus opens & renames a bunch of terminals.
Oh yeah, there's a VB.NET mode in there too. That was fun.
Not really a tip for your dotfile, but learn about all of Emacs's autocompletion variations. There are something like five of them, ranging from basic M-/ to CEDET's context-and-semantics-sensitive code completion tool.
Don't know where I found this, but I like this little gem:
(add-hook 'after-save-hook
'executable-make-buffer-file-executable-if-script-p)
It automatically makes files executable that look like they are scripts. (Start with #!/some/interpreter)That's a really good idea.
Now that you said that, I think I'll build some templates for commonly added files (like importing Django or GAE modules when the file is called "models.py").
Now that you said that, I think I'll build some templates for commonly added files (like importing Django or GAE modules when the file is called "models.py").
I used to have yasnippet with some custom snippets, but then I kept using the custom o ones less and less to the point my last install uses the stock yasnippet package from the distro. I intend to rethink my custom, snippets and redeploy the more interesting ones.
That and loading extras and binding keys in a comfortable way.
That and loading extras and binding keys in a comfortable way.
Here is mine. Not too much in it. The main thing was get rid of all those annoying *~ files
(setq-default truncate-lines t) (setq truncate-partial-width-windows nil) ;; for vertically-split windows (setq inhibit-startup-message t) (setq make-backup-files nil) ; Don't want any backup files (setq auto-save-list-file-name nil) ; Don't want any .saves files (setq-default transient-mark-mode t)
(setq-default truncate-lines t) (setq truncate-partial-width-windows nil) ;; for vertically-split windows (setq inhibit-startup-message t) (setq make-backup-files nil) ; Don't want any backup files (setq auto-save-list-file-name nil) ; Don't want any .saves files (setq-default transient-mark-mode t)