unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: simplifying windmove-frame-edges
Date: Wed, 23 Oct 2019 13:54:14 +0200	[thread overview]
Message-ID: <CAAeL0SS5R9Q8zBC+wBgG7kMPwcka3DcYF2nHC1pkCu1zx9+o-w@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2019-10-23 11:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 11:54 Juanma Barranquero [this message]
2019-10-23 16:05 ` simplifying windmove-frame-edges 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAeL0SS5R9Q8zBC+wBgG7kMPwcka3DcYF2nHC1pkCu1zx9+o-w@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).