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))

2008-01-18

Sick

Tired
Exhausted

Whom can I talk to?

What's wrong with my life?

It's already several days that I can't have good sleep. Feel tired even I when wake up in the morning.

Is what I'm chasing really what I need???

2008-01-15

Switching from ubuntu to Arch linux

Because compared to ubuntu, arch linux is :

- lightweight.
- optimized for i686
- more faster to connect to its mirrors.

2008-01-09

Some misused terminologies

// This post will be kept up to day
Resolution
is now misused to count the number of pixels of the vertical and the horizontal sizes of a screen. But in fact, this just word, "resolution", means the ratio between the actual number of dots in one dimension and the physical size(measured in inches) of of the screen. Dot comes from the typesetting area.

When talking about DPI of screens, we can take one dot = one pixel. When the screen dimensions are 1280x1024(that is, 1280 pixels wide and 1024 pixels height) and the physical diagonal size of the screen is 17", the size of one pixel is about 0.26mm. Thus the pixel size is fixed. So when the DPI is increased, more pixels are used to represent one (in fact virtual) inch, so the font(measured in points, 1 point = 1/72 inch) will become larger...

2008-01-08

Finally the annoying "elseif" indentation bug is solve in php-mode

I browsed emacswiki this morning and found that there is another new version of php-mode. With the hope that this version will solve the annoying and ugly "elseif" indentation bug in my emacs, which is like("_" stands for One SPACE here)


if($true)
__{
__}
elseif($false)
{
}
else
___{
___}


I immediately downloaded that new mode file and installed it, later added several tunings:


(add-hook 'php-mode-hook
'(lambda () (define-abbrev php-mode-abbrev-table "ex" "extends")))


Now, time to try it!! Very lucky, that bug has now disappeared! See this screnshot:




// also, I add "print_r"to the constant php-keywords in php-mode.el to make it appears just the same as "echo":


(defconst php-keywords
(eval-when-compile
(regexp-opt
;; "class", "new" and "extends" get special treatment
;; "case" and "default" get special treatment elsewhere
'("and" "as" "break" "continue" "declare" "do" "echo" "else" "elseif"
"endfor" "endforeach" "endif" "endswitch" "endwhile" "exit"
"extends" "for" "foreach" "global" "if" "include" "include_once"
"next" "or" "print_r" "require" "require_once" "return" "static" "switch"
"then" "var" "while" "xor" "private" "throw" "catch" "try"
"instanceof" "catch all" "finally")))
"PHP keywords.")