Carousel is a lie!

Entries tagged "emacs".

Gloria!
16th August 2004

My wife and I kinda made an impulse purchase on the weekend: a new 12" iBook G4. It was weird: I made a joke about buying a laptop. Then I explained that I was only joking, but if we were going to buy one it should be an iBook since I kept hearing how sweet they were. Then we were going to go to Stanley Park, hang out at the beach, but maybe go to London Drugs (I don't know about you Americans, but in Canada we go to the drugstore for everything...car insurance, furniture, computers, you name it. Oh, and occasionally prescriptions) to see what prices were like. Then we were buying one. It all happened so fast.

So far, it's pretty damned impressive. After all the trouble I had to go to get gphoto to work with our digital camera, my wife just plugged it in here and it worked with iPhoto right away. Not only that, but we were looking at a slideshow of the crack-induced photos we'd taken while Fur Elise played in the background. Fucking unreal, man.

It's weird: I do feel a bit like I've made a deal with the devil. I've come to agree more and more with RMS about Free-as-in-Freedom, and here I am with a closed-source OS. Yada-yada-Darwin, what about Aqua? But it's sooooo nice...well, mostly, anyway.

I'm trying to use MacStumbler at the moment to find a wireless network to hook up to, but no luck: it just sits there, looking like it's scanning but with no more feedback than a scrolling bar. Dammit, I thought W2K was the only culprit there...and dammit, if I can't blog from the steps of the Vancouver Art Gallery, this thing is going back to the store. I suspect a problem with MacStumbler, but it's hard to be sure; I managed to find five or six access points at the office with Knoppix and the work laptop, and (apparently) wasn't able to find a thing with MS. I need to find a command-line version.

So far, though, that's my only complaint. Pretty fucking sweet, if you ask me.

Had a problem at work with Debian and VNC: the alt keys wouldn't work, for some reason. This was pretty annoying for the developer who really, really wanted to use Emacs. It took me about an hour of poring through Google -- Jesus Christ, the number of complaints about ALT keys disappearing, and Good God the long uber-thread about the change in keyboard behaviour between Debian versions -- to find the solution: vncserver --compatiblekbd A-ha!

Back to work and still no wireless access. Carousel is a LIE!!!

UPDATE: The VNC trick doesn't work. Details: The developer is running VNCViewer under VNC to connect to an X desktop on a Debian machine. On that machine, he's opening up an xterm and running User-Mode Linux. Alt-equals-meta works for Emacs when run on the Debian machine, but not for Emacs when run in the User-Mode Linux xterm. Fuck. UPDATE: Buddy found the trick: shift-left-click in the xterm to get the menu, then click "Meta sends escape". Double fuck!

Tags: emacs, hardware.
NWR04B: My descent into little-endian binary arithmetic hell
1st October 2005

Currently writing this entry in emacs. Once upon a time, I stopped using emacs for fear of what loading a 20MB editor would do to the mail server I was working on, and learned to love vi. Prompted by ESR's Art of Unix Programming, I've decided to try pick up emacs again. It's interesting....Anyhow: Right now I'm trying to figure out why the hell writing to flash on the NWR04B is not working. First off, I've edited the map file for the flash devices (drivers/mtd/maps/cx84200-flash.c for those of you playing the home game) so that I've got two partitions declared:

static struct mtd_partition cx84200_partitions[] = {
        {
                name:           "bootloader",
                size:           0x00020000,
                offset:         0x00000000,
                mask_flags:     MTD_WRITEABLE, /* force read-only */
        }, {
                name:           "root_fs",
                // Codeman's original:
                // size:        0x000fa000,
                // My efforts at making a root partition:
                size:           0x00040000,
                offset:         0x000f0000,
}

The first I'm not really doing anything with, but it could (as the title suggests) be turned into a bootloader partition someday. The second is where I'm concentrating my efforts. The read-only flag that was originally in there was removed once I figured out it might help matters. :-) Okay, so now what? Well, got a jffs2 image that I created, so let's try the obvious:

# cat test.jffs2 > /dev/mtd1

...and it just hangs. (I still haven't bothered to figure out how to make CTRL-C interrupt a process yet...something to do with the terminal, I think.) Up the debugging output and you see MTD_open, and then nothing. I had a look at the part of the driver (drivers/mtd/chips/sst39vf080.c) to see what's going on here, and I managed to figure it out a bit. The write operation tries to write one byte at a time, then reads it back to make sure it got read. If so, move on to the next byte; if not, try 256 more times (I guess waiting to see if it just needs a moment) and see if that works. If yes, next byte; if not, give up on the write entirely. I threw in some messages to track that, and one that shows what value it's reading back from flash after the write. After throwing in ridiculous amounts of debugging info to track this, it seems that the write of the first byte is simply not working. The write fails, and cat just keeps on trying (or something). A bunch of looking around finally turned up the MTD-JFFS-HOWTO from (I think) the guy who wrote the MTD driver. 'S full of all sorts of helpful hints, like:

Well, fuck. So I follow the directions for the 2.4 kernel support, and figure out how to compile the flash_eraseall utility. Wonderful! Ready to go! Just gotta erase this here partition, and... Only no, that doesn't work: I get the same error re: the byte not being written as before. I'm currently throwing in even more unholy amounts of debugging than before, and teaching myself the simplest bits of binary arithmetic you can image, in order to confirm that, yes, write protection is being turned off...I think. This little-endian thing still confuses the hell out of me. The datasheet sez that, at the address the enable_write() operation is accessing, there are 32 bits set aside for controlling the first bank of flash (which is what we're after here). The 26th bit is write-protect (1 for on, 0 for off). enable_write() reads all 32 bits at that address, &'s it with 0x04000000, and then WP should be off. So the unholy debugging shows that the long int being read:

Okay, so that works. Maybe I'll give the flashcp utility (part of the MTD tree) a try and see how that goes.

Tags: emacs, nwr04b.
NWR04B: Another year older, and what have I done?
29th December 2005

Gaw'bless you, Matt Johnson.

A year ago today I mentioned, almost in passing, that I had picked up a cheap wireless router and hoped to get Linux running on it shortly. Since then, I've learned an incredible amount about electronics, reverse-engineering, assembly language, compilers, the Linux kernel, and programming as I moved further up the abstraction ladder. I'm still no expert at any of this, but it astounds me how far I've managed to get along.

Currently I'm stuck at getting flash memory to work -- specifically, being able to erase and then program a chunk of flash memory. The trouble is that the magic numbers that the Linux drivers and the datasheet say are needed don't seem to be working. Previously, I was having the same sort of problem getting the kernel to detect the flash in the first place; the trick was figuring out that GPIO was involved in all this. But I'm doing that same trick now, and it's still not working. As always, I'm not sure what I'm doing wrong.

Still, though, I think I'm going to keep poking at it -- for a while, anyway. My interest is beginning to wane a bit (I flit a lot; a year is a long time to me), plus I got a kid on the way (ack!). I may move on to trying to make all the ethernet interfaces work, not to mention the wireless card, as a way of taking a bit of a break. And of course, I'm still aiming at making the world's first Beowulf cluster of wireless routers.

On another note: today's entry is brought to you by the fine, fine folks at the Free Software Foundation, to whom I've just paid my membership dues for another year. I owe these people a huge amount: not only do I get to use a staggering amount of world-class software, written by their members and with their support, for free (I'm writing this on Emacs right now), not only have I been able to earn a fucking living from what I've taught myself using GPL'd and BSD'd software, RMS has also given us the language to, I dunno, frame the whole question of why this is important: by starting the FSF, by naming the Free Software movement, by giving us the GPL. There are those who disagree, while still cherishing the freedom the FSF seeks -- but I think you'd be hard-pressed to deny the power that one pissed-off geek gained when he got pissed off about some closed-source printer drivers.

(Yes, that may be a big myth -- but that is not the same as being a lie, and the providing^Hsynthesis of motivating myths is important too.)

From their website:

Please support the work of the FSF bymaking a donation,joiningas anassociate member,ordering books and merchandise, or signing your organization up as acorporate patron.

Hate RMS? Fine by me. Give to others:

Do it. We owe them.

Tags: emacs, freeasinfreedom, nwr04b, wontyoupleaselendahand.
Emacs, pkg-src, server room
5th June 2007

New emacs, woo! I've downloaded it and compiled it already, 'cos I am that l33+, thank you. But one thing: the tarball is signed by Chong Yidong, pgp/gpg key #BC40251C. I could not find any indication anywhere that this is the right key, or what the right key might be. A quick search turned up lots of posts on the Emacs mailing lists, bugzilla entries and such from him, so I presume it's okay…but it would be nice to make this explicit. (Even a search for the key number turned up nothing.)

This article about updating pkg-src makes me even happier I went with Debian. That is all.

Yesterday I got a new switch in at work. Good god, the 10/100 Procurves are getting cheap — $600 w/academic discount for a 2626. I was just going to rack it, but as always I couldn't stop once I got going; that server room needs a lot of cleaning up. Three hours later I emerged, bloody but triumphant: the network cables were cleaned up considerably, I'd identified the last of the mystery boxes (step-down transformer, not a UPS like I thought), and I'd figured out that the big UPS was only one-third loaded — plenty o' room. Once I get all the cleaning done, I'll post before-and-after pix, 'cos that will be one chunk of work I'll be damned proud of.

Tags: emacs, network, packagemanagement.
So \*that's\* what's going on
16th June 2007

For a while now I've been irritated with the behaviour of OpenRCS and Emacs on my OpenBSD machines: every time I try to check out a file kept in RCS, using C-x v v (vc-next-action), I still have to toggle read-only status on the file. Then, when I try to check it in, it asks if I want to steal the lock from myself, and never actually checks it in.

Finally had some time to track this down, and this bug appears to be the cause. I may have to play around with Emacs a bit to get it to ignore the permissions, or I may just use the OpenBSD package for GNU rcs instead.

Tags: bsd, emacs.
Hurray for old blog entries!
20th June 2007

This entry, detailing the love that comes from XTerm's meta-sends-escape functionality, saved me from tearing my hair out today over why the Alt refused to send Meta to Emacs in a terminal. And hurray for this line in .Xresources:

XTerm*metaSendsEscape: true

Exciting times, I tell you.

Tags: emacs.
Emacs and a new beginning
3rd September 2007

Some fun Emacs stuff:

I had a meeting with my boss at work last week (before a nice four-day weekend…the split schedule I've got means that sort of thing happens very rarely. But I digress) to set my priorities now that the upgrade has more or less been finished (lingering issues aside; see ahead).

One of the big things is getting Zimbra set up. This will be nice; we do not have a calendar for the office right now, and this is is getting to be a pain. My boss is open to the idea of something that's not Outlook/Exchange, and that's good.

The other thing is getting a bunch more Windows machines in. This is a small shop, so "a bunch" means another 15 or 20 -- which'll double the number we have. I'm not entirely happy about that, but because this is a longer-term project I've been given time to do this right. And to me, "right" means "using open-source tools whenever possible to manage Windows". Thus, I'll be getting the time to set up Unattended and wpkg, and possibly even digging up Windflower and seeing if it's worth continuing. I'm actually kind of excited about this.

It's a little strange having a manager take this much of a hand in setting priorities; I've worked in a series of small shops and, up 'til now, have been left more or less on my own nearly the whole time. It does feel good to get a bit of direction, though. I mean, I know what needs to be done and I'm doing it, but I've always felt a bit lost trying to decide what's most important for everyone once past the finger-in-the-dike stage.

Now to go try and get Multi-TTY working on this laptop…

Ack: Just realized I never described the lingering problems with Solaris 10. Fairly simple to describe: LDAP lookups take 'way longer than they should (ls -l /home/ can take 5 seconds per line sometimes), and JDS on the SunRays is slower in parts than it should be (click on the logout button, wait 60 seconds, message pops up saying "Are you shure you want to log out?"). I'm hopeful I can track those down without too much effort…

Tags: emacs, solaris, upgrades, windows.
How handy is \*that\*? I mean, are \*those\*?
18th November 2008

DNS and Emacs:

Tags: dns, emacs.
Random notes
28th January 2009
Tags: books, dell, emacs, hardware, rant, solaris.
Long-term planning
28th January 2009

Another thing I'm trying to do at my new job is make/take more time for long-term planning. I've been dinged by mgt. for this in the past, and while it's not easy to hear I think there has been some validity to this. (My inclination is to concentrate hard on fixing the problems I'm faced with; giving up on something broken, even when doing so would make so much more sense and would free up resources to look for a replacement, just rankles and feels like...well, giving up.) Since the department I'm in is so new, it's even more important to pay attention to this.

Part of the problem is just recognizing that I need to make time. An hour a week to be isolated, and to (say) figure out what I'm going to need to do for the next month, is a habit I'm very conciously trying to adopt.

But another problem is how to keep track of all this. What I've done so far:

So where does that leave me? ATM, (paper planner Cycle) attempting some longer-term project tracking w/org-mode. I figure the TODO bits from org-mode will fit well with the planner, and the flexibility of Emacs and org-mode (different from paper...oh, how I wish I could grep paper) will work well for projects...the records for which should, ideally, be suitable for pasting into wiki-based documentation.

If anyone has any suggestions, please let me know. If I make it to LISA this year, I'll be looking for a BOF about this. (Or maybe I'll just tackle Tom Limoncelli to the ground and holler "I love you, man!" a la "Say Anything".)

Moving on:

And now it is time for bed.

Tags: career, cfengine, emacs, time.
New server room ours at last
11th June 2009

Given the recent hoo-ha about abandoned blogs, and my own tendency to lose interest in writing about something the longer I put it off (I haven't graphed it, but I suspect it's a nice exponential decay), I figured I should finally write up what I've been doing the last week: the move at $WORK to our new server room.

So: construction finally got finished on our new server room. Our UPS was installed, our racks set up, and the keys handed over (though they were to be changed again twice). Our new netblock was assigned, the Internet access at the new location was in place, and movers were booked.

Things I did in advance which helped immensely:

Last Thursday morning, it all started. I got the machines shut down (thank you, SSH and ubiquitous wireless access at UBC) before the two volunteers who were helping me showed up. We started getting machines unracked; since it was only about 20 machines, I figured it wouldn't take too long. While that was true, I had not counted on the rat's nest of power cables (our power requirements were such that we had to connect machines to PDUs in adjacent racks), or the fact that we wouldn't be able to disassemble that 'til we'd got the machines out.

There was one heartstopping moment: a 1U server, while extended on its rails, came off one of the rails while no one was supporting it. Amazingly the other rail held on while it rotated quickly through 90 degrees to bang loudly against the rack. "You swear quickly," the movers remarked. (Doubly amazingly, the machine seems to be fine, though the rails for the thing are shot.)

The movers were big and burly, which was wonderful when it came to moving the Thumper. I weigh more than it does, but not by much, and I'd had the bad fortune to screw up my back a week before the move. It was tricky trying to figure out how to remove it from the rails, but the movers' trick of supporting it with a couple of big blankets, while fully extended from the rack, made such considerations less urgent. Eventually we got it figured out. I don't know how that could have gone smoother, since we'd got Sun to rack the thing and, frankly, it's not like you spend a lot of time un- and re-racking something like that. Anyhow, a minor point.

The new location was right around the corner, which was handy. The movers had put the servers in these big laundry-like carts on wheels; in the end, we only had four of em. We got the machines unloaded, racked the Thumper with the movers help, signed the paper, then went off for lunch where we picked up two more volunteers.

After that, we started racking servers. Having only one sysadmin around (me) proved to be a bottleneck; the volunteers had not worked with rackmounted machines before, and I kept having to stop what I was doing to explain something to them. It would have been a great help to have another admin around; in fact, I think this is the biggest move I'd want to make without some other admin around.

Problems we ran into:

Things that went well:

I'm going to post this now because if I don't, it'll never get done. I may come back and revise it later, but better this than nothing at all.

Tags: emacs, hardware, serverroom, work.
Emacs tip o' the day
12th August 2009

Thanks to Planet Emacs, I came across this tip about tramp: turns out there's a sudo method for tramp. C-c C-r will now re-open a file using sudo. Sweet!

Tags: emacs.
Editing Foswiki files from the command line
22nd December 2009

Hah! Thanks to Teridon, I can now edit Foswiki files from the command line:

rcs -l TextFileName.txt
ci -mnone -t-none -wusername -u TextFileName.txt

Sweet! Now to automate it in Emacs...

1 comments. Tags: emacs, foswiki.
Wikipedia over DNS
31st March 2010

Okay, last micro-update today I swear: you can query Wikipedia over DNS. Here's the description, a short presentation on how it's done, and a bash function. Now to see if I can get something hacked up in Emacs.

Tags: dns, emacs.
You magnificent bastard.
28th June 2010

Wow:

Since I have started to use Org-mode, I though it was missing
something to have appointment locations on a map. Of course, it's
easy to get a LOCATION property from an entry, and then browse-url
on Google Maps.

But it is too easy for me, so once again I said: challenge accepted! I
will bring Google Maps into Emacs!

Google Maps in Emacs

Simply amazing.

Tags: emacs.
Emacs workgroups, birthday beer, smart people
10th February 2012

Random notes:

It's tedious setting Emacs' window layout just the way you like it -- splitting windows, adjusting their size, switching to the right buffers, etc. And even when it is set, it won't stay that way for long. On top of that, you can't save your window-configurations to disk, so you have to start over from scratch every time you restart Emacs.

There are solutions out there to parts of the problem -- elscreen, revive.el, window-configuration-to-register, etc. -- but none provide a complete solution. Workgroups does.

It is so choice. If you have the means, I highly recommend picking one up.

Tags: beer, emacs.
Weird bright satellite on Monday
29th February 2012

Last night was a rare semi-clear night (this month has been awful, grumble), so I was excited to see the Moon, Jupiter and Venus on my walk home from the bus stop after $WORK; it was kinda cloudy, but not completely, and anyhow the crecent moon was awful pretty through the haze. When I got home I asked my oldest son if he wanted to go out w/the telescope after supper. He was enthusiastic, so I put the 4.5" reflector outside to cool while we ate.

Forty minutes was enough to bring in more threatening clouds, but we could still see the three of them. I set up the scope and had a look at Theopilus. A couple years ago my son noticed its distinct appearance, and asked what its name was. I looked it up, and have been fond of it ever since. This time, though, he couldn't pick it out...but he was still interested, so that was good.

I'd looked on Heavens-Above to see if the ISS was due to fly overhead tonight, and it was -- just before 7pm, right when we were outside. Sweet! Sure enough, we watched closely and there it was, bright as anything and moving just past the moon. But wait, wasn't it supposed to go across the moon? What the...

...and then one minute later, there was the real ISS, and it was going across the Moon (very cool!). And there was the other satellite, almost as bright, moving on a different track. As far as I could tell, both stayed the same steady brightness -- so no tumbling for our mystery satellite. We watched both 'til they passed into the Earth's shadow, then headed inside for the night.

First thing I did, of course, was pull up Heavens-Above again to see what this other satellite was. And I couldn't find anything! There was simply nothing listed anywhere near the time the ISS flew over, let alone something that was supposed to be that bright. No Iridium flares either. Stumped, I reported to my son that I had no idea what it was.

But then I realized that I'd been looking at the listings that were supposed to be brighter than 3rd magnitude, rather than the fuller list that went down to 4.5. It was possible this thing was in the fuller list, but was brighter than predicted (because the predicted angle of reflection was wrong, say). So I pulled up the full list and started looking at tracks.

Sure enough, there were a bunch that were overhead at that time. The ISS was the most obvious one, but looking at the map tracks this Delta II rocket was the one we saw, which had launched the Globalstar 26. Here's the ISS pass:

ISS pass

And here's the Delta pass:

Delta pass

The times don't match up perfectly. The Delta was predicted to reach max altitude at 18:44 and enter shadow at 18:50; the ISS was predicted to reach 10 degrees altitude at 18:51, max at 18:54 and shadow at 18:57. I didn't note the time we saw the first one, since it was right around 18:50 and I thought it was the ISS.

I told my son about all this and -- being the son of a geek -- he thought it was pretty cool. :-)

Also -- and this is completely unrelated -- how did I not know about M-a in Emacs? Ordinarily it's "backward-sentence", but in programming modes, it moves to the beginning of non-whitespace on a line. ZOMG.

Tags: astronomy, emacs, geekdad.
Emacs and Outlook
1st March 2012

Here's hoping I never need this: a Tcl script that allows you to use Emacs as an editor for Outlook.

Tags: emacs, windows.
Remember when M-x spook was a joke?
6th March 2012

From the Emacs manual:

35.6 Mail Amusements

M-x spook adds a line of randomly chosen keywords to an outgoing mail message. The keywords are chosen from a list of words that suggest you are discussing something subversive.

The idea behind this feature is the suspicion that the NSA1 and other intelligence agencies snoop on all electronic mail messages that contain keywords suggesting they might find them interesting. (The agencies say that they don't, but that's what they would say.) The idea is that if lots of people add suspicious words to their messages, the agencies will get so busy with spurious input that they will have to give up reading it all. Whether or not this is true, it at least amuses some people.

Hee hee. And then there's the Jargon file:

NSA line eater: n.

The National Security Agency trawling program sometimes assumed to
be reading the net for the U.S. Government's spooks. Most hackers
used to think it was mythical but believed in acting as though
existed just in case. Since the mid-1990s it has gradually become
known that the NSA actually does this, quite illegally, through
its Echelon program.

And now this:

The Department of Homeland Security monitors your updates on social networks, including Facebook and Twitter, to uncover "Items Of Interest" (IOI), according to an internal DHS document released by the EPIC. That document happens to include a list of the baseline terms for which the DHS -- or more specifically, a DHS subcontractor hired to monitor social networks -- use to generate real-time IOI reports. (Although the released PDF is generally all reader-selectable text, the list of names was curiously embedded as an image of text, preventing simple indexing. We've fixed that below.)

stuff to monitor

Epic.org info here. Some random keywords, thanks to Animal New York:

Tags: emacs, politics.
Impromptu training from the sysadmin
9th March 2012

Today I gave some impromptu training at $WORK; the approximate topic was "Saving State in Linux". I've been meaning to do something like this for a while, but it was prompted by a conversation yesterday with one of the researchers who kept losing work state when shit happened -- Emacs window arrangements, SSH sessions to other machines, and so on. I found myself mentioning things like tmux, workgroups, and Emacs daemon mode...and after a while, I said "Let me talk to you about this tomorrow."

So today I found half an hour, decided to mention this to everyone in the lab, crowded into a meeting room, set up my laptop and the projector, and away I went. For a fly-by-the-seat-of-my-pants first attempt, I think it went relatively well. Best idea: asking people for questions. It hadn't occurred to me that people would want to know more basic stuff like "How do I split windows in Emacs?". I'm never sure what people already know, so I don't want to bore them...

Next time:

In other news: finally converted my SVN repos to Git yesterday in a fit of pique. The big three -- my org-mode stuff, and the two Cfengine repos (Cf2 and -3) -- are already in use, as in that's where I'm checking stuff into. The rest (Nagios configs, for example) are being done as I get to them. It's really, really wonderful.

Family: holy house o' plague, Batman!

Gah. We're getting the house boiled next week. (Update, March 13: too late; I puked on Friday night and spent Saturday moaning in bed; my wife did the same thing Saturday night/Sunday. FUCK.)

Also? There's a Planet Lisp. Who knew?

Tags: emacs, geekdad, linux, sysadmin.
Small Emacs win
14th March 2012

Part of how I'm beginning to work with Org and RT:

(defun x-hugh-boxquote-yank-and-indent ()
  "My attempt to combine boxquote-yank and indent.

The car/cdr bits are from the docstring for boxquote-points.  It's a bit silly to run it twice, but it was simple."
  (interactive)
  (save-excursion
(boxquote-yank)
(next-line)
(indent-region (car (boxquote-points)) (cdr (boxquote-points)))))

(global-set-key (kbd "<f9> y")  'x-hugh-boxquote-yank-and-indent)
Tags: emacs, rt.
Magit error "fatal: ambiguous argument"
15th March 2012

When using magit, I came across errors that looked much like these:

Unpulled commits:
fatal: ambiguous argument 'HEAD..exoplanet/compute_server': unknown revision
or path not in the working tree.
Use '--' to separate paths from revisions

(Here, "exoplanet" is the name of a machine, and "compute_server" the name of a branch.)

The problem turned out to be that .git/config looked like this:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = exoplanet:~/dotfiles-git-master
[branch "compute_server"]
    remote = exoplanet

Note how the branch lists the remote as "exoplanet", but there's no "exoplanet" remote config stanza -- only one called "origin". Changing the remote listed under the branch to be "origin" worked. Here's the working config:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = exoplanet:~/dotfiles-git-master
[branch "compute_server"]
    remote = origin
Tags: emacs, git.
Half-assed Emacs mode for Foswiki/Twiki
16th March 2012

Here's my attempt at getting a working Foswiki/TWiki mode for Emacs based on Org-mode. I've started taking this good work and mangling it; my excuse is that I'm only just starting to program Emacs.

What works so far: cycling visibility with tabs and detecting levels. Hey, it's a start. :-) Next up is getting Meta-left/-right to work to promote/demote headings; I'm not sure if I should be doing this with Emacs advice, or if there's some other way to locally override a function's definition. Answers on a postcard to aardvark [ta] saintaardvarkthecarpeted [tod] com 'til I get comments sorted out.

Tags: emacs, foswiki.
Detailed setup for OrgMode
18th April 2012

http://doc.norang.ca/org-mode.html is an excellent tutorial on customizing Org Mode to the nth degree. I keep trying to remember the link, so I'm writing it here to remember...but I highly recommend checking it out.

Tags: emacs, org.
Distracted by Emacs
9th November 2012

I write these blog entries in Markdown mode, but markdown-mode in Emacs doesn't stick links at the end of the text the way God intended (and the way footnote-mode does). This is close, but not yet working:

(defun x-hugh-markdown-footnote (description)
  "A Small but Useful(tm) function to add a footnote in Markdown mode.

  FIXME: Not yet working, but close."
  (interactive "sDescription: ")
  (let ((current-line (line-number-at-pos))
        (last-line (line-number-at-pos (point-max)))
        (link (read-string "Link: "))
        (link-number (x-hugh-get-next-link-number)))
    (save-excursion
      (if (> (- last-line current-line) 1)
          ()
        (insert-string "\n"))
      (goto-char (point-max))
      (insert-string (format "\n[%d]: %s" link-number link)))
    (insert-string (format "[%s][%d]" description link-number))))

(defun x-hugh-get-next-link ()
  "Figure out the number for the next link."
  (interactive)
  (save-excursion
    (goto-char (point-max))
    (beginning-of-line)
    (if (looking-at "\\[\\([0-9]\\)]:")
        (eval (+ 1 (string-to-number (match-string 1))))
      (eval 0))))

Right now it craps out with a "Wrong type argument: integer-or-marker-p, nil" when it runs x-hugh-get-next-link. Doubtless I'm doing a bad thing in my half-baked attempt to return a number. But still, close!

(UPDATE: I figured it out! To return a number, wrap it with eval. Fixed above. Working!)

(Believe it or not, I started out to write about Github and bioinformatics. Such is the life of the easily distracted.)

ObMusic: "The Balcony" by The Rumour Said Fire. Reminds me of 60s folk. I like it.

Tags: emacs, music, yakshaving.

RSS Feed