Home > emacs > Emacs Again (2): auto-save and font

Emacs Again (2): auto-save and font

Auto save revisited

So I joined irc.freenode.net#emacs, and asked how to configure auto-save. Several nice people helped me out. Here’s my .emacs.el for backup and auto-save.

(setq make-backup-files t)       ; enable backup file
;;; locate where you backup files
(setq backup-directory-alist
      (cons (cons "\\.*$" (expand-file-name "~/.backup"))
            backup-directory-alist))

(setq version-control t)     ; enable versions of backup
(setq kept-new-versions 5)   ; how many keep new verisons
(setq kept-old-versions 5)   ; how many keep old versions
(setq delete-old-versions t) ; delete old version without asking
(setq vc-make-backup-files t) ; still make a backup for version-controled files                

;;; Autosave in .backup dir
(setq auto-save-file-name-transforms
  '(("\\([^/]*/\\)*\\([^/]*\\)\\'" "~/.backup/\\2" t)))

Originally, I was very confused by auto-save and backup. FIles of backup are named usually like FILE_NAME~ and autosave are like #FILE_NAME#. At this point, I’m not quite sure that auto-save-file-name-transforms will take, but that’s alright. What I wanted to d

Japanese (or other multibyte)

Me as a native Japanese speaker, I often times, use Japanese Characters, plus I learned Chinese these days, I may have chances to read and write in Chinese Characters as well. Here’s what I use now for Japanese language. They are all copied from some of XEmacs distribution package I guess. It’s still just a magic spells…

;; ============= Japanese language setting ======================                              

;; A. inline input method (window-system)
(when (eq window-system 'mac)
  (add-hook 'minibuffer-setup-hook 'mac-change-language-to-us)
  (mac-translate-from-yen-to-backslash) ;; yen => backslash
  (set-language-info "Japanese" 'input-method "MacOSX") ;; bad fix
  ;; input method in read-only buffer (e.g. C-s in dired-mode)
  (setq mac-pass-key-to-system-on-read-only-buffer t)
  )
;; A. end                                                                                      

;; B. language environment
(set-language-environment "Japanese")
(set-default-coding-systems 'utf-8-unix)
(set-keyboard-coding-system 'utf-8)
(set-clipboard-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
;; (set-file-name-coding-system 'utf-8m) ; already set
(prefer-coding-system 'utf-8-unix)
;; B. end                                                                                      

;; C. fix: Unicode => Japanese mapping
;; Thanks to saiki-san (see [macemacsjp-users 870])
;; register circle around digits to cjk table (by Ando-san)
(defadvice utf-translate-cjk-load-tables
  (after my-ad-circled-digit activate)
  (dotimes (i 20)
    (let ((unicode (+ #x2460 i))
          (char (+ 54433 i)))
      (if (utf-translate-cjk-substitutable-p unicode)
          (puthash unicode char ucs-unicode-to-mule-cjk))
      (puthash char unicode ucs-mule-cjk-to-unicode))))
;; prevent to use half-width marks (by Nanba-san)
(utf-translate-cjk-set-unicode-range
 '((#x2e80 . #xd7a3)
   (#xff00 . #xffef)
   (#xa7 . #xa7)                        ;
   (#xb0 . #xb1)                        ;
   (#xb4 . #xb4)                        ;
   (#xb6 . #xb6)                        ;
   (#xd7 . #xd7)                        ;
   (#xf7 . #xf7)                        ;
   (#x370 . #x3ff)                      ; ギリシャ
   (#x400 . #x4ff)                      ; キリル
   (#x2000 . #x206f)                    ; 一般句読点
   (#x2103 . #x2103)                    ; ℃
   (#x212b . #x212b)                    ; Å
   (#x2190 . #x21ff)                    ; 矢印
   (#x2200 . #x22ff)                    ; 数学記号
   (#x2300 . #x23ff)                    ; 技術記号
   (#x2460 . #x2473)                    ; 円囲み数字
   (#x2500 . #x257f)                    ; 罫線
   (#x25a0 . #x25ff)                    ; 幾何学模様
   (#x2600 . #x26ff)                    ; その他の記号
   ))
;; C. end

Font for Terminal

And for terminal font, I really appreciate Droid Sans Mono. Droid Family is designed for Google’s Android.

Download the Android SDK

Unzip the archive, and you’ll find .ttf files under tools/lib/fonts/default/. what it’s cool about is, very readable with small font size, mono space and comes with CJK typeface as well. License-wise, maybe ok for your personal use, you can at least develop Android with this. Small note: Android SDK comes with Android.el as well.

Comments:0

Comment Form
Remember personal info

Trackbacks:0

Trackback URL for this entry
http://blog.nydd.org/2009/03/emacs-again-2-auto-save-and-font/trackback/
Listed below are links to weblogs that reference
Emacs Again (2): auto-save and font from Vantage Point of Queens

Home > emacs > Emacs Again (2): auto-save and font

Search
Feeds
Meta
Links
Ads!

Return to page top