两个屏,主屏开 emacs 做笔记,副屏开pdf或epub阅读器,这里假设开clearview,想不离开主屏emacs的情况下,控制副屏clearview翻页,有什么好的方法没? 我用applescript脚本试了试,翻页可以,但但是当前窗口会切换到clearview,囧!
向各位大佬求教个好用的方案,谢谢!
两个屏,主屏开 emacs 做笔记,副屏开pdf或epub阅读器,这里假设开clearview,想不离开主屏emacs的情况下,控制副屏clearview翻页,有什么好的方法没? 我用applescript脚本试了试,翻页可以,但但是当前窗口会切换到clearview,囧!
向各位大佬求教个好用的方案,谢谢!
(defun clearview-pageup ()
"ClearView page up"
(interactive)
(do-applescript
(concat
"tell application \"Clearview\"\n"
" activate\n"
" tell application \"System Events\"\n"
" key code 126 using {command down}\n"
" end tell\n"
"end tell\n"
"tell application \"Emacs\"\n"
" activate\n"
"end tell\n")))
(defun clearview-pagedown ()
"ClearView page down"
(interactive)
(do-applescript
(concat
"tell application \"Clearview\"\n"
" activate\n"
" tell application \"System Events\"\n"
" key code 125 using {command down}\n"
" end tell\n"
"end tell\n"
"tell application \"Emacs\"\n"
" activate\n"
"end tell\n")))
(map! "C-c C-x n" #'clearview-pagedown)
(map! "C-c C-x p" #'clearview-pageup)
有点乱,上面的代码能给 clearview翻页,但是不能在翻完之后切回emacs,请大佬帮忙看看存在什么问题呢?感谢!
明白了,改了下,这下管用了。
(defun clearview-pageup ()
"ClearView page up"
(interactive)
(do-applescript
(concat
"tell application \"Clearview\"\n"
" activate\n"
" tell application \"System Events\"\n"
" key code 126 using {command down}\n"
" end tell\n"
" delay 1\n"
" tell application \"Emacs\"\n"
" activate\n"
" end tell\n"
"end tell\n")))
(defun clearview-pagedown ()
"ClearView page down"
(interactive)
(do-applescript
(concat
"tell application \"Clearview\"\n"
" activate\n"
" tell application \"System Events\"\n"
" key code 125 using {command down}\n"
" end tell\n"
" delay 1\n"
" tell application \"Emacs\"\n"
" activate\n"
" end tell\n"
"end tell\n")))
(map! "C-c C-x n" #'clearview-pagedown)
(map! "C-c C-x p" #'clearview-pageup)