[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 61ae7be: Allow 'insert-image' to inhibit isearches or not
From: |
Lars Ingebrigtsen |
Subject: |
master 61ae7be: Allow 'insert-image' to inhibit isearches or not |
Date: |
Sat, 6 Nov 2021 00:18:50 -0400 (EDT) |
branch: master
commit 61ae7bef50c810e7f4837c7c9f3a31a08a456f1b
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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.
---
doc/lispref/display.texi | 6 ++++--
etc/NEWS | 4 ++++
lisp/image.el | 10 +++++++---
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 279b79a..22528a1 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index 4d38968..d2e0cf7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
diff --git a/lisp/image.el b/lisp/image.el
index adcdf0e..4815f00 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -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))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 61ae7be: Allow 'insert-image' to inhibit isearches or not,
Lars Ingebrigtsen <=