[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding the window under a point: nice solution



Thanks to Amy and Kevin who both forward me code from Bill. I was
mistaken about view-contains-point-p not working for windows; I was
passing it local, not global points. The simple solution is this:

(defun topmost-window-containing-global-point
       (global-point &optional (class 'window))
  "Returns the topmost window of type CLASS that contains GLOBAL-POINT in
its content region."
  ;;
  (map-windows
   #'(lambda (w)
       (when (view-contains-point-p w global-point)
         (return-from topmost-window-containing-global-point w)))
   :class class))