Is it possible to amend to a macro without storing the original one in a tmp variable?
Approach is similar to this one here: Redefine macro in terms of old one. But without the OldMacro
I came up with something using groups, but doesn't work.
\def\abc{abc}
\begingroup\let\orgabc\abc\def\abc{\orgabc\endgroup def}
EDIT: It's indeed partially working. But not to my expectations.
\documentclass{article}
\def\abc{abc}
\begingroup\let\orgabc\abc\def\abc{\orgabc\endgroup def}
\begin{document}
\abc
\end{document}
Output: abcdef (Works, as expected)
\documentclass{article}
\def\abc{abc}
\begingroup\let\orgabc\abc\def\abc{\orgabc\endgroup def}
\begin{document}
\abc
\abcorg
\end{document}
Output: Error: undefined control sequence (Works as desired, because \abcorg is not defined)
\documentclass{article}
\def\abc{abc}
\begingroup\let\orgabc\abc\def\abc{\orgabc\endgroup def}
\begin{document}
\orgabc
\end{document}
Output: abc (Why is \orgabc defined here?)
EDIT: The redefinition somehow clashes with the titlesec package. I opened a new question here

abcdef. – TeXnician Feb 28 '17 at 07:27\g@addto@macro, so\g@addto@\abc{foo}→\abcexpands toabcfoothen – Feb 28 '17 at 07:29\g@addto@macro\abc{foo}above... – Feb 28 '17 at 07:36\g@addto@macro\abc{foo}? – Simon Feb 28 '17 at 08:14\xdef... all a in group, so the temp token is volatile actually, but the crucial point is the expansion such that the temp token 'releases' its value – Feb 28 '17 at 08:18\g@addto@macrois implemented. – TonioElGringo Feb 28 '17 at 08:18\abcare only valid for its first use; thereafter it reverts to its previous definition. Is that the desired behavior? – Guho Feb 28 '17 at 08:46