Make QR code buffer readonly

This commit is contained in:
Bram Schoenmakers 2024-02-15 21:27:23 +01:00
parent 73a87ed767
commit 68b36fc922
Signed by: bram
GPG Key ID: 0CCD19DFDC63258F
2 changed files with 4 additions and 0 deletions

View File

@ -931,6 +931,7 @@ Which covers my (potential) GPG/SSH usage within Emacs. Now, anytime a I perform
(with-current-buffer (get-buffer-create "*qr*")
;; in case the buffer still exists and image-mode is active
(fundamental-mode)
(read-only-mode -1)
(erase-buffer)
(insert text)
(let ((file-format
@ -938,6 +939,7 @@ Which covers my (potential) GPG/SSH usage within Emacs. Now, anytime a I perform
(call-process-region nil nil "qrencode" t t nil "-o" "-" "-t" file-format)
(when (and (display-graphic-p) (string= file-format "PNG"))
(image-mode)))
(read-only-mode)
(display-buffer (current-buffer))))
#+end_src

View File

@ -17,6 +17,7 @@ This function relies on qrencode(1) being present in your $PATH."
(with-current-buffer (get-buffer-create "*qr*")
;; in case the buffer still exists and image-mode is active
(fundamental-mode)
(read-only-mode -1)
(erase-buffer)
(insert text)
(let ((file-format
@ -24,4 +25,5 @@ This function relies on qrencode(1) being present in your $PATH."
(call-process-region nil nil "qrencode" t t nil "-o" "-" "-t" file-format)
(when (and (display-graphic-p) (string= file-format "PNG"))
(image-mode)))
(read-only-mode)
(display-buffer (current-buffer))))