[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/lentic 73fe35fa77 023/333: Refactoring to remove code d
From: |
ELPA Syncer |
Subject: |
[elpa] externals/lentic 73fe35fa77 023/333: Refactoring to remove code duplication. |
Date: |
Tue, 27 Feb 2024 12:59:56 -0500 (EST) |
branch: externals/lentic
commit 73fe35fa778e6c9d8f1eaa83a7c3b051cab07e73
Author: Phillip Lord <phillord@haughton.ncl.ac.uk>
Commit: Phillip Lord <phillord@haughton.ncl.ac.uk>
Refactoring to remove code duplication.
---
linked-buffer-block.el | 33 +++++++++++++++++++++------------
linked-buffer-latex-code.el | 30 ++++++++++++++++++------------
2 files changed, 39 insertions(+), 24 deletions(-)
diff --git a/linked-buffer-block.el b/linked-buffer-block.el
index 5facad986f..ee08e0c000 100644
--- a/linked-buffer-block.el
+++ b/linked-buffer-block.el
@@ -28,7 +28,6 @@
;; line comment characters that the other one lacks. Commented regions may be
;; in blocks with block-delimiters between then.
-(require 'dash)
(require 'm-buffer)
(require 'linked-buffer)
@@ -67,14 +66,15 @@ start of line block comment in one buffer but not the
other."
(defmethod linked-buffer-blk-line-start-comment
((conf linked-buffer-block-configuration))
- (concat "^" (oref conf :comment)))
+ (concat "^"
+ (oref conf :comment)))
(defun linked-buffer-blk-uncomment-region (conf begin end buffer)
"Given CONF, remove start-of-line characters in region.
Region is between BEGIN and END in BUFFER. CONF is a
function `linked-buffer-configuration' object."
(m-buffer-replace-match
- (m-buffer-match-data
+ (m-buffer-match
buffer
(linked-buffer-blk-line-start-comment conf)
:begin begin :end end) ""))
@@ -93,7 +93,7 @@ BEGIN and END in BUFFER."
"Given CONF, a `linked-buffer-configuration' object, add
start of line comment characters beween BEGIN and END in BUFFER."
(m-buffer-replace-match
- (m-buffer-match-data
+ (m-buffer-match
buffer
;; perhaps we should ignore lines which are already commented,
"\\(^\\).+"
@@ -123,14 +123,13 @@ BEGIN and END in BUFFER."
demarcation markers between BEGIN and END in BUFFER. Returns a
list of start end cons pairs. BEGIN is considered to be an
implicit start and END an implicit stop."
- (let ((match-start
- (m-buffer-match-begin
- buffer
- (linked-buffer-block-comment-start-regexp conf)))
- (match-end
- (m-buffer-match-end
- buffer
- (linked-buffer-block-comment-stop-regexp conf))))
+ (let* ((match-block
+ (linked-buffer-block-match
+ conf buffer))
+ (match-start
+ (car match-block))
+ (match-end
+ (cadr match-block)))
(unless
(= (length match-start)
(length match-end))
@@ -149,6 +148,16 @@ implicit start and END an implicit stop."
match-end
(list (set-marker (make-marker) end buffer))))))
+(defmethod linked-buffer-block-match ((conf linked-buffer-block-configuration)
+ buffer)
+ (list
+ (m-buffer-match-begin
+ buffer
+ (linked-buffer-block-comment-start-regexp conf))
+ (m-buffer-match-end
+ buffer
+ (linked-buffer-block-comment-stop-regexp conf))))
+
(defun linked-buffer-pabbrev-expansion-length ()
"Returns the length of any text that pabbrev has currently added to the
buffer."
;; this *exact* form suppresses byte compiler warnings.
diff --git a/linked-buffer-latex-code.el b/linked-buffer-latex-code.el
index a8e5e27d99..cf4eac1d0a 100644
--- a/linked-buffer-latex-code.el
+++ b/linked-buffer-latex-code.el
@@ -37,18 +37,24 @@
(require 'linked-buffer-block)
(defun linked-buffer-clojure-latex-init ()
- (setq linked-buffer-config
- (linked-buffer-commented-block-configuration
- "lb-commented"
- :this-buffer (current-buffer)
- :linked-mode 'tex-mode
- :linked-file
- (concat
- (file-name-sans-extension
- (buffer-file-name)) ".tex")
- :comment ";; "
- :comment-start "\\\\end{code}"
- :comment-stop "\\\\begin{code}")))
+ (if
+ (equal
+ "clj"
+ (file-name-extension
+ (buffer-file-name)))
+ (setq linked-buffer-config
+ (linked-buffer-commented-block-configuration
+ "lb-commented clojure latex"
+ :this-buffer (current-buffer)
+ :linked-mode 'tex-mode
+ :linked-file
+ (concat
+ (file-name-sans-extension
+ (buffer-file-name)) ".tex")
+ :comment ";; "
+ :comment-start "\\\\end{code}"
+ :comment-stop "\\\\begin{code}"))
+ (error "Can only use linked-buffer-clojure-latex-init in a .clj buffer")))
(defun linked-buffer-clojure-latex-delayed-init ()
(linked-buffer-delayed-init 'linked-buffer-clojure-latex-init))
- [elpa] externals/lentic c09443853e 016/333: Moved test to examples., (continued)
- [elpa] externals/lentic c09443853e 016/333: Moved test to examples., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic d6ec7f8265 001/333: Initial Checkin, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 26cde813da 006/333: m-buffer has moved to keyword args., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 19a85aadf8 007/333: Reworked form to circumvent byte-compiler warning., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 580c5b315d 011/333: Clone point now operates on buffers with no visible windows also., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 9697d9d4de 003/333: Initial commit., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 7bc58a4813 014/333: Delayed linkage added. Typo in v0.2 fixed., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 9ff8e5a75a 024/333: Bug added., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 9f337f08f2 027/333: Initial commit: sort dependencies during test., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic ed64dff0c7 031/333: Support for asciidoc->latex transformation, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 73fe35fa77 023/333: Refactoring to remove code duplication.,
ELPA Syncer <=
- [elpa] externals/lentic d72b413ac8 037/333: Moved file name, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic ec206bf673 060/333: Update in preparation for 0.5 release., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 29688f7ec6 089/333: Logging alterations., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic b0c705c488 093/333: Removed :numeric option., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 8ee4c01fe5 086/333: Fixed some errant blocks., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic b2e4d953f1 053/333: Support for Org to Elisp transformation., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic e9369029fe 055/333: Having this in git is a pain!, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic c88b7ccbe2 057/333: Update to add emacs temp files., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 8b7966fd4e 066/333: Test files added for org-orgel, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 95feec5f21 075/333: Move to MELPA, ELPA Syncer, 2024/02/27