MacOSX WorkShop/dot emacs el
MacOSX_WorkShop の「OSX-Preferences」と「emacs-lisps」で提供されている Emacs の設定ファイルを議論します。
目次
基本方針
- VineLinux の設定を基準にする。
OSXWS は大学や研究機関の計算機管理者が導入し、管理者権限を持たない学生さんやユーザーが利用する事を念頭に置いて下さい。
- 変更事項はその理由を明記する。
複数人の趣味に偏るのを避ける為にも必要です。
- 修正案の作り方
このWiki上で修正案を作る方法として、取り除くほうが良いと考えている物を「(取り除いた項目)」に移し、追加したいと考えているものを実際に追加し「(追加した項目)」に記入するようにしています。それにコメント、指摘を書き込んで頂けたら助かります。
- inline-patch や transparency patch 等 upstream で仕様が今後も変更される確率が高く、且つ、OSXWS としてのデフォルトなど基本的な設定は、site-start.d 内で行う。
OSXWS-10.6-x の cocoa emacs 設定ファイル
Vine Linux の仕組みを参考に、Emacs のデフォルトの設定を提供する仕組みを大幅に変更する予定です。詳しくは[1]に。とりあえず、最小限の設定のみを提供する方針です。
ユーザーの初期設定ファイルを読む直前に osxws.el がロードされる:"/usr/osxws/share/emacs/site-lisp/emacs-lisps/osxws.el"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; osxws.el for MacOS X WorkShop ;; KOBAYASHI Taizo <xxxxxxx@xxxxxxx> ;; Time-stamp: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; setting the MacOS X WorkShop flag (defconst osxws-emacs-flag t "This is Emacs of MacOS X WorkShop.") (setq emacs-build-system (concat emacs-build-system " - MacOS X WorkShop - 10.6 ")) (setq report-emacs-bug-address "osxws@xxxx.xx.xxx-u.ac.jp") (defcustom osxws-default t "A boolean for all OSX Workshop default settings" :type 'boolean) (defcustom osxws-default-base t "A boolean for loading osxws-setting section 0 (fundamental configurations)" :type 'boolean) (defcustom osxws-default-language_japanese t "A boolean for loading osxws-setting section 1 (language for Japanese)" :type 'boolean) (defcustom osxws-default-appearance t "A boolean for loading osxws-setting section 2 (appearance)" :type 'boolean) (defcustom osxws-default-keyboard t "A boolean for loading osxws-setting section 3 (keyboard/keybinding)" :type 'boolean) (defcustom osxws-default-shell t "A boolean for loading osxws-setting section 4 (shell-command)" :type 'boolean) (defcustom osxws-default-inlinepatch t "A boolean for loading osxws-setting section 5 (inline patch)" :type 'boolean) (defcustom osxws-default-cocoaemacs t "A boolean for loading osxws-setting section 6 (Cocoa Emacs)" :type 'boolean) (defcustom osxws-default-else t "A boolean for loading osxws-setting section 7 (anything else)" :type 'boolean) (defcustom osxws-default-mew t "A boolean for loading osxws-setting for Mew" :type 'boolean) (defcustom osxws-default-yatex t "A boolean for loading osxws-setting for YaTeX" :type 'boolean) (if (file-exists-p (concat user-emacs-directory "setup_osxws_default.el")) (load-file (concat user-emacs-directory "setup_osxws_default.el"))) (when osxws-default (message "Starting osxws-default ...") (load-file "/usr/osxws/share/emacs/site-lisp/emacs-lisps/osxws-default.el") (if osxws-default-yatex (load-file "/usr/osxws/share/emacs/site-lisp/emacs-lisps/osxws-default-yatex.el") )) (setq custom-file "~/.emacs.d/custom_osxws.el") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Local Variables: ;; mode: emacs-lisp ;; buffer-file-coding-system: utf-8-unix ;; End:
デフォルト設定を使用しない場合、ホームディレクトリのファイルから各変数を nil にする:"~/.emacs.d/setup_osxws_default.el"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ~/.emacs.d/setup_osxws_default.el ;; .emacs for MacOS X WorkShop ;; Time-stamp: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; MacOS X WorkShop provides the default setting for Emacs. ;; The setting is written in the following file: ;; /usr/osxws/share/emacs/site-lisp/emacs-lisps/osxws-default.el ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; You can inactivate all by setting the variable osxws-defaul to nil. ;; (setq osxws-default nil) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; You can inactivate each section of the setting by setting ;; the variables osxws-defaul-* to nil. ;;(setq osxws-default-base nil) ;;(setq osxws-default-language_japanese nil) <--- en では有効に設定 ;;(setq osxws-default-appearance nil) ;;(setq osxws-default-keyboard nil) ;;(setq osxws-default-shell nil) ;;(setq osxws-default-inlinepatch nil) ;;(setq osxws-default-cocoaemacs nil) ;;(setq osxws-default-else nil) ;;(setq osxws-default-mew nil) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; You can inactivate the default setting for YaTeX by ;;(setq osxws-default-yatex nil) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Local Variables: ;; mode: emacs-lisp ;; buffer-file-coding-system: utf-8-unix ;; End:
init.el の例を兼ねて、最も変更する可能性の高いウィンドウ設定のみ記述:"~/.emacs.d/init.el"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ~/.emacs.d/init.el ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; You can edit this file as you like! ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; no start up message ;;(setq inhibit-startup-screen t) ;; window mode setting (when (eq window-system 'ns) ;; window size ;;(setq default-frame-alist ;; (append ;; '((width . 100) (height . 40)) ;; default-frame-alist)) ;; Color-thema (require 'color-theme) (color-theme-dark-blue2) ;; Transparency3 (add-to-list 'default-frame-alist '(alpha . (100 80))) ;; (alpha . (<active frame> <non active frame>)) ) ;; input special and control characters by "Option" ;; (setq ns-option-modifier 'none) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Local Variables: ;; mode: emacs-lisp ;; buffer-file-coding-system: utf-8-unix ;; End:
デフォルト設定のファイル:"/usr/osxws/share/emacs/site-lisp/emacs-lisps/osxws-default.el"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; osxws-default.el for MacOS X WorkShop ;; Time-stamp: <2011-03-08 08:20:57 seto> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Section 0 fundamental configurations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when osxws-default-base ;; path setting (setq exec-path (append (list "/usr/osxws/bin" "~/bin") exec-path)) (setenv "PATH" (concat '"/usr/osxws/bin:~/bin:" (getenv "PATH"))) ;; save the position before you editing. (require 'saveplace) (setq-default save-place t) (setq save-place-file "~/Library/Application Support/OSXWS/emacs-places.txt") ;; copy foo to foo~ as a backup file (setq backup-by-copying t) ;; deleting files goes to OS's trash folder ;;(setq delete-by-moving-to-trash t) ;; start emacsclient server ;(server-start) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Section 1 language configurations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when osxws-default-language_japanese ;; japanese settings for Cocoa Emacs Package (set-language-environment 'Japanese) (prefer-coding-system 'utf-8-unix) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Section 2 appearance setting ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when osxws-default-appearance ;; hide tool-bar and menu-bar (if window-system (tool-bar-mode 0) (menu-bar-mode 0)) ;; show the corresponding paren (show-paren-mode) ;; do not font scaling (setq scalable-fonts-allowed nil) ;;; show the present time on status bar (when (equal current-language-environment "Japanese") (setq dayname-j-alist '(("Sun" . "日") ("Mon" . "月") ("Tue" . "火") ("Wed" . "水") ("Thu" . "木") ("Fri" . "金") ("Sat" . "土"))) (setq display-time-string-forms '((format "%s年%s月%s日(%s) %s:%s %s" year month day (cdr (assoc dayname dayname-j-alist)) 24-hours minutes load)))) (display-time) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Section 3 keyboard/keybinding ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when osxws-default-keyboard ;; emulation of the standard CUA key bindings (Mac GUI) (cua-selection-mode t) ;; behavior of "Command + Cursor" to the default of MacOS X ;; default : ns-next-frame in ns-win.el (define-key global-map [s-left] 'move-beginning-of-line) ;; default : ns-prev-frame in ns-win.el (define-key global-map [s-right] 'move-end-of-line) (define-key global-map [s-up] 'backward-page) (define-key global-map [s-down] 'forward-page) ;; font resize short cut (Command +/-/0) (global-set-key [(s ?+)] (lambda () (interactive) (text-scale-increase 1))) (global-set-key [(s ?-)] (lambda () (interactive) (text-scale-decrease 1))) (global-set-key [(s ?0)] (lambda () (interactive) (text-scale-increase 0))) ;; Delete the following character by fn + delete (define-key global-map [kp-delete] 'delete-char) ;; fix yen key problem on JIS keyboard ;; Ando-san's code (see [Macemacsjp-users 1126]) (define-key global-map [2213] nil) (define-key global-map [67111077] nil) (define-key function-key-map [2213] [?\\]) (define-key function-key-map [67111077] [?\C-\\]) (define-key global-map [3420] nil) (define-key global-map [67112284] nil) (define-key function-key-map [3420] [?\\]) (define-key function-key-map [67112284] [?\C-\\]) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Section 4 shell-command ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when osxws-default-shell ;; hide password (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt) ;; escape sequence (autoload 'ansi-color-for-comint-mode-on "ansi-color" "Set `ansi-color-for-comint-mode' to t." t) (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Section 5 inline-patch by Hashimoto-san ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when osxws-default-inlinepatch (when window-system (setq default-input-method "MacOSX") (add-hook 'minibuffer-setup-hook 'mac-change-language-to-us) ;;(mac-add-ignore-shortcut '(control)) (mac-add-key-passed-to-system 'shift) (mac-set-input-method-parameter "com.apple.inputmethod.Kotoeri.Roman" `title "あ") (mac-set-input-method-parameter "com.apple.inputmethod.Kotoeri.Roman" `cursor-type 'box) (mac-set-input-method-parameter "com.apple.inputmethod.Kotoeri.Japanese" `cursor-color "red")) ;; start up by Command-Space (global-set-key [(s \ )] 'toggle-input-method) ;; start up by Shift-Space (global-set-key [?\S-\ ] 'toggle-input-method) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Section 6 CocoaEmacs window mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when osxws-default-cocoaemacs (when window-system ;; if display-height is less than 900, set font size 12pt. (let* ((size (if (< (display-pixel-height) 900) 12 14)) (asciifont "Menlo") (jpfont "Hiragino Maru Gothic ProN") (h (* size 10)) (fontspec (font-spec :family asciifont)) (jp-fontspec (font-spec :family jpfont))) (set-face-attribute 'default nil :family asciifont :height h) (set-fontset-font nil 'japanese-jisx0213.2004-1 jp-fontspec) (set-fontset-font nil 'japanese-jisx0213-2 jp-fontspec) (set-fontset-font nil 'katakana-jisx0201 jp-fontspec) ; 半角カナ (set-fontset-font nil '(#x0370 . #x03FF) fontspec) ; ギリシャ文字 ) (setq face-font-rescale-alist '(("^-apple-hiragino.*" . 1.2) (".*osaka-bold.*" . 1.2) (".*osaka-medium.*" . 1.2) (".*courier-bold-.*-mac-roman" . 1.0) (".*monaco cy-bold-.*-mac-cyrillic" . 0.9) (".*monaco-bold-.*-mac-roman" . 0.9) ("-cdac$" . 1.3))) ;;---------------------------------------------------------- ;; smart-dnd (require 'smart-dnd) ;; yahtml-mode: (add-hook 'yahtml-mode-hook '(lambda () (smart-dnd-setup '( ("\\.gif\\'" . "<img src=\"%R\">\n") ("\\.jpg\\'" . "<img src=\"%R\">\n") ("\\.png\\'" . "<img src=\"%R\">\n") ("\\.css\\'" . "<link rel=\"stylesheet\" type=\"text/css\" href=\"%R\">\n" ) ("\\.js\\'" . "<script type=\"text/javascript\" src=\"%R\"></script>\n" ) (".*" . "<a href=\"%R\">%f</a>\n"))))) ;; yatex-mode: (add-hook 'yatex-mode-hook '(lambda () (smart-dnd-setup '( ("\\.tex\\'" . "\\input{%r}\n") ("\\.cls\\'" . "\\documentclass{%f}\n") ("\\.sty\\'" . "\\usepackage{%f}\n") ("\\.eps\\'" . "\\includegraphics[clip]{%r}\n") ("\\.ps\\'" . "\\includegraphics[clip]{%r}\n") ("\\.pdf\\'" . "\\includegraphics[clip]{%r}\n") ("\\.jpg\\'" . "\\includegraphics[clip]{%r}\n") ("\\.png\\'" . "\\includegraphics[clip]{%r}\n") ("\\.bst\\'" . "\\bibliographystyle{%n}\n") ("\\.bib\\'" . "\\bibliography{%n}\n"))))) ;; C/C++ mode: (add-hook 'c-mode-common-hook '(lambda () (smart-dnd-setup '(("\\.h\\'" . "#include <%f>"))))) ;;---------------------------------------------------------- ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Section 7 anything else ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when osxws-default-else ;; The number of lines to scroll a window by when point moves out (setq scroll-step 1) ;; Time Stamp ;; If you put 'Time-stamp: <>' or 'Time-stamp: ""' on ;; top 8 lines of the file, the '<>' or '""' are filled with the date ;; at saving the file. (require 'time-stamp) (if (not (memq 'time-stamp write-file-functions)) (setq write-file-functions (cons 'time-stamp write-file-functions))) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Local Variables: ;; mode: emacs-lisp ;; buffer-file-coding-system: utf-8-unix ;; End:
YaTeX のデフォルト設定:"/usr/osxws/share/emacs/site-lisp/emacs-lisps/osxws-default-yatex.el"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; osxws-default-yatex.el for MacOS X WorkShop ;; Time-stamp: <2011-03-10 17:13:00 tkoba> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq auto-mode-alist (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist)) (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t) ;; platex with Skim (setq tex-command "platex2pdf" dvi2-command "open -a Skim") ;; pdflatex with Skim ;(setq tex-command "pdflatex -synctex=1" ; dvi2-command "open -a TeXShop") ;; platex with TeXShop ;(setq tex-command "~/Library/TeXShop/bin/platex2pdf-euc" ; dvi2-command "open -a TeXShop") ;; pdflatex with TeXShop ;(setq tex-command "pdflatex" ; dvi2-command "open -a TeXShop") (setq dviprint-command-format "dvips %s | lpr" YaTeX-inhibit-prefix-letter t YaTeX-kanji-code 4 ; (1 JIS, 2 SJIS, 3 EUC, 4 UTF-8) YaTeX-use-AMS-LaTeX t ; AMS-LaTeX section-name "documentclass" makeindex-command "mendex -U" bibtex-command "jbibtex -kanji=utf8" YaTeX-skip-default-reader t YaTeX-latex-message-code 'utf-8 YaTeX-use-font-lock t ) (add-hook 'skk-mode-hook (lambda () (if (eq major-mode 'yatex-mode) (progn (define-key skk-j-mode-map "\\" 'self-insert-command) (define-key skk-j-mode-map "$" 'YaTeX-insert-dollar) )) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; yahtml ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq auto-mode-alist (cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist)) (autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t) (add-to-list 'auto-mode-alist '("\\.htm\\'" . yahtml-mode)) (setq yahtml-www-browser "open" yahtml-lint-program "htmllint" yahtml-kanji-code 4) (add-hook 'yahtml-mode-hook '(lambda () (auto-fill-mode -1) )) ;;;; <p> </p> (setq yahtml-always-/p t) ;;;; <li> </li> (setq yahtml-always-/li t) ;; End:
コメント
過去の議論
http://www.bach-phys.ritsumei.ac.jp/OSXWS/node55.html
10.5 Leopard 版に関する議論
http://www.bach-phys.ritsumei.ac.jp/OSXWS/Leopard/node59.html
10.4 Tiger 版に関する議論
http://www.bach-phys.ritsumei.ac.jp/OSXWS/Tiger/node60.html