unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* simplifying windmove-frame-edges
@ 2019-10-23 11:54 Juanma Barranquero
  2019-10-23 16:05 ` martin rudalics
  0 siblings, 1 reply; 12+ messages in thread
From: Juanma Barranquero @ 2019-10-23 11:54 UTC (permalink / raw)
  To: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 2509 bytes --]

A few years ago (well, fifteen, really), `windmove-frame-edges' was changed
with this commit

commit 82ae2f3f78fca3b1932e60fbb4bb1fa050cea6db
 Author: Eli Zaretskii <eliz@gnu.org>
 Date:   2004-09-13 20:08:44 +0000

     (windmove-frame-edges): Report coordinates of
     outside edges of frame, not inside edges.
     (windmove-coordinates-of-position): Convert into wrapper to new
     function `windmove-coordinates-of-window-position';
     `compute-motion' always applies to selected window.
     (windmove-coordinates-of-position): Update documentation to refer
     to Emacs 21 Lisp Reference Manual.
     (windmove-find-other-window): Fix off-by-one errors for max x,y.

The relevant change to `windmove-frame-edges' is this:

 --- a/lisp/windmove.el
 +++ b/lisp/windmove.el
 @@ -324,11 +324,11 @@ windmove-frame-edges
    (let* ((frame (if window
                     (window-frame window)
                   (selected-frame)))
 -        (top-left (window-inside-edges (frame-first-window frame)))
 +        (top-left (window-edges (frame-first-window frame)))
          (x-min (nth 0 top-left))
          (y-min (nth 1 top-left))
 -        (x-max (+ x-min (frame-width frame) -1)) ; 1- for last row & col
 -        (y-max (+ x-max (frame-height frame) -1)))
 +        (x-max (1- (frame-width frame))) ; 1- for last row & col
 +        (y-max (1- (frame-height frame))))
      (list x-min y-min x-max y-max)))

  ;; it turns out that constraining is always a good thing, even when


But, as it is now,  I don't see the difference between

(defun windmove-frame-edges (window)
  "Return (X-MIN Y-MIN X-MAX Y-MAX) for the frame containing WINDOW.
If WINDOW is nil, return the edges for the selected frame.
\(X-MIN, Y-MIN) is the zero-based coordinate of the top-left corner
of the frame; (X-MAX, Y-MAX) is the zero-based coordinate of the
bottom-right corner of the frame.
For example, if a frame has 76 rows and 181 columns, the return value
from `windmove-frame-edges' will be the list (0 0 180 75)."
  (let* ((frame (if window
                    (window-frame window)
                  (selected-frame)))
         (top-left (window-edges (frame-first-window frame)))
         (x-min (nth 0 top-left))
         (y-min (nth 1 top-left))
         (x-max (1- (frame-width frame))) ; 1- for last row & col
         (y-max (1- (frame-height frame))))
    (list x-min y-min x-max y-max)))

and just defining it as

(defun windmove-frame-edges (window)
  "..."
  (window-edges (frame-root-window window)))

[-- Attachment #2: Type: text/html, Size: 3091 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-10-25 14:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-23 11:54 simplifying windmove-frame-edges Juanma Barranquero
2019-10-23 16:05 ` martin rudalics
2019-10-23 18:10   ` Juanma Barranquero
2019-10-24  6:44     ` martin rudalics
2019-10-24 14:11       ` Eli Zaretskii
2019-10-25 12:17         ` Juanma Barranquero
2019-10-25 12:51           ` Eli Zaretskii
2019-10-25 13:13             ` Juanma Barranquero
2019-10-25 13:42               ` Eli Zaretskii
2019-10-25 14:05                 ` Juanma Barranquero
2019-10-24  9:12     ` Phil Sainty
2019-10-24  9:37       ` Juanma Barranquero

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).