polishing ruby by ryan davis

My Emacs Setup, pt 7: Q & A (1)

Published 2013-07-11 @ 12:00

This is part 7 of My Emacs Setup.

In my last post I asked for suggestions on what to blog about next. I got some questions that I thought were interesting so I’m answering them here:

JEG asks:

I have a ton of specific questions. Here are just a few:

Awesome! Keep throwing them at me.

  • Do you use emacserver and emacsclient?

I certainly have in the past, I pretty much don’t nowadays. This is mostly because I run almost all of my shells within emacs, making emacsclient (mostly) unnecessary. Open prompts are relative to the current directory of whatever buffer you’re in (including shells) and you can open globs, so rather than doing emacsclient lib/*.rb I can just type C-x C-f lib/*.rb RET.

That said, I do fire up M-x server-start once in a while and run emacsclient from Terminal.app. Because I’m running the server from the GUI emacs, I can get Terminal.app communicating over to the GUI and feel more comfortable.

  • How do you handle integration with the OS X clipboard? (Especially, if you said yes above.)

As I said, I generally use the GUI anyways so clipboard integration Just Works(tm).

I do like having save-interprogram-paste-before-kill set to t via custom. That makes the OS integration a bit smoother.

  • What do you use for .erb files?

Nothing. I try not to work on view code (and people thank me for that). If I did, I’d prolly try out MMM again. I didn’t like the older alternatives.

  • Do you indent manually or with an automatic tool?

Um… I use ruby-mode or enh-ruby-mode (or whatever language’s mode) to do indentation for me with plain TAB. I’m not sure if that’s what you’re asking.

JD asks:

  • How much to you rely on [c|e]tags for navigation in projects?

I love exuberant ctags and have a script called retag that does-what-I-want 99% of the time. That said, I don’t use tags that much because most of my projects are limited in scope enough and have sane file layout that it isn’t strictly necessary.

I do recommend using tags to all newcomers to emacs tho. I think it is a very powerful tool (esp once you start using pop-tag-mark to go back from whence you came).

  • Any tricks/best practices for expanding text? I’m a long-time user of dabbrev-expand, but feel like I might be missing some opportunities by not using hippie-expand.

Ah! yes! I have the following in rwd-expand.el:

1
(eval-after-load "dabbrev" '(defalias 'dabbrev-expand 'hippie-expand))

Then, I set hippie-expand-try-functions-list to:

1
2
3
4
5
6
7
8
9
10
11
'(try-expand-all-abbrevs
  try-expand-list
  try-expand-dabbrev-visible
  try-expand-dabbrev
  try-expand-dabbrev-all-buffers
  try-expand-dabbrev-from-kill
  rwd-try-expand-tag
  try-complete-lisp-symbol-partially
  try-complete-lisp-symbol
  try-complete-file-name-partially
  try-complete-file-name)

I believe that the defaults for hippie-expand are pretty good by themselves, but IIRC, I reordered some of them to suit my needs a bit better. It could probably still use some tweaking, but this works for me well enough that it stays off my radar.

Thanks - love the series.

Thank you!