And behold, we have explained the matter of hatmanah, and therefore one must be careful not to perform hatmanah on Shabbat even with a substance that does not add heat. However, during bein hashemashot, it is permitted to perform hatmanah, because generally pots during bein hashemashot are boiling, and there is no concern to decree lest one boil it. And in siman 609 it will be explained that one may not perform hatmanah for the needs of the conclusion of Shabbat, but regarding bread they permitted it, as is written in siman 254, section 16; see there. And with a substance that adds heat, it is forbidden even while it is still day, and if one performed hatmanah with a substance that adds heat, the cooked food is forbidden even ex post facto. And even if one performed hatmanah inadvertently, it is forbidden, for they were very stringent regarding hatmanah. (Magen Avraham, subsection 4) And the reason seems to me to be because it does not appear to people as a prohibition, since there is no fire or coals here. And when do we forbid it: specifically with cold food that became hot or food that shrinks and it is beneficial for it, but regarding food that remains at its heat level, they did not forbid it ex post facto. And similarly, one who performs hatmanah on Shabbat with a substance that does not add heat—they did not forbid it ex post facto for this reason, for it is merely remaining at its heat level, since it does not add heat. (ibid., subsection 6) And there are those who say that if one forgot and performed hatmanah inadvertently with a substance that adds heat, it is permitted in any case, since it is inadvertent, and specifically food that was cooked completely. But if its cooking was completed on Shabbat, it is obvious that it is forbidden. (ibid., subsection 7, and see Taz, subsection 2, who wanted to say that there is no dispute here, for when the primary hatmanah is with a substance that adds heat, everyone agrees it is forbidden, and the "there are those who say" refers to where the primary substance was of those that do not add heat, and the first opinion also admits to this; see there)
והנה בארנו עניין ההטמנה, ולכן יש ליזהר שלא להטמין בשבת אפילו בדבר שאינו מוסיף הבל. אבל בין השמשות - מותר להטמין, משום דסתם קדרות בין השמשות רותחות הן, וליכא למיגזר שמא ירתיח, ובסימן תר"ט יתבאר שאין להטמין לצורך מוצאי שבת, ובפת התירו, כמ"ש בסימן רנ"ד סעיף ט"ז ע"ש. ובדבר המוסיף הבל - אסור אפילו מבעוד יום, ואם הטמין בדבר המוסיף הבל - התבשיל אסור אפילו בדיעבד. ואפילו הטמין בשוגג - אסור, דהרבה החמירו בהטמנה. (מג"א סק"ד) והטעם נראה לי, משום דלא מיחזי לאינשי כאיסורא, כיון שאין כאן אש וגחלים. ואימתי אסרינן: דווקא בצונן שנתחמם או שמצטמק ויפה לו, אבל בעומד בחמימותו - לא אסרו בדיעבד. וכן המטמין בשבת בדבר שאינו מוסיף הבל - לא אסרו בדיעבד מטעם זה, שהרי אינו אלא עומד בחמימותו, כיון שאינו מוסיף הבל. (שם סק"ו) ויש אומרים דאם שכח והטמין בשוגג בדבר המוסיף הבל - מותר בכל עניין, כיון דשוגג הוא, ודווקא תבשיל שנתבשל כל צרכו. אבל אם נגמר בישולו בשבת - פשיטא שאסור. (שם סק"ז, ועיין ט"ז סק"ב שרצה לומר דאין כאן מחלוקת, דכשעיקר ההטמנה היא בדבר המוסיף הבל - לכולי עלמא אסור, והיש אומרים מיירי דעיקר היה מאין מוסיף הבל, וגם דיעה ראשונה מודה בזה ע"ש)