On Fri, Mar 15, 2013 at 8:51 PM, Mark Skilbeck wrote: > Use modify-frame-parameters: > > (modify-frame-parameters nil '((title . "test"))) > > Hi, thank you for your reply. After some searching and reading docs I changed the code to (defun set-project-in-frame-title () (interactive) ;;(select-frame frame) (setq projectname (getenv "project")) (message "Project: %s" projectname) (if projectname (modify-frame-parameters nil (list (cons 'title (concat (buffer-name) " [" projectname "]")))) (modify-frame-parameters frame (list (cons 'title (buffer-name)))) ) ;; if projectname ) But it doesn't really make any difference. I figured out however, that I probably need a hook to be executed when a frame is opened: (add-hook 'after-make-frame-functions 'set-project-in-frame-title) But, this doesn't work exactly right either. I get the buffer-name of the previous buffer. E.g. when I start emacs: export projectname="myproject" emacs myfile The frame title has: *scratch* [myproject] In the documentation of after-make-frame-functions it is claimed that the new frame is passed as an argument, but when I do: (defun set-project-in-frame-title (frame) (interactive) (select-frame frame) (setq projectname (getenv "project")) (message "Project: %s" projectname) (if projectname (modify-frame-parameters frame (list (cons 'title (concat (buffer-name) " [" projectname "]")))) (modify-frame-parameters frame (list (cons 'title (buffer-name)))) ) ;; if projectname ) I get an error: Wrong number of arguments: (lambda (frame) (interactive) (select-frame frame) (setq projectname (getenv project)) (message Project: %s projectname) (if projectname (modify-frame-parameters frame (list (cons (quote title) (concat (buffer-name) [ projectname ])))) (modify-frame-parameters frame (list (cons (quote title) (buffer-name)))))), 0 Thank you very much for any help, Ian. > On Fri, Mar 15, 2013 at 08:24:20PM +0100, Ian van der Neut wrote: > > Hello all, > > > > rather a lisp newbie and been searching all over, but can't figure it > out. > > I have the code below: > > > > (provide 'ian-project) > > ;; Based on the presence of the 'project' environment variable, > > ;; display the project name in the frame title and the mode line. > > (defun set-project-in-frame-title () > > (interactive) > > (setq projectname (getenv "project")) > > (message "Project: %s" projectname) > > (if projectname > > (setq-default frame-title-format (concat "%b (%*) [" projectname "] > > ")) > > (setq frame-title-format (concat "%b (%*)")) > > ) ;; if projectname > > ) > > > > And in my ~/.emacs I have: > > > > (require 'ian-project) > > (set-project-in-frame-title) > > > > The message "Project: " is displayed in the *Messages* > buffer > > on startup, however, the project name does not end up in the frame title, > > unless I execute the function by hand: > > M-x set-project-in-frame-title() > > > > My emacs version is: > > GNU Emacs 24.2.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.6.4) > > of 2013-02-02 on buildvm-04.phx2.fedoraproject.org > > > > Thank you very much in advance for any pointers as to what I may be > missing. > > > > Ian. > > -- > > One man's "magic" is another man's engineering. "Supernatural" is a null > > word. > > -- Excerpt from the notebooks of Lazarus Long, from Robert Heinlein's > "Time > > Enough for Love" > -- One man's "magic" is another man's engineering. "Supernatural" is a null word. -- Excerpt from the notebooks of Lazarus Long, from Robert Heinlein's "Time Enough for Love"