From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#20206: 25.0.50; [PATCH] keep diff-mode's window visible when we visit sources from diff-mode Date: Thu, 26 Mar 2015 11:25:27 -0700 Message-ID: <87a8yzy5t4.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1427394349 28054 80.91.229.3 (26 Mar 2015 18:25:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 26 Mar 2015 18:25:49 +0000 (UTC) To: 20206@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 26 19:25:36 2015 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 1YbCTG-00051i-QO for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Mar 2015 19:25:35 +0100 Original-Received: from localhost ([::1]:46111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbCTG-00013r-1k for geb-bug-gnu-emacs@m.gmane.org; Thu, 26 Mar 2015 14:25:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbCSq-0000Zt-7d for bug-gnu-emacs@gnu.org; Thu, 26 Mar 2015 14:25:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbCSl-0005q8-7Q for bug-gnu-emacs@gnu.org; Thu, 26 Mar 2015 14:25:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbCSl-0005px-4d for bug-gnu-emacs@gnu.org; Thu, 26 Mar 2015 14:25:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YbCSk-0000Z8-Qt for bug-gnu-emacs@gnu.org; Thu, 26 Mar 2015 14:25:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Mar 2015 18:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20206 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14273942782139 (code B ref -1); Thu, 26 Mar 2015 18:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Mar 2015 18:24:38 +0000 Original-Received: from localhost ([127.0.0.1]:37555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbCSL-0000YR-RT for submit@debbugs.gnu.org; Thu, 26 Mar 2015 14:24:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56920) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YbCSI-0000Y9-Ts for submit@debbugs.gnu.org; Thu, 26 Mar 2015 14:24:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbCSC-000552-Jk for submit@debbugs.gnu.org; Thu, 26 Mar 2015 14:24:29 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbCSC-00054y-HF for submit@debbugs.gnu.org; Thu, 26 Mar 2015 14:24:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbCSB-0008Jn-Au for bug-gnu-emacs@gnu.org; Thu, 26 Mar 2015 14:24:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbCS6-00054G-Ah for bug-gnu-emacs@gnu.org; Thu, 26 Mar 2015 14:24:27 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:59872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbCS5-00053o-Ur for bug-gnu-emacs@gnu.org; Thu, 26 Mar 2015 14:24:22 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id B835F205BF for ; Thu, 26 Mar 2015 14:24:15 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Thu, 26 Mar 2015 14:24:18 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=x-sasl-enc:from:to:subject:date:message-id:mime-version :content-type; s=mesmtp; bh=pVacRAZgxRe0vrHN1M/3j+obIk4=; b=je3v BFiCwiH0uRE+fMGhRrJRUDp/iaD/lqisn6Co+6Ghd4N4CGF+6Z9nhYMubVvzUKxz iFVu7q1OQNtAjcd3YMEu7bh70sXbZoc1dqmfyYN4oHNYMmQVTW0r/YXLRqPH7tlo FL7NeDMjjzNtJ5hKWRmeSngv0oxb7bTCof8LROA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:subject:date :message-id:mime-version:content-type; s=smtpout; bh=pVacRAZgxRe 0vrHN1M/3j+obIk4=; b=D52VBlCy1oFwiB9hxCS8eiBLbNbKd2RhQTWqoCZata7 v1fsQiNY2W/xrT/eNg77KWpN/oQgr8t3h6/1LxlMFh+zi4h9IhR5T91PBhfzjgl0 RSWleE/DZB5Vjt9UraCdmxvSOAs2qXfZjAKH6XZ9Se+8WLj2vqUweMTLpwgtbuuY = X-Sasl-enc: 8dpalZ06ETSojXSCOcwMmweZPFN0g2AucrDQaxjikAFY 1427394258 Original-Received: from shorty.local (unknown [104.35.103.243]) by mail.messagingengine.com (Postfix) with ESMTPA id 3C448C00015 for ; Thu, 26 Mar 2015 14:24:18 -0400 (EDT) Original-Received: from ip6-localhost ([::1] helo=shorty) by shorty.local with esmtp (Exim 4.84) (envelope-from ) id 1YbCT9-0000HN-QN for bug-gnu-emacs@gnu.org; Thu, 26 Mar 2015 11:25:27 -0700 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:100959 Archived-At: --=-=-= Content-Type: text/plain When looking at a patch in diff-mode, one can visit the sources being patched with several functions, for instance (diff-goto-source). This patch makes sure that the source buffer does not cover up the diff-mode buffer in its window, but uses any other window instead. This really is a continuation of bug 20034 (and 17675 and 19901). I feel like the earlier display-buffer implementation had a nicer default in this regard. Should we keep adding this patch wherever a user operation on a buffer can cause a different buffer to be displayed, or should display-buffer defaults be changed to make the "don't steal user's focus" behavior the default? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-keep-diff-mode-s-window-visible-when-we-visit-source.patch >From fa88533777a500784cb5def1733aa182c6bd4135 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Thu, 26 Mar 2015 11:21:06 -0700 Subject: [PATCH] keep diff-mode's window visible when we visit sources from diff-mode When looking at a patch in diff-mode, one can visit the sources being patched with several functions, for instance (diff-goto-source). This patch makes sure that the source buffer does not cover up the diff-mode buffer in its window, but uses any other window instead --- lisp/vc/diff-mode.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index a9614e9..15cdae9 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -1318,7 +1318,7 @@ See `after-change-functions' for the meaning of BEG, END and LEN." ;; Select a window that displays the current buffer so that point ;; movements are reflected in that window. Otherwise, the user might ;; never see the hunk corresponding to the source she's jumping to. - (pop-to-buffer (current-buffer)) + (pop-to-buffer (current-buffer) '(display-buffer-use-some-window (inhibit-same-window . t))) (if reset (goto-char (point-min))) (diff-hunk-next arg) (diff-goto-source)) @@ -1801,7 +1801,7 @@ With a prefix argument, REVERSE the hunk." (delete-region (car pos) (cdr pos)) (insert (car new))) ;; Display BUF in a window - (set-window-point (display-buffer buf) (+ (car pos) (cdr new))) + (set-window-point (display-buffer buf '(display-buffer-use-some-window (inhibit-same-window . t))) (+ (car pos) (cdr new))) (diff-hunk-status-msg line-offset (diff-xor switched reverse) nil) (when diff-advance-after-apply-hunk (diff-hunk-next)))))) @@ -1813,7 +1813,7 @@ With a prefix argument, try to REVERSE the hunk." (interactive "P") (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched) (diff-find-source-location nil reverse))) - (set-window-point (display-buffer buf) (+ (car pos) (cdr src))) + (set-window-point (display-buffer buf '(display-buffer-use-some-window (inhibit-same-window . t))) (+ (car pos) (cdr src))) (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))) @@ -1843,7 +1843,7 @@ then `diff-jump-to-old-file' is also set, for the next invocations." (let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched) (diff-find-source-location other-file rev))) - (pop-to-buffer buf) + (pop-to-buffer buf '(display-buffer-use-some-window (inhibit-same-window . t))) (goto-char (+ (car pos) (cdr src))) (diff-hunk-status-msg line-offset (diff-xor rev switched) t)))) -- 2.1.4 --=-=-=--