[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt e97b71e808 171/323: Re-work method to replace
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt e97b71e808 171/323: Re-work method to replace asm contents |
Date: |
Thu, 9 Mar 2023 10:58:28 -0500 (EST) |
branch: externals/beardbolt
commit e97b71e8087eb3da61598b8719dcd6e1ab38a3dd
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Re-work method to replace asm contents
The old method of replacing asm contents was buggy and slow on Emacs
26, causing many hangs when doing large replaces. This method is more
crude, but is much faster and less prone to subtle issues. With small
edits, the point may end up in the wrong place (as it is relying on
position rather than contents), but I think that's an acceptable loss.
Please file an issue if this causes issues for you. On Emacs 25, this
should strictly be better than the previous solution
---
rmsbolt.el | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/rmsbolt.el b/rmsbolt.el
index 42dcd46262..332f3c8c60 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -1231,18 +1231,15 @@ Argument OVERRIDE-BUFFER use this buffer instead of
reading from the output file
(with-current-buffer src-buffer
(setq-local rmsbolt-line-mapping ht))
- ;; Replace buffer contents non-destructively if possible
- (if (functionp #'replace-buffer-contents)
- (with-temp-buffer
- (insert (mapconcat #'identity lines "\n"))
- (let ((tmp-buffer (current-buffer)))
- (with-current-buffer output-buffer
- (replace-buffer-contents tmp-buffer))))
- (with-current-buffer output-buffer
- (let ((old-point (point)))
- (erase-buffer)
- (insert (mapconcat #'identity lines "\n"))
- (goto-char old-point))))
+
+ ;; Replace buffer contents but save point and scroll
+ (let* ((window (get-buffer-window output-buffer))
+ (old-point (window-point window))
+ (old-window-start (window-start window)))
+ (erase-buffer)
+ (insert (mapconcat #'identity lines "\n"))
+ (set-window-start window old-window-start)
+ (set-window-point window old-point))
(asm-mode)
(rmsbolt-mode 1)
(setq-local rmsbolt-src-buffer src-buffer)
- [elpa] externals/beardbolt 93778d8391 298/323: Don't try any window scrolling heroics on recompile, (continued)
- [elpa] externals/beardbolt 93778d8391 298/323: Don't try any window scrolling heroics on recompile, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 12e926f66b 300/323: Correct local variable section of benchmark file, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 782febee77 307/323: Add new option bb-execute and simplify more code, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 13c51a99e0 309/323: Rework window management again. Not more like godbolt, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 27f10327f3 308/323: Rework window management. Not a bad alternative., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f260a62397 312/323: Refactor some behaviour for easier language definition, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3b88b18029 316/323: Update README.md, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 08227684f5 317/323: Provide better local variable defaults for starter examples, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt d9da365a0f 320/323: Rework rainbow overlays to make them slightly more useful, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 06fd5a1eee 323/323: * beardbolt.el (bb--guess-from-ccj): Don't mess with -O flags, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e97b71e808 171/323: Re-work method to replace asm contents,
ELPA Syncer <=