From: Jorge Gajon on
On 2010-04-23, Peter Keller <psilord(a)merlin.cs.wisc.edu> wrote:
> Jorge Gajon <gajon(a)gajon.org> wrote:
>> On 2010-04-22, Peter Keller <psilord(a)merlin.cs.wisc.edu> wrote:
>>> I am a staunch vim user, to say the least. However, after patches I
>>> was giving back to various lisp projects were rejected with the reason
>>> "format it in SLIME or else". I bit the bullet and simply learned emacs
>>> for my Lisp IDE. I'm happy I did this.
>>>
>>
>> I'm an avid Vim user as well, and I've been using "Limp" with a few
>> modifications. I've been playing a little bit with Emacs and SLIME, and
>> I can clearly see that the Emacs platform is much more powerful and that
>> there's nothing like SLIME available to VIM.
>
> I used Limp for a couple months, but it had some very crappy bugs for me.
> I spoke to the very personable maintainer, but we couldn't figure it out.
> The bugs were hjkl would work, but then sometimes also act as if CTRL-Y/E
> were performed. That was the most annoying bug ever and is what made
> me stop using it. Another nasty bug was if I cut and pasted a chunk of
> lisp into limp, and then hit 'u' for undo, it would leave detritus in
> the buffer. And a third bug being whenever I created/destroyed tabs,
> I'd disconnect from the lisp listener. These three bugs, combined with
> Limp not formatting identically to SLIME, made be stop using it. The
> maintainer and I really tried to figure it out, and Limp worked fine
> for lots of other people. I guess my mileage varied. :)

At first I found the exact same bugs you mention, but with the
modifications that I linked to in the previous message they are fixed.

The indentation is because Limp by default sets to the old Vi
indentation mode, I modified that too and now I get decent
indentation, not perfect but good enough.


>> However, I've been hesitant to completely immerse myself into Emacs
>> mainly because I'm afraid that I will spend endless hours learning and
>> customizing it, without gaining a significant advantage over Vim.
>
> I spent probably 3 weeks solid learning (doing the tutorial every day) and
> then customizing emacs before I was happy with it and maybe 3 more weeks
> before my "finger macros" functioned without me seriously concentrating
> on it. I don't use viper mode, I use the nominal method emacs prefers,
> with a couple major exceptions I hacked into the emacs lisp. Now that
> I've been using it, I'll say that it was worth it and I'd do it again.
>
>> Vim, as a platform, may not be as powerful as Emacs, but it is powerful
>> nonetheless, and I wonder if is it worth the effort to start from
>> scratch with Emacs.
>
> I found that emacs was worth learning emacs as a Lisp IDE.
> I found that vim and emacs basically have the same functionality.
> I found that I vastly prefer vim's navigation system to emacs' nav system.
> I found that I vastly prefer emacs' configuration system (elisp and the
> raw interface to the editor itself) to vim's.
>
>> On the other hand, I truly believe the Vi editing model is superior.
>> Have you tried Vimpulse? I've tried viper-mode but it is not enough.
>
> Nah, I hadn't tried it. It is simply because, as a vim user, if I were
> going to drink the kool-aid of emacs, I'd better drink long and deep.
>

Well, one thing is drinking the kool-aid, and other is using what's
best. I believe Vim's editing model is a big deal to just let it go.

I do see myself transitioning to Emacs in the near future, but only if
Vimpulse (or something else) gives me enough of the commands present in
Vim. Most of the text object movements, visual selection, and jumping
(g; g, are way too useful for me). And CTRL-[ must work.

And one thing that I *must* really be able to use is C-X C-N and C-X C-P
in insert mode.

Anyway, I have not been able to spend more time with Emacs recently, but
it is definitely in my to-do list. The problem is that there's not
enough time available, which is also my concern on walking down this
path.

> The one thing I really, really miss is vim's command mode. I find it
> depressing (no pun intended) that I have to hold down ctrl all the time
> to do any command-like operations.

Exactly :)


Thank you for sharing your impressions and the customizations that you
have done in your .emacs file.

From: Tamas K Papp on
On Thu, 22 Apr 2010 14:17:41 -0700, Pillsy wrote:

> On Apr 22, 11:45 am, His kennyness <kentil...(a)gmail.com> wrote:
>> Pillsy wrote:
> [...]
>> > I did too. Actually, I discovered that I liked it almost immediately.
>> > OTOH, I find C-descended syntaxes to be very uncomfortable. Part of
>> > the reason I'm so convinced of the role that personal preference
>> > plays in this is that my own preferences seem to be so radically
>> > different from most other programmers.
>
>> What makes you think most other programmers would not have the same
>> result as yourself, viz. discover they like it almost immediately?
>
> If that were the case, wouldn't we see Lispy syntaxes everywhere? Lots
> of people are exposed to Lisp through intro CS courses or editing Emacs
> configuration files, and writing a Lisp reader is pretty damned easy.
> Even if people hate the dynamic typing or garbage collection, they could
> still give their new languages all the parentheses you could ever want.

The good old argument of relying on the rationality of people. If X
is so good, why doesn't everyone use it? And consequently, if the
vast majority doesn't use X, there must be something wrong with it.

The sad truth is that the majority of people do not devote a lot of time
to exploring alternatives, they just use whatever they were taught, or
what others are using. They will use every excuse they can come up with
to rationalize this behavior.

The fact that Lisp is taught in intro CS courses is a serious handicap
for it IMO. AFAIK the vast majority of these courses use Scheme, and
use it to introduce some particular style of programming or a constructs
which are interesting to theoretical CS people. I would not be surprised
if the vast majority of CS students failed to see the point of these, and
even end up hating (or at least dismissing) the language. These feelings
might just focus on the most apparent superficial distinguishing mark of
Lisp: the parentheses.

> Add to that people's #1 superficial complaint about Lisp is the Legions
> of Irritating Stupid Parentheses, and I'm pretty sure I'm right about
> this.

As I said above, I think that the hatred of parentheses is just the
superficial focus of a problem that runs deeper. If I had to take one of
the intro CS courses I mentioned above, I would probably feel that if I
was subjected to an alien syntax, there should be some advantage to the
language to justify that. But usually there isn't, not in these courses.

I was not a CS major, but I was very excited that I could take CS courses
when I started at the university. I am a self-taught programmer, and I
thought that finally I could learn how to do it better. So I took the
intro course that CS students had to take. The Lisp part went like this:
Lisp is about lists and recursion. The only atoms Lisp has are integers,
which we manipulate. No mention of macros, CLOS, symbols, or even frickin
arrays.

The prof put up a factorial on the blackboard. Then a recursive function
for the Fibonacci series. These we analyzed. I recently found my notes
from that course when I was moving: the factorial wasn't even tail-
recursive! And naively done recursion is probably the dumbest way to
calculate Fibonacci.

This was the last CS course I ever took. I left it with the feeling that
Lisp has no point, it is a toy language for teaching recursion. It took
me about 8 years to look at Lisp again. I think that the vast majority
of students feel this way. There should even be a T-shirt: "I put up
with all those silly parenthesis, and all I got was theoretical CS toys."

Best,

Tamas
From: Peter Keller on
Jorge Gajon <gajon(a)gajon.org> wrote:
> On 2010-04-22, Peter Keller <psilord(a)merlin.cs.wisc.edu> wrote:
>> I am a staunch vim user, to say the least. However, after patches I
>> was giving back to various lisp projects were rejected with the reason
>> "format it in SLIME or else". I bit the bullet and simply learned emacs
>> for my Lisp IDE. I'm happy I did this.
>>
>
> I'm an avid Vim user as well, and I've been using "Limp" with a few
> modifications. I've been playing a little bit with Emacs and SLIME, and
> I can clearly see that the Emacs platform is much more powerful and that
> there's nothing like SLIME available to VIM.

I used Limp for a couple months, but it had some very crappy bugs for me.
I spoke to the very personable maintainer, but we couldn't figure it out.
The bugs were hjkl would work, but then sometimes also act as if CTRL-Y/E
were performed. That was the most annoying bug ever and is what made
me stop using it. Another nasty bug was if I cut and pasted a chunk of
lisp into limp, and then hit 'u' for undo, it would leave detritus in
the buffer. And a third bug being whenever I created/destroyed tabs,
I'd disconnect from the lisp listener. These three bugs, combined with
Limp not formatting identically to SLIME, made be stop using it. The
maintainer and I really tried to figure it out, and Limp worked fine
for lots of other people. I guess my mileage varied. :)

> However, I've been hesitant to completely immerse myself into Emacs
> mainly because I'm afraid that I will spend endless hours learning and
> customizing it, without gaining a significant advantage over Vim.

I spent probably 3 weeks solid learning (doing the tutorial every day) and
then customizing emacs before I was happy with it and maybe 3 more weeks
before my "finger macros" functioned without me seriously concentrating
on it. I don't use viper mode, I use the nominal method emacs prefers,
with a couple major exceptions I hacked into the emacs lisp. Now that
I've been using it, I'll say that it was worth it and I'd do it again.

> Vim, as a platform, may not be as powerful as Emacs, but it is powerful
> nonetheless, and I wonder if is it worth the effort to start from
> scratch with Emacs.

I found that emacs was worth learning emacs as a Lisp IDE.
I found that vim and emacs basically have the same functionality.
I found that I vastly prefer vim's navigation system to emacs' nav system.
I found that I vastly prefer emacs' configuration system (elisp and the
raw interface to the editor itself) to vim's.

> On the other hand, I truly believe the Vi editing model is superior.
> Have you tried Vimpulse? I've tried viper-mode but it is not enough.

Nah, I hadn't tried it. It is simply because, as a vim user, if I were
going to drink the kool-aid of emacs, I'd better drink long and deep.

However, I said there were a couple major exceptions. These exist because
I couldn't make myself stop wanting certain text manipulation behavior that
vim gave me, and emacs didn't. After some hacking, emacs gave it to me.
These examples is emacs lisp that I found on the emacs wiki (which is a great
resource), on some page lost to memory, or wrote, I forgot which.

It is fair to say that I took the shortest route to customizing emacs that
a serious vim user would tolerate. :)

An explanation of my .emacs file.

I use tabs and split screens a lot in vim, adjusting their sizes is fast
in vim's command mode, in emacs it sucks, this rebinds to a better key
distribution.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; make more accessable the bindings to shrink and enlarge buffers
;; The regular keybindings suck.
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<down>") 'shrink-window)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)

These next two are because I want emacs to start up like vim starts up and
have as little stuff as possible except for the text I'm writing taking up
screen real estate.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Get rid of the scroll bars, I don't need them.
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(scroll-bar-mode -1)

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; I don't like the spash screen
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq inhibit-splash-screen t)

Emacs' C-k is a bit dumb from my point of view, this makes it better, more
like dd, but later I reimplemented dd.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; I like more of a vim-like behavior when killing a whole line with C-k.
;; When the point is C-a, then C-k will act like dd.
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq kill-whole-line t)

This is one reason why I use emacs.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Auto newline and indent when I hit return
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key "\C-m" 'newline-and-indent)

This is a usability thing. actually typing 'yes' or 'no' is dumb.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Change the annoying 'yes'/'no' query to just 'y'/'n'
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(fset 'yes-or-no-p 'y-or-n-p)

The default scrolling method of emacs (when you reach the bottom of
the screen you pan the text and center it to the center of the screen)
is very different than vim's (scroll up by one line when reaching the
bottom of the screen), and this makes it act 99% like vim's.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; When I come to the top/bottom of the screen with C-n/p, scroll one line only
;; This is different than "(setq scroll-step 1)" because the latter will have
;; bad boundary behavior at the end of the buffer.
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq scroll-conservatively most-positive-fixnum)

This is the reason why I love SLIME. I simply hit one key, and everything
is formatted like how it is supposed to be. It isn't as good as Lisp's
pretty printer, it doesn't actually go that far, but it goes far enough
that it is worth it weight in gold. I realize that Limp has the exact same
functionality, but the actual indention Limp performs is not what I want.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; When [f12] is hit, indentify the whole buffer. Very useful for Common Lisp
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun iwb ()
"indent whole buffer"
(interactive)
(delete-trailing-whitespace)
(indent-region (point-min) (point-max) nil)
(untabify (point-min) (point-max)))
(global-set-key [f12] 'iwb)

I absolutely hated that emacs didn't have vim's dd, so I wrote it. This binds
shift-alt-m to something which for all intents and purposes, is vim's dd.
I may need to hack it to accept a prefix argument so you can do things like
C-u 10 M-k, I haven't even tested that yet since I needed the raw functionality
so badly.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is my attempt and making a reliable vim dd and binding it to M-K
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun vim-dd ()
"Act like Vim's dd command."
(interactive)
(let ((col (current-column)))
(move-beginning-of-line 1)
(kill-line)
(move-to-column col)))
(global-set-key (kbd "M-K") 'vim-dd)

Yay. Bounce the parenthesis. An old vim habit, I still like it.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; If my point is on a ( or ), then bounce it like % in vim
;; This may be annoying if I actually wish to start or end a variable with
;; this character.
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun bounce-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
(global-set-key "%" 'bounce-paren)

I miss this feature from vim and use it a lot. I got it from the emacs wiki
but it needs more hacking to make it reliable for all values of integers.

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Increment decimal a number under the point
;; doesn't exactly work with negative numbers. :(
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun increment-number-at-point ()
(interactive)
(skip-chars-backward "0123456789")
(or (looking-at "[0123456789]+")
(error "No number at point"))
(replace-match (number-to-string (1+ (string-to-number (match-string 0))))))
(global-set-key (kbd "C-c +") 'increment-number-at-point)

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Decrement decimal a number under the point
;; doesn't exactly work with negative numbers. :(
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun decrement-number-at-point ()
(interactive)
(skip-chars-backward "0123456789")
(or (looking-at "[0123456789]+")
(error "No number at point"))
(replace-match (number-to-string (1- (string-to-number (match-string 0))))))
(global-set-key (kbd "C-c -") 'decrement-number-at-point)

And then in the customization of emacs, I:
turned on column number mode
turned on save my place in files
turned on size indication mode
turned off the tool bar.

Combined with the above stuff, emacs looks basically like vim when it starts
up.

The one thing I haven't done is gotten an acceptable implementation of
vim's J command. I can do the awkward sequence in emacs: C-e C-d M-SPC
but I need to figure out a good mapping for it. A lot of useful keys
are already taken...

> Peter, you say that you are happy you bit the bullet. Care to expand
> that thought?.

I was happy because SLIME indented my lisp in accordance to cultural
norms. This was the main reason I was happy.

I found that I enjoyed emacs' configuration language as well. I wish it was
pure common lisp, but hey, you buy the ticket, you ride the ride.

The one thing I really, really miss is vim's command mode. I find it
depressing (no pun intended) that I have to hold down ctrl all the time
to do any command-like operations. I felt much more free in vim's command
mode. Then again, I figured out and wrote the customizations I needed
much faster in emacs lisp than I ever did in vim.

I like both editors, for different reasons. :)

Later,
-pete


From: Tim Bradshaw on
On 2010-04-21 04:43:14 +0100, G�nther Thomsen said:

> This comes up every now and then. I'm not sure whether this
> parenthesis-paralysis is actually a real problem or an often-repeated
> myth.

I think, though, that there are places where you want other syntaxes.
I'm very happy programming in Lisp's native syntax, but I'd find an
algebra system which required that (and I have used such) a pain to use.

From: Rupert Swarbrick on
Peter Keller <psilord(a)merlin.cs.wisc.edu> writes:

<snip... the real point of the post: sorry!>

> I hacked my emacs/slime syntax coloring to be very detailed and show many
> different classes of semantic ideas: comments, ANSI functions, macros,
> special forms, type names, special variables, constants, etc, etc, etc to
> all be color coordinated with each other using color theory to give me
> insight into what I've written--and whether I'm writing it correctly!
>
> The most important change I did was to make the parenthsis color nearly
> the same as the background color. In a sense they vanish and I'm left
> with the spatial blocks as an indention structure, which works just
> fine. I can always resolve a specific parenthesis from the background if
> I have to to disambiguate a form. Usually, if I screwed something up,
> the indention level of my codebase goes wrong and it is pretty easy
> to find where I missed a parenthsis.

Hi,

This sounds interesting to play with: did you stick the theming changes
you made into a file you could pass around? I've been lazy and tend to
stick with either the default emacs theme or a low contrast one called
zenburn. But it would be really interesting to have a look at one
designed by someone for use writing lisp!

About the actual point of your post, it's unfortunate that "modern" text
editors (gedit, kate, notepad++ etc.) lack the extensibility to turn
them into useful platforms for writing lisp. And your point about
indentation is exactly what's required (and difficult!). Fluffy brown
ubuntu theming and emacs don't really look beautiful together (yes, even
with emacs23) and emacs is _hard_ to get started with, which means that
even your average 1st year compsci student ain't gonna be using
emacs. Of course, that dooms them to a lifetime writing java for
ecommerce, but I guess they don't know that at the time.

Unfortunately, you're unlikely to convince a dedicated emacs user to
spend hours a week trying to make something like gedit better for lisp
because, well, there's emacs to use instead... Oh and, no, I don't know
a solution!


Rupert