[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/annotate 683ebed03a 04/17: -removed macros 'annotate-with-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/annotate 683ebed03a 04/17: -removed macros 'annotate-with-inhibit-modification-hooks' and |
Date: |
Fri, 25 Feb 2022 14:57:55 -0500 (EST) |
branch: elpa/annotate
commit 683ebed03aa1b600dc4867348ec1fd90b66b4a4f
Author: cage <cage@invalid>
Commit: cage <cage@invalid>
-removed macros 'annotate-with-inhibit-modification-hooks' and
'annotate-with-restore-modified-bit', both can be replaced with
'with-silent-modification'.
---
annotate.el | 60 +++++++++++++++++++++---------------------------------------
1 file changed, 21 insertions(+), 39 deletions(-)
diff --git a/annotate.el b/annotate.el
index 0701468171..b899bdf523 100644
--- a/annotate.el
+++ b/annotate.el
@@ -329,21 +329,6 @@ See 'annotate-blacklist-major-mode'."
"Calculate an hash for the argument `OBJECT'."
(secure-hash 'md5 object))
-(cl-defmacro annotate-with-inhibit-modification-hooks (&rest body)
- ;; FIXME: Use `with-silent-modifications' instead?
- "Wrap `BODY' in a block with modification-hooks inhibited."
- `(let ((inhibit-modification-hooks t))
- ,@body))
-
-(cl-defmacro annotate-with-restore-modified-bit (&rest body)
- "Save the value of `BUFFER-MODIFIED-P' before `BODY' is executed
-and restore the saved value just after the end of `BODY'."
- ;; FIXME: Use `with-silent-modifications' instead?
- (let ((modifiedp (gensym)))
- `(let ((,modifiedp (buffer-modified-p)))
- ,@body
- (restore-buffer-modified-p ,modifiedp))))
-
(defun annotate-end-of-line-pos ()
"Get the position of the end of line and rewind the point's
position (so that it is unchanged after this function is called)."
@@ -418,7 +403,7 @@ it is called any time the buffer content is changed (so, for
example, text is added or deleted). In particular, it will
rearrange the overlays bounds when an annotated text is
modified (for example a newline is inserted)."
- (annotate-with-inhibit-modification-hooks
+ (with-silent-modifications
(save-excursion
(let* ((bol (annotate-beginning-of-line-pos))
(eol (annotate-end-of-line-pos))
@@ -1229,22 +1214,22 @@ a a**"
surrounded by `BEGIN' and `END'."
(when (and (> (buffer-size) 0)
(not (buffer-narrowed-p)))
- (annotate-with-inhibit-modification-hooks
- (annotate-with-disable-read-only
- ;; copy undo list
- (let ((saved-undo-list (copy-tree buffer-undo-list t)))
- ;; inhibit property removal to the undo list (and empty it too)
- (buffer-disable-undo)
- (save-excursion
- (goto-char end)
- ;; go to the EOL where the
- ;; annotated newline used to be
- (end-of-line)
- ;; strip dangling display property
- (remove-text-properties (point) (1+ (point)) '(display nil)))
- ;; restore undo list
- (setf buffer-undo-list saved-undo-list)
- (buffer-enable-undo))))))
+ (with-silent-modifications
+ (annotate-with-disable-read-only
+ ;; copy undo list
+ (let ((saved-undo-list (copy-tree buffer-undo-list t)))
+ ;; inhibit property removal to the undo list (and empty it too)
+ (buffer-disable-undo)
+ (save-excursion
+ (goto-char end)
+ ;; go to the EOL where the
+ ;; annotated newline used to be
+ (end-of-line)
+ ;; strip dangling display property
+ (remove-text-properties (point) (1+ (point)) '(display nil)))
+ ;; restore undo list
+ (setf buffer-undo-list saved-undo-list)
+ (buffer-enable-undo))))))
(defun annotate-annotations-overlay-in-range (from-position to-position)
"Return the annotations overlays that are enclosed in the range
@@ -2103,7 +2088,7 @@ status of the buffer before deletion occured.
This function is not part of the public API."
(annotate-ensure-annotation (annotation)
- (annotate-with-restore-modified-bit
+ (with-silent-modifications
(annotate--delete-annotation-chain annotation))))
(defun annotate--confirm-annotation-delete ()
@@ -3172,12 +3157,9 @@ code, always use load files from trusted sources!"
(setf annotate-file new-db)
(cl-loop for annotated-buffer in
(annotate-buffers-annotate-mode) do
(with-current-buffer annotated-buffer
- (let ((buffer-was-modified-p (buffer-modified-p
annotated-buffer)))
- (annotate-with-inhibit-modification-hooks
- (annotate-mode -1)
- (annotate-mode 1)
- (when (not buffer-was-modified-p)
- (set-buffer-modified-p nil)))))))
+ (with-silent-modifications
+ (annotate-mode -1)
+ (annotate-mode 1)))))
(when annotate-use-messages
(message "Load aborted by the user"))))
(signal 'annotate-db-file-not-found (list new-db))))))
- [nongnu] elpa/annotate updated (0cfad246ee -> 5bf59f8038), ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate 58bbb16e07 02/17: - fixed typo in docstring., ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate 683ebed03a 04/17: -removed macros 'annotate-with-inhibit-modification-hooks' and,
ELPA Syncer <=
- [nongnu] elpa/annotate f717cb2514 05/17: - improved comment., ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate 50ac6fb2fe 06/17: - explained why we need too hook into 'window-configuration-change-hook', ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate 87a96e186c 08/17: - explained why we need to use 'after-hook'., ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate f2dd24802e 13/17: - removed nested 'if' inside a call to 'list'., ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate 5bf59f8038 17/17: Merge pull request #122 from cage2/feedback-nonGNU, ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate 3ea6b0c03f 01/17: - patched code as suggested from emacs maintainer., ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate 1f159c36e3 07/17: - commenting call to 'font-lock-flush' when removing annotation, ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate 1507291640 10/17: - fixed comment., ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate f7c4fc47ab 09/17: - removed reference in a comment for a non existent argument function., ELPA Syncer, 2022/02/25
- [nongnu] elpa/annotate 11de81414b 11/17: - flipped order of entries in the news file, now is from more recent to older., ELPA Syncer, 2022/02/25