Function: projectile-save-known-projects

projectile-save-known-projects is a byte-compiled function defined in projectile.el.

Signature

(projectile-save-known-projects)

Documentation

Save PROJECTILE-KNOWN-PROJECTS to PROJECTILE-KNOWN-PROJECTS-FILE.

Text properties are stripped on the way out: a propertized string serializes to #("..." 0 3 (face ...))\=, whose properties can hold objects that don't read back, which is how the file gets corrupted in the first place (see issue #1927).

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-save-known-projects ()
  "Save PROJECTILE-KNOWN-PROJECTS to PROJECTILE-KNOWN-PROJECTS-FILE.
Text properties are stripped on the way out: a propertized string
serializes to `#(\"...\" 0 3 (face ...))\\=', whose properties can hold
objects that don\\='t read back, which is how the file gets corrupted in
the first place (see issue #1927)."
  (projectile-serialize (mapcar (lambda (project)
                                  ;; Anything that isn't a string is left
                                  ;; alone: refusing to save at all would be
                                  ;; a worse failure than the one being
                                  ;; guarded against.
                                  (if (stringp project)
                                      (substring-no-properties project)
                                    project))
                                projectile-known-projects)
                        projectile-known-projects-file)
  (setq projectile-known-projects-on-file
        (and (sequencep projectile-known-projects)
             (copy-sequence projectile-known-projects))))