Subject: Re: bug#6130: 23.1; artist-mode spray-can malfunction

From: martin rudalics <[email-masked]>
Date: Sat, 17 Jan 2015 14:56:26 +0100

Thank you very much, especially for the detailed explanation.

 > Here's a patch that handles 1 through 3.

I think your patch should go into Emacs 24.5.  Have you signed a FSF
copyright form?  If not, please do that as soon as possible.

 > The extra explanatory material
 > in the docs might be an inelegant half measure, though, considering the
 > function and variable names still refer to the object as a window
 > regardless of its actual type.

We could rename it to `posn-window-or-frame' and provide an alias.

 > I also went ahead and searched the lisp/ tree for other places that
 > looked risky -- that is, where a position object was assumed to hold a
 > window in a context where there was no such guarantee. Nothing jumped
 > out at me, but there could be any number of issues with third-party
 > code.

`posnp' also looks strange in this regard.

 > +the second element of any mouse event in the same way. However, the
                                                          ^
Please always use two spaces after the end of a sentence.

 > +drag event may end outside the boundaries of the selected frame. In
 > +that case, the third element's position list contains the selected
 > +frame in place of a window.

I'd expect it to be the selected frame but are we 100% sure?  Could this
frame not still be the frame selected at the time mouse dragging started
while the selected frame has changed under our feet?  Think of weird
things like `focus-follows-mouse' and `mouse-autoselect-window'.  (This
remark might be silly but I was too lazy to test its validity right now.)

 > +location outside the boundaries of the selected frame, in which case
 > +the list contains the selected frame in place of a window.

Same as before.

 > +Return the window that @var{position} is in. If the frame with input
 > +focus does not have any window at @var{position}, return the frame
 > +instead.

Hmmm...  here you use "frame with input focus".  This looks better but
I'm still not entirely convinced.

 > +         (window          (if (windowp frame-or-window)
 > +                              frame-or-window
 > +                            nil))

Please use either

(and (windowp frame-or-window) frame-or-window)

or

(when (windowp frame-or-window) frame-or-window)

here.

 > +      (let* ((spacing (when (display-graphic-p frame)
 > +                 (or (with-current-buffer (window-buffer window)

Here `window' is the selected window.  IMHO

(frame-selected-window frame)

sounds more accurate, given what I said about the selected frame above.

 > diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el

I didn't look into these but just trust your experience here.

Thanks again, martin