[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/lentic a1775e7f70 135/333: Specialised first and header
From: |
ELPA Syncer |
Subject: |
[elpa] externals/lentic a1775e7f70 135/333: Specialised first and header line handling for orgel. |
Date: |
Tue, 27 Feb 2024 13:00:18 -0500 (EST) |
branch: externals/lentic
commit a1775e7f7070a6ad6ed4bba1bb702b3361f016a1
Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
Commit: Phillip Lord <phillip.lord@newcastle.ac.uk>
Specialised first and header line handling for orgel.
---
lentic-org.el | 109 ++++++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 83 insertions(+), 26 deletions(-)
diff --git a/lentic-org.el b/lentic-org.el
index 12015f8eab..a0cedbc74d 100644
--- a/lentic-org.el
+++ b/lentic-org.el
@@ -37,6 +37,7 @@
;; #+BEGIN_SRC emacs-lisp
(require 'cl-lib)
(require 'lentic-block)
+(require 'm-buffer-at)
;; #+END_SRC
@@ -219,33 +220,89 @@
;; so, this needs to be more complex -- if we include the first line, expand
;; to all of the first line, I think. This should leave the first line in a
;; consistent state
- (call-next-method conf start stop length-before
- start-converted stop-converted)
(m-buffer-with-markers
- ((first-line-end-match
- (cl-cadar
- (m-buffer-match-first-line
- (lentic-that conf)))))
- (m-buffer-replace-match
- (m-buffer-match
- (lentic-that conf)
- ;; we can be in one of two states depending on whether we have made a new
- ;; clone or an incremental change
- "^;; \\(;;;\\|# #\\)"
- :end first-line-end-match)
- ";;;")
- ;; replace big headers, in either of their two states
- (m-buffer-replace-match
- (m-buffer-match
- (lentic-that conf)
- "^;; [*] \\(\\w*\\)$"
- :begin first-line-end-match)
- ";;; \\1:")
- (m-buffer-replace-match
- (m-buffer-match (lentic-that conf)
- "^;; ;;; \\(\\w*:\\)$"
- :begin first-line-end-match)
- ";;; \\1")))
+ ((first-line
+ (m-buffer-match-first-line
+ (lentic-this conf)))
+ (header-one-line
+ (m-buffer-match
+ (lentic-this conf)
+ "^[*] \\(\\w*\\)$"
+ :begin (cl-cadar first-line)))
+ (special-lines
+ (-concat first-line header-one-line)))
+ ;; check whether we are in a special line -- if so widen the change extent
+ (let*
+ ((start-in-special
+ (when
+ (and
+ start
+ (m-buffer-in-match-p
+ special-lines start))
+ (m-buffer-at-line-beginning-position
+ (lentic-this conf)
+ start)))
+ (start (or start-in-special start))
+ (start-converted
+ (if start-in-special
+ (m-buffer-at-line-beginning-position
+ (lentic-that conf)
+ start-converted)
+ start-converted))
+ (stop-in-special
+ (when
+ (and
+ stop
+ (m-buffer-in-match-p
+ special-lines stop))
+ (m-buffer-at-line-end-position
+ (lentic-this conf)
+ stop)))
+ (stop (or stop-in-special stop))
+ (stop-converted
+ (if stop-in-special
+ (m-buffer-at-line-end-position
+ (lentic-that conf)
+ stop-converted)
+ stop-converted)))
+ (call-next-method conf start stop length-before
+ start-converted stop-converted)
+ (let ((first-line-end-match
+ (cl-cadar
+ (m-buffer-match-first-line
+ (lentic-that conf)))))
+ (m-buffer-replace-match
+ (m-buffer-match
+ (lentic-that conf)
+ ;; we can be in one of two states depending on whether we have made
a new
+ ;; clone or an incremental change
+ "^;; \\(;;;\\|# #\\)"
+ :end first-line-end-match)
+ ";;;")
+ ;; replace big headers, in either of their two states
+ (m-buffer-replace-match
+ (m-buffer-match
+ (lentic-that conf)
+ "^;; [*] \\(\\w*\\)$"
+ :begin first-line-end-match)
+ ";;; \\1:")
+ (m-buffer-replace-match
+ (m-buffer-match (lentic-that conf)
+ "^;; ;;; \\(\\w*:\\)$"
+ :begin first-line-end-match)
+ ";;; \\1")))))
+
+(defmethod lentic-convert
+ ((conf lentic-org-to-orgel-configuration)
+ location)
+ (let ((converted (call-next-method conf location)))
+ (m-buffer-with-current-position
+ (oref conf :this-buffer)
+ location
+ (beginning-of-line)
+ (if (looking-at "[*] \\w*$")
+ (- converted 1)
+ converted))))
(defmethod lentic-invert
((conf lentic-org-to-orgel-configuration))
- [elpa] externals/lentic 34d05cb7f9 108/333: Now uses random face., (continued)
- [elpa] externals/lentic 34d05cb7f9 108/333: Now uses random face., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic cebd7a744d 111/333: Add face as well as font-lock-face, ELPA Syncer, 2024/02/27
- [elpa] externals/lentic bb986c0676 116/333: New test for empty line bug., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 772186d38f 122/333: Merge branch 'feature/incremental-blocks-update', ELPA Syncer, 2024/02/27
- [elpa] externals/lentic fce88ba411 123/333: Added marmalade for noflet., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 61d00b8ace 124/333: Files renamed to lentic., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 613556e708 127/333: Re-added .travis.yml after name change., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 123ef5f3f0 129/333: Documentation updates., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic d241dcc5be 130/333: Travis Versions Removed., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 750ee11893 132/333: m-buffer version bump., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic a1775e7f70 135/333: Specialised first and header line handling for orgel.,
ELPA Syncer <=
- [elpa] externals/lentic e704f0363b 137/333: lentic-init made buffer-local., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 41bfdd8c4b 138/333: New test., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic bd00f005fe 141/333: Update references to linked-buffer., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic bd1df9ea2c 136/333: Back to pre-release for m-buffer., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic efa43f5844 142/333: Detect b-c-f, a-c-f skew and fix., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 7dc2d77d85 146/333: Automatic skew detection added., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 05381474e7 160/333: Updated with all the random files in my version., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic b52d97a6d7 161/333: Autoloads for lentic-dev., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 3a94a88ae8 005/333: Added test functions for running after-change and post-command hooks interactively., ELPA Syncer, 2024/02/27
- [elpa] externals/lentic 777396393a 012/333: Configuration totally reworked to use eieio., ELPA Syncer, 2024/02/27