News for hackers. Stuff that matters.
Re:Most frequently enabled Emacs packages by barrkel on Monday December 09, 2013 @05:23AM (#6873665)
I only started using emacs about 3 months ago.

The most useful packages for me, things I wish I'd known about from the beginning:

* package, pointing at GNU and Milkbox repos. Any time I edit a new type of file, I look for packages that work well for it.

* helm, much better than flex matching for my purposes. I use helm for all list completion except find-file, for which I use ido-find-file. helm-git-grep completely changed the way I work with mixed-source RoR projects, to the point I've fully abandoned RubyMine.

* projectile, mostly just for finding files across a whole git repo. I use helm to complete the file to find (setq projectile-completion-system 'helm-comp-read).

In addition, it helps enormously to not be afraid of Lisp. Emacs isn't really worth it if you're not interested in tweaking it, IMO. I had to tweak it quite a bit in order for it to play well with rxvt, my preferred terminal; and even further to get it to work well with screen in rxvt, and with mintty on Windows, and screen inside mintty. A familiarity with how termcap works, the esr's showkey utility, and a bunch of time with define-key got it sorted.

Here's a function I use a lot (bk-helm-occur at the end):

  (defun get-point-text ()
    "Get 'interesting' text at point; either word, or region"
    (if mark-active
        (buffer-substring (mark) (point))
      (thing-at-point 'symbol)))
  (defun helm-occur-1 (initial-value)
    "Preconfigured helm for Occur with initial input."
    (setq helm-multi-occur-buffer-list (list (buffer-name (current-buffer))))
    (helm-occur-init-source)
    (helm :sources 'helm-source-occur
          :buffer "*helm occur*"
          :history 'helm-grep-history
          :truncate-lines t
          :input initial-value))
  (defun bk-helm-occur ()
    "Invoke helm-occur with initial input configured from text at point"
    (interactive)
    (helm-occur-1 (get-point-text)))
  (global-set-key (kbd "M-o") 'bk-helm-occur)  
It lets me press Alt-O on any symbol and see all occurrences of that symbol in the file. I can then jump to uses, then use helm-resume to find the earlier occurrence and jump back. I have a similar function for a pre-initialized helm-git-grep.

It's these kinds of customizations that make emacs shine. Any time you find yourself doing anything repetitive or tedious, you can usually hack a function up in a few minutes that improves your workflow. Prototyping Lisp functions is completely trivial owing to the ability to evaluate Lisp in the buffer.

There are no comments on this comment yet.