0

I try to set the frame title to projectile-project-name: buffer-name when focused, projectile-project-name when not.

I use the following title-frame-format and hooks to achieve that behaviour:

(setq frame-title-format
      '(""
        (:eval
         (let ((project-name (projectile-project-name)))
           (if (not (string= "-" project-name))
               project-name
             invocation-name)))
        ""
        (:eval
         (if (buffer-file-name)
             (concat ": " 
                     (tom/short-path 
                       (abbreviate-file-name (buffer-file-name)) 1))
           ": %b"))))

(define-hook-helper focus-out ()
  (set-frame-parameter (selected-frame)
                       'title (let ((project-name (projectile-project-name)))
                                (if (not (string= "-" project-name))
                                    project-name
                                invocation-name))))
(define-hook-helper focus-in ()
  (set-frame-parameter (selected-frame)
                       'title nil))

This works most of the time, but sometimes, when switching frames, the frame-title is set to the name of the visited file, not the project-name.

No other part of my config touches frame-name or -title. Any ideas or hints, which mechanism is interfering, where (and how) to look?

  • Can you try to narrow down just what those "sometimes" situations are, and provide a recipe? If you can't then maybe someone will guess an answer, but if you can that will likely help. – Drew Mar 8 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.