emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org-transclusion 5f7e300f04 2/7: (internal) change line


From: ELPA Syncer
Subject: [elpa] externals/org-transclusion 5f7e300f04 2/7: (internal) change line ending from CRLF to LF
Date: Tue, 23 Aug 2022 15:57:54 -0400 (EDT)

branch: externals/org-transclusion
commit 5f7e300f04282609957a7eafba36ab139226fcce
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>

    (internal) change line ending from CRLF to LF
---
 org-transclusion-src-lines.el | 66 +++++++++++++++++++++----------------------
 test/test-2.1-lines.org       | 10 +++++--
 2 files changed, 40 insertions(+), 36 deletions(-)

diff --git a/org-transclusion-src-lines.el b/org-transclusion-src-lines.el
index 3ae40e95a8..f22ab37a57 100644
--- a/org-transclusion-src-lines.el
+++ b/org-transclusion-src-lines.el
@@ -73,7 +73,7 @@ Return nil if PLIST does not contain \":src\" or \":lines\" 
properties."
             (org-transclusion-content-src-lines link plist)))
    ;; :lines needs to be the last condition to check because :src INCLUDE 
:lines
    ((or (plist-get plist :lines)
-       (plist-get plist :end))
+        (plist-get plist :end))
         ;; Link contains a search-option ::<string>
         ;; and NOT for an Org file
 ;;     (and (org-element-property :search-option link)
@@ -107,7 +107,7 @@ it means from line 10 to the end of file."
          (type (org-element-property :type link))
          (entry-pos) (buf)
          (lines (plist-get plist :lines))
-        (end-search-op (plist-get plist :end)))
+         (end-search-op (plist-get plist :end)))
     (if (not (string= type "id")) (setq buf (find-file-noselect path))
       (let ((filename-pos (org-id-find path)))
         (setq buf (find-file-noselect (car filename-pos)))
@@ -120,43 +120,43 @@ it means from line 10 to the end of file."
                             ((when search-option
                                (save-excursion
                                  (ignore-errors
-                                  ;; FIXME `org-link-search' does not
-                                  ;; return postion when eithher
-                                  ;; ::/regex/ or ::number is used
+                                   ;; FIXME `org-link-search' does not
+                                   ;; return postion when eithher
+                                   ;; ::/regex/ or ::number is used
                                    (if (org-link-search search-option)
-                                      (line-beginning-position))))))
+                                       (line-beginning-position))))))
                              ((point-min))))
-               (end-pos (when end-search-op
+                (end-pos (when end-search-op
                            (save-excursion
                              (ignore-errors
-                              ;; FIXME `org-link-search' does not return
-                              ;; postion when ::/regex/ and ;;number are
-                              ;; used
+                               ;; FIXME `org-link-search' does not return
+                               ;; postion when ::/regex/ and ;;number are
+                               ;; used
                                (when (org-link-search end-search-op)
                                  (line-beginning-position))))))
-               (range (when lines (split-string lines "-")))
-               (lbeg (if range (string-to-number (car range))
-                       0))
-               (lend (if range (string-to-number (cadr range))
-                       0))
-               ;; This means beginning part of the range
-               ;; can be mixed with search-option
-               ;;; only positive number works
-               (beg  (progn (goto-char (or start-pos (point-min)))
-                            (when (> lbeg 0)(forward-line (1- lbeg)))
-                            (point)))
-               ;;; This `cond' means :end prop has priority over the end
-               ;;; position of the range. They don't mix.
-               (end (cond
-                     ((when (and end-pos (> end-pos beg))
-                        end-pos))
-                     ((if (zerop lend) (point-max)
-                        (goto-char start-pos)
-                        (forward-line (1- lend))
-                        (end-of-line);; include the line
-                        ;; Ensure to include the \n into the end point
-                        (1+ (point))))))
-               (content (buffer-substring-no-properties beg end)))
+                (range (when lines (split-string lines "-")))
+                (lbeg (if range (string-to-number (car range))
+                        0))
+                (lend (if range (string-to-number (cadr range))
+                        0))
+                ;; This means beginning part of the range
+                ;; can be mixed with search-option
+                ;;; only positive number works
+                (beg  (progn (goto-char (or start-pos (point-min)))
+                             (when (> lbeg 0)(forward-line (1- lbeg)))
+                             (point)))
+                ;;; This `cond' means :end prop has priority over the end
+                ;;; position of the range. They don't mix.
+                (end (cond
+                      ((when (and end-pos (> end-pos beg))
+                         end-pos))
+                      ((if (zerop lend) (point-max)
+                         (goto-char start-pos)
+                         (forward-line (1- lend))
+                         (end-of-line);; include the line
+                         ;; Ensure to include the \n into the end point
+                         (1+ (point))))))
+                (content (buffer-substring-no-properties beg end)))
            (list :src-content content
                  :src-buf (current-buffer)
                  :src-beg beg
diff --git a/test/test-2.1-lines.org b/test/test-2.1-lines.org
index 0b3f93439e..53fba13227 100644
--- a/test/test-2.1-lines.org
+++ b/test/test-2.1-lines.org
@@ -6,7 +6,11 @@ Including lines of source code
 
 [[file:./paragraph.org::/Lorem/]]
 
-#+transclude: [[id:2022-06-26T141859]] :lines 5-10
+Suspendisse tincidunt justo sit amet sapien tempus pretium. Duis tincidunt 
arcu hendrerit pretium lacinia. Phasellus pharetra felis at facilisis commodo. 
Praesent ornare arcu eu rhoncus accumsan. Proin sed pulvinar dolor. Vestibulum 
vestibulum eleifend tellus non pellentesque. Phasellus pharetra cursus ex, id 
vestibulum erat egestas at. Proin at hendrerit lacus.
+
+Vestibulum orci elit, efficitur eu vehicula quis, luctus nec mi. Nam hendrerit 
mattis tortor, id finibus sapien eleifend eget. Morbi dignissim, libero sed 
luctus posuere, mi diam feugiat elit, sed interdum dui lacus nec felis. 
Vestibulum dapibus pellentesque lorem a mattis. Suspendisse interdum dapibus 
fermentum. Proin sodales, orci sed vulputate euismod, dolor massa porttitor 
lacus, in consectetur neque enim quis magna. Proin rhoncus urna luctus nisi 
congue commodo. Nulla facilisis et r [...]
+
+* Heading 1
 
 #+name: source code 1
 #+transclude: [[file:../org-transclusion-src-lines.el]] :lines 1-10 :src elisp
@@ -41,11 +45,11 @@ You can use the Org file link's search option with adding 
"::". The =:lines= opt
 
 #+transclude: [[file:test.txt::/Transcendental Ontology/]]  :end "Idea"
 
-#+transclude: [[file:test.txt::Transcendental Ontology]] 
+#+transclude: [[file:test.txt::Transcendental Ontology]]
 
 This is the next paragraph.
 
-offset before and after 
+offset before and after
 
 * src-blocks
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]