Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code system setting #4

Open
nasoundead opened this issue May 20, 2017 · 0 comments
Open

code system setting #4

nasoundead opened this issue May 20, 2017 · 0 comments

Comments

@nasoundead
Copy link
Owner

http://liu233w.github.io/blog/2016/09/29/org-python-windows/

;; 设置编码
(cond
((eq system-type 'windows-nt) ; 或者 (spacemacs/system-is-mswindows)
;;
(set-language-environment "chinese-gbk")
(prefer-coding-system 'utf-8)
(set-terminal-coding-system 'gbk)
;;
(modify-coding-system-alist 'process "*" 'gbk)
(defun liu233w/windows-shell-mode-coding ()
(set-buffer-file-coding-system 'gbk)
(set-buffer-process-coding-system 'gbk 'gbk))
(add-hook 'shell-mode-hook #'liu233w/windows-shell-mode-coding)
(add-hook 'inferior-python-mode-hook #'liu233w/windows-shell-mode-coding)
;;
(defun liu233w//python-encode-in-org-babel-execute (func body params)
"org-babel 执行代码时不会自动编码文件,这里通过动态作用域覆
盖默认选项来编码文件。"
;; 此问题的详细信息请参考:Liu233w/.spacemacs.d#6
(let ((coding-system-for-write 'utf-8))
(funcall func body params)))
(advice-add #'org-babel-execute:python :around
#'liu233w//python-encode-in-org-babel-execute))
;; --
(t
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant