What I use Emacs for

Evolution

Like almost all newbies, I started out with pico, the editor that
comes with pine. pico was friendly. pico was easy to use. pico also
kept wrapping my lines, which is a Very Bad Idea when you're
programming. I discovered that pico -w would turn such
undesirable behavior off, and alias pico="pico -w "
became part of my .bashrc everywhere.

However, I felt mildly ashamed of pico. All the Unix books said I
should learn how to use vi, so I did. vi was fun, too - vim,
especially. I had my funky one-line ex commands, like :s%/foo/bar/g. I
could go to any line with :linenumber. I regularly used :! to invoke
shell commands. I liked the way it syntax-colored practically all the
files I edited - even the more obscure ones - and I was even thinking
of writing my own syntax files for the things it didn't handle yet.

I suppose it was sheer curiosity that made me try out Emacs. Emacs was
an intellectual challenge. I found myself attracted to its
intimidating complexity. I wanted to see if I could get the hang of it.

Emacs was surprisingly easy to use. I read through the tutorial. I
even browsed through the info node in my spare time. I used the menu
bar and the tool bar until I learned the different shortcuts and
extended commands. It was pretty cool.

Then one summer, I opened the Emacs LISP intro manual. I got hooked.
I started reading Emacs source code. I traced through functions. I
wrote my own. I did more and more stuff in Emacs and I realized how
much I had missed by using other editors.

47. BBDB tags

Right, that tags thing looks like a good idea. It should be easy to
hack into BBDB. I'll need to actually tag people, and then write an
Emacs Lisp script that scans through all of the records, gathers them
into categories, and then creates the list.

Use C-o to add a "tags" field to your BBDB records. This should be a space-delimited list of tags (case-sensitive for now).
Call M-x sacha/planner-bbdb-insert-tags-alist to produce a list like the one above.

44. Proof of concept: Deleting private tasks

It's easy to tweak Planner. For example, the following two lines of
code delete all lines that contain {{private}} before publishing. Your
planner pages will be fine, but the published HTML won't contain them.

39. Refactoring Planner annotation code

Many planner files just contain code for creating hyperlinks from the
current buffer. This does not have anything to do with the idea of
planning, but simply makes planning information available from more
buffers.

If we separate this functionality from planner.el, we can make it
easier for people to play around with context-sensitive hyperlinking
without having to deal with planner's complexity.

To make it easy for other people to play around with this, the
composition function needs to be flexible. Annotations should be
returned as (uri text) pairs, and a -composition-function can put the
two together in the appropriate format, escaping as necessary.
Highlighting will be provided in a separate file that defines a minor
mode that can be placed anywhere.

Other people's code for creating annotations, then, would just involve
calling -get-uri, or -as-kill, or -to-string. We can use the hook
mechanism to get the appropriate annotations for the current buffer.
-core.el will provide a method for resolving links, and it should be
something that can be used as browse-url-browser-function.

planner code also specifies how to mark up links. If we're moving the
annotation code into a layer that doesn't know about publishing, what
will happen to the code? In that case, we will define URL
transformation functions in either emacs-wiki or planner. Yes, that
would work...

I need to think of a good name for it. uri.el? Yeah, that sounds okay.

38. Updating the timelog

I often update my task descriptions. We haven't found a neat way to do
this in-buffer, so I use planner-edit-task-description. However, if I
update the task description or replan a task, my timelog data gets out
of date. This code snippet updates all matching tasks in the timelog,
and can serve as an example for code that updates things after a task
is edited.

28. AAAAARRRRRRRRGGGGGHHHH! I hate open source! In the nicest way possible, but still...

ARGH!
I hate open source. <sniff>
In the nicest way possible.
<sniff> So I decided to be nice <sniff> and work on command completion in Emacs for the tla version control system <sniff> and I Google to check if it had been done before <sniff> but only come across messages saying people were interested in doing it... <sniff>
Pour a few hours into it <sniff> adding completion for _every_ _darn_ _command_ <sniff> and a day after posting it on gnu.emacs.sources and the arch mailing list <sniff> I get a note asking how it's different from an existing module listed on the wiki <sniff!>
And the existing implementation is more flexible, too! <sniff> (Although not as pretty in terms of coding conventions.)
Story of my life, really, <sniff> every time I get a good idea <sniff> and work on it <sniff> someone's gone and done it <sniff> and better than I would've.

27. pcmpl-arch.el

All the commands documented in tla help can be completed using
../emacs/vc-arch/pcmpl-arch.el, a programmable completion module
for the arch version control system. I'm getting the hang of pcomplete
now... =)

26. Heavily tweaked w3m

I've decided to do even more things the Emacs Way. Emacs-w3m is a lot
more customizable than Mozilla. This is Emacs we're talking about
after all, so it's no surprise. ;)

I've set up a heavily tweaked keymap that might fit the way I browse:
an insane number of tabs and a lot of remembering. The default keymaps
favor QWERTY, but I've tweaked it for my Dvorak keyboard. Here are a
few thoughts.:

, and . cycle through the tabs
HTNS (all caps) navigate through the page per line
tn scroll through the page like DEL and SPC
r remember

13. ERC pseudo-AI assisted IRC help

<sachac> Hmm. That gives me another nifty ERC idea - if we annotate BBDB records with timezones, we should be able to
greet people good morning/day/evening appropriately. Plus points for greetings in native languages! ;)
<sachac> Now that's just insane, really. <laugh>
<arete> *augh*
<arete> laugh too
<arete> sacha: I'm sure you'll have it done by tomorrow ;)
<myrkraverk> sachac: that could be nice, yes
<myrkraverk> ,there is also an evil place without a name -- it does not have emacs
<fsbot> Added entry to the term "there"
<plaisthos> ,now
<fsbot> try: Acknowledgments NowPlaying PostItNow WikiAcknowledgments WikiNow
<sachac> arete: Well, I've been thinking of rule-based matching on privmsgs received, with responses suggested in another
buffer for easy selection with keysequence or mouse... =)
<Lukhas> sachac: good idea
<arete> hehe yeah, saw you mention it the other day
<arete> just one step away from eliza =P
<sachac> arete: I'm just thinking of how to do it nicely so that the matches don't take a terribly long time. I suppose
match-string is my friend. I can build the regexp at the start, match it constantly, then match again based on
the match string...
<delYsid> ,df rx
<fsbot> rx is a Lisp macro in `rx'.
<fsbot> (rx REGEXP)
<fsbot> Translate a regular expression REGEXP in sexp form to a regexp string.
<fsbot> See also `rx-to-string' for how to do such a translation at run-time.
<fsbot> The following are valid subforms of regular expressions in sexp
<fsbot> notation.
<fsbot> STRING ..[Type ,more]
<sachac> arete: ... but of course that means I'll be working as a stateless machine for now. Oh well. Actually, no, the
functions can keep state on their own; I just won't be able to add new keywords without recompiling the regular
expression, which shouldn't be too hard.
<myrkraverk> sachac: I guess the best way for the greeting is some standard text that gets translated at other ercs
<arete> don't forget to weight the chosen responses so you don't have to look through them all each time the same choices
come up =)
<delYsid> sachac: use rx-to-string and a variable...
<sachac> myrkraverk: Actually, that will hook into my "hi" thing...
<myrkraverk> oh, k, then
<sachac> myrkraverk: ERC should not only check which of your pals are online, but also which you haven't greeted yet, and
people who aren't pals but who have greated you specifically. =)
<sachac> I haven't written said "hi" thing yet, though.
<sachac> Err.
<sachac> Greeted.
<sachac> Grrr.
<sachac> myrkraverk: Ideally, ERC should compile a list of people to say Hi to, and hi them all on one line, appending a
generic ", world" at the end or something like that. =)
<sachac> myrkraverk: An extension to BBDB could have custom greetings for hi. For example, I greet some people in other
languages.
<myrkraverk> sachac: you have too many ppl to say hi to ;)
<sachac> myrkraverk: It's a proof of concept! ;)
<sachac> myrkraverk: If you tie that in with the funky timezone thing, that would be, well, pretty funky.
<myrkraverk> btw, can erc let me know when someone is online?
<arete> sacha: don't' forget the automated reply to a greeting =)
<sachac> myrkraverk: However, the timezone thing could be done without the funky hi thing...
<myrkraverk> hmm
<sachac> arete: My proposed system wouldn't be entirely automated. It would suggest responses, but it would allow the
user to actually change them or select a different response from the buffer.
<zeDek> howdy sachac
<sachac> arete: I'm thinking of a circular queue of 5 to 10 (of course, configurable) possible replies.
<sachac> zeDek: howdy zeDek
<sachac> Well, that's an easy way around it - just echo the greeting... ;)
* sachac is the resident bot-in-training. ;)
<zeDek> lol
<myrkraverk> sachac: btw, I have a photo now on orkut (like you care :P )
<arete> *chuckle*
<Lukhas> zeDek: did you find time to send me the new color-theme ? :)
<zeDek> Lukhas, ok wait
<Lukhas> thanks
<sachac> arete: I'm interested in this because I stay on a few help channels. My hippie-expansion from BBDB is pretty
useful for expanding factoids, but (a) I don't want to have to remember what to expand, and (b) I want to be
able to deal with questions I might not have paid attention to. ;)
* zeDek was migrating old gnusfr.org and emacsfr.org
<Lukhas> lukhas -> free point fr
<sachac> myrkraverk: I'll check that out when I get around to starting up a graphical browser...
<Lukhas> did you find hosting room ?
<arete> sacha: now there is a more productive use of it =)
<arete> I can never remember what keyword fsbot wants
<sachac> delYsid: Hmmm, that should be interesting.
<sachac> arete: The human still filters the automatic responses, of course. =)
<delYsid> I use it in chess-ics for a very complicated re (760 chars)
<sachac> arete: And automatic responses can be of the form <name>: <canned response> already...
<sachac> arete: Naturally, if we allow functions and strings as canned responses, then we can even have a state machine.
<arete> yumm, pseudo-AI assisted irc help
<zeDek> Lukhas,
<sachac> arete: Yeah, something like that. <laugh>
<zeDek> Lukhas, done
<sachac> arete: Worth hacking on in my spare time, I think.

10. Good idea for nethack.el

kanaldrache: yes, therefor i want a mapping function ... take a
picture of that level when you leave it so that you can chekc nine
levels later "Mhh, where was that expensive shop? Level 4 or level
7?" without walking back or use you /oT

8. Woohoo! Emacspeak back up!

After struggling with ../emacs/emacspeak-config.el, Emacs with
Emacspeak now boots all the way up to my tasks. Now I get to play with
it a whole lot more. Next step - get another Twiddler (Dr. Rodrigo
said that the department will spring for it). Also, check out gestures
for Emacs. Oh, and have lots of fun... =)

emacspeak-planner.el in ../emacs/emacs-wiki has preliminary
support. emacspeak doesn't seem to like invisible text in emacs-wiki.
Fix one of these days.

7. committing

The proper thing to do when C-x v v is called and files are modified
depends on whether or not multiple files had been changed. If multiple
files would be committed in a single patchset, one should bring up a
dired buffer containing the modified files, allowing the user to
unmark a few. When the files have been selected, a log window should
appear. C-c C-c in this window should commit the patchset.

I'd love to hear about any questions, comments, suggestions or links that you might have. Your comments will not be posted on this website immediately, but will be e-mailed to me first. You can use this form to get in touch with me, or e-mail me at [email protected] .

Page: Emacs Hacks

Updated: 2005-06-09

NOTE: ANTI-SPAM MEASURE NOW IN PLACE. Please answer the following question with the right number in order to send me your comment.