未臨

醉里挑燈看劍 夢回吹角連營 

emacs 23.1 released

http://article.gmane.org/gmane.org.fsf.announce/1129

From: Chong Yidong <cyd <at> stupidchicken.com>

Subject: Emacs 23.1 released

Newsgroups: gmane.org.fsf.announce

Date: 2009-07-30 03:01:22 GMT (5 days, 4 hours and 4 minutes ago)

在我从大连回北京的路上悄悄发布了,恩…… 刚拜读了下 NEWS,看来又可以消灭许多额外的 elisp 包,函数等等了。偶的读书笔记:

1. *** The Emacs character set is now a superset of Unicode. (It has about four times the code space, which should be plenty).

The internal encoding used for buffers and strings is now Unicode-based and called `utf-8-emacs' (`emacs-internal' is an alias for this).  This encoding is backward-compatible with Unicode's UTF-8 encoding.  The internal encoding previously used by Emacs, `emacs-mule', is still available for reading and writing files.

During byte-compilation, Emacs 23 uses `utf-8-emacs' to write files. As a result, byte-compiled files containing non-ASCII characters can't be read by earlier versions of Emacs.  Files compiled by Emacs 20, 21, or 22 are loaded correctly as `emacs-mule' (whether or not they contain multibyte characters).  This takes somewhat more time, so it may be worth recompiling existing .elc files which don't need to be shared with older Emacsen.

竟然搞了个 utf-8 的 superset(超集?) -- "utf-8-emacs"。难怪我前阵子发现 emms 有些乱码用 utf-8 都保存不了,用 utf-8-emacs 倒是可以。莫非以后 prefer-coding-system 要从 utf-8 改成 utf-8-emacs?FIXME

2. *** There are new language environments for Chinese-GBK, Chinese-GB18030, Khmer, Bengali, Punjabi, Gujarati, Oriya, Telugu, Sinhala, and TaiViet.

emacs 终于认识朱镕基总理的第 2 个字了。当然,你的字体里应该包含这个字哦。

3. *** Minibuffer input of shell commands now comes with completion.

赞!之前装过一个 shell-command.el --- enables tab-completion for `shell-command'可以扔掉了。

4. *** When enable-recursive-minibuffers is non-nil, operations which use switch-to-buffer (such as C-x b and C-x C-f) do not fail any more when used in a minibuffer or a dedicated window.  Instead, they fallback on using pop-to-buffer, which will use some other window.  This change has no effect when enable-recursive-minibuffers is nil (the default).

经常受困(如 M-x C-x o),但没想过去解决它。有了它,好多了。

5. *** New commands to change the default face size in the current buffer. To increase it, type `C-x C-+' or `C-x C-='.  To decrease it, type `C-x C--'.  To restore the default (global) face size, type `C-x C-0'. These work via Text Scale mode, a new minor mode.

The final key in the above commands may be repeated without the leading `C-x', e.g. `C-x C-= C-= C-=' increases the face height by three steps.  Each step scales the height of the default face by the value of the variable `text-scale-mode-step'.

演示时会比较实用。

6. *** C-l is bound to the new command recenter-top-bottom, rather than recenter. This moves the current line to window center, top and bottom on successive invocations.

这个,看起来是个不错的主意,给我点时间适应一下。

7. ** proced.el provides a Dired-like interface for operating on processes.  Proced makes an Emacs buffer containing a listing of the current processes.  You can use the normal Emacs commands to move around in this buffer, and special Proced commands to operate on the processes listed.  It is currently only functional on GNU/Linux, MS-Windows and Solaris.

不错!用得不多,得提醒自己常用。尚不支持 Mac,残念啊!

8. ** There is a new `whitespace' package. (The pre-existing one has been renamed to `old-whitespace'.) Now, besides reporting bogus blanks, the whitespace package has a minor mode and a global minor mode to visualize blanks (TAB, (HARD) SPACE and NEWLINE).  The visualization is made via faces and/or display table.  It can also indicate lines that extend beyond a given column, trailing blanks, and empty lines at the start or end of a buffer. See `whitespace-style' for more details.  The `whitespace-action' option specifies what to do when a buffer is visited, killed, or written.

可以用不同显示效果区分出空格、tab、回车。看图:

whitespace-mode.png

9. *** `&' runs the command `dired-do-async-shell-command' that executes the command asynchronously without the need to manually add ampersand to the end of the command.  Its output appears in the buffer `*Async Shell Command*'.

好!

10. *** `M-s f C-s' and `M-s f M-C-s' run Isearch that matches only at file names. When a new user option `dired-isearch-filenames' is t, then even ordinary Isearch started with `C-s' and `C-M-s' matches only at file names in the Dired buffer.  When `dired-isearch-filenames' is `dwim' then activation of file name Isearch depends on the position of point - if point is on a file name initially, then Isearch matches only file names, otherwise it matches everywhere in the Dired buffer.  You can toggle file names matching on or off by typing `M-s f' in Isearch mode.

我写的 dired-isearch.el 可以扔掉了…… 主意应该是我头一个想到并实现的吧,emacs-devel上讨论了几回没下文,不知他们什么时候背着我偷偷实现了(当然实现方法不一样)…… =,= 

11. *** VC now supports applying VC operations to a set of files at a time. This enables VC to work much more effectively with changeset-oriented version-control systems such as Subversion, GNU Arch, Mercurial, Git and Bzr.  VC will now pass a multiple-file commit to these systems as a single changeset.

等你很久了!

12. *** A new command `display-time-world' has been added to the Time package.  It creates a buffer with an updating time display using several time zones.

曾经想过写一个,从没下手写过。这下省了。

13. *** `apply-partially' performs a "curried" application of a function.

currying function!

14. ** Emacs session information

*** The new variables `before-init-time' and `after-init-time' record the value of `current-time' before and after Emacs loads the init files.

*** The new function `emacs-uptime' returns the uptime of an Emacs instance.

*** The new function `emacs-init-time' returns the duration of the Emacs initialization.

又和我英雄略同了。我老早前写的可以扔了:

(defvar xwl-emacs-start-time (current-time))

(defun xwl-emacs-uptime ()

  (interactive)

  (let* ((diff (time-subtract (current-time) xwl-emacs-start-time))

         (str (format "Emacs started at %s, more than %d days(= %.2f hours) ago"

                      (format-time-string "%Y/%m/%d %H:%M:%S" xwl-emacs-start-time)

                      (time-to-number-of-days diff)

                      (/ (time-to-seconds diff) 3600.0))))

    (message str)))

总结:看起来挺美!对 Mac 的支持差了点,写 22 的那个 Andrew 大哥别跟 RMS 较真就好了。另外现在单位不让使用自己本本,上网又要代理,又是 XP 系统,玩起 Emacs 还是颇有不便。祝 Emacs 英明神武、一统江湖!

Comments [0]

virtualbox: ssh to guest machine

Run following, then CLOSE(not just reboot) and start guest machine again. 

C:\> VBoxManage setextradata <guestname> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
C:\> VBoxManage setextradata <guestname> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
C:\> VBoxManage setextradata <guestname> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

Test:

C:\> ssh -l william localhost -p 2222

Comments [0]

LDCN | 分享桌面心得,传播业界资讯

天气壁纸脚本:wallther

2009-07-21 9:22 | 分类 酷玩软件 | By xiooli

作者:xiooli 地址:天气墙纸脚本:wallthe

点击下载 wallther 脚本及 icon 素材

看LinuxToy时发现了一个天气墙纸的程序,貌似依赖不少的Gnome组件,很不方便,于是就萌生了用bash脚本写一个相同功能的脚本的想法,经过几个小时的奋战终于搞定了,呵呵,主要是convert等处理图片的软件用得不熟。

(全文…)

Tags:.

Founded in 2007, looks neat as a linux news/tips site.

Comments [0]

Copy texts to blog website

So, I've just written some blog inside Emacs, like this one.  I'd like to post it on my blog site, I would do: mark region, kill region, paste it some editor in web browser.

One issue here is that I have to convert all the hard newlines to soft newlines, or it will look bad when rendering in the browser.  Here is my utility function to do that, so I don't have to learn not-so-simple longlines-mode(which is also going to deprecate some time in the future):

(defun xwl-soft-kill-ring-save (beg end)
  "Same as `kill-ring-save' except it will convert hard newlines to soft newlines.
This could be useful for copying texts from Emacs and pasting it to blog
websites.  It also keeps original empty line for separating paragraphs."
  (interactive "r")
  (let ((content (buffer-substring-no-properties beg end)))
    (with-temp-buffer
      (insert content)
      (insert "\n")
      (goto-char (point-min))
      (move-beginning-of-line 2)
      (while (not (eobp))
        (if (looking-at "\n")
            (move-beginning-of-line 3)
          (if (looking-at "[[:ascii:]]")
              (progn (backward-delete-char-untabify 1)
                     (insert " "))
            (backward-delete-char-untabify 1))
          (move-beginning-of-line 2)))
      (copy-region-as-kill (point-min) (point-max)))))

Comments [1]

Kill referencing buffers

On w32, it happens very often when I want to rename or delete some files, the OS
tells me that some application is still visiting it.  Too bad!  Especially when
some buffer(s) inside emacs is still visiting it.  (Well, Linux & Mac OS X have
no such constraints)

So we nned to find a way to kill buffers opened in emacs that are referencing
interested files.  Here is an easy way to do that with help of ibuffer:

(eval-after-load 'ibuf-ext
  '(progn
     (define-ibuffer-filter reference
       "Toggle current view to buffers that have references to filename matching QUALIFIER.
Such that we can rename or some other operations successfully for file at
point.  Especially useful for w32."
       (:description "reference"
                     :reader (read-from-minibuffer "Filter by file reference (regexp): "))
       (ibuffer-awhen (or (buffer-local-value 'buffer-file-name buf)
                          (and (eq (buffer-local-value 'major-mode buf) 'dired-mode)
                               (buffer-local-value 'default-directory buf)))
                      (string-match qualifier it)))

     (define-key ibuffer-mode-map (kbd "/ R") 'ibuffer-filter-by-reference)
     ))

Comments [0]

ga.el 0.5 Release

Ga is a generic apt(as used in Debian GNU/Linux) alike interface over
various package management tools.
 
,----[ Changes since 0.4 ]
| - ga-apt-cyg.el: New backend for Cygwin under W32.
| - (ga-insert-end-string): New func.
| - (ga-run-command): Replace start-process with start-process-shell-command.
| - (ga-mode): Run an additional new hook -- ga-BACKEND-hook.
| - (ga-pkgsrc-jump): New func.
`----
 
Get it from:
 
  http://xwl.appspot.com/ref/ga.tar.gz

Comments [0]

Monaco under Windows XP

Ha, still, monaco looks better under Windows XP, on my T400, at least better than Dejavu.  You can download it from http://www.gringod.com/2006/02/24/return-of-monacottf/.

The setup in .emacs:

(setq xwl-default-font "Monaco-10"
      xwl-chinese-font "NSimSun"
      xwl-japanese-font xwl-chinese-font)

(let ((charset-font `((japanese-jisx0208   . ,xwl-japanese-font)
                      (chinese-gb2312      . ,xwl-chinese-font)
                      (chinese-gbk         . ,xwl-chinese-font)
                      (gb18030             . ,xwl-chinese-font)
                      ;; (big5             . "Hei")
                      (japanese-jisx0208   . ,xwl-japanese-font)
                      ;; (japanese-jisx0212 . ,xwl-japanese-font)
                      )))
  (set-default-font xwl-default-font) ; this will decide font size.
  (mapc (lambda (charset-font)
          (set-fontset-font (frame-parameter nil 'font)
                            (car charset-font)
                            (font-spec :family (cdr charset-font) :size 14)))
        charset-font))

Comments [0]

gnus picons

You should install picons package, on Mac,
 
  $ sudo fink install picons
 
Then add it to gnus-picon-databases:
 
,----
| (eval-after-load 'gnus-art
| '(progn
| (add-to-list 'gnus-picon-databases "/sw/share/picons")
| ))
|
| (setq gnus-treat-from-picon 'head)
|
| (setq gnus-picon-style 'right)
|
| (setq gnus-treat-body-boundary nil)
`----

Comments [0]

telnet to BBS with ansi-term

-- William

Comments [1]

Gnus: fuzzy matching subjects when threading

See the following first.

This google group adds message number prefix at the very start of the subject, thus gnus can't figure out that they actually belong to the same thread. To fix this, we need to instruct gnus to fuzzy match subjects when threading.  Specifically in this case, I'm going to ignore the number prefix when threading, here is how to do it:
 

,---- 
| (setq gnus-summary-gather-subject-limit 'fuzzy
| gnus-simplify-subject-fuzzy-regexp "^\\[.+\\]")
`----

 
Now the result looks like this:

Yes!
 

Comments [1]