5

I would like to have the Projectile project name as frame title and also have it updated when I switch between two different buffers in two different Projectile projects. I tried with the following:

(setq frame-title-format
      '("" (:eval projectile-project-name-function)))

This doesn't work at all. The frame title is blank with no text at all. Any ideas?

2 Answers 2

8

The following code works for me.

(setq frame-title-format
    '(""
      "%b"
      (:eval
       (let ((project-name (projectile-project-name)))
         (unless (string= "-" project-name)
           (format " in [%s]" project-name))))))
1
  • Brilliant! Works just like I wanted it. Thanks! Commented Sep 12, 2017 at 10:51
1

I use this code

;; Set my-projectile-project-name to projectile-project-name,
;; so that later I can also set projectile project name when in *Messages* buffer etc
(defun my-projectile-switch-project-action ()
  (set-frame-parameter nil 'my-projectile-project-name projectile-project-name)
  (projectile-run-eshell)
  (projectile-find-file))

(setq projectile-switch-project-action 'my-projectile-switch-project-action)

(setq frame-title-format
    '(""
      "%b"
      (:eval
       (let ((project-name (projectile-project-name)))
           (if (not (string= "-" project-name))
             (format " in [%s]" project-name)
             (format " in [%s]" (frame-parameter nil 'my-projectile-project-name)))))))

I've previously used https://github.com/john2x/nameframe.

It will switch to projectile project frame if there is already opened such.

It sets persistent projectile project name in frame title, but its format is not customizable and there appears separate window with *Messages*. And if you close it, all emacs frames are closed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.