emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 6716eb2: * lisp/image-mode.el (image-toggle-display


From: Stefan Monnier
Subject: [Emacs-diffs] master 6716eb2: * lisp/image-mode.el (image-toggle-display-image): Avoid string-make-unibyte
Date: Mon, 15 Oct 2018 22:32:04 -0400 (EDT)

branch: master
commit 6716eb24cfc5b21be5232acdc8c743dd0de81b41
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/image-mode.el (image-toggle-display-image): Avoid string-make-unibyte
---
 lisp/image-mode.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 97c23e6..606c661 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -145,7 +145,7 @@ otherwise it defaults to t, used for times when the buffer 
is not displayed."
   (unless (listp image-mode-winprops-alist)
     (setq image-mode-winprops-alist nil))
   (add-hook 'window-configuration-change-hook
-           'image-mode-reapply-winprops nil t))
+           #'image-mode-reapply-winprops nil t))
 
 ;;; Image scrolling functions
 
@@ -572,8 +572,8 @@ Key bindings:
        ;; Keep track of [vh]scroll when switching buffers
        (image-mode-setup-winprops)
 
-       (add-hook 'change-major-mode-hook 'image-toggle-display-text nil t)
-       (add-hook 'after-revert-hook 'image-after-revert-hook nil t)
+       (add-hook 'change-major-mode-hook #'image-toggle-display-text nil t)
+       (add-hook 'after-revert-hook #'image-after-revert-hook nil t)
        (run-mode-hooks 'image-mode-hook)
        (let ((image (image-get-display-property))
              (msg1 (substitute-command-keys
@@ -725,10 +725,14 @@ was inserted."
                            (not (and (boundp 'epa-file-encrypt-to)
                                      (local-variable-p
                                       'epa-file-encrypt-to))))))
-        (file-or-data (if data-p
-                          (string-make-unibyte
-                           (buffer-substring-no-properties (point-min) 
(point-max)))
-                        filename))
+        (file-or-data
+          (if data-p
+             (let ((str
+                    (buffer-substring-no-properties (point-min) (point-max))))
+                (if enable-multibyte-characters
+                    (encode-coding-string str buffer-file-coding-system)
+                  str))
+           filename))
         ;; If we have a `fit-width' or a `fit-height', don't limit
         ;; the size of the image to the window size.
         (edges (and (null image-transform-resize)



reply via email to

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