[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/m-buffer 1ab361ed32 053/115: with-markers and with-curr
From: |
ELPA Syncer |
Subject: |
[elpa] externals/m-buffer 1ab361ed32 053/115: with-markers and with-current-location added. |
Date: |
Tue, 19 Jul 2022 15:58:48 -0400 (EDT) |
branch: externals/m-buffer
commit 1ab361ed3275c417ac3f178af192d9adc0a89eec
Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
Commit: Phillip Lord <phillip.lord@newcastle.ac.uk>
with-markers and with-current-location added.
Two new macros one of which works like let, but auto nils markers, and
the other which runs the body in a given buffer and location.
---
m-buffer.el | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/m-buffer.el b/m-buffer.el
index a94e557426..90866a91ff 100644
--- a/m-buffer.el
+++ b/m-buffer.el
@@ -45,6 +45,41 @@
;;; Code:
(require 'dash)
+;;
+;; Macro Support
+;;
+(defmacro m-buffer-with-markers (varlist &rest body)
+ "Bind variables after VARLIST then eval BODY.
+All variables should contain markers or collections of markers.
+All markers are niled after BODY."
+ ;; indent let part specially.
+ (declare (indent 1)(debug let))
+ ;; so, create a rtn var with make-symbol (for hygene)
+ (let* ((rtn-var (make-symbol "rtn-var"))
+ (marker-vars
+ (mapcar 'car varlist))
+ (full-varlist
+ (append
+ varlist
+ `((,rtn-var
+ (progn
+ ,@body))))))
+ `(let* ,full-varlist
+ (m-buffer-nil-marker
+ (list ,@marker-vars))
+ ,rtn-var)))
+
+(defmacro m-buffer-with-current-location
+ (buffer location &rest body)
+ "Run BODY in BUFFER at LOCATION."
+ (declare (indent 2)
+ (debug t))
+ `(with-current-buffer
+ ,buffer
+ (save-excursion
+ (goto-char ,location)
+ ,@body)))
+
;;
;; Regexp matching
;;
- [elpa] externals/m-buffer 9dcfcd69d8 106/115: Update Emacs version requirement, (continued)
- [elpa] externals/m-buffer 9dcfcd69d8 106/115: Update Emacs version requirement, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer e2d5a416ce 113/115: Move back to melpa-stable, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 8681342aaf 114/115: Renamespace assess-discover, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer f76c2d205b 025/115: Merge branch 'master' of github.com:phillord/m-buffer-el, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer fff98c95e3 030/115: Return type of replace-match changed to start end markers. New function `clone-markers', ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 32c3077044 031/115: Bump to snapshot version (rather late!), ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 71a712044e 033/115: v0.3 release, ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 1ce2bb58bb 040/115: Test from melpa-stable only., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 6c25f66a6d 039/115: Uses cask for dependency management and testing., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer b501935037 047/115: Version and Dependency updates., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 1ab361ed32 053/115: with-markers and with-current-location added.,
ELPA Syncer <=
- [elpa] externals/m-buffer 20f5618f2b 061/115: Documentation updates., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 7dc326288e 065/115: Documentation now orgified., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 4bf9bbe61d 069/115: README update for 0.8., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer d232b27d1e 074/115: Unused variable name changed., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer f62d176423 075/115: Byte-compile errors fixed., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer da475fb914 079/115: Update for 0.10., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 31b6db5145 080/115: New start file for lentic doc., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 47e9243598 088/115: Prepare for next iteration., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 61d1fceb84 090/115: Prepare for next iteration., ELPA Syncer, 2022/07/19
- [elpa] externals/m-buffer 970b87f18d 093/115: Port tests to new travis infrastructure., ELPA Syncer, 2022/07/19