[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/lentic 370ebf12a9 268/333: Widening was inconsistent in
From: |
ELPA Syncer |
Subject: |
[elpa] externals/lentic 370ebf12a9 268/333: Widening was inconsistent in hooks. |
Date: |
Tue, 27 Feb 2024 13:00:43 -0500 (EST) |
branch: externals/lentic
commit 370ebf12a9908a4ee732fa7823a7c246e5879b3e
Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
Commit: Phillip Lord <phillip.lord@newcastle.ac.uk>
Widening was inconsistent in hooks.
Lentic was widen buffers inconsistently in hooks, in particular the
before-command-function was not widened. This has been fixed a new macro
introduced which widens both buffers in a conf cleanly.
In this process of fixing this bug, I found that the orgel-org
configuration was dependent on the global current-buffer, rather than
obeying its own state; this was caused by a bug in m-buffer, hence the
dependency for this has been updated.
This also addresses a problem with "comment-region", in clojure buffers.
This uses narrowing to limit the effect of the commenting function. The
before-command-function was running with narrowing in place, which mean
that the location of the change was incorrectly calculated.
Closes #27
---
Cask | 2 +-
lentic-block.el | 1 -
lentic.el | 64 +++++++++++++++++++++++++++++++++++----------------------
3 files changed, 41 insertions(+), 26 deletions(-)
diff --git a/Cask b/Cask
index f3a67c6a06..8080df17e9 100644
--- a/Cask
+++ b/Cask
@@ -1,7 +1,7 @@
;; -*- emacs-lisp -*-
(source gnu)
(source marmalade)
-(source melpa-stable)
+(source melpa)
(package-file "lentic.el")
diff --git a/lentic-block.el b/lentic-block.el
index e94065b31c..ba50a28486 100644
--- a/lentic-block.el
+++ b/lentic-block.el
@@ -141,7 +141,6 @@ should only have occurred between BEGIN and END in BUFFER."
(defun lentic-blk-comment-region (conf begin end buffer)
"Given CONF, a `lentic-configuration' object, add
start of line comment characters beween BEGIN and END in BUFFER."
- (lentic-log "comment-region (%s,%s,%s)" begin end buffer)
(m-buffer-with-markers
((line-match
(m-buffer-match
diff --git a/lentic.el b/lentic.el
index 465ba37a86..20e7a670e5 100644
--- a/lentic.el
+++ b/lentic.el
@@ -7,7 +7,7 @@
;; Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
;; Maintainer: Phillip Lord <phillip.lord@newcastle.ac.uk>
;; Version: 0.10
-;; Package-Requires: ((emacs "24.4")(m-buffer "0.10")(dash "2.5.0")(f
"0.17.2"))
+;; Package-Requires: ((emacs "24.4")(m-buffer "0.13")(dash "2.5.0")(f
"0.17.2"))
;; The contents of this file are subject to the GPL License, Version 3.0.
@@ -534,6 +534,7 @@ in the new."
(stop (or stop (point-max))))
(with-current-buffer that-b
(save-restriction
+ (widen)
;; get the start location that we converted before the change.
;; lentic-convert is not reliable now, because the two
;; buffers do not share state until we have percolated it
@@ -545,8 +546,6 @@ in the new."
(min (point-max)
(or stop-converted
(point-max)))))
- ;; does this widen do anything?
- (widen)
(delete-region converted-start
converted-stop)
(save-excursion
@@ -650,6 +649,19 @@ Emacs crashes with backtraces in batch." )
,bodyform
,@handlers)))
+(defmacro lentic-widen (conf &rest body)
+ "Widen both buffers in CONF, then evaluate BODY."
+ (declare (debug t)
+ (indent 1))
+ `(with-current-buffer
+ (lentic-that ,conf)
+ (save-restriction
+ (widen)
+ (with-current-buffer
+ (lentic-this ,conf)
+ (save-restriction
+ (widen)
+ ,@body)))))
;; #+end_src
;; Recurse down the lentic tree to all lentic views.
@@ -1102,23 +1114,25 @@ SEEN-BUFFER is a list of buffers to which the change
has been percolated."
(or (-contains? seen-buffer (lentic-that config))
;; convert uses that buffer
(not (buffer-live-p (lentic-that config))))
- (oset config :last-change-start start)
- (oset config
- :last-change-start-converted
- (lentic-convert
- config
- start))
- (oset config :last-change-stop stop)
- (oset config
- :last-change-stop-converted
- (lentic-convert
- config
- stop))
- (lentic-before-change-function-1
- (lentic-that config)
- (oref config :last-change-start-converted)
- (oref config :last-change-stop-converted)
- seen-buffer)))
+ (lentic-widen
+ config
+ (oset config :last-change-start start)
+ (oset config
+ :last-change-start-converted
+ (lentic-convert
+ config
+ start))
+ (oset config :last-change-stop stop)
+ (oset config
+ :last-change-stop-converted
+ (lentic-convert
+ config
+ stop))
+ (lentic-before-change-function-1
+ (lentic-that config)
+ (oref config :last-change-start-converted)
+ (oref config :last-change-stop-converted)
+ seen-buffer))))
lentic-config)))
;; #+end_src
@@ -1190,10 +1204,12 @@ LENGTH-BEFORE is the length of area before the change."
(oset conf :last-change-start-converted nil)
(oset conf :last-change-stop nil)
(oset conf :last-change-stop-converted nil)
- (if skewed
- (lentic-clone conf)
- (lentic-clone conf start stop length-before
- start-converted stop-converted))))))
+ (lentic-widen
+ conf
+ (if skewed
+ (lentic-clone conf)
+ (lentic-clone conf start stop length-before
+ start-converted stop-converted)))))))
(defun lentic-update-point (conf)
"Update the location of point in that-buffer to reflect this-buffer.
- [elpa] externals/lentic b8f399ea51 244/333: lentic-doc now uses correct directory., (continued)
- [elpa] externals/lentic b8f399ea51 244/333: lentic-doc now uses correct directory., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 9d542c732b 255/333: README update for 0.8 release., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic c740b170ea 262/333: Enable use of tags in org-mode src blocks., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic ba0be3b36f 265/333: Merge branch 'feature/tags-on-org-sections', ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 678db93272 322/333: Merge pull request #50 from DamienCassou/patch-1, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 7b75e8079c 276/333: Regularisation of start/stop handling., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic c744f3d3be 321/333: Shorten maximum line length in orgel, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic e27c3f3b2a 281/333: Merge pull request #41 from syohex/load-library, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 32a17b1829 323/333: Fix use of undefined variable, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic bbbfa78a0d 302/333: Add missing files, including tests., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 370ebf12a9 268/333: Widening was inconsistent in hooks.,
ELPA Syncer <=
- [elpa] externals/lentic 72542b681a 273/333: Correctly require s in cask and lentic-doc., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic a75637bb2f 280/333: Load 'f' for using f-equal?, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 15c336bfe7 288/333: Update to travis-container testing., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 97b939ee15 266/333: Reimplement insert-file-local using core function., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 36861bdf9c 331/333: Add lentic-markdown, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 8e4a26d861 300/333: Example files added, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 92af154760 264/333: Enables tags on section headers., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic f5136cd683 291/333: Update copyright years., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 0f5464880d 295/333: Provide org-mode start up hook., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 5cdfda936c 305/333: Ensure script directory tree is created, ELPA Syncer, 2024/02/27