aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2020-12-23 11:30:04 +0200
committerJuri Linkov2020-12-23 11:30:04 +0200
commit268a3d32fb5a26c09787627d12a4dfc61ba059ff (patch)
tree5a0fad34c30355e01ec8921cab879fb989f4b1d7
parent5c86a5329664cd5fd3b81fe991c8d7dc18815e07 (diff)
downloademacs-268a3d32fb5a26c09787627d12a4dfc61ba059ff.tar.gz
emacs-268a3d32fb5a26c09787627d12a4dfc61ba059ff.zip
Show image as text when trying to search/replace in image buffer (bug#25905)
* lisp/image-mode.el (image-mode-isearch-filter): New function. (image-mode--setup-mode): Use it to add it as :before-while to isearch-filter-predicate.
-rw-r--r--lisp/image-mode.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 465bf867627..143b68f52e7 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -667,6 +667,9 @@ Key bindings:
667 (when image-auto-resize-on-window-resize 667 (when image-auto-resize-on-window-resize
668 (add-hook 'window-state-change-functions #'image--window-state-change nil t)) 668 (add-hook 'window-state-change-functions #'image--window-state-change nil t))
669 669
670 (add-function :before-while (local 'isearch-filter-predicate)
671 #'image-mode-isearch-filter)
672
670 (run-mode-hooks 'image-mode-hook) 673 (run-mode-hooks 'image-mode-hook)
671 (let ((image (image-get-display-property)) 674 (let ((image (image-get-display-property))
672 (msg1 (substitute-command-keys 675 (msg1 (substitute-command-keys
@@ -782,6 +785,14 @@ Remove text properties that display the image."
782 (if (called-interactively-p 'any) 785 (if (called-interactively-p 'any)
783 (message "Repeat this command to go back to displaying the image")))) 786 (message "Repeat this command to go back to displaying the image"))))
784 787
788(defun image-mode-isearch-filter (_beg _end)
789 "Show image as text when trying to search/replace in the image buffer."
790 (save-match-data
791 (when (and (derived-mode-p 'image-mode)
792 (image-get-display-property))
793 (image-mode-as-text)))
794 t)
795
785(defvar archive-superior-buffer) 796(defvar archive-superior-buffer)
786(defvar tar-superior-buffer) 797(defvar tar-superior-buffer)
787(declare-function image-flush "image.c" (spec &optional frame)) 798(declare-function image-flush "image.c" (spec &optional frame))