Rabbi Yehonathan Eibshitz (Eybeshutz), 'a"h, author of Ya'aroth Debash and other works, was one of the great Ashkenazi scholars who lived about 250 years ago. It is said about him that he was extremely poor, to the extent that he did not even have a set of Gemara of his own, because in those days it was very expensive. There was a widow who had a set of Shas and people would come to her and borrow a Gemara from time to time.
On one occasion Rabbi Eibshitz went to her and asked to borrow Masekheth (tractace) Berakhoth. He promised to return it in one week. Since he was the Gadol HaDor, he was constantly interrupted in his studies by people coming about all manner of religious matters. He realized that, at this rate, he would never be able to finish the Gemara in a week. He looked hard for a place where he could study without interruption and could only find such a place in the cemetery. He studied there near a grave, under the shade of a tree.
At the end of the week he returned the Gemara and, in its stead, borrowed Masekheth Shabbath. Since this was a substantially longer and more complicated tractate he asked for two weeks. He again went to the cemetery, where he finished it and returned it at the due date and continued to borrow the Gemaroth in this manner.
People asked him how he could study Torah in a cemetery because it appeared to come under the banner of "Lo'egh LaRash" (mocking the unfortunate who were no longer able to study in this world). He answered that before he started his learning, he said that it was for the raising of the souls of all those buried there and thus it was not only not mocking them but, on the contrary, brought them much good.
(See Abihem Shel Yisrael 'Al HaTorah, Wayhi, Berakhoth Le'Illui Neshama)
Rabbi Yonatan Eibeshitz, Rav Yonason Eibeshutz, loeg larash, mocking the dead, learning Torah in a cemetery