(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的快捷方式。
如果遇到以下问题
打开emacs的shell,看一看是不是cmd有乱码的问题
如果有的话,修改编码:
;;处理终端乱码的问题 (set-terminal-coding-system 'gb2312) (modify-coding-system-alist 'process "*" 'gb2312) (setq default-process-coding-system '(gb2312 . gb2312))