home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / help-lucid-emacs / text0324.txt < prev    next >
Encoding:
Text File  |  1993-07-14  |  1.5 KB  |  47 lines

  1. >>>>> On Wed, 12 May 1993 09:06:13 CDT, irvine@lks.csi.com said:
  2. irvine> x-gateway: rodan.UU.NET from help-lucid-emacs to alt.lucid-emacs.help; Wed, 12 May 1993 10:06:12 EDT
  3.  
  4. irvine> I need an elisp function that given a buffer returns the screen that it
  5. irvine> is currently being displayed in, otherwise returns nil. I've dug a
  6. irvine> little bit in screens.el, and so far I haven't been able to figure it
  7. irvine> out. Anyone know how to do it off the top of their head? Thanks.
  8.  
  9. irvine> --
  10. irvine> Comdisco Systems, Inc        Chuck Irvine        FAX (913) 841-1345
  11. irvine> Suite A                            irvine@lks.csi.com
  12. irvine> 1310 Wakarusa Dr.                    (913) 841-1283    
  13. irvine> Lawrence, KS 66049
  14.  
  15.     You can have more than one screen showing the same buffer. How would
  16. you decide which screen you really want? Should it return a list of screens?
  17. I guess what you want is the screen of the current window?
  18.  
  19.     If you want to get a list of the screens that has the window that
  20. displays this buffer, the following lisp programn seems to do it:
  21.  
  22. (defun find-screen-showing-buffer (buf)
  23.   (let ((cur (selected-window)))
  24.     (let ((w cur)
  25.       win
  26.       result)
  27.       (if (eq (window-buffer w) buf)
  28.       (let ((screen (window-screen w)))
  29.         (or (memq screen result)
  30.         (setq result (cons screen result)))))
  31.       (setq w (next-window w nil t t))
  32.       (while (not (eq w cur))
  33.     (if (eq (window-buffer w)  buf)
  34.         (let ((screen (window-screen w)))
  35.           (or (memq screen result)
  36.           (setq result (cons screen result)))))
  37.     (setq w (next-window w nil t t)))
  38.       result)))
  39.  
  40.  
  41.  
  42.       
  43.     
  44.  
  45. ---- Wilson
  46.  
  47.