Closed laurynas-biveinis closed 4 years ago
I'll take a look but it will probably be a few days.
OK upon further review, this is probably not something that should be builtin, but is fairly trivial to add. I've made the function cmake-build-get-run-config-name
"public" so you can easily build a projectile modeline function (or whatever) yourself
As an example:
(defun projectile-custom-mode-line-function ()
(if-let ((name (cmake-build-get-run-config-name)))
(format "[%s:%s]"
(projectile-project-name)
(cmake-build-get-run-config-name))
(projectile-default-mode-line)))
(setq projectile-mode-line-function 'projectile-custom-mode-line-function)
Thanks!
I wrote the following to get the "[project name:cmake:debug:all-tests]" example, which should work in CMake and non-CMake Projectile options:
;; cmake-build.el integration with Projectile
(defun dotfiles--cmake-build-projectile-mode-line-function ()
"Report current Projectile and cmake-build.el project info in the modeline."
(let ((project-name (projectile-project-name))
(project-type (projectile-project-type))
(cmake-build-config (cmake-build-get-run-config-name)))
(format "%s[%s%s%s]"
projectile-mode-line-prefix
(or project-name "-")
(if project-type
(format ":%s" project-type)
"")
;; Enable cmake-build.el part based only on
;; cmake-build-get-run-config-name presence, as cmake-build-profile
;; is set outside of cmake-build.el projects too.
(if cmake-build-config
(format ":%s:%s"
(symbol-name cmake-build-profile)
cmake-build-config)
""))))
(setq projectile-mode-line-function
#'dotfiles--cmake-build-projectile-mode-line-function)
First of all, thank you for this package. I have been looking for this functionality for quite some time.
It might be hard to remember which CMake configuration and which test target is currently active (i.e. what will happen on
cmake-build-current
andcmake-build-run
). Since this package already integrates with Projectile somewhat for getting project roots, it could integrate with its mode line facilities, usingprojectile-mode-line-function
, as well to show current configuration too (right now it shows "[project name:cmake]"). For example "[project name:cmake:debug:all-tests]".