In a place where the custom is to inquire after the welfare of mourners on the Sabbath, one inquires; and in the South they inquire. Rabbi Yehoshua went to a certain place and saw mourners on the Sabbath, and he greeted them. He said, "I do not know the custom of your place, but rather, peace be upon you, according to the custom of our place." Rabbi Yosi used to praise Rabbi Meir before the people of Tzippori as a great man, a holy and modest man. One time Rabbi Meir saw mourners on the Sabbath and inquired after their welfare. They said to him, "Rabbi, is this the one you tell us about in his praise?" He said to them, "What did he do?" They said to him, "Such and such." He said to them, "Do you wish to know what his power is? He came to inform us that there is no mourning on the Sabbath, as it is written, 'The blessing of the LORD, it makes rich' (Proverbs 10:22)."
Rabbi Meir Greets the Mourners to Teach No Grief on Shabbat
Yalkut Shimoni on Torah 16:19
מָקוֹם שֶׁנָּהֲגוּ לִשְׁאֹל בִּשְׁלוֹם אֲבֵלִים בְּשַׁבָּת, שׁוֹאֲלִין. וּבַדָּרוֹם שׁוֹאֲלִין. רַבִּי יְהוֹשֻׁעַ אָזַל לְחַד אֲתַר חָמָא אֲבֵלַיָּא בְּשַׁבְּתָא שָׁאַל בְּהוֹן אָמַר, אֲנִי אֵינִי יוֹדֵעַ מִנְהַג מְקוֹמְכֶם אֶלָּא שָׁלוֹם עֲלֵיכֶם כְּמִנְהַג מְקוֹמֵנוּ. רַבִּי יוֹסִי הָוֵי מִשְׁתַּבֵּחַ בְּרַבִּי מֵאִיר קוּמֵי צִפֹּרָאֵי דְּאָדָם גָּדוֹל הוּא, אָדָם קָדוֹשׁ וְצָנוּעַ. חַד זְמַן חָמָא אֲבֵלַיָּא בְּשַׁבְּתָא וְשָׁאַל בִּשְׁלוֹמְהוֹן. אָמְרִין לֵיהּ, רַבִּי, אֲהַן דְּאַתּ מְתַנֵי בְּשִׁבְחֵהּ אָמַר לוֹן, מֶה עָבַד, אָמְרִין לֵיהּ כָּךְ וְכָךְ אָמַר לְהוּ, בָּעוּ אַתּוּן מֵידַע מַאי חֵילֵיהּ בָּא לְהוֹדִיעֵנוּ שֶׁאֵין אֲבֵלוּת בְּשַׁבָּת דִּכְתִיב (משלי י, כב) "בִּרְכַּת ה' הִיא תַּעֲשִׁיר".