Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了linux – 如何重置emacs以utf-8-unix字符编码保存文件?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我有个问题.我发现emacs最近停止使用默认字符集“utf-8-unix”保存所有新文件. 我不明白我做了什么,但是当我打开一个文件时,在迷你缓冲区上面我看到“ – :—”而不是“-U:—”,其中“U”表示该文件用utf-8-unix charset保存. 如何重置emacs以在正确的编码系统中保存文件? 这是我的设置: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EN
@H_403_1@我有个问题.我发现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 '("@R_874_9004@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_@R_953_3801@ 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字符编码保存文件?所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。