Ads by Google

Wednesday, February 6, 2008

The power of lists

You know the emacs kill ring? Well, I just had a look at it. considering the operations you can do with the kill ring, the data structure is simply a list!

In it's simplest form, working with plain text, it looks like

kill-ring is a variable defined in `simple.el'.
Its value is
("glgjglkg" "ggjjkg")


You get this by entering some text in a txt buffer and killing some lines of text. C-h v kill-ring will bring up the list.

Of course, for different modes it becomes a little more complex than that but essentially it's just a list.

In case you were wondering whether Emacs was using some difficult, arcane data structure. All the more reason for me to start learning Lisp sensibly. I've been starting, putting it off for quite some time now.

Should. start. it. some. time. soon.

Monday, February 4, 2008

Mea culpa. Listen to Emacs

If Emacs warns you about something, please stop what you're doing and understand what it's trying to say.

"File on disk has changed, do you want to save?"

This while remote editing the file. Blithely continuing, I hit C-x C-s and managed to corrupt the file.

In the split instant of saving the file and going "hmmm...who could be editing the file?"

ack! my colleague who was fixing a small typo .

Desperately pounding C-g, C-g, C-g.


No dice. I had a truncated file!

Good thing I had taken a backup the day before. A few calls and sheepish explanations later, sanity was restored.

If Emacs ever tells you something, listen.....carefully.

Sunday, February 3, 2008

Getting people to use Emacs

How easy has it been for you?

In my 10 years of using Emacs and talking to people about it, I think (the emphasis is on 'think') I managed 2 converts. But those were already Unix experts and probably don't count. :-)
Even the 2 converts, took about a couple of years, one decided to plunge in and the other a couple of half hearted attempts and then took a deep dive into it.

Like, decided to use Emacs for 6 months without using any other editor.

I really find it hard, to understand why this is difficult for someone. Not that Emacs is easy to learn. I meant the apparent decision in making up one's mind that indeed Emacs does things better than notepad or vi.

I can understand that if someone agreed that Emacs is the way to go but gave up due to the learning issues; for whatever reason. But what I don't get is the complete disinterest when your work involves things that Emacs does in a jiffy. Apparently I just showed you that in Emacs editing database columnar data is easy (you don't have switch from pasting between notepad and MS Excel to align the data) and you still show a complete lack of interest in knowing how that is done?

Leaving aside the Emacs learning part, wouldn't anyone be interested in that 'cool', 'neat' way of solving a simple text issue? Using vi to review large code bases versus using Emacs and bookmarks? Using htmlize? Helping someone with applying code changes using ediff? Simple word wrapping using M-q?

I tried across the aboard, people in the early twenties, late twenties and even my age group.
Not a single chap has come back to ask where, how and what to learn about Emacs?

Depressing.

Without evangelising, I've shown people how to do stuff in Emacs and the results have been....let's say diplomatically.....bloody disaster.

I must be getting old. That's all I can think of. or Ugly. or Stupid.

Using bookmarks...finally

Using Emacs for so long I never used bookmarks at all. Nada, not even once in almost 9-10 years. Sure I had read the documentation and knew that it existed. But using it?

Nope.

Bit like ctags. Know what it is about but since I don't program in C, I don't use it all.

Till about a few months back. Told to fix an application written in ksh, Oracle PL-SQL and Syncsort scripts. About 11KLOC lines of code in all.

The first few days I spent time opening many frames and buffers of the same file and it was clunky. I mean, there was a wall of Emacs frames on the taskbar.

There had got to be a better way. Since I had a RSS feed to the RecentChanges page on the Emacswiki site, I got a link about the bookmarks page.

A quick look at the page and then the manual, whipped up the one line change to my .emacs.


(global-set-key (quote [f9]) (quote bookmark-jump))


Setting bookmarks is done by C-x r m and entering a label using a mnemonic. Hint: Use the label latest for the most frequent or current focus of analysis. Then I use F9 to make Emacs prompt for a bookmark, which, by the way, allows tab completion in the minibuffer.

Bookmarks works in Dired buffers too AND tramp setup. Pressing F9 and Emacs prompting me for the password for the remote server is nice. Very nice (Yes, I know I can set the .authinfo or .netrc setup for the passwords)

With bookmarks, my analysis speed went up by an order of magnitude. I was using considerably less buffers, with less screen splitting and was going hither and thither through the code. Not only was my work done faster, I also bookmarked the frequent folders that I used to edit files in.

All in all, bookmarks WILL increase your productivity when you're looking at large code bases.

Those used to ISPF editors on the mainframe will not find this new, as it's very similar to labels. But the bookmarks on the mainframe is limited to the file you're currently editing or viewing. And I don't recollect whether the bookmarks are remembered across session; I think one cannot store those across sessions.

Sunday, January 13, 2008

Why is there no copy rectangle?

Well, the rectangle commands have everything except copy-rectangle. You can only do this by C-x r r, copy-rectangle-to-register which seems to be a bit clunky.

Wonder why.


Though to be fair, the registers are the ones that I use frequently. Multiple clipboards done right IMO.

Tuesday, December 25, 2007

Got Miro?

I'm not sure whether it's very popular or not but there is the free as in GPL free video player called Miro.

Miro is a project of the Participatory Culture Foundation, a non-profit organization.

This is a very good video software which integrates well with YouTube and Googlevideo. All you need is a very good internet connection for downloading videos.

The reason I post about this is that there are some emacs videos which are worth downloading to understand how certain features are used. Of course you could do the same on the websites of the above mentioned video sites but the player gets them all in one place for later viewing.

Neat piece of software worth having and I have to confess that I use it a lot more than just Emacs videos. :-)

As for the feature set of Miro, you're better off checking the website here rather than me listing the features.

It is is a 1.x release and there are a few bugs in its UI but none of it is a show stopper that prevents you from seeing videos.

Be aware that the binary download is large.

Saturday, December 22, 2007

How does he do it?

I've been using Org mode for sometime now and I should say that it's one of the best productivity enhancing tools for me. It's helped to get things organised so fast that I find myself tasking thinking of org mode when planning something.

If there is anything that needs to be done in the next few days, I usually plug it into the org file and then forget about it(err, not that way) and let emacs remind me of all the things on my plate as the deadline approaches.

And Carsten Dominik has been brutal in his releases; I mean, bug fixes, new features, re-writes, the works, it's really amazing seeing the point releases come out. It's so fast that I had to switch to a monthly update of org releases i.e. download the org release only once a month.

It's frenetic. and absolutely beautiful to watch everything happen working on a simple text file.

I just don't know how he does the kind of output on implementing things on org mode.

Whatever he's doing, it's an enormously useful for the rest of the user community.

you can get the latest package here

Friday, December 7, 2007

Emacswiki, a must use resource




The emacswiki website is perhaps one of the best collection of Emacs
information in one place. ummm... that is apart from the Emacs
Manual. :-)


The canonical website is http://www.emacswiki.org/cgi-bin/wiki. Since
this is a wiki, how does one keep track of all the new and modified
posts made by someone?

Simple, use the Recent Changes link to check for new entries

http://www.emacswiki.org/cgi-bin/wiki/RecentChanges

Plug that into your RSS reader and you can check the latest postings
on the wiki.


A Test Post using Emacs Gblogger




A test post.

Wednesday, November 14, 2007

Showing tabs

Without going into the debates of whether tabs are evil and what not, here's a simple way to visually see tabs in as you traverse text in a buffer.

(setq x-stretch-cursor t)
Documentation:
*Non-nil means draw block cursor as wide as the glyph under it.
For example, if a block cursor is over a tab, it will be drawn as
wide as that tab on the display.


Plug that into your .emacs and you should see a block cursor when emacs encounters a tab. I like this setting, as it's unobtrusive and shows up only when required.

Sure, there's M-x untabify and BlankMode but I prefer this as I scroll through the code quite slowly.