emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/sqlite 0a6dd5b: Don't store unreadable objects


From: Lars Ingebrigtsen
Subject: scratch/sqlite 0a6dd5b: Don't store unreadable objects
Date: Tue, 14 Dec 2021 21:52:35 -0500 (EST)

branch: scratch/sqlite
commit 0a6dd5b2122ff89a025a27ffec78a88db3101513
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Don't store unreadable objects
---
 lisp/emacs-lisp/multisession.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el
index e2ad261..9c1a6be 100644
--- a/lisp/emacs-lisp/multisession.el
+++ b/lisp/emacs-lisp/multisession.el
@@ -218,6 +218,8 @@ DOC should be a doc string, and ARGS are keywords as 
applicable to
                  (print-circle t)
                  (print-level nil))
              (prin1-to-string value))))
+      (when (string-match-p "\\`#" pvalue)
+        (error "Unable to store unreadable value: %s" pvalue))
       (sqlite-execute
        multisession--db
        "insert into multisession(package, key, sequence, value) values(?, ?, 
1, ?) on conflict(package, key) do update set sequence = sequence + 1, value = 
?"
@@ -302,6 +304,9 @@ DOC should be a doc string, and ARGS are keywords as 
applicable to
             (print-circle t)
             (print-level nil))
         (prin1 value (current-buffer)))
+      (goto-char (point-min))
+      (when (looking-at-p "\\`#")
+        (error "Unable to store unreadable value: %s" (buffer-string)))
       ;; Write to a temp file in the same directory and rename to the
       ;; file for somewhat better atomicity.
       (let ((coding-system-for-write 'utf-8)
@@ -360,7 +365,7 @@ storage method to list."
          (if choose-storage
              (intern (completing-read "Storage method: " '(sqlite files) nil 
t))
            multisession-storage)))
-    (pop-to-buffer (get-buffer-create "*Multisession*"))
+    (pop-to-buffer (get-buffer-create (format "*Multisession %s*" storage)))
     (multisession-edit-mode)
     (setq-local multisession-storage storage)
     (multisession-edit-mode--revert)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]