branch: externals/compat commit c1501b497a2e2215b1560579f2c552b7414a88c7 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
compat-29: Drop with-buffer-unmodified-if-unchanged --- NEWS.org | 2 ++ compat-29.el | 37 ------------------------------------- compat.texi | 17 ----------------- 3 files changed, 2 insertions(+), 54 deletions(-) diff --git a/NEWS.org b/NEWS.org index c2a4000409..084a1babeb 100644 --- a/NEWS.org +++ b/NEWS.org @@ -24,6 +24,8 @@ downstream issue in the doom-modeline package. If a more efficient solution is possible, the function will be added back. - compat-29: Drop broken function ~string-limit~. +- compat-29: Drop broken macro ~with-buffer-unmodified-if-unchanged~, which relied + on ~buffer-hash~ which does not exist on all supported Emacs versions. - compat-29: Add ~pos-bol~ and ~pos-eol~. * Release of "Compat" Version 29.1.0.1 diff --git a/compat-29.el b/compat-29.el index 194e87f75a..c3f4d52218 100644 --- a/compat-29.el +++ b/compat-29.el @@ -272,43 +272,6 @@ CONDITION." ;;;; Defined in subr-x.el -(compat-defmacro with-buffer-unmodified-if-unchanged (&rest body) ;; <UNTESTED> - "Like `progn', but change buffer-modified status only if buffer text changes. -If the buffer was unmodified before execution of BODY, and -buffer text after execution of BODY is identical to what it was -before, ensure that buffer is still marked unmodified afterwards. -For example, the following won't change the buffer's modification -status: - - (with-buffer-unmodified-if-unchanged - (insert \"a\") - (delete-char -1)) - -Note that only changes in the raw byte sequence of the buffer text, -as stored in the internal representation, are monitored for the -purpose of detecting the lack of changes in buffer text. Any other -changes that are normally perceived as \"buffer modifications\", such -as changes in text properties, `buffer-file-coding-system', buffer -multibyteness, etc. -- will not be noticed, and the buffer will still -be marked unmodified, effectively ignoring those changes." - (declare (debug t) (indent 0)) - (let ((hash (make-symbol "hash")) - (buffer (make-symbol "buffer"))) - `(let ((,hash (and (not (buffer-modified-p)) - (buffer-hash))) - (,buffer (current-buffer))) - (prog1 - (progn - ,@body) - ;; If we didn't change anything in the buffer (and the buffer - ;; was previously unmodified), then flip the modification status - ;; back to "unchanged". - (when (and ,hash (buffer-live-p ,buffer)) - (with-current-buffer ,buffer - (when (and (buffer-modified-p) - (equal ,hash (buffer-hash))) - (restore-buffer-modified-p nil)))))))) - (compat-defun add-display-text-property (start end prop value ;; <OK> &optional object) "Add display property PROP with VALUE to the text from START to END. diff --git a/compat.texi b/compat.texi index 500fddd1b9..891382fa25 100644 --- a/compat.texi +++ b/compat.texi @@ -2221,23 +2221,6 @@ you can say: @xref{Size of Displayed Text,,,elisp}. @end defun -@c based on lisp/subr-x.el -@defmac with-buffer-unmodified-if-unchanged &rest body@dots{} -Evaluate @var{body} like @code{progn}, but change buffer-modified status -only if buffer text changes. If the buffer was unmodified before -execution of BODY, and buffer text after execution of BODY is identical -to what it was before, ensure that buffer is still marked unmodified -afterwards. - -Note that only changes in the raw byte sequence of the buffer text, as -stored in the internal representation, are monitored for the purpose of -detecting the lack of changes in buffer text. Any other changes that -are normally perceived as "buffer modifications", such as changes in -text properties, @code{buffer-file-coding-system}, buffer multibyteness, -etc. -- will not be noticed, and the buffer will still be marked -unmodified, effectively ignoring those changes. -@end defmac - @defun file-attribute-file-identifier Return the fields @code{(inodenum device)} as a list from attributes generated by @code{file-attributes}.