2008-10-13

A great tutorial to Emacs editor

That tutorial is available at http://www.gnu.org/software/emacs/tour/ .

I learned some new features, such as `wdired-change-to-wdired-mode' which enables one to change filenames(use C-x C-s or C-c C-c to save, or C-c C-k to abord changes). Also, that tutorial reminds me how to move in units of sentences(`M-a', `M-e', still not used to the former, though); how to stop isearch at the place found(namely, leaving point there) by press the
key.

BTW, I have bound `C-2' to call the command `set-mark-command`, so it unifies the set mark action in both the X system and the console environment: I just have to type `C-2', though in X it's interpreted as Ctrl+2 but in console environment as Ctrl+@.

2008-10-06

using thunderbird's lightning: difference between events and tasks

Copied verbatim from mozilla's FAQ:

The following definitions are from the calendar help glossary:

event - A calendar entry that represents something that will happen whether you take action or not. For example, meetings and birthdays are events.

task - A calendar entry that represents some action by you. For example, writing a report and visiting a client are tasks.

In general, an event is something you schedule on the calendar, and it happens at a specific time and place. A task occurs over time, and while it may need to be started at a specific time or completed by a specific time, the task itself does not.

Finally, it should be noted that tasks can only be displayed in the main calendar in certain views. (ie. multiweek)

Example: A staff meeting is an event; it happens at 9:00am on the 10th.

Calling everyone on staff to review the agenda for the meeting is a task; it must be completed by 5pm on the 9th.


That is, an event is scheduled at a specific time and a task spans a period of time

2008-10-01

Let emms to remember the last directory

It causes a little trouble to me each time to find the target directory in directory when using the fantastic Emacs Multimedia System(emms), because I have to start to locate the target directory from the default directory which is specified in `emms-source-file-default-directory'(BTW, I bound the key `' to `emms-play-find').

So I'm wondering why not to make emms remember the last target directory? Then it's easy to switch other directories around the current targeted one(I tend to listen to albums with the same genre). So after digging into emms's source code, I changed the definition of `emms-play-find' a little(in fact that function is defined via a macro called `define-emms-source'):


;;;###autoload (autoload 'emms-play-find "emms-source-file" nil t)
;;;###autoload (autoload 'emms-add-find "emms-source-file" nil t)
(define-emms-source find (dir regex)
"An EMMS source that will find files in DIR or
`emms-source-file-default-directory' that match REGEX."
(interactive (let ((directory-name (emms-read-directory-name "Find in directory: "
emms-source-file-default-directory
emms-source-file-default-directory
t))
(regex (read-from-minibuffer "Find files matching: ")))
(setq emms-source-file-default-directory directory-name)
(list directory-name regex)))
(mapc (lambda (file)
(unless (let ((case-fold-search nil))
(string-match emms-source-file-exclude-regexp file))
(emms-playlist-insert-track
(emms-track 'file file))))
(emms-source-file-directory-tree dir regex)))


And that's it. After reloading emms, use `emms-play-find' to find a target directory, it simply remembers that directory which ease the next operation for me.

And here is the patch file:


--- /tmp/emms-3.0/emms-source-file.el 2007-06-30 00:16:24.000000000 +0800
+++ elisp/emms/emms-source-file.el 2008-10-01 14:14:40.000000000 +0800
@@ -150,12 +150,13 @@
(define-emms-source find (dir regex)
"An EMMS source that will find files in DIR or
`emms-source-file-default-directory' that match REGEX."
- (interactive (list
- (emms-read-directory-name "Find in directory: "
- emms-source-file-default-directory
- emms-source-file-default-directory
- t)
- (read-from-minibuffer "Find files matching: ")))
+ (interactive (let ((directory-name (emms-read-directory-name "Find in directory: "
+ emms-source-file-default-directory
+ emms-source-file-default-directory
+ t))
+ (regex (read-from-minibuffer "Find files matching: ")))
+ (setq emms-source-file-default-directory directory-name)
+ (list directory-name regex)))
(mapc (lambda (file)
(unless (let ((case-fold-search nil))
(string-match emms-source-file-exclude-regexp file))