helloout

导航

windows下emacs调用外部程序打开文件

(eval-after-load "org"
'(progn
;; .txt files aren't in the list initially, but in case that changes
;; in a future version of o·rg, use if to avoid errors

(if (assoc "\\.doc\\'" org-file-apps)
(setcdr (assoc "\\.doc\\'" org-file-apps) " D:/iap/WPSOffice.lnk  %s")
(add-to-list 'org-file-apps '("\\.doc\\'" . " D:/iap/WPSOffice.lnk  %s") t))
;; Change .pdf association directly within the alist
(if (assoc "\\.xls\\'" org-file-apps)
(setcdr (assoc "\\.xls\\'" org-file-apps) " D:/iap/WPSOffice.lnk  %s")
(add-to-list 'org-file-apps '("\\.xls\\'" . " D:/iap/WPSOffice.lnk  %s") t))
))

使用以上代码实现,调用wps打开doc和xls文件

其中 D:/iap/WPSOffice.lnk 是wps的快捷方式。

报错1:打开文件发现乱码

 

 

如果遇到以下问题

 

 

 

 

 

 打开emacs的shell,看一看是不是cmd有乱码的问题

如果有的话,修改编码:

;;处理终端乱码的问题
(set-terminal-coding-system 'gb2312)
(modify-coding-system-alist 'process "*" 'gb2312)
(setq default-process-coding-system '(gb2312 . gb2312))

  

参考

stackoverflow上的讨论:

http://stackoverflow.com/questions/8834633/how-do-i-make-org-mode-open-pdf-files-in-evince

posted on 2022-04-06 19:22  helloout  阅读(141)  评论(0)    收藏  举报