6104 comments
2357 subscribers
6264 on Twitter
Subscribe! Feed reader E-mail

Adding an arbitrary extension to your planner files

Do you want all of your planner files to have a TXT extension so that
they’ll be searched by tools such as Google Desktop or Apple Spotlight?

Use the ‘rename’ tool to add .txt extensions to all of your files, or
use the following code to rename all of your planner files from a
running Planner setup:

(defun my-rename-planner-files ()
  "Rename all my planner files to .txt if they don't have that extension yet."
  (interactive)
  (mapcar
   (lambda (file)
     (unless (string-match "\\.txt$" (cdr file))
       (rename-file (cdr file) (concat (cdr file) ".txt"))
       (message "%s" (cdr file))))
   (planner-file-alist))
  (with-planner
    (emacs-wiki-refresh-file-alist)))

Then add this to your ~/.emacs before you load Planner:

(setq emacs-wiki-ignored-extensions-regexp "\\.txt")

(defadvice emacs-wiki-find-file (around extension activate)
  "Open the Emacs Wiki page WIKI by name.
If COMMAND is non-nil, it is the function used to visit the file.
If DIRECTORY is non-nil, it is the directory in which the Wiki
page will be created if it does not already exist."
  (unless (interactive-p)
    (setq wiki (cons wiki
                     (cdr (assoc wiki (emacs-wiki-file-alist))))))
  ;; At this point, `wiki' is (GIVEN-PAGE FOUND-FILE).
  (if (cdr wiki)
      (let ((buffer (funcall (or command 'find-file) (cdr wiki))))
        (if (= (prefix-numeric-value current-prefix-arg) 16)
            (with-current-buffer buffer
              (set (make-variable-buffer-local 'emacs-wiki-directories)
                   (cons (file-name-directory (cdr wiki))
                         emacs-wiki-directories))
              (set (make-variable-buffer-local 'emacs-wiki-file-alist)
                   nil)))
        buffer)
    (let* ((dirname (or directory
                        (emacs-wiki-maybe t)
                        (car emacs-wiki-directories)))
           (filename (expand-file-name (car wiki) dirname)))
      (unless (file-exists-p dirname)
        (make-directory dirname t))
      (funcall (or command 'find-file) (concat filename ".txt")))))

新しいパソコンを買うつもりで金を溜めているんだ。 I am saving money in order to buy a new personal computer.

On Technorati: , ,

Short URL: http://sachachua.com/blog/p/2775

On This Day...

  • 2012: Monthly review: May 2012 — Business: I’ve been in business for a quarter. By golly. This business thing is pretty cool. I rather enjoy doing [...]
  • 2011: Negative optimization — Checking on one of my projects (a Ruby on Rails survey site), I realized that it was running painfully slowly, [...]
  • 2010: Weekly review: Week ending June 7, 2010 — What a week! W- and I spent the entire weekend woodworking. I’m tired, happy, and looking forward to the next [...]
  • 2009: Preventive maintenance and the Goldtouch Go! keyboard — Other people might go to a massage therapist to relax. I go so that I can spend an hour and [...]
  • 2008: Emacs Gnus: Filter Spam — (draft for an upcoming book called Wicked Cool Emacs) Ah, spam, the bane of our Internet lives. There is no completely reliable [...]
  • 2005: Software Freedom Day — 1. Why Sept. 10? What’s the significance of that date? Hehe… well, that wss the day that Open Minds (now the [...]
  • 2003: Extreme programming in the classroom — - http://www.compapp.dcu.ie/~cdaly/research/confs/02/sigcse.html (very useful) - http://ecommerce.ncsu.edu/people/williams.html - http://csis.pace.edu/~bergin/XPWorkshop/tutorial.html Thanks to Dominique Cimafranca for the heads-up! =)
  • 2003: Found an apartment! — I’ll be staying at Dormitoryana on B. Gonzales St. – it’s a girls’ dorm, pretty nice, lots of greenery, and quite [...]
  • 2003: Christian Manoloto — http://www.geocities.com/among2004/

Get the highlights as a PDF!

Stories from my Twenties: Highlights from a Decade of Blogging

Free sample!