
Emacs My Way - intinig
http://dev.mikamai.com/post/70585280775/emacs-my-way
======
dmortin
"I had to spend around two full years memorizing key chords"

Yet another user who thinks emacs is about the key cords. It's not, it's about
extensibility. I changed most of the default key bindings, because they were
inconvenient.

Remember: Emacs should adapt to you, not the other way around. That's what
Emacs is about.

Some people even use VIM bindings in Emacs:
[http://www.youtube.com/watch?v=Uz_0i27wYbg](http://www.youtube.com/watch?v=Uz_0i27wYbg)

~~~
klibertp
Yes, yes, yes! I came here to write exactly this: what is the point of having
infinitely configurable and extensible editor if you don't configure it and
extend it to your liking?

The very first thing I did after switching to Emacs was to rebind most
frequently used keys to something sane. The next thing was to make the
functions themselves sane - IIRC the first command I wrote was "comment-or-
uncomment-region-or-line".

My emacs config is about 4k lines of my own code at this point, very little of
which implements anything by itself. It's full of customize-options, hooks and
defadvices, eval-when-loads and similar things, which make Emacs into _my_
editor. If I had to learn some defaults I couldn't change I would just use
some IDE or another editor.

~~~
dded
> the first command I wrote was "comment-or-uncomment-region-or-line"

verilog-mode (and I imagine others) includes something like this this. C-c C-c
comments region, and C-c C-u uncomments it. It handles embedded /* */-style
embedded comments intelligently.

~~~
klibertp
I don't want to hit different keys for commenting and uncommenting! What I
want is to have one key which does all this:

1\. if there is no region active and current line is not commented - comment
it

2\. if there is no region active and current line is commented - uncomment it

3\. if there is region active and it's fully commented - uncomment that region

4 otherwise comment the full region

And it's this easy to do this:

    
    
        (defun comment-or-uncomment-region-or-line ()
          "Comments or uncomments the region or the current line if
        there's no active region."
          (interactive)
          (let (beg end)
            (if (region-active-p)
                (setq beg (region-beginning)
                      end (region-end))
              (setq beg (line-beginning-position)
                    end (line-end-position)))
            (comment-or-uncomment-region beg end)))
    

So I see absolutely no reason for not coding this up and using it :) (Other
than, heck, it really is my first ELisp function and it shows :D)

~~~
ics
Evil-nerd-commenter does the same thing, but if I didn't use email I would
have the same thing in my init. It's pretty great.

------
weaksauce
I like the idea of emacs... Every time I read a list of plugins like this I
get put off by it though. I want an editor that does editing well and helps me
edit source code faster. These lists, for the most part, show how emacs has
git integration that's better than the command line(not too hard a task), or
rvm switching(how often is this really needed? Set it once in the .ruby-
version file and be done with it), or some other external program that can be
brought into emacs and have marginal utility.

Maybe I am just not getting it and this is a sincere query for the emacs
people out there to show me the way. (Vim guy that wouldn't mind switching but
hasn't seen a compelling case for it other than the fact that emacs lisp is
the bees knees.)

~~~
klibertp
Well, I switched to Emacs from Vim exactly because of ELisp. Or rather because
of Vimscript: I thought that Lisp or whatever, even Forth would be better than
Vimscript :)

After 3 or so years of using Vim heavily I started hit the limit of what can
be done with defaults, simple options adjustions and even plugins. I honestly
tried to use Vimscript, but I couldn't bring myself to do this for real. I
knew some Scheme then, so I wasn't afraid of Lisps. I switched and I
immediately started implementing things I wished I had implemented months
earlier in Vim. My Vim config was ~700 loc and it had only a few custom
commands defined in it after 3 years. As I mentioned in another comment my
emacs config is ~4k loc now and defines a multitude of advices, hooks and
plain commands after half a year. It grows almost every day and what's most
important is that coding to Emacs APIs in ELisp gives me much more pleasure
than coding in Vimscript.

Lastly, modality - somehow I'm not missing it. It's not that I've seen the
light and now think that modal editors are an abomination, but I came to
appreciate modeless-by-default model of editing. Emacs ofers many ways to
enter modal mode, so when I felt that modal interface would be better for
something I just coded it so it's modal.

In short - if you're a happy Vim user who doesn't feel the need to write your
own Vimscript (or you're happy with Vimscript!) then I see no reason to switch
(maybe org-mode or something, but that's a very specific case). But if you
thought at some point that you'd like to code up something in your editor but
didn't because it was too much of a PITA then give Emacs a try.

~~~
weaksauce
Have you tried the evil mode or whatever vim emulator suits your fancy?

Is your config out there in the wild?

~~~
klibertp
> Have you tried the evil mode

I did. It's nice - it actually emulates Vim instead of Vi, which makes a huge
difference. With proper plugins you get even things like surround and
increment/decrement number at point. I stopped using it temporarily because it
didn't work well on my Windows machine and when I moved to *nix-only Emacs I
forgot to enable it back. It's great for reducing the shock of switching
though :)

> Is your config out there in the wild?

It somewhat is, although it's not the greatest thing in terms of organization
or portability. I'm telling myself that I will move to el-get and stop having
all the plugins in this repository and so on, but I didn't do this yet. My own
code is here:
[https://github.com/piotrklibert/dotemacs_reloaded/tree/maste...](https://github.com/piotrklibert/dotemacs_reloaded/tree/master/config)

~~~
justinmk
> I stopped using it temporarily because it didn't work well on my Windows
> machine

Just to set the record, I use evil-mode on Windows and haven't had any
problems. I also use it on Mac/Linux and haven't noticed inconsistencies.

------
fddlr
I'm a recent CS graduate, who only used IDE-s and Sublime Text so far. I have
only heard about Emacs and vim when I started my internship. I tried it but it
didn't really felt good using it.

Can somebody tell me what are Emacs' benefits over IDE-s and ST for example?

~~~
actsasbuffoon
Emacs is extremely extensible. Some people use it as-is out of the box and are
happy with it, others treat it more like a framework for creating text
editors.

Sublime has plugins, but it's nothing compared to the Emacs ecosystem. I can
edit code in one pane, manage my git repository in another, have a terminal to
run tests in a third pane, chat with a co-worker with Jabber in another, and
look up documentation in a browser (w3m) in yet another pane. The merge
conflict resolution capabilities in Emacs are also pretty excellent. I'd say
they're at least on par with Vim's excellent Fugitive plugin.

Org mode is a thing of beauty. You can write notes (and enable spell checking
in the buffer), create TODO lists, spreadsheets, calendars, handle time
tracking, and even embed executable snippets from various languages. The
coolest Org mode story I've heard is about Avdi Grimm. He wrote a Ruby book in
Org mode and embedded his code right in it. With a single Emacs command he
could extract the code from the book and run specs against it, and also
package the whole thing up as an ebook.

The learning curve doesn't have to be as brutal as depicted in the blog post.
I've only been using Emacs for 4-5 months, and I'm already very efficient with
it. I've changed a lot of the keybindings to match what I'm already familiar
with, so I didn't learn Emacs as much as I made Emacs learn me.

I used Sublime for years before my switch to Emacs (with a 3 month layover in
Vim Land). Sublime is really easy to use, and I still recommend it for
designers who write a bit of code, people new to programming, and people who
just aren't interested in learning new tools. That said, I spend 90% of my
time writing code, and it's great to have an editor that can trivially be made
to do whatever I want it to.

------
hardwaresofton
The default-installed package management system on emacs is fantastic. You
generally have to include more sources to get a lot more packages (marmalade),
but it's way better than Vundle/Pathogen.

Also, IMO the real driving force behind why emacs is the best browser is the
rejection of modality that was the norm (of the time).

I think a lot of people would find it ridiculous if they entered their
favorite IDE and were forced into a modal scheme for text entry.

------
macavity23
Nice shoutout to ag but doesn't link to it:
[https://github.com/Wilfred/ag.el](https://github.com/Wilfred/ag.el)

Search the current project, the scope of which is automatically constrained by
git/subversion metadata. Awesome sauce!

This is one of the things I love about emacs. I've been using it for over a
decade now and I'm still regularly discovering new hotness.

------
unknownian
After using vim for a while by recommendation of acquaintances, I decided to
give Emacs a try on Windows and GNU/Linux. I've found that it's quite
enjoyable, even though I'm too lazy to customize it extensively. It has a lot
of nice things already built-in. I would say it's the best FOSS text editor on
Windows, at least.

------
jeremiep
"go-mode, because the cool guys program in Go now, don’t they?"

Way too opinionated for my tastes, I'll stick to using
[https://github.com/bbatsov/prelude](https://github.com/bbatsov/prelude) with
a few custom settings.

Optional packages should be the way to go for these configuration bundles.

------
samgranieri
I tried emacs a few years ago when the peepcode on it came out. It's a full
blown OS with a text editor! I managed to get my work done, but it wasn't for
me. I went back to Textmate for another few years, and am now happily using
vim with tmux. I might try emacs again in the future.

------
arthurnn
for the minitest users, I created a minitest-mode that has being really useful
[https://github.com/arthurnn/minitest-
emacs](https://github.com/arthurnn/minitest-emacs) .

The mode is pretty similar to the rspec-mode, however it works on minitest.

