Allow 'insert-image' to inhibit isearches or not

* doc/lispref/display.texi (Showing Images): Mention it.
* lisp/image.el (insert-image): Take an optional parameter to
inhibit isearch of the STRING argument.
This commit is contained in:
Lars Ingebrigtsen 2021-11-06 05:18:32 +01:00
parent c8acc5fd92
commit 61ae7bef50
3 changed files with 15 additions and 5 deletions

View file

@ -6505,7 +6505,7 @@ will compute a scaling factor based on the font pixel size.
property yourself, but it is easier to use the functions in this
section.
@defun insert-image image &optional string area slice
@defun insert-image image &optional string area slice inhibit-isearch
This function inserts @var{image} in the current buffer at point. The
value @var{image} should be an image descriptor; it could be a value
returned by @code{create-image}, or the value of a symbol defined with
@ -6530,7 +6530,9 @@ image.
Internally, this function inserts @var{string} in the buffer, and gives
it a @code{display} property which specifies @var{image}. @xref{Display
Property}.
Property}. By default, doing interactive searches in the buffer will
consider @var{string} when searching. If @var{inhibit-isearch} is
non-@code{nil}, this is inhibited.
@end defun
@cindex slice, image

View file

@ -438,6 +438,10 @@ If set, 'isearch' will skip these areas, which can be useful (for
instance) when covering huge amounts of data (that has no meaningful
searchable data, like image data) with a 'display' text property.
*** 'insert-image' now takes an INHIBIT-ISEARCH optional parameter.
It marks the image with the 'inhibit-isearch' text parameter, which
inhibits 'isearch' matching the STRING parameter.
---
*** New user option 'pp-use-max-width'.
If non-nil, 'pp' will attempt to limit the line length when formatting

View file

@ -603,7 +603,7 @@ means display it in the right marginal area."
;;;###autoload
(defun insert-image (image &optional string area slice)
(defun insert-image (image &optional string area slice inhibit-isearch)
"Insert IMAGE into current buffer at point.
IMAGE is displayed by inserting STRING into the current buffer
with a `display' property whose value is the image.
@ -620,7 +620,11 @@ SLICE specifies slice of IMAGE to insert. SLICE nil or omitted
means insert whole image. SLICE is a list (X Y WIDTH HEIGHT)
specifying the X and Y positions and WIDTH and HEIGHT of image area
to insert. A float value 0.0 - 1.0 means relative to the width or
height of the image; integer values are taken as pixel values."
height of the image; integer values are taken as pixel values.
Normally `isearch' is able to search for STRING in the buffer
even if it's hidden behind a displayed image. If INHIBIT-ISEARCH
is non-nil, this is inhibited."
;; Use a space as least likely to cause trouble when it's a hidden
;; character in the buffer.
(unless string (setq string " "))
@ -644,7 +648,7 @@ height of the image; integer values are taken as pixel values."
(list (cons 'slice slice) image)
image)
rear-nonsticky t
inhibit-isearch t
inhibit-isearch ,inhibit-isearch
keymap ,image-map))))