Skip to content

Instantly share code, notes, and snippets.

@ryseto
Last active November 12, 2018 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryseto/5710882 to your computer and use it in GitHub Desktop.
Save ryseto/5710882 to your computer and use it in GitHub Desktop.
Emacs から Skim.app で開いている PDF の編集位置を表示させる関数(YaTeX 1.78 以降は標準のジャンプ機能で対応している)
;;; Tsuchiya-san's corrections (yatex ML [yatex:04810,04811])
(defun skim-forward-search ()
(interactive)
(process-query-on-exit-flag
(start-process
"displayline"
nil
"/Applications/Skim.app/Contents/SharedSupport/displayline"
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
buffer-file-name)))
;;; Key bindings
;;; Command + r or C-c s
(add-hook 'yatex-mode-hook
'(lambda ()
(require 'yatexprc)
(define-key YaTeX-mode-map [?\s-R] 'skim-forward-search)
(define-key YaTeX-mode-map (kbd "C-c s") 'skim-forward-search)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment