Function: multisession--read-file-value
multisession--read-file-value is a byte-compiled function defined in
multisession.el.gz.
Signature
(multisession--read-file-value FILE OBJECT)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/multisession.el.gz
(defun multisession--read-file-value (file object)
(catch 'done
(let ((i 0)
last-error)
(while (< i 10)
(condition-case err
(throw 'done
(with-temp-buffer
(let* ((time (file-attribute-modification-time
(file-attributes file)))
(coding-system-for-read 'utf-8-emacs-unix))
(insert-file-contents file)
(let ((stored (read (current-buffer))))
(setf (multisession--cached-value object) stored
(multisession--cached-sequence object) time)
stored))))
;; Windows uses OS-level file locking that may preclude
;; reading the file in some circumstances. In addition,
;; rename-file is not an atomic operation on MS-Windows,
;; when the target file already exists, so there could be a
;; small race window when the file to read doesn't yet
;; exist. So when these problems happen, wait a bit and retry.
((permission-denied file-missing)
(setq i (1+ i)
last-error err)
(sleep-for (+ 0.1 (/ (float (random 10)) 10))))))
(signal (car last-error) (cdr last-error)))))