From ce474d87225a325bc73c84890b079a2a1b8a635c Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 4 May 2014 21:43:33 +0000
Subject: environ (4may14)

git-svn-id: svn://tug.org/texlive/trunk@33821 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/environ/environ.sty | 27 +++++++++++++++----------
 1 file changed, 16 insertions(+), 11 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/environ/environ.sty')

diff --git a/Master/texmf-dist/tex/latex/environ/environ.sty b/Master/texmf-dist/tex/latex/environ/environ.sty
index afecbd08338..8cf854b9767 100644
--- a/Master/texmf-dist/tex/latex/environ/environ.sty
+++ b/Master/texmf-dist/tex/latex/environ/environ.sty
@@ -11,7 +11,8 @@
 %% 
 %%   License information appended.
 %% 
-\ProvidesPackage{environ}[2013/04/01 v0.3 A new environment syntax]
+%% ^^A Test that \RenewEnvironment works correctly:
+\ProvidesPackage{environ}[2014/05/04 v0.3 A new way to define environments]
 \RequirePackage{trimspaces}
 \def\environbodyname#1{\def\env@BODY{#1}}
 \environbodyname\BODY
@@ -80,11 +81,9 @@
   \fi
   \process@envbody}
 \def\NewEnviron{%
-  \let\env@newcommand\newcommand
   \let\env@newenvironment\newenvironment
   \env@NewEnviron}
 \def\RenewEnviron{%
-  \let\env@newcommand\renewcommand
   \let\env@newenvironment\renewenvironment
   \env@NewEnviron}
 \def\env@NewEnviron#1{%
@@ -106,23 +105,29 @@
       \@temptokena\expandafter[\env@finalcode]%
   }}
 \long\def\env@new#1#2#3[#4]{%
+  \longdef@c{env@#1@BODY\expandafter}\expandafter{\env@BODY}%
   \env@newenvironment{#1}{%
     \expandafter\Collect@Body\csname env@#1@parse\endcsname
   }{#4}%
   \longdef@c{env@#1@parse}##1{%
     \csname env@#1@save@env\endcsname##1\env@nil
     \csname env@#1@process\endcsname##1\env@nil}%
-  \expandafter\env@newcommand
-    \csname env@#1@save@env\endcsname#2{\env@save}%
-  \expandafter\env@newcommand
-    \csname env@#1@process\endcsname#2{#3\env@ignore}}
-\long\def\env@save#1\env@nil{%
-  \expandafter\edef\env@BODY{%
+  \expandafter\let\csname env@#1@save@env\endcsname\relax
+  \expandafter\let\csname env@#1@process\endcsname\relax
+  \expandafter\newcommand
+    \csname env@#1@save@env\endcsname#2{%
+      \expandafter\expandafter\expandafter
+        \env@save\csname env@#1@BODY\endcsname}%
+  \expandafter\newcommand
+    \csname env@#1@process\endcsname#2{#3\env@ignore}%
+}
+\long\def\env@save#1#2\env@nil{%
+  \edef#1{%
     \unexpanded\expandafter
-      \expandafter\expandafter{\trim@spaces{#1}}}}
+      \expandafter\expandafter{\trim@spaces{#2}}}}
 \long\def\env@ignore#1\env@nil{}
 %% 
-%% Copyright (C) 2007-2008, 2013 by Will Robertson <wspr81@gmail.com>
+%% Copyright (C) 2007-2014 by Will Robertson <wspr81@gmail.com>
 %% 
 %% Distributable under the LaTeX Project Public License,
 %% version 1.3c or higher (your choice). The latest version of
-- 
cgit v1.2.3

