update packages

This commit is contained in:
2025-02-26 20:16:44 +01:00
parent 59db017445
commit 45d49daef0
291 changed files with 16240 additions and 522600 deletions

View File

@@ -1,4 +1,4 @@
;;; ob-stata.el --- org-babel functions for stata code evaluation
;;; ob-stata.el --- org-babel functions for stata code evaluation -*- lexical-binding: t; -*-
;; Copyright (C) 2014, 2021 Ista Zahn
;; Author: Ista Zahn istazahn@gmail.com
@@ -66,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-name
(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)
@@ -85,12 +93,13 @@
(or graphics-file (org-babel-stata-graphical-output-file params))))
(mapconcat
#'identity
((lambda (inside)
(if graphics-file
inside
inside))
(append (org-babel-variable-assignments:stata params)
(list body))) "\n")))
(if graphics-file
(append (org-babel-variable-assignments:stata params)
(list body))
;; FIXME: same value for both `if' branches.
(append (org-babel-variable-assignments:stata params)
(list body)))
"\n")))
(defun org-babel-execute:stata (body params)
"Execute a block of stata code.
@@ -152,7 +161,7 @@ This function is called by `org-babel-execute-src-block'."
(cdr (nth i vars))
(cdr (nth i (cdr (assq :colname-names params))))
(cdr (nth i (cdr (assq :rowname-names params)))))))
(org-number-sequence 0 (1- (length vars)))))))
(number-sequence 0 (1- (length vars)))))))
(defun org-babel-stata-quote-csv-field (s)
"Quote field S for export to stata."
@@ -160,7 +169,7 @@ This function is called by `org-babel-execute-src-block'."
(concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"")
(format "%S" s)))
(defun org-babel-stata-assign-elisp (name value colnames-p rownames-p)
(defun org-babel-stata-assign-elisp (name value _colnames-p _rownames-p)
"Construct stata code assigning the elisp VALUE to a variable named NAME."
(if (listp value)
(let ((max (apply #'max (mapcar #'length (cl-remove-if-not
@@ -175,9 +184,11 @@ This function is called by `org-babel-execute-src-block'."
(orgtbl-to-csv value '(:fmt org-babel-stata-quote-csv-field))
"\n"))
(let ((file (org-babel-process-file-name transition-file 'noquote))
(header (if (or (eq (nth 1 value) 'hline) colnames-p)
"TRUE" "FALSE"))
(row-names (if rownames-p "1" "NULL")))
;; FIXME: unused.
;; (header (if (or (eq (nth 1 value) 'hline) colnames-p)
;; "TRUE" "FALSE"))
;; (row-names (if rownames-p "1" "NULL"))
)
(if (= max min)
(format "%s = insheet using \"%s\"" name file)
(format "%s = insheet using \"%s\""
@@ -233,11 +244,12 @@ current code buffer."
body result-type result-params column-names-p row-names-p)))
(defun org-babel-stata-evaluate-external-process
(body result-type result-params column-names-p row-names-p)
(body result-type result-params column-names-p _row-names-p)
"Evaluate BODY in external stata process.
If RESULT-TYPE equals 'output then return standard output as a
string. If RESULT-TYPE equals 'value then return the value of the
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-")))
@@ -254,11 +266,12 @@ 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)
(session body result-type result-params column-names-p _row-names-p)
"Evaluate BODY in SESSION.
If RESULT-TYPE equals 'output then return standard output as a
string. If RESULT-TYPE equals 'value then return the value of the
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."
(cl-case result-type
(value