Emacs Calendar Extension – Information Unity (Part 3)

4

Ok, this post should wrap up the series – finally. Sorry it’s taken me a while, but got caught up in life for a bit…

To summarize what we’ve covered so far, I figured out how to get a iCal file imported into Emacs calendaring system, remove duplicates, and do a little post-processing in order to get it looking the way I wanted.

Up to this point, it’s all been manual calls with eval-region and that just won’t cut it! We need an Emacsian way of both a) Automatically running this code on start up (which the provided functions can already handle, and b) Being able to manually re-execute at any time via Emacsian means.

The running on start up, as I’ve said, is already handled via normal elisp code execution. We really just need to enable that same functionality through manual Emacs interaction.

Looking through documentation and many blog posts I discovered how to interact with the Emacs system – and it’s actually pretty simple. You only have to do a couple of things, actually:

  1. defun a standard lisp method.
  2. Include the interactive form (of which there are varying arguments it takes based on the required functionality.
  3. From within this form make calls out to the forms that we already created for importing an iCal

Read more

Tags: , , ,

Ugggh – Malware in WordPress?

0

Sorry folks, but apparently one of the images that I had linked out to in a post – if clicked – would direct you to a malware page…

Luckily, Chrome alerted me to it and I’ve taken care of it.

I guess I need to be even more careful with my content!

Again, my apologies.

Are Lower Level Languages Better?

6

I dropped a link to the post on my programming history on Facebook and got an interesting comment from one of my lifelong buddies – none other than Digger Waggle:

 I learned 6502 assembly when I was around 14 . Never really learned C or C++ or any of the higher level scripting languages(though I know how to read them like I can read a French or Spanish label on the back of the shampoo bottle.) I’m still of the strange mindset that the only way to really program is ASM.

I’ve often thought about the subject of this post, and Digger’s comment just brought it to the forefront of my mind.. Are Lower Level Languages Better?

My definitive answer is: Um, it depends? But more often than not, the higher level language will win out.

“Why”, you ask? Let’s start out with an abbreviated and paraphrased computer history lesson… On second thought, check out this article and then come on back for my explanation. I’ll wait here.

Ok – back? Did you get all that? Good. Read on…

PDP-1

PDP-1

Read more

A Look At My Programming History – Part 1

3

I’m an old man – I’ve just broken through the 40 year barrier – and I’ve been coding a long time. By my guesstimation, about 30 years or so – starting with a Basic cartridge on my IBM PCjr.

IBM PCjr

IBM PCjr

It was my first real machine, and my mom paid a king’s ransom for it at the time. It was very upsetting to her when I took it all apart to explore the guts (I’ve always been a take-it-apart kinda guy. I could take apart anything. Remember real metal indestructible Tonka trucks – yeah, I took them apart, too). Luckily, I got it all back together and working to avoid Armageddon, but I digress.

Back to Basic programming on that behemoth… I knew nothing about programming back then, but I was always curious as to how this machine did things. Being the inquisitive person that I am – I researched. There were no interwebs back then, no Google, no BBSs – I had no other recourse but to RTFM that came in the box – which was good enough to get me going. The light went on, and I had the perfect project in mind to practice my new skills!

AD&D

AD&D

Some background on my selected project. I, like most 10 yr old boys at the time, really dug AD&D. You know – the Dungeons and Dragons role-playing game series (my mom loathed it, but that’s another story in its own right). AD&D was great fun, the only problem was that you really couldn’t play it alone – you needed a player and a Dungeon Master, at the very least. Not only that, you kinda needed a dungeon or something similar in which to adventure. The gathering of folks to play, as you can imagine, wasn’t always easy. But I was in luck! The Dungeon Master’s Guide had in its appendix a series of random dungeon generation tables! Awesome stuff! You roll a D20 die and based on the result you could get the room size, layout, creatures, treasures, etc.

Read more

Emacs Calendar Extension – Information Unity (Part 2)

0

Go back to the first post in this series, I was trying to solve the problem of having many views of my calendars, but only a single source of record. Specifically, I wanted to be able to view this “source” calendar in Emacs without the manual syncing process.

As was discussed earlier, a few of the issues were solved:

  1. Google Calendar exports calendars in the iCalendar format
  2. Emacs Calendar is able to import an iCalendar format file via URL

Stellar! This is going to be easy! I’ll just list out my calendars’ iCalendar URLs (provided by Google), and have Emacs Calendar cycle through them and import them. Nice 🙂

First, let’s create a var that points to our diary file (that way we can export it to our site config if necessary)

1
(setq diary-file (concat my-emacs-org "diary_entries"))

Next, I’ll create an alist  to hold all my calendars.

1
2
3
(setq my-ical-calendars-alist '(
 ("test", "https://www.google.com/calendar/icaltest.ics")
 ))

All nice and easy thus far. The next thing we need to do is write a nifty function to help import the URL as icalender.el can only import from a file via icalendar-import-file.

No problem, as there’s a built-in function to download a URL to a local temp copy – url-file-local-copy.

We’ll write our function to:

  1. Download the URL
  2. Pass the temp file to icalendar-import-file
  3. Close the buffer
1
2
3
4
5
6
7
(defun import-remote-ical (url my-diary-file)
 "Download ics file from URL and add to diary"
 (let ((tmpfile (url-file-local-copy url)))
 (icalendar-import-file tmpfile my-diary-file nil)
 (kill-buffer (car (last (split-string tmpfile "/"))))
 )
)

I run it and am astounded that it works! So I run it a few more times to make sure I’m not imagining things. Yup – it does work!

I hurriedly open my diary file, anxious to see my handiwork and… (wait for it) … uggh. There are multiple duplicates for each event. I should’ve known that it couldn’t of been that easy.

Read more

Tags: , , ,