[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 37c0b0b39f 2/2: consult-buffer-substring: Remov
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 37c0b0b39f 2/2: consult-buffer-substring: Remove problematic text properties |
Date: |
Wed, 26 Jan 2022 13:57:23 -0500 (EST) |
branch: externals/consult
commit 37c0b0b39f5093bd3bcd90862af39167a2479ec4
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
consult-buffer-substring: Remove problematic text properties
---
consult.el | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/consult.el b/consult.el
index 126d2a9ad7..6c10d92d1f 100644
--- a/consult.el
+++ b/consult.el
@@ -998,15 +998,23 @@ tofu-encoded MARKER suffix for disambiguation."
(add-text-properties 0 1 `(consult-location (,marker . ,line) ,@props) cand)
cand)
+(defconst consult--remove-text-properties
+ '(mouse-face help-echo keymap local-map read-only cursor-intangible field
cursor pointer
+ modification-hooks insert-in-front-hooks insert-behind-hooks
cursor-sensor-functions
+ front-sticky rear-nonsticky follow-link)
+ "List of text properties to remove from buffer strings.")
+
(defsubst consult--buffer-substring (beg end &optional fontify)
"Return buffer substring between BEG and END.
If FONTIFY and `consult-fontify-preserve' are non-nil, first ensure that the
region has been fontified."
(if consult-fontify-preserve
- (progn
- (when fontify
- (consult--fontify-region beg end))
- (buffer-substring beg end))
+ (let (str)
+ (when fontify (consult--fontify-region beg end))
+ (setq str (buffer-substring beg end))
+ ;; TODO Propose the addition of a function
`preserve-list-of-text-properties'
+ (remove-list-of-text-properties 0 (- end beg)
consult--remove-text-properties str)
+ str)
(buffer-substring-no-properties beg end)))
(defun consult--region-with-cursor (beg end marker)