Article View: gnu.epoch.misc
Article #2124Re: changing titles of screens
From: Simon Kaplan
Date: Mon, 08 Apr 1991 03:33
Date: Mon, 08 Apr 1991 03:33
101 lines
4062 bytes
4062 bytes
You do this by setting the property "WM_NAME" using set-property.
Similarly, use WM_ICON_NAME to get icon names.
Here is a file of mine, maintain-screen-titles.el, that sort of does this.
use ^Z-a to resync titles when necessary. It misses buffer changes under
some circumstances, unfortunately. I cant remember who wrote this code
initially: either myself or Alan, I think.
;; have screens rename on the following actions: they get the current name
;; of the buffer.
;;
;; ^Xo
;; ^X0
;; ^x4b
;; ^x^f
;; ^x4^f
;; ^x1
;; ^xb
;; ^xk
(setq buffer-names-as-titles t)
(defvar inviolate-names '("Mh-Rmail" "Calendar" "Gnus"))
(defun memq-string-list (name list)
(cond ((null list) nil)
((string= name (car list)) (car list))
(t (memq-string-list name (cdr list)))))
(defun rename-screen (&optional name)
(interactive)
(let ((curr-scr-name (epoch::get-property "WM_NAME")))
(if (not (memq-string-list curr-scr-name inviolate-names))
(progn
(epoch::set-property "WM_NAME" (or name (concat (buffer-name)
(sys-name))))
(epoch::set-property "WM_ICON_NAME" (epoch::get-property "WM_NAME"))))))
(rename-screen) ;; rename first screen to match
(defun my-other-window (&optional count)
(interactive "p")
"Like other-window but renames screen to reflect current buffer"
(other-window count)
(rename-screen))
(defun my-delete-window (&optional window)
(interactive)
"Like delete-window but renames screen to reflect current buffer"
(delete-window window)
(rename-screen))
(defun my-switch-to-buffer-other-window ()
(interactive)
"Like switch-to-buffer-other-window but renames screen to reflect current buffer"
(command-execute 'switch-to-buffer-other-window)
(rename-screen))
(defun my-find-file (&optional filename)
(interactive "FFind file: ")
"Like find-file but renames screen to reflect current buffer"
(find-file filename)
(rename-screen))
(defun my-find-file-other-window (&optional filename)
(interactive "FFind file: ")
"Like find-file-other-window but renames screen to reflect current buffer"
(find-file-other-window filename)
(rename-screen))
(defun my-delete-other-windows (&optional window)
(interactive)
"Like delete-other-windows but renames screen to reflect current buffer"
(delete-other-windows window)
(rename-screen))
(defun my-switch-to-buffer ()
(interactive)
(command-execute 'switch-to-buffer)
(rename-screen))
(defun my-kill-buffer (&optional buffer)
(interactive "bKill Buffer ")
(kill-buffer buffer)
(rename-screen))
(global-set-key "\C-xk" 'my-kill-buffer)
(global-set-key "\C-xb" 'my-switch-to-buffer)
(global-set-key "\C-xo" 'my-other-window)
(global-set-key "\C-x0" 'my-delete-window)
(global-set-key "\C-x4b" 'my-switch-to-buffer-other-window)
(global-set-key "\C-x\C-f" 'my-find-file)
(global-set-key "\C-x4\C-f" 'my-find-file-other-window)
(global-set-key "\C-x1" 'my-delete-other-windows)
(global-set-key "\C-za" 'rename-screen)
--
Simon Kaplan kaplan@cs.uiuc.edu
Department of Computer Science uiucdcs!kaplan@uunet.uu.net
University of Illinois at Urbana-Champaign
1304 W. Springfield Ave phone: +1 217 244 0392
Urbana Illinois 61801, USA fax: +1 217 333 3501
Technical Details
Message-ID:
<KAPLAN.91Apr7223344@ash.cs.uiuc.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!wuarchive!m.cs.uiuc.edu!uiucdcs!kaplanReferences:
<1991Apr8.002030.27754@maverick.ksu.ksu.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc7ee,fb3dd5a98248683d X-Google-Attributes: gidfc7ee,public X-Google-ArrivalTime: 1991-04-07 22:36:30 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!cs.utexas.edu!wuarchive!m.cs.uiuc.edu!uiucdcs!kaplan From: kaplan@ash.cs.uiuc.edu (Simon Kaplan) Newsgroups: gnu.epoch.misc Subject: Re: changing titles of screens Message-ID: <KAPLAN.91Apr7223344@ash.cs.uiuc.edu> Date: 8 Apr 91 03:33:44 GMT References: <1991Apr8.002030.27754@maverick.ksu.ksu.edu> Sender: news@m.cs.uiuc.edu (News Database (admin-Mike Schwager)) Organization: University of Illinois at Urbana-Champaign Lines: 101 In-Reply-To: brtmac@maverick.ksu.ksu.edu's message of 8 Apr 91 00:20:30 GMT Nntp-Posting-Host: ash.cs.uiuc.edu