Log in

No account? Create an account
Lindsey Kuper [entries|archive|friends|userinfo]
Lindsey Kuper

[ website | composition.al ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

I sort of forgot how great it was. [Jan. 14th, 2006|04:54 pm]
Lindsey Kuper

I'm trying to get the Book of Power properly set up for the things I need to do, and Andrew pixelherder recommended this flavor of Emacs for OS X. It's been a long, long time since I used Emacs with any frequency. I'm re-learning the key bindings (the tutorial's good, as is this book) and un-learning various bad habits I've picked up in the last couple years. What I really need is for one of you to rig up something that will make the computer start beeping and swearing at me if I so much as look at an arrow key while Emacs is running.

When I was in school, if I wanted to edit remote files, I would just ssh -X and fire up XEmacs remotely. It worked pretty well. If I try to do that through X11 on OS X, though, it just sucks. I can start the program, but it's very slow (after all, this is our flaky wifi, not Grinnell's T3), and it keeps barfing up things like "X protocol error: BadWindow (invalid Window parameter) on protocol request 38". And, well, it's just really ugly compared to everything else on the screen! Heh. I started thinking, "Wouldn't it be great if I could edit remote files in my local Emacs?" Turns out there's a way, and lots of folks use it. We use a nonstandard port for ssh at work, but once I figured out how to tell it that, it was able to do its thing. Pretty soon I might even be able to, you know, do actual work.

I'm excited to be using Emacs again. I sort of forgot how great it was.


From: (Anonymous)
2006-01-15 05:08 am (UTC)

Remap your keys??

Not familiar with OS X, but every OS has a utility SOMEWHERE (even if only 3rd party) that lets you remap the keys.

Make your arrow keys do something crazy, and you will certainly either go insane or adapt in short order.

Sort of like switching from a 'normal' keyboard, to one of those @(*&(*$^(# keyboards with the huge delete key (and, thus, shifted page up/down keys. Seriously, who the heck needs a huge DELETE key? _backspace_ key, sure, but delete?

Kudos though; I couldn't live without ctrl-(arrow) curser movements.

I also can't remember what arrow keys do in e-macs (I had VI nazi for my CS classes; I think I might have been flogged publicly if I had used e-macs in class), so perhaps a remap would be 'a very bad thing'.

I made a concerted effort to forget everything about VI. There is just something about using an editor that causes a perpetual fear of deleting the third letter of every word in every file in the same directory as the file you are currently editing.

-- Planetbob99

(Reply) (Thread)
[User Picture]From: lindseykuper
2006-01-15 06:29 pm (UTC)

Re: Remap your keys??

Make your arrow keys do something crazy, and you will certainly either go insane or adapt in short order.

Heh...I'm thinking about it. I'd probably just do it from within Emacs, though, since I still want to be able to use them elsewhere.

The arrow keys don't do anything horrible; they let you move around as expected, but I'd rather get the (numerous and varied) ways to move around without leaving home row under my fingers.
(Reply) (Parent) (Thread)
[User Picture]From: pixelherder
2006-01-15 07:52 pm (UTC)

Re: Remap your keys??

'Tis easy enough. Add this to your .emacs or init.el file and make sure you have pc-select-mode turned off since that overlays a keymap on the global one that redefines the arrows:
(defun complain-about-arrows ()
  "Complain about using arrow keys."
  (message "Don't use the arrow keys!"))
(define-key global-map [(left)] 'complain-about-arrows)
(define-key global-map [(right)] 'complain-about-arrows)
(define-key global-map [(up)] 'complain-about-arrows)
(define-key global-map [(down)] 'complain-about-arrows)

(Reply) (Parent) (Thread)
[User Picture]From: lindseykuper
2006-01-16 12:40 am (UTC)

Re: Remap your keys??

Yay! I knew someone would come through. Thank you!
(Reply) (Parent) (Thread)
(Deleted comment)
[User Picture]From: oniugnip
2006-01-15 08:21 am (UTC)
I like it for SLIME :)

(but if I'm not doing Lisp, I usually use vim too.)
(Reply) (Parent) (Thread)
[User Picture]From: oniugnip
2006-01-15 09:44 am (UTC)
Actually, rethinking your question...

Emacs isn't that different from Eclipse. Eclipse isn't domain-specific, it's pluggable -- it just happens to come with stuff to make it good for working on Java and whatnot... but it can be made to do other things pretty easily.

Emacs is a lisp machine that comes with a text editor and nice modes for programming -- but some people use it to read email and play MUDs and work out their issues relating to their fathers :)
(Reply) (Parent) (Thread)
[User Picture]From: lindseykuper
2006-01-15 06:30 pm (UTC)
I've never used Vim, so I'm not qualified to make a list of reasons why Emacs is better. (I'll leave that to the thousands of others who are.)

Mostly, it's just what feels right. I was messing around with my .emacs config file yesterday. I can edit it on the fly from within Emacs, save it, and have the program work differently without restarting. Or, I can use the menus to turn options on and off and watch the config file change before my eyes. I can also understand what the config file is saying because Lisp makes sense to me. That's just one tiny, tiny example, but it's part of why Emacs feels right. Oh, and command completion works exactly the same as it does in bash. In fact, I think that feature of bash came from Emacs.

Apples and oranges, though, right?
(Reply) (Parent) (Thread)
[User Picture]From: pixelherder
2006-01-15 08:26 pm (UTC)
Lots of other Bash features come from Emacs. Most of the Emacs cursor navigation works in Bash. Ctrl-A and Ctrl-E for example.
(Reply) (Parent) (Thread)
From: mrr
2006-01-25 04:26 am (UTC)

ctrl-a and ctrl-e

these came from the 'readline' library. as did ctrl-p and ctrl-n for previous/next command.

emacs copied them.
(Reply) (Parent) (Thread)
[User Picture]From: lindseykuper
2006-01-31 05:26 am (UTC)

Re: ctrl-a and ctrl-e

Hee. A couple days ago I was Spotlighting for something on the PowerBook, and 'readline.h' totally came up in the document list.

I was all, "What up."
(Reply) (Parent) (Thread)
[User Picture]From: pixelherder
2006-01-15 08:23 pm (UTC)

In my case, some reasons are:

  1. I was exposed to Emacs first. This is probably the biggest reason.
  2. I dislike the modal style of Vi.
  3. I have Emacs customized to my tastes. I know Emacs lisp and have written tons of extensions for it -- my configuration file is over 1100 lines long, though much of that consists of comments and blank lines. And that doesn't include the self-contained packages I've written that it links to. And I can write throw-away macros on the fly if I need to.
  4. Domain-specific editors are nice, but Emacs gives me domain-specific modes all under a single roof with a common way of handling things. Once you learn the keys, they're remarkably consistent across the different modes. Plus, sometimes there are no domain-specific editors -- I once wrote an Emacs mode for a proprietary in-house programming language. There's a good chance of finding an emacs mode for nearly anything. And they're usable remotely.
  5. Reflection. If I forget a key or command or want to see if there's a command to do something, it's easy to query Emacs for it without having to go outside Emacs to look it up. User written extensions with proper doc-strings extend the database automatically.
  6. It just feels higher level to me. I know Vi users talk about the length of the Emacs key sequences, but I find that the longer ones they complain about tend to do non-trivial text manipulations that would take many more keystrokes to do using just basic edits.
I've never really learned any of the Vi editors, though, so I'll admit that I might be being unfair. Every time I've tried to learn, I've gone running back to my nice, safe Emacsen.
(Reply) (Parent) (Thread)
From: mrr
2006-01-25 04:24 am (UTC)

ways to make OS X not suck with X Windows

mike's tips of the day for people who develop stuff on macs:

1) the macos X default installation of X-Windows sucks. You want to install Mac OS X without it, installing the Developer Toolkit, and then install Fink. Use Fink to compile the latest version of xorg for MacOS X (similar to 'emerge xorg'), and then your window manager of choice. You can run this on top of OS X transparently: left side dock, right side KDE dock.

2) use vim, not emacs. xvim exists, and it sucks less.

3) use SSH keys. you don't have to type your password so much that way.
and google around for ssh keys.

also, even better than tramp:
4) http://fuse.sourceforge.net/sshfs.html
sshfs. if you can SSH into the box, you can get to files on it.
for example, sshfs lindsey@box.com:/ /workbox
it logs you with SSH and uses that to tunnel the file information.

4) vim, not emacs. =)

(Reply) (Thread)
[User Picture]From: lindseykuper
2006-01-31 05:23 am (UTC)

Re: ways to make OS X not suck with X Windows

(1) Yep, I already have Fink, and I like it.

(2) No.

(3) I do RSA authentication with SSH so I never have to type my password. Not only that, I have a little shell script rigged up so I can type, for instance, s partners instead of ssh -p 2222 lkuper@partners.ibctv.com.

(4) Cool, I'll check that out. I think I found yet another system that I like even better than emacs+tramp, though...I'll see how it goes.

(4) You already did 4. And: no.
(Reply) (Parent) (Thread)
From: mrr
2006-01-25 04:25 am (UTC)

oh yeah

arrow keys work in vim

and you can also use the homerow. ;)
(Reply) (Thread)
[User Picture]From: lindseykuper
2006-01-31 05:24 am (UTC)

Re: oh yeah

Arrow keys work in emacs, I just want to train myself off of them.
(Reply) (Parent) (Thread)