[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-transclusion 4fb11ac23b 5/9: feat: suggestion for l
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-transclusion 4fb11ac23b 5/9: feat: suggestion for live-sync-buffers-src-lines |
Date: |
Wed, 29 Mar 2023 16:59:08 -0400 (EDT) |
branch: externals/org-transclusion
commit 4fb11ac23b8a41f4a3f106a35baff5ef8f42ba0d
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
feat: suggestion for live-sync-buffers-src-lines
Suggestion: instead of changing function
'live-sync-buffers-others-default', change 'live-sync-buffers-src-lines'
Discussed here:
https://github.com/nobiot/org-transclusion/pull/176#discussion_r1149612461
---
org-transclusion-src-lines.el | 20 +++++++++++++++-----
org-transclusion.el | 39 ++++++++++++++-------------------------
2 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index a3def5e16b..2f4b69ac26 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -17,7 +17,7 @@
;; Author: Noboru Ota <me@nobiot.com>
;; Created: 24 May 2021
-;; Last modified: 08 February 2023
+;; Last modified: 28 March 2023
;;; Commentary:
;; This is an extension to `org-transclusion'. When active, it adds features
@@ -258,10 +258,20 @@ The cons cell to be returned is in this format:
This function uses TYPE to identify relevant files; it's meant
for non-Org text files including program source files."
(when (org-transclusion-src-lines-p type)
- ;; Let's not allow live-sync when source is transcluded into a source
block.
- ;; (when (string= "src" type)
- ;; (user-error "No live sync for src-code block"))
- (org-transclusion-live-sync-buffers-others-default nil)))
+ (cl-destructuring-bind
+ (src-ov . tc-ov) (org-transclusion-live-sync-buffers-others-default
nil)
+ (save-mark-and-excursion
+ (org-babel-mark-block)
+ (let* ((tc-ov-beg-mkr (get-text-property (point)
'org-transclusion-beg-mkr))
+ (tc-ov-end-mkr (get-text-property (point)
'org-transclusion-end-mkr))
+ (src-ov-length (- (overlay-end src-ov) (overlay-start
src-ov)))
+ (region-length (- (region-end) (region-beginning)))
+ (overlay-has-extra-newline (= 1 (- region-length
src-ov-length)))
+ (newline-offset (if overlay-has-extra-newline 1 0)))
+ (move-overlay tc-ov
+ (region-beginning)
+ (- (region-end) newline-offset))))
+ (cons src-ov tc-ov))))
(provide 'org-transclusion-src-lines)
;;; org-transclusion-src-lines.el ends here
diff --git a/org-transclusion.el b/org-transclusion.el
index 4f1edf1d14..2989ff098f 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -17,7 +17,7 @@
;; Author: Noboru Ota <me@nobiot.com>
;; Created: 10 October 2020
-;; Last modified: 05 March 2023
+;; Last modified: 28 March 2023
;; URL: https://github.com/nobiot/org-transclusion
;; Keywords: org-mode, transclusion, writing
@@ -1640,20 +1640,9 @@ This function is for non-Org text files."
(overlay-start tc-pair)
(overlay-end tc-pair)
(overlay-buffer tc-pair)))
- (tc-ov-beg-mkr (get-text-property (point)
'org-transclusion-beg-mkr))
- (tc-ov-end-mkr (get-text-property (point)
'org-transclusion-end-mkr))
- (tc-ov (if (org-in-src-block-p)
- (with-current-buffer (marker-buffer tc-ov-beg-mkr)
- (save-mark-and-excursion
- (org-babel-mark-block)
- (let* ((src-ov-length (- (overlay-end src-ov)
(overlay-start src-ov)))
- (region-length (- (region-end)
(region-beginning)))
- (overlay-has-extra-newline (= 1 (-
region-length src-ov-length)))
- (newline-offset (if
overlay-has-extra-newline 1 0)))
- (text-clone-make-overlay (region-beginning)
- (- (region-end)
newline-offset)))))
- (text-clone-make-overlay tc-ov-beg-mkr
- tc-ov-end-mkr))))
+ (tc-ov (text-clone-make-overlay
+ (get-text-property (point) 'org-transclusion-beg-mkr)
+ (get-text-property (point) 'org-transclusion-end-mkr))))
(cons src-ov tc-ov)))
;;-----------------------------------------------------------------------------
@@ -1672,16 +1661,16 @@ ensure the settings revert to the user's setting prior
to
;; Ensure this happens only once until deactivation
(unless (memq 'org-transclusion-type yank-excluded-properties)
(let ((excluded-props))
- ;; Return t if 'wrap-prefix is already in `yank-excluded-properties'
- ;; if not push to elm the list
- ;; wrap-prefix, etc.
- (dolist (sym org-transclusion-yank-excluded-properties)
- (if (memq sym yank-excluded-properties)
- (push sym org-transclusion-yank-remember-user-excluded-props)
- ;; Avoid duplicate
- (push sym excluded-props)))
- (setq yank-excluded-properties
- (append yank-excluded-properties excluded-props)))))
+ ;; Return t if 'wrap-prefix is already in `yank-excluded-properties'
+ ;; if not push to elm the list
+ ;; wrap-prefix, etc.
+ (dolist (sym org-transclusion-yank-excluded-properties)
+ (if (memq sym yank-excluded-properties)
+ (push sym org-transclusion-yank-remember-user-excluded-props)
+ ;; Avoid duplicate
+ (push sym excluded-props)))
+ (setq yank-excluded-properties
+ (append yank-excluded-properties excluded-props)))))
(defun org-transclusion-yank-excluded-properties-remove ()
"Remove transclusion-specific text props from `yank-excluded-properties'.
- [elpa] externals/org-transclusion updated (ff722826ce -> 2e77e341c6), ELPA Syncer, 2023/03/29
- [elpa] externals/org-transclusion 9060dcf712 3/9: Adapt to magic enter., ELPA Syncer, 2023/03/29
- [elpa] externals/org-transclusion 980a0fc9b4 1/9: Allow live sync on org-blocks -- experimental, ELPA Syncer, 2023/03/29
- [elpa] externals/org-transclusion 076b2a4597 7/9: doc: update manual for the new feature for live-sync org src block, ELPA Syncer, 2023/03/29
- [elpa] externals/org-transclusion 67c9bfbeeb 2/9: Augment only needed for magical enter in thing-at-point branch., ELPA Syncer, 2023/03/29
- [elpa] externals/org-transclusion 2d0502f6bd 4/9: Typo., ELPA Syncer, 2023/03/29
- [elpa] externals/org-transclusion 4fb11ac23b 5/9: feat: suggestion for live-sync-buffers-src-lines,
ELPA Syncer <=
- [elpa] externals/org-transclusion 2e77e341c6 9/9: doc: mention the live-sync to be in the next stable rel for ELPA, ELPA Syncer, 2023/03/29
- [elpa] externals/org-transclusion ee816482df 8/9: Merge pull request #178 and #176 for feature--org-block-live-sync, ELPA Syncer, 2023/03/29
- [elpa] externals/org-transclusion 2751fbc7d0 6/9: refactor: remove unused let variable, ELPA Syncer, 2023/03/29