

Emacs, artist mode - VeXocide
http://www.cinsk.org/emacs/emacs-artist.html

======
vault_
For you vim-lovers out there, DrawIt accomplishes most of the same things:
<http://www.vim.org/scripts/script.php?script_id=40>

------
batterseapower
You can turn your ASCII arts drawings into actual images with ditaa:
<http://ditaa.sourceforge.net/>.

I've found this handy for when you are generating HTML manuals from text
comments in the source code, and you want to include a quick-n-dirty diagram
in your manual.

------
rauljara
Slightly off topic: I've recently gotten to the point where I feel comfortable
and productive in Vim. I know emacs is worth the effort to learn if you're
replacing most editors out there. But does anyone have any opinions on whether
it's worth the effort if the editor you'd be replacing is Vim?

~~~
Xurinos
As a regular vim user who explored the emacs world for a while, I have
somewhat mixed advice.

emacs is worth learning. It highlights certain features, almost all of which
you can pretty much get in vim -- it is just a different focus. One feature
you do NOT have in vim is the ability to smoothly run a subprocess within the
editor. That is why vimmers like to call emacs an OS; however, despite the
ridicule, there really is something different about the SLIME experience that
you ought to feel. There has been a lot of work on emacs to make it integrate
in neat graphical ways.

However, if you are fairly competent in vim, emacs is not worth using
regularly for editing anything that has to do with text. The biggest issue is
that to make emacs usable, you have to remap just about everything. It is
almost as if its designers did everything in their power to stop people from
editing text. For example (and there are many), vim folks make their lives
quickly easier by using (book)marks and macros; compare the key combos for
these in vim to the ones in emacs, and you will see one reason why emacs
editing is, by default, slower.

I avoid remapping keys because I actually work with other people sometimes
within their environment, and it helps if the keys do the same thing. This
makes for an unfortunate need for me to NOT get used to dvorak. :(

There are other nitpicks, such as the inability to edit/view large files
(before some naysayer shows up again to ask what large files we might edit:
genome files and log files come to mind).

Also, if you are told to try viper mode (and then told subsequently to use
vimpulse.el with it -- definitely do this if you are using viper), these are
good suggestions to get a fraction of vim's functionality along with some
minor but annoying differences. Again, I point you towards macros. But also
note that as soon as, for any reason, you open another buffer (for help, for
an error, for giggles), you are in emacs keys world again and not in viper, so
you will not be able to do your beloved Ctrl-W Ctrl-W immediately. If you are
going to try emacs, just use the emacs bindings and forget about
viper/vimpulse.

One advantage suggested by emacs folks is the configurability of the editor
with elisp. It is true that it is very configurable. You will find, however,
that some of the difference is marketing and FUD; vimscript is a rather
powerful little language worth learning in its own right. Most people do not
realize that vimscript has OOP. And elisp does not teach you Lisp that you can
use outside emacs... just Lispy concepts.

All that said, I am not such a hardcore vimmer that I have a "set -i vi"
configuration in bash. Learning emacs helped me learn how to do edits faster
on the commandline. With dual experience in these editors, I sometimes use the
wrong keys (try to move forward a word with Alt-F). Fortunately, in vim, undo
is just a "u" away.

Try it out. Let me know if you come away with the same experience or find ways
to make it reasonably tolerable.

~~~
kroger
"For example (and there are many), vim folks make their lives quickly easier
by using (book)marks and macros; compare the key combos for these in vim to
the ones in emacs, and you will see one reason why emacs editing is, by
default, slower."

Could you provide a concrete example? I'm not trolling, I never used vi but I
use emacs a lot and find emacs macros very useful and powerful.

~~~
dpritchett
Last week I forced myself to pull a bunch of names out of HTML for a dropdown
listbox using a vim macro. I could've used a regular expression but I wanted
to learn vim macros. Here's what I did. No guarantees that this is the right
way to do it or that it's better than emacs.

    
    
      q0  (start recording a macro to store in buffer 0)
    
      df" (delete everything from cursor through the next quote character)
    
      f(  (jump to the next open paren)
    
      d$  (delete everything from cursor to end of line)
    
      j   (cursor down one line)
    
      0   (skip to beginning of line)
    
      q   (finish recording macro)
    
      50@0 (execute macro 0 fifty times)
    

That turned a bunch of lines that looked like

    
    
      <option value="My Full Name (domain\account)">My Full Name (domain/account)</option>
    

into lines that just looked like

    
    
      My Full Name
    

To reiterate, I typed _q0df"f(d$j0q50@0_ and my problem was solved with little
thought.

~~~
Xurinos
Two helpful mods to your macro:

(1) After the f(, you probably want h to move the cursor left onto the space
before the (.

(2) Instead of d$, just use D.

Alternative for both those comments: Replace d$ with Dx

More than one way to do it anyway...

I would have spammed "qq" instead of "q0" to save finger space, but you might
have already been using your q register for all I know.

The other nice thing about vim macros is that since they are stored in vim
registers, they can be accessed and manipulated. Make a one-keystroke mistake
in your macro? Paste it to your buffer, edit it, and copy it back into the
register. Now you can use it again. Example:

    
    
        "0p => df"f(d$j0q
    
    

Modify to be df"f(Dxj0q and highlight and "0y

For the readers, " accesses a register, y = yank, p = paste.

Emacs defines "yank" the opposite way of vim: it means to yank from the
clipboard and paste to your buffer. In vim, it means to yank it out of your
buffer and put it into your clipboard (another register, as it happens, along
with special registers that understand different levels of your OS's
clipboards).

~~~
nuclear_eclipse
> _After the f(, you probably want h to move the cursor left onto the space
> before the (._

Or just use t( to automatically move to the preceding space. ;)

The best part about Vim is that you can ask 50 people about shotcuts and get
50 distinct answers, and each person can learn something new from each other.
:)

~~~
Xurinos
Good catch! So true. I forgot about this point, a concept I do not see a lot
of in emacs:

vim has a number of similar functions that differ purely by where the cursor
ends up. The f vs t is one such distinction. Another is navigation of words by
first letter or last letter (w vs e).

Not often mentioned is the variations of block highlighting, where I can
quickly (two or three letters) highlight my block and choose whether or not to
include the beginning and end of block. For example, when I am in the middle
of a sexp, vi( highlights everything inside the parentheses, and va( includes
the parentheses. For {}s, just use vi{ and va{.

And there are more options like these for saving keystrokes that, thanks to
generally consistent policies, are the same for multiple commands -- cw
(change the next word), dw (delete the next word), vw (highlight the next
word), etc.

------
steve19
Very cool. In Emacs.app (aka. Carbon Emacs) my right click acts as an eraser
and does not show a menu like it does in the video. Does anybody know how to
enable that popup menu (I am a vim user and a emacs noob.)

~~~
chrislo
Middle button works for me.

~~~
steve19
Are you using OSX? What key combo is your middle button mapped to?

------
ww520
There are always some surprising delights about Emacs from time to time.

------
surki
Check EmacsWiki as well: <http://www.emacswiki.org/emacs/ArtistMode>

Especially integration with Ido mode.

------
b3b0p
Maybe this is a dumb question, but do Emacs users edit all their configuration
files and quick edits in it too?

When I'm setting up / configuring Linux boxes at work I always use Vim because
it's always there and light weight.

I always got the impression using Emacs for this would be the equal of using
Visual Studio or Eclipse.

~~~
gchpaco
Traditionally one has a single, long running Emacs process that you do
everything in, even quick edits. If you had to wait for it to start up from
scratch then yeah, that would be pretty annoying.

My fingers frequently go `sudo vi ...' because I'm not used to using the sudo
mode in TRAMP, but that would arguably be my deficiency, not Emacs.

~~~
limmeau
emacsclient helps with that style of work. It sends the editing job to the
running emacs.

------
jcsalterego
The takeaway for me (since I use Emacs in a console and not in GUI mode) is
`C-x n n` and `C-x n w`. Looks like it could be pretty useful for `M-x
replace-regexp` (if I don't want to use query-replace-regexp, and I've got a
lot of searching and replacing to do in a particular region.

~~~
s1rech
indeed. When you want to do a quick and dirty 'replace-string', this command
looks very good. I've ended up copying the whole region to _scratch_ to make
my edits more than once.

~~~
ramen
If you use transient-mark-mode (which is on by default these days), you can
mark a region and then use replacement commands like query-replace (M-%) that
affect just that region.

~~~
jcsalterego
I had tried that before transient-mark-mode was on by default (Emacs 23?) and
it didn't work, but turns out you are 100% correct.

Thanks ramen!

------
zokier
Yuck, mouse. I'd assume that there are also nice way to use this with
keyboard?

(vim user, but emacs seems nicer and nicer every time I see stuff like this)

~~~
cag_ii
`C-h f artist-mode` - The documentation describes how to draw with the
keyboard.

------
lelele
Thank you for sharing. I think this shows limits of comment format. Why can't
we just draw and embed images inside comments, along with Rich Text?

------
steveeq1
orgtbl mode is also pretty cool: <http://www.youtube.com/watch?v=EQAd41VAXWo>

