How would I add a hook to rename the *compilation* buffer after running projectile-run-project? reddit / emacs ---------------------------------------------------------------------- kigas2 · 2022-07-23 11:07 ---------------------------------------------------------------------- snubbyJspreaker · 2022-07-23 12:54 you could look through compile.el to see if there are any hooks for after compile. I don't think projectile has such a thing but you can always check the source and see. if you C-h v and search for compilation you'll find a list of the available hooks ---------------------------------------------------------------------- RyanTheKing · 2022-07-23 13:31 Can you create a wrapper function then bind that to your hot key? Either define a new hook in the wrapper or just put your buffer rename logic there. ---------------------------------------------------------------------- bespokey · 2022-07-23 14:03 You can use hooks on compilation mode or compilation-finish-functions ---------------------------------------------------------------------- _viz_ · 2022-07-23 16:16 There's compilation-buffer-name-function but I'm not sure how useful that will be for you. ---------------------------------------------------------------------- dm_g · 2022-07-23 18:32 Take a look at how to define advice functions: [https://www.gnu.org/software/emacs/manual/html\_node/elisp/Advising-F unctions.html](https://www.gnu.org/software/emacs/manual/html_node/eli sp/Advising-Functions.html) they are very powerful. They give you the opportunity to specify code to run before, after, instead of the original function whenever the original function is invoked. ---------------------------------------------------------------------- kigas2 · 2022-07-23 19:51 Seems like exactly what i need thanks! ---------------------------------------------------------------------- kigas2 · 2022-07-25 08:02 I ended up solving it like this.... `(defun compile-project () "Run current project with a different buffer name." (interactive) (call-interactively 'projectile-run- project) (with-current-buffer "*compilation*" (rename-buffer compilation-buffer-name)))`