I was messing with trying to get emojis to display and I broke my emacs by messing with the coding system settings somehow. After my desktop file failed to load, I uninstalled unicode-fonts and deleted anything from my init file that messed with the coding system, such as:

;;(set-default-coding-systems 'utf-8-unix)
;;(prefer-coding-system 'utf-8-unix)

Now,when I launch emacs, I get weird errors like the following backtrace:

Debugger entered--Lisp error: (void-variable 爨煥極敲✠慹湳灩数⥴ਊ㬻眠楨整灳捡⁥敲潭楶杮映湵瑣潩獮映潲慍湧牡匠敶湥㬠㬻㬻㬻㬻㬻㬻㬻㬻㬻㬻㬻㬻㬻਻搨晥湵礠獡猭琭楲⵭敬瑦⠠⥳ ∠敒潭敶眠楨整灳捡⁥瑡琠敨戠来湩楮杮漠⁦⹓ਢ†椨⁦猨牴湩ⵧ慭捴⁨尢恜⁛瑜湜牜⭝•⥳ ††⠠敲汰捡ⵥ慭捴⁨∢琠琠猠਩††⥳਩⠊敤畦慹⵳⵳牴浩爭杩瑨⠠⥳ ∠敒潭敶眠楨整灳捡⁥瑡琠敨攠摮漠⁦⹓ਢ†椨⁦猨牴湩ⵧ慭捴⁨嬢尠屴屮嵲尫❜•⥳ ††⠠敲汰捡ⵥ慭捴⁨∢琠琠猠਩††⥳਩⠊敤畦慹⵳⵳牴浩⠠⥳ ∠敒潭敶眠楨整灳捡⁥瑡琠敨戠来湩楮杮愠摮攠摮漠⁦⹓ਢ†礨獡猭琭楲⵭敬瑦⠠慹⵳⵳牴浩爭杩瑨猠⤩਩ਊ搨晥湵礠獡猭牴湩ⵧ敲敶獲⁥猨牴਩†刢癥牥敳愠猠牴湩⁧呓⁒慭畮污祬琠敢挠浯慰楴汢⁥楷桴攠慭獣瘠牥楳湯⁳‼㔲∮ ⠠灡汰⁹✣瑳楲杮 ††††爨癥牥敳 ††††⠠瑳楲杮琭ⵯ楬瑳猠牴⤩⤩ਊ搨晥湵礠獡琭楲浭摥挭浯敭瑮猭慴瑲⠠਩†吢楨⁳畦据楴湯爠瑥牵獮怠潣浭湥⵴瑳牡❴琠楲浭摥戠⁹桷瑩獥慰散⹳ਢ†礨獡猭琭楲潣浭湥⵴瑳牡⥴਩⠊敤畦慹⵳牴浩敭ⵤ潣浭湥⵴湥⁤⤨ ∠桔獩映湵瑣潩敲畴湲⁳捠浯敭瑮攭摮‧牴浩敭⁤祢眠楨整灳捡獥椠⁦捠浯敭瑮攭摮‧獩渠瑯攠灭祴ਮ瑏敨睲獩⁥桴⁥敲敶獲摥漠瑵異⁴景映湵瑣潩祠獡琭楲浭摥挭浯敭瑮猭慴瑲‧獩爠瑥牵敮⹤ਢ†椨⁦攨ⁱ氨湥瑧⁨潣浭湥⵴湥⥤〠਩†††礨獡猭牴湩ⵧ敲敶獲⁥礨獡琭楲浭摥挭浯敭瑮猭慴瑲⤩ †⠠慹⵳⵳牴浩挠浯敭瑮攭摮⤩਩)
  (eval-buffer #<buffer  *load*-675843> nil "/usr/share/yasnippet-snippets/prog-mode/.yas-setup..." nil t)  ; Reading at buffer position 582
  (load-with-code-conversion "/usr/share/yasnippet-snippets/prog-mode/.yas-setup.el" "/usr/share/yasnippet-snippets/prog-mode/.yas-setup.el" t t)
  (load "/usr/share/yasnippet-snippets/prog-mode/.yas-setup" noerror t)
  (yas--load-yas-setup-file "/usr/share/yasnippet-snippets/prog-mode/.yas-setup")
  (yas--load-directory-2 "/usr/share/yasnippet-snippets/prog-mode" prog-mode)
  (yas--load-directory-1 "/usr/share/yasnippet-snippets/prog-mode" prog-mode)
  (apply yas--load-directory-1 ("/usr/share/yasnippet-snippets/prog-mode" prog-mode))
  (#f(compiled-function (&rest args2) #<bytecode 0x1580721bcaa9>))
  (yas-minor-mode 1)
  (run-hooks after-change-major-mode-hook)
  (run-mode-hooks emacs-lisp-mode-hook)
  (set-auto-mode-0 emacs-lisp-mode nil)
  (normal-mode t)
  (after-find-file nil nil)
  (find-file-noselect-1 #<buffer init.el> "~/.emacs.d/init.el" :nowarn nil "~/.emacs.d/init.el" (5889992 2050))
  (find-file-noselect "/home/nate/.emacs.d/init.el" :nowarn)
  (desktop-restore-file-buffer "/home/nate/.emacs.d/init.el" "init.el" nil)
  (desktop-create-buffer 208 "/home/nate/.emacs.d/init.el" "init.el" emacs-lisp-mode (eldoc-mode override-global-mode global-auto-revert-mode projectile-mode ws-butler-mode flycheck-mode yas-minor-mode company-mode company-box-mode which-key-mode popper-mode popper-echo-mode) 25315 (25126 nil) nil nil ((buffer-display-time 25613 56468 927524 293000) (buffer-file-coding-system . utf-16le-with-signature-unix)) ((mark-ring (25026 746 746 746 25026))))
  (eval-buffer #<buffer  *load*> nil "/home/nate/.emacs.d/var/desktop/emacs-desktop" nil t)  ; Reading at buffer position 5639
  (load-with-code-conversion "/home/nate/.emacs.d/var/desktop/emacs-desktop" "/home/nate/.emacs.d/var/desktop/emacs-desktop" t t)
  (load "/home/nate/.emacs.d/var/desktop/emacs-desktop" t t t)
  (#f(compiled-function () #<bytecode 0x158071d8da0d>))
  (run-hooks after-init-hook delayed-warnings-hook)

The file /usr/share/yasnippet-snippets/prog-mode/.yas-setup.el is not a bunch of chinese characters, it's just an ordinary looking lisp file. So I have no idea what's going on.

  • Is the problem reproducible? Do you see it if you start Emacs with emacs -Q (no init file)? If so, post a reproducible recipe. If not, bisect your init file to find the culprit.
    – Drew
    Mar 12, 2023 at 16:26

1 Answer 1


This was caused by emacs inferring the incorrect coding system for files. Solved by putting the following at the top of my init file to force utf-8:

;; There will be problems if it tries to load some file as the incorrect
;; coding system, so set that stuff up immediately
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; backwards compatibility as default-buffer-file-coding-system
;; is deprecated in 23.2.
(if (boundp 'buffer-file-coding-system)
    (setq-default buffer-file-coding-system 'utf-8)
  (setq default-buffer-file-coding-system 'utf-8))

;; Treat clipboard input as UTF-8 string first; compound text next, etc.
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.