From 403b89066339e71049a16c48da6c2f7d517c3710 Mon Sep 17 00:00:00 2001
From: Christophe Garion <tofgarion@runbox.com>
Date: Wed, 7 Aug 2019 16:23:07 +0200
Subject: [PATCH] my-listings: use makeatletter for nocolors option and
refactor accordingly
---
my-listings.sty | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/my-listings.sty b/my-listings.sty
index 05bd7e7..9a0b697 100644
--- a/my-listings.sty
+++ b/my-listings.sty
@@ -6,11 +6,9 @@
LaTeX package for listings configuration]
% options
-\def\@colorlst{}
-\DeclareOption{colors}{
- \def\@colorlst{true}
-}
+\newif\if@lstcolors \@lstcolorstrue
+\DeclareOption{nocolors}{\@lstcolorsfalse}
\ProcessOptions\relax
% LuaLaTeX
@@ -238,17 +236,24 @@
}
}
-\ifx@colorlst\@empty
-\relax
-\else
+% \if@lstcolors
+% \makeatletter
+% \@ifclassloaded{beamer}{%
+% \mode<presentation>{\lstusecolors}%
+% \ifx\slideshandout\undefined\mode<handout>{\lstusecolorshandouts}\else\relax\fi%
+% }{%
+% \lstusecolors%
+% }%
+% \makeatother
+% \else%
+% \lstusecolors%
+% \fi
+% \fi
+
\makeatletter
-\@ifclassloaded{beamer}{%
- \mode<presentation>{\lstusecolors}%
- \ifx\slideshandout\undefined\mode<handout>{\lstusecolorshandouts}\else\relax\fi%
-}{%
+\if@lstcolors
\lstusecolors%
-}%
-\makeatother
\fi
+\makeatother
\endinput
\ No newline at end of file
--
GitLab