home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / alt / lucidem / help / 182 < prev    next >
Encoding:
Text File  |  1992-07-29  |  1.9 KB  |  60 lines

  1. Path: sparky!uunet!mcsun!corton!sophia!rhea.inria.fr!beust
  2. From: beust@rhea.inria.fr (Cedric Beust)
  3. Newsgroups: alt.lucid-emacs.help
  4. Subject: Setting the icon title properly
  5. Message-ID: <25943@sophia.inria.fr>
  6. Date: 30 Jul 92 15:05:42 GMT
  7. Sender: news@sophia.inria.fr
  8. Organization: University of Nice Sophia-Antipolis, France
  9. Lines: 49
  10.  
  11.  
  12.     I want to write some elisp that would set the icon title with
  13.     the name of the buffers. By setting the variable unmap-screen-hook,
  14.     this seems to work fine for one screen but when I open a second
  15.     screen, even though I give it another name, I can't seem to have
  16.     two icons with distinct titles. The already iconified lemacs
  17.     takes the title of the newly iconified one, so you can't
  18.     distinguish one from the other.
  19.  
  20.     It seems the screen-icon-title-format variable doesn't act on
  21.     a per-screen basis but is global to all screens. Did I miss
  22.     something?
  23.  
  24.     Here is the code I wrote :
  25.  
  26. (defun ced-make-string (l sep)
  27.   "Given a list of string, return one string composed of all its elements
  28.    separated by the string sep"
  29.   (if l
  30.       (concat (car l)
  31.           (let ((result (ced-make-string (cdr l) sep)))
  32.         (if result (concat sep result) "")))))
  33.  
  34. (defun ced-squeeze-empty (l)
  35.   "Given a list of strings, return the list with each empty string removed"
  36.   (if l
  37.       (if (equal (car l) "") (ced-squeeze-empty (cdr l))
  38.                       (cons (car l) (ced-squeeze-empty (cdr l))))))
  39.     
  40.  
  41. (defun ced-set-titles (screen) ;; (buffer &arg ignored)
  42.   "Set the icon title according to the buffers currently displayed"
  43.   (setq screen-icon-title-format
  44.     (ced-make-string
  45.      (ced-squeeze-empty
  46.       (mapcar '(lambda (buffer)
  47.              (if (get-buffer-window buffer)
  48.              (buffer-name buffer)
  49.                ""))
  50.           (buffer-list)))
  51.      ",")))
  52.  
  53.  
  54. (setq unmap-screen-hook 'ced-set-titles)
  55.  
  56.  
  57. --
  58. Cedric BEUST, beust@sa.inria.fr, Bull Research Koala proj, KoalaBus & xforum
  59. Pho:(33) 93.65.77.70(.66 Fax), INRIA, B.P.93 - 06902 Sophia Antipolis, FRANCE.
  60.