tag:blogger.com,1999:blog-3992530807750384868.post7583600805500387232..comments2022-03-28T08:42:20.497+03:00Comments on emacs-fu: setting the frame titleUnknownnoreply@blogger.comBlogger12125tag:blogger.com,1999:blog-3992530807750384868.post-55085268480156276032012-03-11T19:12:09.115+02:002012-03-11T19:12:09.115+02:00Okay, maybe it is just my window manager doing som...Okay, maybe it is just my window manager doing something silly. Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-81449518263346662752012-03-10T12:56:05.279+02:002012-03-10T12:56:05.279+02:00@Anonymous: hmmmm, cannot reproduce that...@Anonymous: hmmmm, cannot reproduce that...djcbhttps://www.blogger.com/profile/15938154009846040711noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-53778869458352265832012-03-04T18:32:05.973+02:002012-03-04T18:32:05.973+02:00Hi, this works great for me, except...
When I swi...Hi, this works great for me, except...<br /><br />When I switch away from emacs, a short while later the window title reverts back to "emacs@hostname". If I switch back to emacs it then updates the title again. I'm using emacs 24 if that makes a difference.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-22717647375643037292011-07-05T05:40:32.576+03:002011-07-05T05:40:32.576+03:00Thanks for explaining how to set the frame title. ...Thanks for explaining how to set the frame title. I wanted to take some screen shots and leave my machine name out of them and couldn't find how to do that.Johnhttp://www.johndcook.com/blognoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-13304291460062499302011-03-01T23:22:47.018+02:002011-03-01T23:22:47.018+02:00Sorry. I put a debug elisp statement in my last p...Sorry. I put a debug elisp statement in my last post. The real line of code I am trying to use is:<br /><br />(setq frame-title-format '("Hi " (:eval (mapconcat (lambda (x) (format "%s" x)) (last (split-string "%f" "/") 3) "/"))))<br /><br />Thanks for the help!Brian Whitehttps://www.blogger.com/profile/07001120631267438475noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-42526499999667672802011-03-01T23:03:42.015+02:002011-03-01T23:03:42.015+02:00Thanks for this information. It has put me on the...Thanks for this information. It has put me on the right path. I want to massage the value returned by %f so I tried the following:<br /><br />(setq frame-title-format '("Hi " (:eval (mapconcat (lambda (x) (format "%s" x)) (last (message-box "%s" (split-string "%f" "/")) 3) "/"))))<br /><br />If I replace %f with a literal string it works as I expect ut using %f just places the full path with filename like it didn't run my code at all. I do get the leading "Hi " though.<br /><br />Any thoughts would be greatly appreciated!Brian Whitehttps://www.blogger.com/profile/07001120631267438475noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-44456855782663328662011-01-06T23:58:36.713+02:002011-01-06T23:58:36.713+02:00I didn't knew about the :eval trick thanks!I didn't knew about the :eval trick thanks!Samue1604noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-32903862809355973202011-01-06T23:44:52.094+02:002011-01-06T23:44:52.094+02:00I like to set the frame name to reflect the projec...I like to set the frame name to reflect the project I'm working on: "emacs (Project Name)". So I wrote this little function to do it:<br /><br />(defun my-set-frame-name ()<br /> "Prompt the user for a window title, and set the current<br />frame's title to that string."<br /> (interactive)<br /> (let ((title (read-string "Enter window title: " "emacs (")))<br /> (if (string-match "\\`emacs ([^)]+\\'" title) ; no trailing close-paren<br /> (setq title (concat title ")")))<br /> (set-frame-name title)<br /> ))<br /><br />It prompts me for a string to use as a frame title, and it defaults to a string that begins with "emacs (". I can type a project name there, or I can erase the "emacs (" part and type anything I want. If I forget to use a close parenthesis, the function adds it for me.<br /><br />I have this assigned to a keystroke, and I use it almost every time I start emacs.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-56585670705983872772011-01-06T23:38:58.323+02:002011-01-06T23:38:58.323+02:00I use the following, which I believe I grabbed fro...I use the following, which I believe I grabbed from the comments in <a href="http://emacs-fu.blogspot.com/2009/04/dot-emacs-trickery.html" rel="nofollow">this very blog</a> :)<br /><br />;; titlebar = buffer unless filename<br />(setq frame-title-format '(buffer-name "%f" ("%b")))Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-78381177358654320672011-01-06T22:15:14.650+02:002011-01-06T22:15:14.650+02:00Thanks. I've wondering how to change the frame...Thanks. I've wondering how to change the frame title but haven't had time to look into it. This article saved me a lot of time and effort.Anonymoushttps://www.blogger.com/profile/09075166920864462374noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-62815130333994838842011-01-06T21:56:42.947+02:002011-01-06T21:56:42.947+02:00OK, I figured out the answer to my own question. J...OK, I figured out the answer to my own question. Just replace 'buffer-file-name' with 'buffer-name'.be_slayedhttps://www.blogger.com/profile/02920742528327860445noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-23908449597602677762011-01-06T19:39:19.758+02:002011-01-06T19:39:19.758+02:00Hmm... I would like to show the buffer name, but a...Hmm... I would like to show the buffer name, but a lot of my files are deeply buried (and abbreviate-file-name apparently doesn't deal with this) and the title text ends up running out of "bar space". <br /><br />Is there anyway to work with the "uniquified" buffer name instead?be_slayedhttps://www.blogger.com/profile/02920742528327860445noreply@blogger.com