ag91 / moldable-emacs

Adapting Emacs for moldable development
GNU General Public License v3.0
105 stars 8 forks source link

Do not try to use buffer filename when nil #15

Closed ikappaki closed 2 years ago

ikappaki commented 2 years ago

Hi,

could you please consider fix for me-mold-treesitter-to-parse-tree that might fail when the buffer of which it tries to retrieve the parse tree is not visiting a file name, as in the example case in #14 where the buffer is a process buffer.

Fixes #14.

Other than the :buffer-file change to check for the existence of buffer file name, I've converted the recursive calls to the fn lambda function to use the cl-labels which is a more appropriate pattern when using inline lambdas (the current pattern was failing for me when trying to run the tests).

I've included a test to check both cases.

Thanks

ag91 commented 2 years ago

I am grateful for your PR @ikappaki ! I have learned a couple of things (buffer-file-name is a buffer variable and cl-labels syntax). Thanks for your contribution!