This is from recentf.el in Emacs 26.3:

    (defconst recentf-save-file-coding-system
      (if (coding-system-p 'utf-8-emacs)
      "Coding system of the file `recentf-save-file'.")

Why is it set to utf-8 rather than plain text?

Is it to support the extended character set in file paths & file names or is there something more?

Encountered this when I wanted to use sed to do a clean-up of my .recentf file. I wanted to remove many entries using a regexp and sed from the command line when Emacs is not running. sed silently does not do the right thing (no deletion of lines) and I think it's because of the encoding.

  • Unless you find some comment about this in the file recentf.el you might need to ask Emacs developers, by sending mail to [email protected]. In any case, you likely don't want to use emacs-mule. Maybe another question is why this is a defconst, not a defvar or even a defcustom. In principle this means that the program needs (expects) it to be utf-8 or emacs-mule. defconst indicates that neither the program nor people should change the value.
    – Drew
    Commented Apr 18, 2022 at 18:50
  • 1
    sed can deal with utf-8 so I would suggest you post the command you use and a portion of the file that does not respond the way you expect. But since this has nothing to do with Emacs, I suggest you ask in Unix & Linux SE.
    – NickD
    Commented Apr 18, 2022 at 19:01


Your Answer

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

Browse other questions tagged or ask your own question.