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

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

[nongnu] elpa/org-contrib b2c5460598 05/10: lisp/ob-stata.el: Keep ESS o


From: ELPA Syncer
Subject: [nongnu] elpa/org-contrib b2c5460598 05/10: lisp/ob-stata.el: Keep ESS optional to pacify compiler
Date: Wed, 17 Jan 2024 07:00:59 -0500 (EST)

branch: elpa/org-contrib
commit b2c5460598c7d91a66bd87ab9b6e9c0c442c9210
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    lisp/ob-stata.el: Keep ESS optional to pacify compiler
    
    * lisp/ob-stata.el (ess-custom): Remove require.  We cannot declare
    ESS in common org-contrib dependencies.
    (org-babel-stata-command): Change default value to nil, setting it to
    `org-babel-stata-command' only after 'ess-custom is loaded.
    (org-babel-stata-evaluate-external-process): Demand ess-custom during
    runtime.
    (ess-eval-visibly-p): Add variable declaration.
---
 lisp/ob-stata.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-stata.el b/lisp/ob-stata.el
index b7568e2475..5956d2f55d 100644
--- a/lisp/ob-stata.el
+++ b/lisp/ob-stata.el
@@ -42,7 +42,6 @@
 ;;; Code:
 (require 'ob)
 (require 'cl-lib)
-(require 'ess-custom) ; for `inferior-STA-program'
 
 (declare-function orgtbl-to-csv "org-table" (table params))
 (declare-function stata "ext:ess-stata" (&optional start-args))
@@ -67,12 +66,20 @@
 ;; only ':results output' currently works, so make that the default
 (defvar org-babel-default-header-args:stata '((:results . "output")))
 
-(defcustom org-babel-stata-command inferior-STA-program
+(defcustom org-babel-stata-command nil
   "Name of command to use for executing stata code."
   :group 'org-babel
   :version "24.4"
   :package-version '(Org . "8.3")
   :type 'string)
+;; FIXME: Arrange the default value to be set without byte-compiler
+;; complaining.  A proper fix would be putting this file into a
+;; separate package and adding ESS to package requires. Not possible
+;; while it is a part of org-contrib.
+(defvar inferior-STA-program)
+(eval-after-load 'ess-custom
+  (unless org-babel-stata-command
+    (setq org-babel-stata-command inferior-STA-program)))
 
 (defvar ess-local-process-name) ; dynamically scoped
 (defun org-babel-edit-prep:stata (info)
@@ -242,6 +249,7 @@ current code buffer."
 If RESULT-TYPE equals \\='output then return standard output as a
 string.  If RESULT-TYPE equals \\='value then return the value of the
 last statement in BODY, as elisp."
+  (require 'ess-custom)
   (cl-case result-type
     (value
      (let ((tmp-file (org-babel-temp-file "stata-")))
@@ -258,6 +266,7 @@ last statement in BODY, as elisp."
        column-names-p)))
     (output (org-babel-eval org-babel-stata-command body))))
 
+(defvar ess-eval-visibly-p)
 (defun org-babel-stata-evaluate-session
     (session body result-type result-params column-names-p _row-names-p)
   "Evaluate BODY in SESSION.



reply via email to

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