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

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

[elpa] externals/lentic b2e4d953f1 053/333: Support for Org to Elisp tra


From: ELPA Syncer
Subject: [elpa] externals/lentic b2e4d953f1 053/333: Support for Org to Elisp transformation.
Date: Tue, 27 Feb 2024 13:00:01 -0500 (EST)

branch: externals/lentic
commit b2e4d953f1a699a00a8832c9f549cd3986b7e354
Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
Commit: Phillip Lord <phillip.lord@newcastle.ac.uk>

    Support for Org to Elisp transformation.
    
    This is a new feature, currently functional but not slick.
---
 .ert-runner                |  2 +-
 linked-buffer-org.el       | 59 ++++++++++++++++++++++++++++++++++++++++++++++
 test/linked-buffer-test.el | 39 ++++++++++++++++++++----------
 3 files changed, 86 insertions(+), 14 deletions(-)

diff --git a/.ert-runner b/.ert-runner
index e6bbe06237..14ced4d6e3 100644
--- a/.ert-runner
+++ b/.ert-runner
@@ -1 +1 @@
---load linked-buffer.el linked-buffer-block.el linked-buffer-latex-code 
linked-buffer-asciidoc test/linked-buffer-test.el
\ No newline at end of file
+--load linked-buffer.el linked-buffer-block.el linked-buffer-latex-code 
linked-buffer-asciidoc linked-buffer-org test/linked-buffer-test.el
\ No newline at end of file
diff --git a/linked-buffer-org.el b/linked-buffer-org.el
new file mode 100644
index 0000000000..fb2eba1d5f
--- /dev/null
+++ b/linked-buffer-org.el
@@ -0,0 +1,59 @@
+;;; linked-buffer-org.el --- org support for linked-buffer -*- 
lexical-binding: t -*-
+
+;; This file is not part of Emacs
+
+;; Author: Phillip Lord <phillip.lord@newcastle.ac.uk>
+;; Maintainer: Phillip Lord <phillip.lord@newcastle.ac.uk>
+
+;; The contents of this file are subject to the LGPL License, Version 3.0.
+;;
+;; Copyright (C) 2014, Phillip Lord, Newcastle University
+;;
+;; This program is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU Lesser General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or (at your
+;; option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+;; for more details.
+;;
+;; You should have received a copy of the GNU Lesser General Public License
+;; along with this program. If not, see http://www.gnu.org/licenses/.
+
+;;; Commentary:
+;;
+;; Linked buffers with org BEGIN_SRC blocks
+
+;; Again, the problem is switching into emacs-lisp modes, because of the
+;; meaningful first line -- for example for lexical-binding which pretty much
+;; MUST be at the start of the file.
+
+;; Worse, it's not just the first line. The header of the Lisp file is very
+;; structured. Really we would want to translate this into org code also (from
+;; Commentary onward.
+
+(require 'linked-buffer-block)
+
+;;; Code:
+
+(defun linked-buffer-org-to-el-new ()
+  (linked-buffer-uncommented-block-configuration
+   "lb-org-to-el"
+   :this-buffer (current-buffer)
+   :linked-file
+   (concat
+    (file-name-sans-extension
+     (buffer-file-name))
+    ".el")
+   :comment ";; "
+   :comment-stop "#\\\+BEGIN_SRC emacs-lisp"
+   :comment-start "#\\\+END_SRC"))
+
+(defun linked-buffer-org-el-init ()
+  (setq linked-buffer-config
+        (linked-buffer-org-to-el-new)))
+
+(provide 'linked-buffer-org)
+;;; linked-buffer-org.el ends here
diff --git a/test/linked-buffer-test.el b/test/linked-buffer-test.el
index 11c35ceae3..a05c653acb 100644
--- a/test/linked-buffer-test.el
+++ b/test/linked-buffer-test.el
@@ -1,6 +1,8 @@
+
 (require 'linked-buffer)
 (require 'linked-buffer-latex-code)
 (require 'linked-buffer-asciidoc)
+(require 'linked-buffer-org)
 (require 'f)
 
 
@@ -17,6 +19,14 @@
       (error "Test File does not exist: %s" file))
     file))
 
+(defun linked-buffer-test-clone-equal (init file cloned-file)
+  (equal
+   (f-read
+    (linked-buffer-test-file cloned-file))
+   (linked-buffer-batch-clone-with-config
+    (linked-buffer-test-file file) init)))
+
+
 (defvar conf-default
   (linked-buffer-default-configuration "bob"))
 
@@ -34,19 +44,22 @@
 
 (ert-deftest linked-buffer-clojure-latex ()
   (should
-   (equal
-    (f-read
-     (linked-buffer-test-file
-      "block-comment-out.tex"))
-    (linked-buffer-batch-clone-with-config
-     (linked-buffer-test-file "block-comment.clj")
-     'linked-buffer-clojure-latex-init))))
+   (linked-buffer-test-clone-equal
+    'linked-buffer-clojure-latex-init
+    "block-comment.clj" "block-comment-out.tex")))
+
 
 (ert-deftest linked-buffer-asciidoc-clojure ()
   (should
-   (equal
-    (f-read
-     (linked-buffer-test-file "asciidoc-clj-out.clj"))
-    (linked-buffer-batch-clone-with-config
-     (linked-buffer-test-file "asciidoc-clj.txt")
-     'linked-buffer-asciidoc-clojure-init))))
+   (linked-buffer-test-clone-equal
+    'linked-buffer-asciidoc-clojure-init
+    "asciidoc-clj.txt" "asciidoc-clj-out.clj")))
+
+
+;; org mode start up prints out "OVERVIEW" from the cycle. Can't see any way
+;; to stop this
+(ert-deftest linked-buffer-org-el ()
+  (should
+   (linked-buffer-test-clone-equal
+    'linked-buffer-org-el-init
+    "org-el.org" "org-el.el")))



reply via email to

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