[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/lentic 779c2d05e3 120/333: Treat start of line properly
From: |
ELPA Syncer |
Subject: |
[elpa] externals/lentic 779c2d05e3 120/333: Treat start of line properly in blocks. |
Date: |
Tue, 27 Feb 2024 13:00:15 -0500 (EST) |
branch: externals/lentic
commit 779c2d05e36b7648a89d1b71abd64c0fbf64bbfe
Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
Commit: Phillip Lord <phillip.lord@newcastle.ac.uk>
Treat start of line properly in blocks.
Previously, deleting the uncommented buffer to the beginning of the line
would leave the comments around. We now expand any change at the
beginning of the line in the uncommented buffer to the beginning of the
line in the commented buffer (i.e. affecting comments).
---
linked-buffer-block.el | 64 +++++++++++++++++++++++++++++-----------------
test/linked-buffer-test.el | 11 +++-----
2 files changed, 44 insertions(+), 31 deletions(-)
diff --git a/linked-buffer-block.el b/linked-buffer-block.el
index c88dba2096..d766d113ad 100644
--- a/linked-buffer-block.el
+++ b/linked-buffer-block.el
@@ -361,30 +361,46 @@ between the two buffers; we don't care which one has
comments."
&optional start stop length-before start-converted stop-converted)
"Update the contents in the linked-buffer with comments."
;;(linked-buffer-log "blk-clone-comment conf):(%s)" conf)
- (call-next-method conf start stop length-before
- start-converted stop-converted)
- (condition-case e
- (linked-buffer-blk-comment-buffer
- conf
- ;; the buffer at this point has been copied over, but is in an
- ;; inconsistent state (because it may have comments that it should
- ;; not). Still, the convertor should still work because it counts from
- ;; the end
- (linked-buffer-convert
- conf
- ;; point-min if we know nothing else
- (or start (point-min)))
- (linked-buffer-convert
- conf
- ;; if we have a stop
- (if stop
- ;; take stop (if we have got longer) or
- ;; start length before (if we have got shorter)
- (max stop
- (+ start length-before))
- (point-max)))
- (linked-buffer-that conf))
- (unmatched-delimiter-error nil)))
+ (let*
+ ((start-at-bolp
+ (when
+ (and start
+ (linked-buffer-bolp
+ (oref conf :this-buffer)
+ start))
+ (m-buffer-with-current-location
+ (oref conf :that-buffer)
+ start-converted
+ (line-beginning-position))))
+ (start-converted (or start-at-bolp start-converted)))
+ (if (or start-at-bolp)
+ (linked-buffer-log "In comment: %s"
+ (when start-at-bolp
+ "start")))
+ (call-next-method conf start stop length-before
+ start-converted stop-converted)
+ (condition-case e
+ (linked-buffer-blk-comment-buffer
+ conf
+ ;; the buffer at this point has been copied over, but is in an
+ ;; inconsistent state (because it may have comments that it should
+ ;; not). Still, the convertor should still work because it counts from
+ ;; the end
+ (linked-buffer-convert
+ conf
+ ;; point-min if we know nothing else
+ (or start (point-min)))
+ (linked-buffer-convert
+ conf
+ ;; if we have a stop
+ (if stop
+ ;; take stop (if we have got longer) or
+ ;; start length before (if we have got shorter)
+ (max stop
+ (+ start length-before))
+ (point-max)))
+ (linked-buffer-that conf))
+ (unmatched-delimiter-error nil))))
(defmethod linked-buffer-invert
((conf linked-buffer-uncommented-block-configuration))
diff --git a/test/linked-buffer-test.el b/test/linked-buffer-test.el
index 369b447bd6..0a61abd27f 100644
--- a/test/linked-buffer-test.el
+++ b/test/linked-buffer-test.el
@@ -21,7 +21,7 @@
(defun linked-buffer-test-equal-loudly (a b)
"Actually, this just tests equality and shouts if not."
;; change this to t to disable noisy printout
- (if t
+ (if nil
(string= a b)
(if (string= a b)
t
@@ -163,7 +163,7 @@ results."
(setq this
(find-file-noselect filename))
(setq linked-buffer-init init)
- (progn
+ (progn
(setq that
(linked-buffer-init-create))
(funcall f-this)
@@ -183,7 +183,7 @@ results."
(point-max))))
(set-buffer-modified-p nil)
retn)
-
+
;; unwind forms
(when this (kill-buffer this))
(when that (kill-buffer that))))
@@ -316,12 +316,9 @@ This mostly checks my test machinary."
"orgel-org.el" "orgel-org.el"
nil
(lambda ()
+ (show-all)
(goto-char (point-min))
(forward-line)
(insert "a")
(delete-char -1))
t)))
-
-
-
-
- [elpa] externals/lentic e195259aac 076/333: linked-buffer-org documentation completed., (continued)
- [elpa] externals/lentic e195259aac 076/333: linked-buffer-org documentation completed., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic bf5a5cfbf1 085/333: Add long test file., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 070c94118e 074/333: Added .dir-locals, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 08cb364e4c 094/333: Nil markers after use., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 449c4d0bc1 098/333: Pass start and end through., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 10c91c51d5 110/333: Specialised beginning of line treatment., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 8ab992a0d0 113/333: Added a test to bug with orgel->org mode., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 48d809a4af 115/333: Use unwind-protect in test forms., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic abcdc7f422 117/333: m-buffer-with-markers used., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 934c7bc313 118/333: Fixes for incremental updates., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 779c2d05e3 120/333: Treat start of line properly in blocks.,
ELPA Syncer <=
- [elpa] externals/lentic 30d9141686 121/333: m-buffer update -- move to stable., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic a740327d41 126/333: More efficient detection of first line., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 37eb0a74cd 128/333: More Emacs versions added., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 6ce64ab475 131/333: Test only two versions!, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 7e39bf724c 134/333: Incorporate new functions from m-buffer., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic b71b478f51 139/333: Test expected to fail., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic c60736c5c6 140/333: Comment removed because it is out of date., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic f0e3d7b287 145/333: Limit to lentic to allow some support files., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 2cfc982759 147/333: New tests added., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 6480e71885 148/333: Fixed some accidentally lower casing., ELPA Syncer, 2024/02/27