[buug] local calendar app

Ian Zimmerman itz at madbat.mine.nu
Thu Apr 19 21:51:08 PDT 2007


Emory> sorry for losing a lot of geek cred by not just suggesting
Emory> ssh+screen+emacs? I'm still not sure why you've ruled that out.

I would still have to hack in the encryption.

Here's the Emacs Lisp I ended up doing to improve my current usage.  
I have looked hard for a better solution, but couldn't find one.
On the way I learned to set up openvpn - very nice, the most
straightforward option for a VPN today, I think.

-- 
(defadvice exit-calendar (before exit-calendar-save-diary
                                 activate compile)
  "If the diary buffer has been modified (and there is no prefix argument), save it.
Also, encrypt and upload it for sharing with laptop."
  (let ((diary-buffer (get-file-buffer diary-file)))
    (when (and (not current-prefix-arg)
               diary-buffer
               (buffer-modified-p diary-buffer))
      (with-current-buffer diary-buffer (save-buffer))
      (kill-buffer diary-buffer)
      (let ((encrypter "gpg -qcao - --passphrase-file ~/.gpgsymm.pass --no-tty")
            (uploader "ssh server.dot.org"))
        (shell-command (format "%s %s | %s 'cat > %s.gpg' 2> /dev/null"
                               encrypter diary-file
                               uploader diary-file))))))

(defun diary-download-diary ()
  (unless (get-file-buffer diary-file)
    (let ((downloader "ssh server.dot.org")
          (decrypter "gpg -qd --passphrase-file ~/.gpgsymm.pass --no-tty"))
      (shell-command (format "%s 'cat %s.gpg' | %s > %s 2> /dev/null"
                             downloader diary-file
                             decrypter diary-file)))))

(defadvice diary (before diary-download
                         activate compile)
  "If we're reading the diary file from disk, refresh from server copy first."
  (diary-download-diary))

(defadvice show-all-diary-entries (before show-all-diary-entries-download
                                          activate compile)
  "If we're reading the diary file from disk, refresh from server copy first."
  (diary-download-diary))

(defadvice view-diary-entries (before view-diary-entries-download
                                          activate compile)
  "If we're reading the diary file from disk, refresh from server copy first."
  (diary-download-diary))

(defadvice mark-diary-entries (before mark-diary-entries-download
                                          activate compile)
  "If we're reading the diary file from disk, refresh from server copy first."
  (diary-download-diary))



More information about the buug mailing list