mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-07 12:47:30 -05:00
When adding a snippet/alias to a mode for the first time, setting `default-directory` before calling `+snippet--ensure-dir` would cause an error due to the directory not existing. As a fix, return the dir from `+snippet--ensure-dir` and bind `default-directory` to that. Additionally, not having a file associated with the buffer caused issues with loading the snippet after using snippet-mode's C-c C-c binding, especially when other directories were added to yasnippet's load paths. As a solution for this, prompt the user for a snippet key and set the buffer's file name to it within the snippet dir. If an existing file would be overwritten, ask user for confirmation. As an additional convenience, set the snippet's key field to the entered value. Finally, replace %alias with doom-snippets-expand in the generated alias snippets. Not aware of any history here, but %alias did not work for me.