linux – 如何重置emacs以utf-8-unix字符编码保存文件?

linux – 如何重置emacs以utf-8-unix字符编码保存文件?,第1张

概述我有个问题.我发现emacs最近停止使用默认字符集“utf-8-unix”保存所有新文件. 我不明白我做了什么,但是当我打开一个文件时,在迷你缓冲区上面我看到“ – :—”而不是“-U:—”,其中“U”表示该文件用utf-8-unix charset保存. 如何重置emacs以在正确的编码系统中保存文件? 这是我的设置: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EN 我有个问题.我发现emacs最近停止使用默认字符集“utf-8-unix”保存所有新文件.
我不明白我做了什么,但是当我打开一个文件时,在迷你缓冲区上面我看到“ – :—”而不是“-U:—”,其中“U”表示该文件用utf-8-unix charset保存.
如何重置emacs以在正确的编码系统中保存文件?解决方法 这是我的设置:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ENCoding ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; C-h C RET;; M-x describe-current-Coding-system(add-to-List 'file-Coding-system-aList '("\.tex" . utf-8-unix) )(add-to-List 'file-Coding-system-aList '("\.txt" . utf-8-unix) )(add-to-List 'file-Coding-system-aList '("\.el" . utf-8-unix) )(add-to-List 'file-Coding-system-aList '("\.scratch" . utf-8-unix) )(add-to-List 'file-Coding-system-aList '("user_prefs" . utf-8-unix) )(add-to-List 'process-Coding-system-aList '("\.txt" . utf-8-unix) )(add-to-List 'network-Coding-system-aList '("\.txt" . utf-8-unix) )(prefer-Coding-system 'utf-8-unix)(set-default-Coding-systems 'utf-8-unix)(set-terminal-Coding-system 'utf-8-unix)(set-keyboard-Coding-system 'utf-8-unix)(set-selection-Coding-system 'utf-8-unix)(setq-default buffer-file-Coding-system 'utf-8-unix);; Treat clipboard input as UTF-8 string first; compound text next,etc.(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING));; mnemonic for utf-8 is "U",which is defined in the mule.el(setq eol-mnemonic-dos ":CRLF")(setq eol-mnemonic-mac ":CR")(setq eol-mnemonic-undecIDed ":?")(setq eol-mnemonic-unix ":LF")(defalias 'read-buffer-file-Coding-system 'lawList-read-buffer-file-Coding-system)(defun lawList-read-buffer-file-Coding-system ()  (let* ((bCSS (find-Coding-systems-region (point-min) (point-max)))         (css-table          (unless (equal bCSS '(undecIDed))            (append '("dos" "unix" "mac")                    (delq nil (mapcar (lambda (cs)                                        (if (memq (Coding-system-base cs) bCSS)                                            (symbol-name cs)))                                      Coding-system-List)))))         (combined-table          (if css-table              (completion-table-in-turn css-table Coding-system-aList)            Coding-system-aList))         (auto-cs          (unless find-file-literally            (save-excursion              (save-restriction                (wIDen)                (goto-char (point-min))                (funcall set-auto-Coding-function                         (or buffer-file-name "") (buffer-size))))))         (preferred 'utf-8-unix)         (default 'utf-8-unix)         (completion-ignore-case t)         (completion-pcm--delim-wild-regex ; Let "u8" complete to "utf-8".          (concat completion-pcm--delim-wild-regex                  "\|\([[:Alpha:]]\)[[:digit:]]"))         (cs (completing-read              (format "Coding system for saving file (default %s): " default)              combined-table              nil t nil 'Coding-system-history              (if default (symbol-name default)))))    (unless (zerop (length cs)) (intern cs))))
总结

以上是内存溢出为你收集整理的linux – 如何重置emacs以utf-8-unix字符编码保存文件?全部内容,希望文章能够帮你解决linux – 如何重置emacs以utf-8-unix字符编码保存文件?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1048351.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存