From e597bcfbb27477a4e98dc96ada2e91bce397a1e6 Mon Sep 17 00:00:00 2001 From: Akib Azmain Turja Date: Thu, 15 Dec 2022 13:52:08 +0600 Subject: [PATCH] Don't use '.*-char-property-.*' functions * eat.el (eat--t-move-before-to-safe): Use 'previous-single-property-change' instead of '(previous-single-char-property-change'. * eat.el (eat--t-join-long-line): Use 'get-text-property' instead of 'get-char-property'. Handle properly the case where 'next-single-property-change' returns nil. * eat.el (eat--t-fix-partial-multi-col-char): Handle properly the case where 'next-single-property-change' returns nil. --- eat.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/eat.el b/eat.el index 831b85a..042d15e 100644 --- a/eat.el +++ b/eat.el @@ -684,10 +684,11 @@ Assume all characters occupy a single column." For example: \"*foo\\nbar\\nbaz\" is converted to \"foo*bar\\nbaz\", where `*' indicates point." ;; Are we already at the end a part of a long line? - (unless (get-char-property (point) 'eat--t-wrap-line) + (unless (get-text-property (point) 'eat--t-wrap-line) ;; Find the next end of a part of a long line. - (goto-char (next-single-property-change - (point) 'eat--t-wrap-line nil limit))) + (goto-char (or (next-single-property-change + (point) 'eat--t-wrap-line nil limit) + limit (point-max)))) ;; Remove the newline. (when (< (point) (or limit (point-max))) (1value (cl-assert (1value (= (1value (char-after)) ?\n)))) @@ -1185,8 +1186,9 @@ character or its the internal invisible spaces." (get-text-property (1- (point)) 'eat--t-invisible-space)) (let ((start-pos (point))) ;; Move to the safe position. - (goto-char (previous-single-char-property-change - (point) 'eat--t-invisible-space)) + (goto-char (or (previous-single-property-change + (point) 'eat--t-invisible-space) + (point-min))) (cl-assert (1value (or (bobp) (null (get-text-property @@ -1214,8 +1216,9 @@ character or its the internal invisible spaces." (if (get-text-property (point) 'eat--t-invisible-space) (let ((start-pos (point)) (count nil)) - (goto-char (next-single-property-change - (point) 'eat--t-invisible-space)) + (goto-char (or (next-single-property-change + (point) 'eat--t-invisible-space) + (point-max))) (setq count (- (1+ (point)) start-pos)) ;; Make sure we really overwrote the character ;; partially.