Carbon EmacsでObjective-Cのコードを書きつつXcodeでデバッグをしていると、Emacsで見えているファイルの行にブレークポイントを追加したくなることがよくある。そこで、AppleScript経由で現在の行をXcodeのブレークポイントとして追加するEmacs Lispを作ってみた。すぐにはXcodeで該当行のマークが表示されないけど、プロジェクトのツリーにも反映されてるし、ソースを表示し直したりすればちゃんと表示される。
興味ある人は試してみてください。
(defun xcode-add-breakpoint-at-line () (interactive) (let ((line (number-to-string (line-number-at-pos))) (file-path buffer-file-name)) (do-applescript (concat "tell application \"Xcode\" activate tell front project repeat with r in file references set p to full path of r if \"" file-path "\" = p then set bp to make new file breakpoint with properties {line number:" line "} set file reference of bp to r set enabled of bp to true exit repeat end if end repeat end tell end tell"))))