Skim の displayline をバックグラウンドで
LaTeX 用のPDFプレビュア Skim.app には、行番号を指定して開く displayline というスクリプトがある(Skim.app/Contents/SharedSupport/displayline)。これに、エディタにフォーカスしたまま背景で displayline を実行する -g (-background) という新たなオプションを追加してみた。Apple script の部分の activate という命令を条件分岐しただけ。しばらく使ってみて便利だと思えばメーリングリストなどから提案してみる。
追記:MLで、同じ話題が来たので -g オプションのスクリプトを投稿しておいた。忘れられなければ正式に採用してもらえると思う。
追記:同じ要望が既に一度却下されていた。採用してもらえるかな?
追記:1.3.11 に -g オプションが追加された!でも 1.3.11 は自動更新を毎回聞いてくるというバグがあり、開発者も認識しているので次を待った方がよいかも。1.3.11 からは日本語リソースも追加されている。
それにしても Apple Script の部分の最後のところはコメントかと思った。自分ですらすら書けるような気がしないな。
New option "-g" is added in order not to bring Skim.app to the foreground. I may post this change to the official mailing list.
#!/bin/bash # displayline (Skim) # # Usage: displayline [-r] [-b] [-g] LINE PDFFILE [TEXSOURCEFILE] if [ $# == 0 -o "$1" == "-h" -o "$1" == "-help" ]; then echo "Usage: displayline [-r] [-b] [-g] LINE PDFFILE [TEXSOURCEFILE]" exit 0 fi # get arguments revert=0 bar=0 activate=1 while [ "${1:0:1}" == "-" ]; do if [ "$1" == "-r" -o "$1" == "-revert" ]; then revert=1; elif [ "$1" == "-b" -o "$1" == "-readingbar" ]; then bar=1 elif [ "$1" == "-g" -o "$1" == "-background" ]; then activate=0 fi shift done line=$1 file="$2" [ $# -gt 2 ] && source="$3" || source="${file%.pdf}.tex" # expand relative paths [ "${file:0:1}" == "/" ] || file="${PWD}/${file}" [ "${source:0:1}" == "/" ] || source="${PWD}/${source}" # pass arguments as NULL-separated string to osascript # pass through cat to get them as raw bytes to preserve non-ASCII characters echo -ne "${line}\x00${file}\x00${source}\x00${revert}\x00${bar}\x00${activate}\x00" | \ /usr/bin/osascript \ -e "set theArgv to do shell script \"/bin/cat\"" \ -e "set AppleScript's text item delimiters to ASCII character 0" \ -e "set {theLine, theFile, theSource, shouldRevert, shouldShowBar, shouldActivate} to text items of theArgv" \ -e "set theLine to theLine as integer" \ -e "set theFile to POSIX file theFile" \ -e "set theSource to POSIX file theSource" \ -e "set shouldRevert to (shouldRevert as integer) as boolean" \ -e "set shouldShowBar to (shouldShowBar as integer) as boolean" \ -e "set shouldActivate to (shouldActivate as integer) as boolean" \ -e "set thePath to POSIX path of (theFile as alias)" \ -e "tell application \"Skim\"" \ -e " if shouldActivate then activate" \ -e " if shouldRevert then" \ -e " try" \ -e " set theDocs to get documents whose path is thePath" \ -e " if (count of theDocs) > 0 then revert theDocs" \ -e " end try" \ -e " end if" \ -e " open theFile" \ -e " tell front document to go to TeX line theLine from theSource showing reading bar shouldShowBar" \ -e "end tell" -
バックグラウンドのプレビュー.appを更新する方法
プレビューもPDFファイルが更新された時にバックグラウンドで再読み込みすると思っていたけど、それは勘違いだった。
そして、こちらにこの方法が紹介されているのを見つけた。
追記:以下の方法ではPDFの最初のページが開かれてしまう。最初に動作を確認した時は、表示しているページを保ったまま更新すると思っていたけど勘違いだった。ここにも毎回先頭にジャンプすることに対する不満が書かれていた。Preview の環境設定に"Start on the last viewed page"という項目があり、これにチェックをいれると一度終了して再度開くときに前に見ていたページを開く。しかし、既に開いているPDFファイルをもう一度 open(またはクリック)すると最初のページが開かれてしまう。このチェックが入っていたら、開いているページをキープしてくれても良いように思う(バグだろうか?)。
OSX の open コマンドは「open ファイル名」でファイルをクリックするのと同じことをコマンドラインから行える。オプション -a で開くアプリケーションを指定することもできる。これにはさらに -g というオプションがあり、ウインドウを前面にせずにファイルをアプリケーションで開くことができる。
$ open -g -a Preview foo.pdf
以下のようなスクリプトを、~/bin/pdflatex-preview などとして用意すれば、YaTeX のコンパイル&バックグラウンドでのプレビューが同時にできる。
#!/bin/sh command="pdflatex" #command="/usr/local/texlive/2010/bin/x86_64-darwin/pdflatex" bn=`basename $1 .tex` $command $1 && open -g -a Preview $bn.pdf
(実行権限を与えることを忘れない。 $chmod +x pdflatex-preview )
yatex で tex-command をスクリプトにする。コマンド+Bなどのショートカットを定義しておくと便利。
(setq tex-command "~/bin/pdflatex-preview") (add-hook 'yatex-mode-hook '(lambda() (require 'yatexprc) (local-set-key [(s b)] 'YaTeX-typeset-buffer) (local-set-key [(s r)] 'YaTeX-preview)))
EmacsとSkim.appでTeX・PDFシンクロ
最終更新日 2014年12月30日
[追記:2014/12/30]YaTeX 1.78 で、(カーソル位置に応じて振る舞いを変える)ジャンプ機能(C-c C-g)の1つとして、ここで紹介していたことと同等の機能が追加されました。
TeX用のPDFプレビュアSkimは「プレビュアからエディタ」と「エディタからプレビュア」と双方向でジャンプできる機能がある。後者を実現するにはエディタからコマンドを実行する必要があるので、EmacsのYaTeX用に関数を書いてみた。
Skim.app に内蔵されているシェルスクリプト displayline に、エディタのカーソルがある行番号とPDFファイル、そして現在開いているTeXファイルの3つの引数を与えて実行するだけ。(メインファイル foo.texから小ファイル bar.tex をインクルードする場合は、2番目の引数が foo.pdf で 3番目の引数は bar.tex)実際に、ターミナルからコマンドを実行すると、どのように動作するのかが分かる。
$ /Applications/Skim.app/Contents/SharedSupport/displayline 行番号 PDFファイル名 TeXファイル
[追記:2012/4/27]ここに紹介していたコードは、TeXWikiにそれを修正したものが紹介されているのでそちらを参考に。
[追記:2013/7/2]YaTeXのMLで問題点を修正してもらったので、再びここに掲載。
こういうエディタとプレビュアの間を自動的に行き来することは本来実現するべき機能だから、pdfTeX が日本語に対応していないために日本語TeX(pTeX)でできないというのは残念なこと。 [追記:2012/4/27] いつのまにかできるようになっていた!"platex -synctex=1"とすればよい。
[追記:2012/4/27] Skimを背面のままに保ちたい場合は、displayline に -g オプションを追加する。
OSXWS10.6のEmacsのデフォルト設定を提供する仕組み(変更案)
最終更新: 2011年1月28日
更新履歴
1月28日: 山本さんにコメントを頂き message を追加。
Emacs の設定ファイルを提供する仕組みについて、Vine Linux のメーリングリストで"vine-default の仕組みを新しくしました"というのがあった。たしかに現行では、hookを使わないとユーザの設定が上書きされて反映されない可能性がある。それをシンプルな方法で解決している。
一方今のOSXWS(10.6β)は、OSXWS 以外の Emacs (Carbon Emacs パッケージ/Aquamacs/自分でビルド) を起動した時に OSXWSがデフォルトで用意した設定を読み込まれないようにするために、init.el の条件分岐で init_osxws.el をロードしそこから各設定ファイルをロードするという込み入った仕組みにしている。init.el を編集することで設定を無効にすることは簡単だけど、一部を変更したいユーザーはどこに書くべきかを知らないといけないし、再びデフォルトを使いたくなった時に戻す方法も知らなければいけない。これらを考えると今の方法が良いとは言えない。
そこでOSXWSでもVine Linuxの新しい考え方をそのまま採用させてもらうことを提案したい(追記:採用してもらうことになった)。
提案の概要
これによってOSXWSが提供するEmacsは以下のような形になる。
- OSXWS は Emacs をある程度設定した状態で提供する
- ユーザは自由に init.el を書け、その設定が優先される。
- 最初からOSXWSの設定を読み込みたくない場合は変数 osxws-default を nil にする
- 一部の設定を読み込みたくない場合は対応する osxws-default-* を nil を nil にする
新しく用意された osxws-default などの変数を設定する場所にだけ制約があるが、それさえ了解してもらえれば、より自然な形で Emacs を使うことができる。
仕組み
以下の手順で、目的が達成できる。
- ユーザーの init.el を読む直前にロードされる osxws.el から、~/.emacs.d/setup-osxws-default.el を読みに行って osxws-default-* などの変数を拾ってくる。
- その後に osxws.el から osxws-default.el をロードする。個々の設定の有効/無効は osxws-default.el の中の条件分岐を行う。
- ユーザの init.el はその後にロードされる。
移行時にOSXWSがすること
- 移行前にユーザのホームディレクトリにある ~/.emacs.d/init.el をリネーム。
- OSX-Preferences パッケージは新しい ~/.emacs.d/init.el を提供。(ほぼ白紙かコメントのみ)
- OSX-Preferences パッケージに ~/.emacs.d/setup-osxws-default.el を追加。
- emacs-lisps パッケージに新しい osxws.el
- emacs-lisps パッケージにデフォルト設定ファイル osxws-default.el
- emacs-lisps パッケージにYaTeXのデフォルト設定ファイル osxws-default-yatex.el
この方法を採用する事になれば、以上のような変更を加える必要があるため、移行後にユーザは init_osxws.el などに書き加えた自分のカスタマイズが反映されないという状況になる。
あと考えなければいけない事は
- この仕組みで不備はないか?Emacsの標準的な考え方、作法に違反していないか?
- 将来の修正など、長期的なメンテナンスに耐えるか?
- OSXWS10.6でいきなり変更して混乱しないか?
識者の方々の意見を聞きたい所です。(追記:Vine Linux のEmacsメンテナ山本さんにコメントを頂きました)
/usr/osxws/etc/emacs-23.2/site-start.d/99osxws.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@xxxxxxxxxxx") (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 t "A boolean for loading osxws-setting section 1 (language)" :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-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: junet-unix ;; End:
~/.emacs.d/setup-osxws-default.el
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; setup-osxws-default.el for MacOS X WorkShop ;; KOBAYASHI Taizo <xxxxxxx@xxxxxxx> ;; 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 nil) ;;(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) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; You can inactivate the default setting for YaTeX by ;;(setq osxws-default-yatex nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Local Variables: ;; mode: emacs-lisp ;; buffer-file-coding-system: junet-unix ;; End:
/usr/osxws/share/emacs/site-lisp/emacs-lisps/osxws-default.el は、これまでosxws-sec?.elと分割していたものを1つにまとめたもの。
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; osxws-default.el for MacOS X WorkShop ;; Time-stamp: <2011-01-01 14:59:01 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 settings for Cocoa Emacs Package (if (equal (substring (shell-command-to-string "defaults read -g AppleLocale") 0 2) "jp") (progn (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) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Section 3 keyboard/keybinding ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (when osxws-default-keyboard ;; emulation of the standard CUA key bindings (Mac GUI) (cua-selection-mode t) ;; 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 [(alt \ )] '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 (let* ((size 14) (asciifont "Menlo") ;;(asciifont "Monaco") ;;(asciifont "Courier") ;;(asciifont "Andale Mono") (jpfont "Hiragino Maru Gothic ProN") ;;(jpfont "Hiragino Kaku Gothic ProN") ;;(jpfont "Hiragino Mincho ProN") ;;(jpfont "Osaka") (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: junet-unix ;; End:
■
ドイツの大学では生命科学の食品工学というところに所属している。研究で雇われているから教育のデューティはほとんどないのだけど、時々手伝ったり相談されたりする。うちの講座は力学、応用力学、電磁気、流体力学、レオロジーの授業を主に担当している。他の講座が何を教えているのか把握していないが、熱力学は他がやっているだろう。食品工学の学生はこういった科目も勉強するみたいだ。教え方や教えている内容の選び方に多少違いがあるのかもしれないが、物理学科でなくても物理を勉強するんだなと素朴に感じている。でも物理学科の中心である量子力学はさすがに教えない。量子力学、それは私にとっては一番重要だった。学生時代に量子力学に費やした時間は他の科目と比べ物にならない。でも逆に言えば、それに夢中になりすぎて他を疎かにした。存在感がありすぎるというのも困り者だ。いつからか忘れたけど、もっと身近な所にも面白い物理があるに違いないという考え方を持つようになった。おそらく寺田寅彦の文章の影響かな。だからコロイドという研究テーマのポスドクの話があった時に飛びついた。量子力学とは無関係の所で何か面白い物理ができるかもしれない。いい加減な動機だけど、こうやってテーマを変えて研究する機会があったのは運がよかった。そして、この分野の事をますます好きになっている。何よりも実験が近い。学部生の頃は、純粋に数式だけから予言され後で実験で見つかった陽電子の話に憧れ、勝手に理論物理は実験よりすごいと思っていた。しかし、実際に対象を測定することで、偏見に支配されないように対象と向き合う事こそが物理の本質だ(量子力学も主観より実験を優先することで完成した)。この分野で研究を始めてから意識するようになったけど、たくさんの研究者たちが日々工夫を積み重ねて、今まで見る事ができなかった所に光を当てている。それらのほとんどが応用を目的とした研究で、個々にモチベーションがバラバラだったりするけど、いつかそれらを基礎物理学へ還元するような仕事ができないかなんて事を考えている。
coreaudiod
MacBookのファンの音がなかなか鳴り止まなくて、アクティビティモニタを眺めていると、coreaudiod が常にCPU5%で動いていた。システム環境設定のサウンドの設定に変な所はなかったけど音の種類を変えたりしているうちになおったみたい。
OSXWSで提供されるCocoa Emacsのフォント設定
2011年1月16日に修正
Cocoa Emacs のフォント設定の新しい情報は MacEmacs 参照。
以下の設定はこちらをほぼそのまま使わせてもらっています。違う所は、é といったunicode文字の一部を日本語フォントではなくasciiフォントと同じにしたことと、画面の大きさに応じてフォントのサイズが変更されるようになっていることです。
ascii 文字などをMenlo。その他の unicode 文字はヒラギノ丸ゴ。
フォントサイズをショートカットで変更した時に、ヒラギノのフォントサイズを変えるには face-font-rescale-alist を使う必要があると、sakitoさんに教えていただいた。
以下では、Mac の標準的なショートカット(⌘+、⌘ー、⌘0)を定義している。
(when window-system (let* ((fontsize (if (< (display-pixel-height) 900) "12" "14"))) (create-fontset-from-ascii-font (concat "Menlo-" fontsize ":weight=normal:slant=normal") nil "menlomarugo")) (set-fontset-font "fontset-menlomarugo" 'unicode (font-spec :family "Hiragino Maru Gothic ProN") nil 'append) (set-fontset-font "fontset-menlomarugo" '(#x0080 . #x024F) (font-spec :family "Menlo") nil 'prepend) (add-to-list 'default-frame-alist '(font . "fontset-menlomarugo")) (setq face-font-rescale-alist '((".*Hiragino.*" . 1.2) (".*Menlo.*" . 1.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))))