From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#16017: 24.3.50; windmove is broken Date: Tue, 03 Dec 2013 12:44:23 +0100 Message-ID: <529DC417.1080806@gmx.at> References: <87bo1172xf.fsf@yandex.ru> <529C38E4.1020305@gmx.at> <529C60FE.9030903@yandex.ru> <529CCE6A.90908@gmx.at> <529CD9F0.3000403@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020308000506050503040403" X-Trace: ger.gmane.org 1386071121 16997 80.91.229.3 (3 Dec 2013 11:45:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Dec 2013 11:45:21 +0000 (UTC) Cc: 16017@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 03 12:45:25 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VnoPs-0008Qd-4i for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Dec 2013 12:45:24 +0100 Original-Received: from localhost ([::1]:41776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnoPr-0003lI-P9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 03 Dec 2013 06:45:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnoPf-0003ax-Rv for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2013 06:45:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnoPY-0005R7-Gz for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2013 06:45:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnoPY-0005Q9-DL for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2013 06:45:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VnoPX-0000rE-9E for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2013 06:45:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 03 Dec 2013 11:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16017 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16017-submit@debbugs.gnu.org id=B16017.13860710863247 (code B ref 16017); Tue, 03 Dec 2013 11:45:02 +0000 Original-Received: (at 16017) by debbugs.gnu.org; 3 Dec 2013 11:44:46 +0000 Original-Received: from localhost ([127.0.0.1]:55597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VnoPE-0000qH-RG for submit@debbugs.gnu.org; Tue, 03 Dec 2013 06:44:45 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:59770) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VnoP6-0000pu-My for 16017@debbugs.gnu.org; Tue, 03 Dec 2013 06:44:37 -0500 Original-Received: from [62.47.63.161] ([62.47.63.161]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MA8hF-1VuBGR2kpd-00BMil for <16017@debbugs.gnu.org>; Tue, 03 Dec 2013 12:44:30 +0100 In-Reply-To: <529CD9F0.3000403@yandex.ru> X-Provags-ID: V03:K0:8QT0f1o/JXeF+1AfRGCdDO8xGS0S7psOXShg0eKDldVvdzYJNG0 hMYiv1hZlp1CVMizkKa/sd2V/kB/rMcth4Ti/d/yqClf9jgpqwYCIlQgFOYR6XyYxJV3Vzv LuczBF/SY4CvDEcQEU4Y6LiQ5xWCJ9pJ1oPBB1UN9MzGa+DO4WCiDE62KCoaFQsGWVS/1RT cqgc5dl+VvK3vC3VwD5nQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:81304 Archived-At: This is a multi-part message in MIME format. --------------020308000506050503040403 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit >> I'll into this as soon as I sorted out bug 16013 (unless you wanted to >> have a look). > > Please do. I'm sure you understand the problem area better, and there > are other issues I'd rather devote attention to. IIUC the bug happens only in a window whose subwindow does not have an integral number of lines like in a maximized frame. Is that correct? Here on a maximized frame with two windows above each other and the upper one selected the following happens (window-height) => 30 (window-pixel-height) => 484 so the selected window has 484 / 16 lines which is larger than 30. Now `windmove-other-window-loc' with DIR 'down does (+ (1- (nth 3 edges)) windmove-window-distance-delta))) ; (x, y1+d-1) and returns 30. `window-at' returns the selected window since that window extends until after line 30 and windmove doesn't move because the target window is the selected one. In the long run I'd like to use `window-in-direction' here because it doesn't suffer this problem. Meanwhile I can offer the attached patch (although I'm not sure whether it is really better than customizing `windmove-window-distance-delta'). martin BTW: If you want to test `window-in-direction' directly you can try the following instead: (defun select-window-on-left () "Select window on the left." (interactive) (select-window (window-in-direction 'left))) (defun select-window-above () "Select window above." (interactive) (select-window (window-in-direction 'above))) (defun select-window-on-right () "Select window on the right." (interactive) (select-window (window-in-direction 'right))) (defun select-window-below () "Select window below." (interactive) (select-window (window-in-direction 'below))) (defun select-window-keybindings (&optional modifier) "Set up keybindings as in windmove." (interactive) (unless modifier (setq modifier 'shift)) (global-set-key (vector (list modifier 'left)) 'select-window-on-left) (global-set-key (vector (list modifier 'right)) 'select-window-on-right) (global-set-key (vector (list modifier 'up)) 'select-window-above) (global-set-key (vector (list modifier 'down)) 'select-window-below)) --------------020308000506050503040403 Content-Type: text/plain; name="windmove.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="windmove.diff" === modified file 'lisp/windmove.el' --- lisp/windmove.el 2013-01-01 09:11:05 +0000 +++ lisp/windmove.el 2013-12-03 10:19:43 +0000 @@ -438,24 +438,28 @@ to. DIR is one of `left', `up', `right', or `down'; an optional ARG is handled as by `windmove-reference-loc'; WINDOW is the window that movement is relative to." - (let ((edges (window-edges window)) ; edges: (x0, y0, x1, y1) + (let ((edges (window-pixel-edges window)) ; edges: (x0, y0, x1, y1) (refpoint (windmove-reference-loc arg window))) ; (x . y) (cond ((eq dir 'left) - (cons (- (nth 0 edges) + (cons (- (ceiling (nth 0 edges) + (frame-char-width (window-frame window))) windmove-window-distance-delta) (cdr refpoint))) ; (x0-d, y) ((eq dir 'up) (cons (car refpoint) - (- (nth 1 edges) + (- (ceiling (nth 1 edges) + (frame-char-height (window-frame window))) windmove-window-distance-delta))) ; (x, y0-d) ((eq dir 'right) - (cons (+ (1- (nth 2 edges)) ; -1 to get actual max x + (cons (+ (1- (ceiling (nth 2 edges) + (frame-char-width (window-frame window)))) ; -1 to get actual max x windmove-window-distance-delta) (cdr refpoint))) ; (x1+d-1, y) ((eq dir 'down) ; -1 to get actual max y (cons (car refpoint) - (+ (1- (nth 3 edges)) + (+ (1- (ceiling (nth 3 edges) + (frame-char-height (window-frame window)))) windmove-window-distance-delta))) ; (x, y1+d-1) (t (error "Invalid direction of movement: %s" dir))))) --------------020308000506050503040403--