branch: master commit 87e8cb03696e6dfac20d79677a07f818f5ef96e4 Author: Arash Esbati <ar...@gnu.org> Commit: Arash Esbati <ar...@gnu.org>
Simplify implementation of style/pythontex.el * style/pythontex.el (LaTeX-env-pythontex): Delete function and move the functionality into the hook. --- style/pythontex.el | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/style/pythontex.el b/style/pythontex.el index 610a6341..8c1399f0 100644 --- a/style/pythontex.el +++ b/style/pythontex.el @@ -1,6 +1,6 @@ ;;; pythontex.el --- AUCTeX style for `pythontex.sty' (v0.16) -*- lexical-binding: t; -*- -;; Copyright (C) 2018--2022 Free Software Foundation, Inc. +;; Copyright (C) 2018--2023 Free Software Foundation, Inc. ;; Author: Arash Esbati <ar...@gnu.org> ;; Maintainer: auctex-devel@gnu.org @@ -113,24 +113,6 @@ Update the variable `LaTeX-pythontex-language-list' if still nil." '("py" "sympy" "pylab" "rb" "ruby" "jl" "julia" "octave") "List of language families provided by pythontex package.") -(defun LaTeX-env-pythontex (environment) - "Insert ENVIRONMENT provided by pythontex package." - (let ((session (TeX-read-string - (TeX-argument-prompt t nil "Session"))) - (fvkeyval (TeX-read-key-val t (LaTeX-fancyvrb-key-val-options)))) - (LaTeX-insert-environment environment - (concat - (when (and session (not (string= session ""))) - (concat LaTeX-optop session LaTeX-optcl)) - ;; We need an extra pair of brackets - ;; when no session is given but - ;; key=vals are available - (when (and session (string= session "") - fvkeyval (not (string= fvkeyval ""))) - (concat LaTeX-optop LaTeX-optcl)) - (when (and fvkeyval (not (string= fvkeyval ""))) - (concat LaTeX-optop fvkeyval LaTeX-optcl)))))) - ;; Setup for \saveprintpythontex & \savestdoutpythontex & ;; \savestderrpythontex (TeX-auto-add-type "pythontex-savecontent" "LaTeX") @@ -248,7 +230,9 @@ a list of strings." verb-macs)) (apply #'LaTeX-add-environments (mapcar (lambda (env) - (list env #'LaTeX-env-pythontex)) + (list env #'LaTeX-env-args + [ "Session" ] + [TeX-arg-key-val (LaTeX-fancyvrb-key-val-options)])) verb-envs)) ;; Filling: (dolist (mac verb-macs)