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#1806: dired-pop-to-buffer in wrong place Date: Fri, 01 May 2009 12:04:17 +0200 Message-ID: <49FAC921.5010201@gmx.at> References: <87r63gzcap.fsf@jurta.org> <87d4ezuw6w.fsf@jurta.org> <4964CB72.1090605@gmx.at> <87aba3qb5g.fsf@jurta.org> <4965AE6B.6070802@gmx.at> <87fxjtmo4z.fsf@jurta.org> <49671922.4080609@gmx.at> <87zlhubw10.fsf@jurta.org> <496DF4B9.3080805@gmx.at> <496E5F58.7030304@gmx.at> <496F11C0.4080700@gmx.at> <87ocy8fajt.fsf@jurta.org> <4975F4D5.5030000@gmx.at> <87y6tk1j47.fsf@mail.jurta.org> <49F7FE14.8010107@gmx.at> <49F969F9.5010603@gmx.at> Reply-To: martin rudalics , 1806@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030805010707070202040401" X-Trace: ger.gmane.org 1241173938 14793 80.91.229.12 (1 May 2009 10:32:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 May 2009 10:32:18 +0000 (UTC) Cc: 1806@emacsbugs.donarmstrong.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 01 12:32:08 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lzq2J-0002IE-JF for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 May 2009 12:32:08 +0200 Original-Received: from localhost ([127.0.0.1]:36308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lzq2I-0001Vs-U9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 May 2009 06:32:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lzq2D-0001Si-7m for bug-gnu-emacs@gnu.org; Fri, 01 May 2009 06:32:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lzq28-0001Qj-Co for bug-gnu-emacs@gnu.org; Fri, 01 May 2009 06:32:00 -0400 Original-Received: from [199.232.76.173] (port=35643 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lzq28-0001Qd-2k for bug-gnu-emacs@gnu.org; Fri, 01 May 2009 06:31:56 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:59893) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lzq27-000386-HY for bug-gnu-emacs@gnu.org; Fri, 01 May 2009 06:31:55 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lzq26-0006Vk-HR for bug-gnu-emacs@gnu.org; Fri, 01 May 2009 06:31:54 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n41AVpSg026899; Fri, 1 May 2009 03:31:52 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n41AF3uK021754; Fri, 1 May 2009 03:15:03 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: martin rudalics Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 01 May 2009 10:15:02 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 1806 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1806-submit@emacsbugs.donarmstrong.com id=B1806.124117242820243 (code B ref 1806); Fri, 01 May 2009 10:15:02 +0000 Original-Received: (at 1806) by emacsbugs.donarmstrong.com; 1 May 2009 10:07:08 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id n41A73Mh020233 for <1806@emacsbugs.donarmstrong.com>; Fri, 1 May 2009 03:07:05 -0700 Original-Received: (qmail invoked by alias); 01 May 2009 10:06:58 -0000 Original-Received: from 62-47-59-240.adsl.highway.telekom.at (EHLO [62.47.59.240]) [62.47.59.240] by mail.gmx.net (mp026) with SMTP; 01 May 2009 12:06:58 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX185bdd0CUY5pdXcrOKEh4NEhIqAryP5hLcEsjNw6s 8IUy+D3iPglb7M User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: X-Y-GMX-Trusted: 0 X-FuHaFi: 0.71,0.64 X-detected-kernel: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Resent-Date: Fri, 01 May 2009 06:32:00 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:27584 Archived-At: This is a multi-part message in MIME format. --------------030805010707070202040401 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit >> Maybe you can come up with some advanced technique to do that but here I >> would have to define a variable to save the current (user provided) >> `split-window-preferred-function' and call the function I save there >> within the body of the function provided by dired. > > I'd use something like > > (lexical-let ((oldfun split-window-preferred-function)) > (let ((split-window-preferred-function > (lambda () (with-selected-window TOTO (funcall oldfun))))) > BLABLA)) We probably need something like in the attached patch but my knowledge of closures within Elisp is very limited. > The above coding should be close to "standard practice" for locally > rebinding a *-function variable. The "extra variable" doesn't matter, > it's not like we count variables. > > Maybe what you're getting at is that we should make a hook to influence > the window-choice. Maybe so. But it doesn't seem urgent. I was aiming at an extra variable to work around "advanced techniques" like closures. `lexical-let' doesn't even indent reasonably :-( martin --------------030805010707070202040401 Content-Type: text/plain; name="dired.el.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="dired.el.diff" *** dired.el.~1.422.~ 2009-04-18 08:32:56.546875000 +0200 --- dired.el 2009-05-01 11:47:49.109375000 +0200 *************** *** 2686,2694 **** (defun dired-pop-to-buffer (buf) "Pop up buffer BUF in a way suitable for Dired." ! ;; Don't split window horizontally. (Bug#1806) ! (let (split-width-threshold) ! (pop-to-buffer (get-buffer-create buf))) ;; If dired-shrink-to-fit is t, make its window fit its contents. (when dired-shrink-to-fit ;; Try to not delete window when we want to display less than --- 2686,2696 ---- (defun dired-pop-to-buffer (buf) "Pop up buffer BUF in a way suitable for Dired." ! (lexical-let ((old-fun split-window-preferred-function) ! (old-window (selected-window))) ! (let ((split-window-preferred-function ! (lambda () (with-selected-window old-window (funcall old-fun))))) ! (pop-to-buffer (get-buffer-create buf)))) ;; If dired-shrink-to-fit is t, make its window fit its contents. (when dired-shrink-to-fit ;; Try to not delete window when we want to display less than --------------030805010707070202040401--