Shulchan Arukh, Orach Chayim Siman 350
Can copy this into an AI, or connect the whole library to your assistant. For deeper learning, you can directly use the original seforim, sites, and apps.
עומד אדם ברה"י ומוציא ידו לרשות הרבים ומטלטל שם חפצים שאינם צריכים לו במקום שהוא עומד שנוטלן מכאן ומניחן כאן ובלבד שלא יעבירם ארבע אמות ולא חיישינן שמא יביאם אליו כיון שאינם צריכין לו במקום שהוא עומד שם הילכך מותר לעמוד ברשות הרבים ליטול מפתח ברשות היחיד ולפתוח שם וכן מרה"י לרה"ר אבל לא יעמוד ברשות היחיד ויוציא ראשו לרשות הרבים וישתה שם או איפכא אלא אם כן יכנוס ראשו ורובו למקום שהוא שותה דכיון שהוא צריך לאלו המים חיישינן שמא יביאם אליו אבל מותר לעמוד ברשות היחיד או ברה"ר ולשתות בכרמלית או איפכא ויש מפרשים דחפצים הצריכים לו היינו כלים נאים שהוא צריך להם אבל אם הם כלים שאינם נאים מותר לשתות בהם אף ע"פ שלא הוציא ראשו ורובו אלא שהושיט צוארו לבד ושאר טלטולים חוץ משתייה אפילו כלים נאים מותר לטלטל שלא גזרו אלא בכלים נאים ובשותה בהם שהוא מקרבן לפיו:
A man may stand in the private domain and reach his hand to the public domain and carry objects there that he does not need where he is. He may move them around as long as he doesn't move them four amot. We do not worry that he will bring them to himself because he doesn't need them where he is. Therefore, one is permitted to stand in the public domain and take a key from the private domain and open a door there, and the same is true from the private domain to the public domain. However, he may not stand in the private domain and extend his head into the public domain and drink there, or the opposite, unless he extends his head and most of his body to the place from which he drinks; because he needs the water, we worry that he will bring the water to himself. However, one is permitted to stand in the private or public domain and drink in the karemlit, or vice versa. There are some who explain that objects that he needs are nice objects, but if the object is not nice, he may drink from them even without extending his head and most of his body and just extending his neck. Regarding other objects that are not drinking-related, one may even carry nice objects, because there is only a rabbinic decree for nice objects that he drinks from, because he will come to bring them near him.
לא יעמוד אדם ברשות הרבים וישתין או ירוק ברשות היחיד או בכרמלית או איפכא אפילו אם הוציא פיו ואמתו לחוץ:
One should not stand in the public domain and urinate or spit into the private domain or the karmelit, or vice versa, even if he extends his mouth and arm outside [of his domain].
רוקו שנתלש מפיו ומוכן לזרקו יש מי שאומר שלא יהלך ד' אמות ברשות הרבים עד שירוק:
If spit is floating around his mouth and he is prepared to spit it out, there is one who says that he should not walk four amot in the public domain until he spits.