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.
This commit is contained in:
Akib Azmain Turja 2022-12-15 13:52:08 +06:00
parent 559c9c362c
commit e597bcfbb2
No known key found for this signature in database
GPG key ID: 5535FCF54D88616B

17
eat.el
View file

@ -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.