anchor.diff:    (:export :get-focus-item
              :apply-print-spec))
   (in-package :lem.popup-window)
  +
  +(defparameter +border-size+ 1)
   
   (defvar *menu-buffer* nil)
   (defvar *menu-window* nil)
  
positive.code: (defvar *action-callback* nil)
  (defvar *focus-attribute* nil)
  (defvar *non-focus-attribute* nil)
  
  (define-attribute popup-menu-attribute
    (t :foreground "white" :background "RoyalBlue"))
  
negative.code:       (buffer-start p)
        (loop :do (move-to-column p max-column t)
              :while (line-offset p 1))
        ;; (put-text-property (buffer-start-point buffer)
        ;;                    (buffer-end-point buffer)
        ;;                    :attribute 'popup-window-attribute)
        (values buffer
                max-column
                (buffer-nlines buffer)))))
  
  (defun compute-size-from-buffer (buffer)
    (flet ((compute-height ()
             (buffer-nlines buffer))
           (compute-width ()
             (with-point ((p (buffer-point buffer)))
               (buffer-start p)
               (loop
                 :maximize (string-width (line-string p))
                 :while (line-offset p 1)))))
      (list (compute-width)
            (compute-height))))
  
  (defun display-popup-buffer-default (buffer timeout &optional (size (compute-size-from-buffer buffer)))
    (clear-popup-message)
    (destructuring-bind (width height) size
      (let ((window (popup-window (current-window) buffer width height)))
        (buffer-start (window-view-point window))
        (window-see window)
  