From unknown Tue Jun 24 17:23:40 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#7381 <7381@debbugs.gnu.org> To: bug#7381 <7381@debbugs.gnu.org> Subject: Status: 24.0.50; Provide a hook run when a window is selected Reply-To: bug#7381 <7381@debbugs.gnu.org> Date: Wed, 25 Jun 2025 00:23:40 +0000 retitle 7381 24.0.50; Provide a hook run when a window is selected reassign 7381 emacs submitter 7381 =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec severity 7381 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 11 19:11:53 2010 Received: (at submit) by debbugs.gnu.org; 12 Nov 2010 00:11:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGhFB-0007GV-6o for submit@debbugs.gnu.org; Thu, 11 Nov 2010 19:11:53 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGhF9-0007GQ-CM for submit@debbugs.gnu.org; Thu, 11 Nov 2010 19:11:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGhJl-0007o2-QI for submit@debbugs.gnu.org; Thu, 11 Nov 2010 19:16:38 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:57491) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGhJl-0007ny-OA for submit@debbugs.gnu.org; Thu, 11 Nov 2010 19:16:37 -0500 Received: from [140.186.70.92] (port=36933 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGhJk-00040v-9w for bug-gnu-emacs@gnu.org; Thu, 11 Nov 2010 19:16:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGhJj-0007nQ-DP for bug-gnu-emacs@gnu.org; Thu, 11 Nov 2010 19:16:36 -0500 Received: from mail-bw0-f41.google.com ([209.85.214.41]:58548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGhJj-0007nF-8d for bug-gnu-emacs@gnu.org; Thu, 11 Nov 2010 19:16:35 -0500 Received: by bwz16 with SMTP id 16so2608114bwz.0 for ; Thu, 11 Nov 2010 16:16:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:mime-version:content-type:content-transfer-encoding; bh=09FYAjdyHSAWwOw2BBYORYtJoYegEdf6s3vC86qcNbc=; b=M+4gWvxJD2S6MOdYhx1N5Q8Sg1+WXbxSjYhj8GatuO0rDx/tyEQcrw8pCV1a8gPgdw FvgNsm4/lG3f/nAH6shrMLbS77SbQJcjii1FzLuDTY2g8vtWylTVXCEA2oDrnMA9fCNM uRH7gp/e0SsJVIGl7Kxv1XrLzD0wNA0r+do1Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; b=drTTjX1iT4+hlGeylchsLAG0/sOX8e0PXZN3B3aIhPpeSRYsitA2TLncg841ge+qIu eIqPBHkvd21oJAA7fChU8lSK3VW0SlP3lPIHfexN399okcHfgvgO3otwCCOKK6fO0tRO JhRQX/rNEwzB333kbqkm0M0HblWc0HzMPoFIs= Received: by 10.204.46.33 with SMTP id h33mr2095250bkf.95.1289520993929; Thu, 11 Nov 2010 16:16:33 -0800 (PST) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id p22sm1231859bkp.21.2010.11.11.16.16.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 11 Nov 2010 16:16:31 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: bug-gnu-emacs@gnu.org Subject: 24.0.50; Provide a hook run when a window is selected Date: Fri, 12 Nov 2010 01:14:59 +0100 Message-ID: <87k4kjfldo.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) Severity: wishlist The subject line says it all: could we get a `window-selected-hook' or `window-selected-functions' or something? Use case: I wanted to make myself a command to select the last selected window (i.e., repeating the command would toggle between two windows). After some head-scratching, the best I could come up with is this: (defun .goto-mru-window () (interactive) (select-window (frame-parameter nil '.last-selected-window))) (defadvice select-window (before .save-selected-window activate) (set-frame-parameter nil '.last-selected-window (selected-window))) ...which seems to work most of the time, but using an advice doesn't feel that great, esp. with C functions. =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Thu Nov 11 19:49:09 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 00:49:09 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGhpE-0007W7-Md for submit@debbugs.gnu.org; Thu, 11 Nov 2010 19:49:09 -0500 Received: from mail-ew0-f44.google.com ([209.85.215.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGhpD-0007Vu-7Q for 7381@debbugs.gnu.org; Thu, 11 Nov 2010 19:49:07 -0500 Received: by ewy27 with SMTP id 27so1580921ewy.3 for <7381@debbugs.gnu.org>; Thu, 11 Nov 2010 16:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=yRaZJgx9e7vrCHqBTl5nhbVFYKlI6wpaJ5ysTRWg79I=; b=n/bFLZ2wvB19u/ya3ULZbuU8MmnIqsEMsuaM5eXWGYGWaGqKpbTEf0t7bDfPIrdwW2 3bpW8A2vkXvlhTga2kaKJONj0dr7q0vnLe7RlrBbkinkS9JxAA12yFyKTzTch7BuW4IM zmjC21S8wk33E46V60YG7gUvtlYhuI+au5m9A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=l1rOwGK6jNRlPzmx3L/mBtT37ArpAbRxNyB7O9IdVYNpTlPZRtw6LvWw151rrW9ixu yD2b/wglV97DB6Q1v7U+HkwlHRmsPMiTlVw6EasWEwTuAb9ZOElSPXhlicbOZF7oXCWE 0aHjzlRU9Y0Y88bvhEZ9wSMOOBRicaKAoMNKc= Received: by 10.213.14.79 with SMTP id f15mr1508132eba.58.1289523234173; Thu, 11 Nov 2010 16:53:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.213.22.135 with HTTP; Thu, 11 Nov 2010 16:53:34 -0800 (PST) In-Reply-To: <87k4kjfldo.fsf@gmail.com> References: <87k4kjfldo.fsf@gmail.com> From: Lennart Borgman Date: Fri, 12 Nov 2010 01:53:34 +0100 Message-ID: Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) 2010/11/12 =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec : > Severity: wishlist > > The subject line says it all: could we get a `window-selected-hook' or > `window-selected-functions' or something? > > Use case: I wanted to make myself a command to select the last selected > window (i.e., repeating the command would toggle between two windows). Can't you use post-command-hook? From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 12 03:11:49 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 08:11:49 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGojd-0002UU-Ba for submit@debbugs.gnu.org; Fri, 12 Nov 2010 03:11:49 -0500 Received: from mailout-de.gmx.net ([213.165.64.23] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PGojb-0002UP-7z for 7381@debbugs.gnu.org; Fri, 12 Nov 2010 03:11:48 -0500 Received: (qmail invoked by alias); 12 Nov 2010 08:16:34 -0000 Received: from 62-47-61-179.adsl.highway.telekom.at (EHLO [62.47.61.179]) [62.47.61.179] by mail.gmx.net (mp009) with SMTP; 12 Nov 2010 09:16:34 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+jfoIGqWKjTrsZLokfUFtRIZLmLmh1d63bI3Slx0 7w3n9nNLxp2jqE Message-ID: <4CDCF7E0.40406@gmx.at> Date: Fri, 12 Nov 2010 09:16:32 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> In-Reply-To: <87k4kjfldo.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) > Use case: I wanted to make myself a command to select the last selected > window (i.e., repeating the command would toggle between two windows). > > After some head-scratching, the best I could come up with is this: > > (defun .goto-mru-window () > (interactive) > (select-window (frame-parameter nil '.last-selected-window))) > > (defadvice select-window (before .save-selected-window activate) > (set-frame-parameter nil '.last-selected-window (selected-window))) > > ...which seems to work most of the time, but using an advice doesn't > feel that great, esp. with C functions. You might want to have a look at my window-pub branch. It has window-use-time is a built-in function in `window.c'. (window-use-time &optional WINDOW) Return WINDOW's use time. WINDOW defaults to the selected window. The window with the highest use time is the most recently selected one. The window with the lowest use time is the least recently selected one. and get-mru-window is a compiled Lisp function in `window.el'. (get-mru-window &optional ALL-FRAMES) Return the most recently used window on frames specified by ALL-FRAMES. Do not return a minibuffer window. The following non-nil values of the optional argument ALL-FRAMES have special meanings: - t means consider all windows on all existing frames. - `visible' means consider all windows on all visible frames. - 0 (the number zero) means consider all windows on all visible and iconified frames. - A frame means consider all windows on that frame only. Any other value of ALL-FRAMES means consider all windows on the selected frame and no others. martin From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 12 06:22:58 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 11:22:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGrib-0003hb-PT for submit@debbugs.gnu.org; Fri, 12 Nov 2010 06:22:58 -0500 Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGria-0003hW-5w for 7381@debbugs.gnu.org; Fri, 12 Nov 2010 06:22:56 -0500 Received: by bwz12 with SMTP id 12so2925379bwz.3 for <7381@debbugs.gnu.org>; Fri, 12 Nov 2010 03:27:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :in-reply-to:references:user-agent:date:message-id:mime-version :content-type:content-transfer-encoding; bh=SorKfRdKxqsevi1o8MeKt8NGVDQKz/bMcGpP7QPKxVk=; b=cp+k2FH9nEKPFvrym6W2xnltcXjzN0UT9Bm1dLBfrcfce3gqivmZBdycF52avJnkjx S8sD+z+NzUxby9Or4c8vmYmn25ogVXLd6KOoA72/2zrP4HxEcf9kg5eVL5/oHWFuIhlR auuvRK9uSdh0bauDxu0DX5gbExcDUZxVmpbKE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=VJBpsHi3ExgGVXs7YNIwAvIpV2FGbWOPxhNaU4oVhaqD8grpcvRmoYN63gul+Cko7T igHzCMu20bVoeochTWbw7pLuBok3qAOPhLofT6M2hE3etz6U0Gj5BxePgPVmhgDdjP2r T9oGyIXIcLRo077Za8ZmUDm+/6UrSO2YCVExI= Received: by 10.204.62.139 with SMTP id x11mr2648424bkh.28.1289561264025; Fri, 12 Nov 2010 03:27:44 -0800 (PST) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id v25sm1457157bkt.6.2010.11.12.03.27.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Nov 2010 03:27:41 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Lennart Borgman Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: (Lennart Borgman's message of "Fri, 12 Nov 2010 01:53:34 +0100") References: <87k4kjfldo.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Fri, 12 Nov 2010 12:26:08 +0100 Message-ID: <87fwv6g4vj.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) Lennart Borgman writes: > 2010/11/12 =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec : >> Severity: wishlist >> >> The subject line says it all: could we get a `window-selected-hook' or >> `window-selected-functions' or something? >> >> Use case: I wanted to make myself a command to select the last selected >> window (i.e., repeating the command would toggle between two windows). > > > Can't you use post-command-hook? That sounds like an even less appropriate way to handle this than the advice. From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 12 06:28:40 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 11:28:40 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGro7-0003lJ-Os for submit@debbugs.gnu.org; Fri, 12 Nov 2010 06:28:39 -0500 Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGro5-0003lD-K0 for 7381@debbugs.gnu.org; Fri, 12 Nov 2010 06:28:39 -0500 Received: by bwz12 with SMTP id 12so2929509bwz.3 for <7381@debbugs.gnu.org>; Fri, 12 Nov 2010 03:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :in-reply-to:references:user-agent:date:message-id:mime-version :content-type:content-transfer-encoding; bh=GVkyaxkE17cJSI+sF0snlF7xAfS4QrkKxrE3iOrDpek=; b=UGnzF4n4iJv7EmpXm9yyKvmXQiH6OzEm2suVXx5NFCm9wYCnu32Cv7AfvBO77ITFqY UgLSESJrw4MFm/mYv59CENtuXsv3G4o8wc4hao7gpWf+j8LV9FUWxWdfIhRFGj9JfcSO 9ZeHuqfz1Ltp0hpqBsGIxLFDdOlmk/AWxaZJ0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=Rp+wtROPmzTjqunLI4kOJkKJdiWuZNlkvYO9JSxmwsqAqrt0IX5eTGgmch1xHyimP9 B0a1umvk4Fo4xSplNGl5DgIdUc/458zRqUsPFznCMyxH72rNQXcF7qq0LmTD5b3L+X+r OtanUjHQXVkNrWxJVIwdQg0vUh9uJeTs6cMuc= Received: by 10.204.27.20 with SMTP id g20mr2620937bkc.114.1289561605693; Fri, 12 Nov 2010 03:33:25 -0800 (PST) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id l3sm301927fan.0.2010.11.12.03.33.23 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Nov 2010 03:33:24 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: martin rudalics Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: <4CDCF7E0.40406@gmx.at> (martin rudalics's message of "Fri, 12 Nov 2010 09:16:32 +0100") References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Fri, 12 Nov 2010 12:31:52 +0100 Message-ID: <87bp5ug4lz.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.2 (---) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) martin rudalics writes: >> Use case: I wanted to make myself a command to select the last selected >> window (i.e., repeating the command would toggle between two windows). >> >> After some head-scratching, the best I could come up with is this: >> >> (defun .goto-mru-window () >> (interactive) >> (select-window (frame-parameter nil '.last-selected-window))) >> >> (defadvice select-window (before .save-selected-window activate) >> (set-frame-parameter nil '.last-selected-window (selected-window))) >> >> ...which seems to work most of the time, but using an advice doesn't >> feel that great, esp. with C functions. > > You might want to have a look at my window-pub branch. It has > > window-use-time is a built-in function in `window.c'. > > (window-use-time &optional WINDOW) > > Return WINDOW's use time. > WINDOW defaults to the selected window. The window with the highest use > time is the most recently selected one. The window with the lowest use > time is the least recently selected one. > > and > > get-mru-window is a compiled Lisp function in `window.el'. > > (get-mru-window &optional ALL-FRAMES) > > Return the most recently used window on frames specified by ALL-FRAMES. > Do not return a minibuffer window. > > The following non-nil values of the optional argument ALL-FRAMES > have special meanings: > > - t means consider all windows on all existing frames. > > - `visible' means consider all windows on all visible frames. > > - 0 (the number zero) means consider all windows on all visible > and iconified frames. > > - A frame means consider all windows on that frame only. > > Any other value of ALL-FRAMES means consider all windows on the > selected frame and no others. This is great, thank you! I'll have a look. Any reason not to have `get-mru-window' in the trunk (I actually searched for exactly that before resorting to the advice hack)? (And I guess the hook proposal still stands as well, or are there any arguments against that? One might want to do other things triggered by window selection.) =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 12 08:00:48 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 13:00:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGtFH-00056H-Kc for submit@debbugs.gnu.org; Fri, 12 Nov 2010 08:00:47 -0500 Received: from mailout-de.gmx.net ([213.165.64.22] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PGtFF-00056C-66 for 7381@debbugs.gnu.org; Fri, 12 Nov 2010 08:00:46 -0500 Received: (qmail invoked by alias); 12 Nov 2010 13:05:32 -0000 Received: from 62-47-61-179.adsl.highway.telekom.at (EHLO [62.47.61.179]) [62.47.61.179] by mail.gmx.net (mp070) with SMTP; 12 Nov 2010 14:05:32 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19htkQQK91hkrGVHf+CRdsE1PYLr5ohiELenHoAfU 4rQNYk1/VsubyZ Message-ID: <4CDD3B9B.8090309@gmx.at> Date: Fri, 12 Nov 2010 14:05:31 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> In-Reply-To: <87bp5ug4lz.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) > Any reason not to have `get-mru-window' in the trunk (I actually > searched for exactly that before resorting to the advice hack)? In general it's not very useful because the mru-window is usually the selected one (unless it was selected with NORECORD non-nil). I use it only in `delete-other-windows' when the selected window gets deleted. > (And I guess the hook proposal still stands as well, or are there any > arguments against that? One might want to do other things triggered by > window selection.) Can't you use `window-configuration-change-hook'? martin From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 12 09:50:37 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 14:50:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGuxZ-0005wX-My for submit@debbugs.gnu.org; Fri, 12 Nov 2010 09:50:37 -0500 Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGuxX-0005wP-Tk for 7381@debbugs.gnu.org; Fri, 12 Nov 2010 09:50:36 -0500 Received: by bwz12 with SMTP id 12so3112584bwz.3 for <7381@debbugs.gnu.org>; Fri, 12 Nov 2010 06:55:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :in-reply-to:references:user-agent:date:message-id:mime-version :content-type:content-transfer-encoding; bh=9MhjSLBYJwxJV/mqU6NnYJYE6G8HqghRjoB9kqS6F+I=; b=nl3W0f6wozvp8pYK/3kgLdyk3a0K425KiK7GnyEez58/8cwGzV1ejYhB9NMkybTN07 zEFTuUa4eQ05ajSuNYzcuujfopClg0FMV7dSYqFsCSEOnw55Fl5xhPDlwJEPUvFpA4zp zIVr2iWg3Kqx/uMtsdkG8QwSDmYc/8Skh01lE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=RkvC9Cxo3LnM8mSLYmgLVC+gdAIOyHG+QHM9NjyUxUhxE6UtlpYDJ7GidxanHR+IOu 3QGLwq/7R0T/EbcIWoefYnA5S+4JaewcMF7qUqpd2Bx+ja5pfzG9NRmu0OyBOjAbOviF 5sSCooAxQzjiHB725cGLd5AnPETR8RssXUIlA= Received: by 10.204.101.84 with SMTP id b20mr2846967bko.53.1289573724036; Fri, 12 Nov 2010 06:55:24 -0800 (PST) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id 4sm1549524bki.13.2010.11.12.06.55.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Nov 2010 06:55:22 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: martin rudalics Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: <4CDD3B9B.8090309@gmx.at> (martin rudalics's message of "Fri, 12 Nov 2010 14:05:31 +0100") References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Fri, 12 Nov 2010 15:53:50 +0100 Message-ID: <877hgifv9d.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.1 (---) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) martin rudalics writes: >> Any reason not to have `get-mru-window' in the trunk (I actually >> searched for exactly that before resorting to the advice hack)? > > In general it's not very useful because the mru-window is usually the > selected one (unless it was selected with NORECORD non-nil). I use it > only in `delete-other-windows' when the selected window gets deleted. Oh! I misunderstood -- I expected it to return the most recently used window other than the selected one... Well, as it is now it's not very useful at all, indeed. :-| >> (And I guess the hook proposal still stands as well, or are there any >> arguments against that? One might want to do other things triggered by >> window selection.) > > Can't you use `window-configuration-change-hook'? I don't see how that would help, as the hook is not run when a window is selected. So I'm still stuck with the advice... I guess I could at least use your `window-use-time' to manually sort the windows and select the one with the next-to-highest value. =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 12 11:26:41 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 16:26:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGwSX-0006lm-4Z for submit@debbugs.gnu.org; Fri, 12 Nov 2010 11:26:41 -0500 Received: from mailout-de.gmx.net ([213.165.64.22] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PGwSU-0006lf-He for 7381@debbugs.gnu.org; Fri, 12 Nov 2010 11:26:39 -0500 Received: (qmail invoked by alias); 12 Nov 2010 16:31:26 -0000 Received: from 62-47-37-164.adsl.highway.telekom.at (EHLO [62.47.37.164]) [62.47.37.164] by mail.gmx.net (mp050) with SMTP; 12 Nov 2010 17:31:26 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18uMoBN1XMuRvrbhxeLMj5BYi3vUk7REBIPCsV4HA K5TZQRhad4QYi3 Message-ID: <4CDD6BDC.4010305@gmx.at> Date: Fri, 12 Nov 2010 17:31:24 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> In-Reply-To: <877hgifv9d.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) >> Can't you use `window-configuration-change-hook'? > > I don't see how that would help, as the hook is not run when a window is > selected. Well, we _could_ run it when another window gets selected. But at the time we'd run it the identity of the old selected window would not be available anywhere. So this wouldn't help you much either. Basically, we could keep the old window configuration around from one "change" to the next but it's not clear whether we want to save the configuration before the last command or before the last configuration change. In the latter case, your code would hardly know whether it runs within one and the same command or within different commands. Note in this context that a single command like setting up a GDB frame may entail a couple of configuration changes and you would have to keep track of all of them. And the hook would trigger within each and every instance of `with-selected-window' or `save-window-excursion' no matter how silly these macros are occasionally used. martin From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 12 12:06:23 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 17:06:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGx4x-0007J4-DS for submit@debbugs.gnu.org; Fri, 12 Nov 2010 12:06:23 -0500 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGx4v-0007Iz-4i for 7381@debbugs.gnu.org; Fri, 12 Nov 2010 12:06:21 -0500 Received: by fxm3 with SMTP id 3so2464503fxm.3 for <7381@debbugs.gnu.org>; Fri, 12 Nov 2010 09:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :in-reply-to:references:user-agent:date:message-id:mime-version :content-type:content-transfer-encoding; bh=tGv6Njm9PGcL8BeYT4Po2tP5qSlnGyqVhT6NPPeaMj0=; b=fIC9Z/dZTJsaZ56Quu3IhKwVZBN/Msmgt1WKZeWYAY+SKCBwLN9c5joA8d+++RQ+T8 3ckhgy+RH36BrjPH8VW1N2RH/D3PKEhHZByBmqNFfWIInlLUethR/p/h+21aIApREweb K50kA/9iKgnSiQoNbOLcTvmy1ttNHt+28b6m0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=Z4PdjF7e2DLq/pSBMOObmcj47mWR8XKHkOcp8HI4T0/IQLsgC3RXXhHm/6hXiHhBE9 nITT9YWurTxmihgovpo2oPmX/q3KldrhJoMtjgca6E4WEWqd6xjRKfXTr3tF2Uc9IGQ+ Io/QP9qnfXFu1ZkIjXm8CmW6TEuX7fIpBbta8= Received: by 10.223.87.2 with SMTP id u2mr1710087fal.106.1289581869696; Fri, 12 Nov 2010 09:11:09 -0800 (PST) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id r22sm97551fax.45.2010.11.12.09.11.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Nov 2010 09:11:08 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: martin rudalics Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: <4CDD6BDC.4010305@gmx.at> (martin rudalics's message of "Fri, 12 Nov 2010 17:31:24 +0100") References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Fri, 12 Nov 2010 18:09:36 +0100 Message-ID: <8739r6foz3.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.0 (---) martin rudalics writes: >>> Can't you use `window-configuration-change-hook'? >> >> I don't see how that would help, as the hook is not run when a window is >> selected. > > Well, we _could_ run it when another window gets selected. But at the > time we'd run it the identity of the old selected window would not be > available anywhere. [...] Right, but I don't consider that too much of a problem -- I could always save the last two windows instead of just the last one, for instance. But I really don't think extending `w-c-c-hook' is the right solution. I don't see why just selecting another window should be considered a window configuration change...=20 > Basically, we could keep the old window configuration around from one > "change" to the next but it's not clear whether we want to save the > configuration before the last command or before the last configuration > change. In the latter case, your code would hardly know whether it runs > within one and the same command or within different commands. > > Note in this context that a single command like setting up a GDB frame > may entail a couple of configuration changes and you would have to keep > track of all of them. And the hook would trigger within each and every > instance of `with-selected-window' or `save-window-excursion' no matter > how silly these macros are occasionally used. ...and these caveats seem only to confirm such doubts (although some of them would apply to lesser extent to the hypothetical `select-window'-specific hook as well). What's wrong with a separate `window-selected-hook' or perhaps `select-window-hook'? [On a related note, it would be nice if there were some clean and simple way to define custom hooks attached to arbitrary functions; that would solve problems similar to this one, preventing discussions whether adding yet another hook is worth it or not. Something like: (define-function-hook 'select-window) =3D> select-window-hook (add-hook 'select-window-hook ...) Dream on...] =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 12 13:04:55 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 18:04:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGxzb-0007jn-G9 for submit@debbugs.gnu.org; Fri, 12 Nov 2010 13:04:55 -0500 Received: from mailout-de.gmx.net ([213.165.64.23] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PGxzY-0007jg-Lu for 7381@debbugs.gnu.org; Fri, 12 Nov 2010 13:04:54 -0500 Received: (qmail invoked by alias); 12 Nov 2010 18:09:40 -0000 Received: from 62-47-37-164.adsl.highway.telekom.at (EHLO [62.47.37.164]) [62.47.37.164] by mail.gmx.net (mp031) with SMTP; 12 Nov 2010 19:09:40 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18V7a4IEyMVleq2sdxwav/qtxP+VKqgA5i7yfDILn mrQ4xOg8EXyQz6 Message-ID: <4CDD82E2.9070906@gmx.at> Date: Fri, 12 Nov 2010 19:09:38 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> In-Reply-To: <8739r6foz3.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) > But I really don't think extending `w-c-c-hook' is the right > solution. I don't see why just selecting another window should be > considered a window configuration change... Agreed. >> Basically, we could keep the old window configuration around from one >> "change" to the next but it's not clear whether we want to save the >> configuration before the last command or before the last configuration >> change. In the latter case, your code would hardly know whether it runs >> within one and the same command or within different commands. >> >> Note in this context that a single command like setting up a GDB frame >> may entail a couple of configuration changes and you would have to keep >> track of all of them. And the hook would trigger within each and every >> instance of `with-selected-window' or `save-window-excursion' no matter >> how silly these macros are occasionally used. > > ...and these caveats seem only to confirm such doubts (although some of > them would apply to lesser extent to the hypothetical > `select-window'-specific hook as well). I'm afraid they would apply to the same extent. > What's wrong with a separate `window-selected-hook' or perhaps > `select-window-hook'? Nothing but the fact that it might not help you very much. Your use case was formulated in terms of commands > ... repeating the command would toggle between two windows ... and not in terms of window selections. So I don't think that Lennart's proposal of using a `post-command-hook' here is unreasonable ;-) > [On a related note, it would be nice if there were some clean and simple > way to define custom hooks attached to arbitrary functions; that would > solve problems similar to this one, preventing discussions whether adding > yet another hook is worth it or not. Something like: > > (define-function-hook 'select-window) > => select-window-hook > > (add-hook 'select-window-hook ...) > > Dream on...] Hooks can be dangerous. It's very easy to crash Emacs by putting some innocuously looking function on `window-configuration-change-hook'. BTW, I could give `get-mru-window' an additional argument like (defun get-mru-window (&optional all-frames avoid-selected) (let (best-window best-time time) (dolist (window (window-list-1 nil nil all-frames)) (setq time (window-use-time window)) (unless (and avoid-selected (eq (window (selected-window)))) (when (or (not best-time) (> time best-time)) (setq best-time time) (setq best-window window)))) best-window)) which would return nil if the selected window is the only one on ALL-FRAMES. martin From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 12 13:37:51 2010 Received: (at 7381) by debbugs.gnu.org; 12 Nov 2010 18:37:51 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGyVT-0007yj-Ad for submit@debbugs.gnu.org; Fri, 12 Nov 2010 13:37:51 -0500 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PGyVR-0007ye-T6 for 7381@debbugs.gnu.org; Fri, 12 Nov 2010 13:37:50 -0500 Received: by fxm3 with SMTP id 3so2554866fxm.3 for <7381@debbugs.gnu.org>; Fri, 12 Nov 2010 10:42:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :in-reply-to:references:user-agent:date:message-id:mime-version :content-type:content-transfer-encoding; bh=roFYBfBbyBriB4LWmU12IcuYxRZ5yYUWLKPSwkAvmuc=; b=w/UBRSC+eMgAodCc6F4BMsqANbyel260jFYW4qJhYL5h4VmJLC2d4PFPfYpZJoNMkt RVxPvFBftrf7wdy/0d8JdhhxbONbmbUdmOBw3ppxP77WRQCg/M6pXzxNS9ETcN3mVKrF uaGjtR/3t8opEbpS1hkq2BQiKEUiy6v6BoDBg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=qPv64YjCyraSZeQZA5hAGsyod/UjAgFBes9u+BfqtPHrXd15Xkmd5pMVGzx0Y8sdPZ lgjGzVPn0iYzlwiaXg7bwI+MBNL4ZPHMaJGEb6DpRzhTdZJ7dbzLP2FNhl1x4f8QVzC+ wTLG138DnBnbhoetImfD+3VRai4zXT1a4FH4k= Received: by 10.223.100.4 with SMTP id w4mr1884786fan.26.1289587357912; Fri, 12 Nov 2010 10:42:37 -0800 (PST) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id 16sm136275fal.24.2010.11.12.10.42.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Nov 2010 10:42:36 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: martin rudalics Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: <4CDD82E2.9070906@gmx.at> (martin rudalics's message of "Fri, 12 Nov 2010 19:09:38 +0100") References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Fri, 12 Nov 2010 19:40:58 +0100 Message-ID: <87y68ye66d.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) martin rudalics writes: >>> Basically, we could keep the old window configuration around from one >>> "change" to the next but it's not clear whether we want to save the >>> configuration before the last command or before the last configuration >>> change. In the latter case, your code would hardly know whether it runs >>> within one and the same command or within different commands. >>> >>> Note in this context that a single command like setting up a GDB frame >>> may entail a couple of configuration changes and you would have to keep >>> track of all of them. And the hook would trigger within each and every >>> instance of `with-selected-window' or `save-window-excursion' no matter >>> how silly these macros are occasionally used. >> >> ...and these caveats seem only to confirm such doubts (although some of >> them would apply to lesser extent to the hypothetical >> `select-window'-specific hook as well). > > I'm afraid they would apply to the same extent. Hm. Would they? A lot of window configuration changes don't involve changing the selected window. >> What's wrong with a separate `window-selected-hook' or perhaps >> `select-window-hook'? > > Nothing but the fact that it might not help you very much. Your use > case was formulated in terms of commands > >> ... repeating the command would toggle between two windows ... > > and not in terms of window selections. So I don't think that Lennart's > proposal of using a `post-command-hook' here is unreasonable ;-) No, my use case is really about the previous selected window (on a given frame), not specific commands. `select-window' is not even a command. Checking after each and every command if by any chance we changed the selected window does seem rather unreasonable to me. I'd much rather have a `select-window-hook' and keep track of the two last selected windows. >> [On a related note, it would be nice if there were some clean and simple >> way to define custom hooks attached to arbitrary functions; that would >> solve problems similar to this one, preventing discussions whether adding >> yet another hook is worth it or not. Something like: >> >> (define-function-hook 'select-window) >> =3D> select-window-hook >> >> (add-hook 'select-window-hook ...) >> >> Dream on...] > > Hooks can be dangerous. It's very easy to crash Emacs by putting some > innocuously looking function on `window-configuration-change-hook'. Well, I don't find that very persuasive. It's not like Emacs lacks other ways to shoot yourself in the foot, and you can already achieve about the same (minus the "clean and simple" part) using advice. > BTW, I could give `get-mru-window' an additional argument like > > (defun get-mru-window (&optional all-frames avoid-selected) > (let (best-window best-time time) > (dolist (window (window-list-1 nil nil all-frames)) > (setq time (window-use-time window)) > (unless (and avoid-selected > (eq (window (selected-window)))) > (when (or (not best-time) (> time best-time)) > (setq best-time time) > (setq best-window window)))) > best-window)) > > which would return nil if the selected window is the only one on > ALL-FRAMES. That'd be great, yeah (and including it in the trunk). =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 03:27:54 2010 Received: (at 7381) by debbugs.gnu.org; 13 Nov 2010 08:27:54 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHBSk-00075W-FX for submit@debbugs.gnu.org; Sat, 13 Nov 2010 03:27:54 -0500 Received: from mailout-de.gmx.net ([213.165.64.22] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PHBSh-00075P-Aj for 7381@debbugs.gnu.org; Sat, 13 Nov 2010 03:27:52 -0500 Received: (qmail invoked by alias); 13 Nov 2010 08:32:40 -0000 Received: from 62-47-61-175.adsl.highway.telekom.at (EHLO [62.47.61.175]) [62.47.61.175] by mail.gmx.net (mp034) with SMTP; 13 Nov 2010 09:32:40 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19iDZMxJxVi7dTnAuRMA2N2lN2fZD3+hncUWIYZA5 RePQIvWQmEJ9T4 Message-ID: <4CDE4D27.4000306@gmx.at> Date: Sat, 13 Nov 2010 09:32:39 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> In-Reply-To: <87y68ye66d.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) > Hm. Would they? A lot of window configuration changes don't involve > changing the selected window. I suppose you want to use a variable, say old-window, where your remember the previously selected window. Now if `window-configuration-change-hook' does not change the selected window, the selected window and old-window are the same and you don't even care. Your problem is with things like `save-window-excursion' where the selected window changes temporarily. >> Hooks can be dangerous. It's very easy to crash Emacs by putting some >> innocuously looking function on `window-configuration-change-hook'. > > Well, I don't find that very persuasive. It's not like Emacs lacks other > ways to shoot yourself in the foot, and you can already achieve about > the same (minus the "clean and simple" part) using advice. Using advice is deprecated in the Emacs sources but functions running on hooks are used. That's why the latter have to be more robust by design. > That'd be great, yeah (and including it in the trunk). Meanwhile you can simply try out for yourself by adding DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, doc: /* Return WINDOW's use time. WINDOW defaults to the selected window. The window with the highest use time is the most recently selected one. The window with the lowest use time is the least recently selected one. */) (window) Lisp_Object window; { return decode_window (window)->use_time; } ... defsubr (&Swindow_use_time); to your window.c ;-) martin From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 07:10:07 2010 Received: (at 7381) by debbugs.gnu.org; 13 Nov 2010 12:10:07 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHEvn-00009f-4t for submit@debbugs.gnu.org; Sat, 13 Nov 2010 07:10:07 -0500 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHEvl-00009G-IL for 7381@debbugs.gnu.org; Sat, 13 Nov 2010 07:10:06 -0500 Received: by fxm17 with SMTP id 17so181148fxm.3 for <7381@debbugs.gnu.org>; Sat, 13 Nov 2010 04:14:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :in-reply-to:references:user-agent:date:message-id:mime-version :content-type:content-transfer-encoding; bh=4mxVpLW2/6pOk7efC/A/t6OtpIhqmOUYmxStXEYdmEc=; b=HjKHxhCG40F4qnGlAxtlndLL5ng/PhadD5HEHPfz/onw2cqfBVGv/IfTUFQzFsJ28T MK6FjCrsuh15xUFPDJQcKdNuXF2RgP6Jz2cl0yu+GQ99AKuUxy4D8mO8Q/JF4+eff+Kv ZRVVYu+JeSgY+AKR1QyICQMhzG8qMKYt4/eXQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=tsE6rVlPiy88hw08c/VvjIrDP31ho2ZlLgMgqpCRMdwE0Y9vA472VY+c7RGU5PkdPr vNiCaC+Rz+andFSCUXz9k4YJ3G82xTHDcfg6XBECzu7wJgQYM5nSMVPJU4wp5WAJp4ix ig0rypGya+kezJyp/hiRPXSeLTTRInKJPPbuY= Received: by 10.223.96.129 with SMTP id h1mr2592149fan.94.1289650496121; Sat, 13 Nov 2010 04:14:56 -0800 (PST) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id b15sm321327fah.4.2010.11.13.04.14.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 13 Nov 2010 04:14:53 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: martin rudalics Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: <4CDE4D27.4000306@gmx.at> (martin rudalics's message of "Sat, 13 Nov 2010 09:32:39 +0100") References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Sat, 13 Nov 2010 13:13:19 +0100 Message-ID: <87tyjle80w.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) martin rudalics writes: > Meanwhile you can simply try out for yourself by adding > > DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, > doc: /* Return WINDOW's use time. > WINDOW defaults to the selected window. The window with the highest use > time is the most recently selected one. The window with the lowest use > time is the least recently selected one. */) > (window) > Lisp_Object window; > { > return decode_window (window)->use_time; > } > > ... > > defsubr (&Swindow_use_time); > > to your window.c ;-) That, together with a slightly modified `get-mru-window' definition (there is no `window-list-1' in the trunk), seems to work just fine for my purpose. Thank you very much. Could `window-use-time' and `get-mru-window' (or at least the former) be included in the trunk? =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 08:52:37 2010 Received: (at 7381) by debbugs.gnu.org; 13 Nov 2010 13:52:37 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHGWz-0001VK-8R for submit@debbugs.gnu.org; Sat, 13 Nov 2010 08:52:37 -0500 Received: from mailout-de.gmx.net ([213.165.64.23] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PHGWv-0001VF-Lg for 7381@debbugs.gnu.org; Sat, 13 Nov 2010 08:52:35 -0500 Received: (qmail invoked by alias); 13 Nov 2010 13:57:23 -0000 Received: from 62-47-61-175.adsl.highway.telekom.at (EHLO [62.47.61.175]) [62.47.61.175] by mail.gmx.net (mp031) with SMTP; 13 Nov 2010 14:57:23 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+qBrckPriqzlQMbzRWivTxz4Rbg7BM9/PbMqTbiQ rTtrNOyRlMgOyL Message-ID: <4CDE9942.1010205@gmx.at> Date: Sat, 13 Nov 2010 14:57:22 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> <87tyjle80w.fsf@gmail.com> In-Reply-To: <87tyjle80w.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) > Could `window-use-time' and `get-mru-window' (or at least the former) be > included in the trunk? Could you submit the trivial patch for `window-use-time'? I hardly ever use the trunk these days, so I'm a bit reluctant to install anything for it at the moment. If you have enough space on your disk, testing window-pub would be obviously a perfect alternative. martin From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 10:20:04 2010 Received: (at 7381) by debbugs.gnu.org; 13 Nov 2010 15:20:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHHtb-00024U-K1 for submit@debbugs.gnu.org; Sat, 13 Nov 2010 10:20:04 -0500 Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHHtZ-000245-6k for 7381@debbugs.gnu.org; Sat, 13 Nov 2010 10:20:01 -0500 Received: by bwz12 with SMTP id 12so4026845bwz.3 for <7381@debbugs.gnu.org>; Sat, 13 Nov 2010 07:24:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :in-reply-to:references:user-agent:date:message-id:mime-version :content-type:content-transfer-encoding; bh=haqF+OFbxNzROQW2JL/dC+eqfLtt8h0s072kLBCM690=; b=fBcw8eqVZgKzCzz2ieXK5BzioTtU+vS28+mZ74FQIq8NJ8mX2oQfHVNJf8bxgdyEdE hDtr6VkwSNGOCAL7H8dBCSc642dL9HmnqZBDL+3jqMDE1n8yeFXghEZLyha1ysQbHXZV DdWTLoIqv3Z8RWtUz2eISpdLYJoNnAAQMEsmg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=UbDgPDEii1Pf6nfPf/Zn4xZ6cvBpdmcrD59iMvyk93n0vpyuAncY0+FCVYeS3KvBDd 7VAicDCeVHuvDr1WRJ/hb2aLUszIjPUN1HpQfNYvUKuqLpi3cyMVrT7u5yCxVXZQQWOe 7/uQ56oxgokamjXx7vEi6IRkKGTWPr4DNxjUQ= Received: by 10.204.116.201 with SMTP id n9mr4168032bkq.138.1289661891021; Sat, 13 Nov 2010 07:24:51 -0800 (PST) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id d27sm2076724bkw.14.2010.11.13.07.24.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 13 Nov 2010 07:24:50 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: martin rudalics Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: <4CDE9942.1010205@gmx.at> (martin rudalics's message of "Sat, 13 Nov 2010 14:57:22 +0100") References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> <87tyjle80w.fsf@gmail.com> <4CDE9942.1010205@gmx.at> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Sat, 13 Nov 2010 16:23:16 +0100 Message-ID: <87pqu9dz8b.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.9 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.9 (--) martin rudalics writes: >> Could `window-use-time' and `get-mru-window' (or at least the former) be >> included in the trunk? > > Could you submit the trivial patch for `window-use-time'? I hardly ever > use the trunk these days, so I'm a bit reluctant to install anything for > it at the moment. Sure. At the end of this mail is what I have in my local trunk copy now. > If you have enough space on your disk, testing window-pub would be > obviously a perfect alternative. Well, I did checkout that branch (I'm using the Git mirror), but it seems to include much more changes than `window-use-time' and `get-mru-window', and the last merge from trunk is from 30. October. You mean you'd like to merge it into the trunk as a whole in the near future, so you're looking for more testers? -- 8< -- Subject: Add a `window-use-time' function. From: Martin Rudalics diff --git a/src/window.c b/src/window.c index 7591401..414354c 100644 --- a/src/window.c +++ b/src/window.c @@ -2420,6 +2420,17 @@ check_all_windows (void) window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); } +DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, + doc: /* Return WINDOW's use time. +WINDOW defaults to the selected window. The window with the highest use +time is the most recently selected one. The window with the lowest use +time is the least recently selected one. */) + (window) + Lisp_Object window; +{ + return decode_window (window)->use_time; +} + DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, doc: /* Return the window least recently selected or used for displ= ay. \(LRU means Least Recently Used.) @@ -7216,6 +7227,7 @@ frame to be redrawn only if it is a tty frame. */); defsubr (&Snext_window); defsubr (&Sprevious_window); defsubr (&Sother_window); + defsubr (&Swindow_use_time); defsubr (&Sget_lru_window); defsubr (&Sget_largest_window); defsubr (&Sget_buffer_window); -- =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 10:58:13 2010 Received: (at 7381) by debbugs.gnu.org; 13 Nov 2010 15:58:13 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHIUW-0002KB-Dh for submit@debbugs.gnu.org; Sat, 13 Nov 2010 10:58:12 -0500 Received: from mailout-de.gmx.net ([213.165.64.22] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PHIUU-0002K6-45 for 7381@debbugs.gnu.org; Sat, 13 Nov 2010 10:58:11 -0500 Received: (qmail invoked by alias); 13 Nov 2010 16:03:00 -0000 Received: from 62-47-45-78.adsl.highway.telekom.at (EHLO [62.47.45.78]) [62.47.45.78] by mail.gmx.net (mp014) with SMTP; 13 Nov 2010 17:03:00 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+LFGwbI4WLxCbVp0tw4aR3mEPhy+DVh22FTuw/mD MI/b47sQ3bYdTo Message-ID: <4CDEB6B3.4080504@gmx.at> Date: Sat, 13 Nov 2010 17:02:59 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> <87tyjle80w.fsf@gmail.com> <4CDE9942.1010205@gmx.at> <87pqu9dz8b.fsf@gmail.com> In-Reply-To: <87pqu9dz8b.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -1.5 (-) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.5 (-) > Well, I did checkout that branch (I'm using the Git mirror), but it > seems to include much more changes than `window-use-time' and > `get-mru-window', and the last merge from trunk is from 30. October. The last time I merged from trunk and pushed back was yesterday so maybe the Git mirror hasn't been updated yet. > You > mean you'd like to merge it into the trunk as a whole in the near > future, so you're looking for more testers? I need people who confim that it doesn't break their daily workflow before merging anything into the trunk. martin From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 10:58:22 2010 Received: (at 7381) by debbugs.gnu.org; 13 Nov 2010 15:58:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHIUg-0002KN-N9 for submit@debbugs.gnu.org; Sat, 13 Nov 2010 10:58:22 -0500 Received: from mailout-de.gmx.net ([213.165.64.23] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PHIUf-0002KH-EW for 7381@debbugs.gnu.org; Sat, 13 Nov 2010 10:58:21 -0500 Received: (qmail invoked by alias); 13 Nov 2010 16:03:11 -0000 Received: from 62-47-45-78.adsl.highway.telekom.at (EHLO [62.47.45.78]) [62.47.45.78] by mail.gmx.net (mp065) with SMTP; 13 Nov 2010 17:03:11 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1/yBcBT6qDySXTwwkxysHls5rYNCCbn9B5aa6dNT1 Zk0OdNeR3fS8M7 Message-ID: <4CDEB6BD.5030402@gmx.at> Date: Sat, 13 Nov 2010 17:03:09 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> <87tyjle80w.fsf@gmail.com> <4CDE9942.1010205@gmx.at> <87pqu9dz8b.fsf@gmail.com> In-Reply-To: <87pqu9dz8b.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -1.5 (-) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org, Chong Yidong , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.5 (-) Stefan, Chong - please consider installing the patch below. martin > diff --git a/src/window.c b/src/window.c > index 7591401..414354c 100644 > --- a/src/window.c > +++ b/src/window.c > @@ -2420,6 +2420,17 @@ check_all_windows (void) > window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); > } > > +DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, > + doc: /* Return WINDOW's use time. > +WINDOW defaults to the selected window. The window with the highest use > +time is the most recently selected one. The window with the lowest use > +time is the least recently selected one. */) > + (window) > + Lisp_Object window; > +{ > + return decode_window (window)->use_time; > +} > + > DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, > doc: /* Return the window least recently selected or used for display. > \(LRU means Least Recently Used.) > @@ -7216,6 +7227,7 @@ frame to be redrawn only if it is a tty frame. */); > defsubr (&Snext_window); > defsubr (&Sprevious_window); > defsubr (&Sother_window); > + defsubr (&Swindow_use_time); > defsubr (&Sget_lru_window); > defsubr (&Sget_largest_window); > defsubr (&Sget_buffer_window); From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 13 13:44:50 2010 Received: (at 7381) by debbugs.gnu.org; 13 Nov 2010 18:44:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHL5m-00047U-6u for submit@debbugs.gnu.org; Sat, 13 Nov 2010 13:44:50 -0500 Received: from pantheon-po16.its.yale.edu ([130.132.50.72]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PHL5j-00047P-DE for 7381@debbugs.gnu.org; Sat, 13 Nov 2010 13:44:47 -0500 Received: from furball (c-71-192-165-84.hsd1.ct.comcast.net [71.192.165.84]) (authenticated bits=0) by pantheon-po16.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id oADInd8n027541 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 13 Nov 2010 13:49:39 -0500 Received: by furball (Postfix, from userid 1000) id 2D72616062F; Sat, 13 Nov 2010 13:49:37 -0500 (EST) From: Chong Yidong To: martin rudalics Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> <87tyjle80w.fsf@gmail.com> <4CDE9942.1010205@gmx.at> <87pqu9dz8b.fsf@gmail.com> <4CDEB6BD.5030402@gmx.at> Date: Sat, 13 Nov 2010 13:49:37 -0500 In-Reply-To: <4CDEB6BD.5030402@gmx.at> (martin rudalics's message of "Sat, 13 Nov 2010 17:03:09 +0100") Message-ID: <87r5epkqim.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -3.2 (---) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org, =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.1 (---) martin rudalics writes: > Stefan, Chong - please consider installing the patch below. >> >> +DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, >> + doc: /* Return WINDOW's use time. Installed. From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 15 16:00:27 2010 Received: (at 7381) by debbugs.gnu.org; 15 Nov 2010 21:00:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PI6A7-0002zf-3F for submit@debbugs.gnu.org; Mon, 15 Nov 2010 16:00:27 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PI6A4-0002zX-Bu; Mon, 15 Nov 2010 16:00:25 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0GAA4v4UxFpY76/2dsb2JhbAChXH1ywDuFSgSEWo1f X-IronPort-AV: E=Sophos;i="4.59,201,1288584000"; d="scan'208";a="82622099" Received: from 69-165-142-250.dsl.teksavvy.com (HELO ceviche.home) ([69.165.142.250]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 15 Nov 2010 16:05:21 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 3C4E366205; Fri, 12 Nov 2010 15:55:30 -0500 (EST) From: Stefan Monnier To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected Message-ID: References: <87k4kjfldo.fsf@gmail.com> Date: Fri, 12 Nov 2010 15:55:30 -0500 In-Reply-To: <87k4kjfldo.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Fri, 12 Nov 2010 01:14:59 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) severity 7381 wishlist thanks > Use case: I wanted to make myself a command to select the last selected > window (i.e., repeating the command would toggle between two windows). We could add a select-window-hook, indeed. We'd probably only want to run it when the norecord argument is nil, but other than that I don't see any good reason not to have such a thing (tho I don't see any particularly strong reason to have such a thing either: your use case makes sense, but it's not extremely important/useful since you can get somewhat comparable results in many different ways, and I haven't seen many other use cases yet). It may come down to just adding the appropriate run_hooks call in Fselect_window, but someone will first have to check all calls to Fselect_window and make sure they can withstand running arbitrary Elisp code (currently Fselect_window cannot cause Elisp code to be run, AFAICT). Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 23 12:03:32 2010 Received: (at 7381) by debbugs.gnu.org; 23 Dec 2010 17:03:32 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PVoZf-0002lI-L2 for submit@debbugs.gnu.org; Thu, 23 Dec 2010 12:03:32 -0500 Received: from mail-fx0-f44.google.com ([209.85.161.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PVoZd-0002l7-PF for 7381@debbugs.gnu.org; Thu, 23 Dec 2010 12:03:30 -0500 Received: by fxm9 with SMTP id 9so6549609fxm.3 for <7381@debbugs.gnu.org>; Thu, 23 Dec 2010 09:10:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :in-reply-to:references:user-agent:date:message-id:mime-version :content-type:content-transfer-encoding; bh=F6MaABNOOlHvf311skGEFt6khT1dDfrAm4sKKumv/PY=; b=RziWeHB7TDYrTkO6vcKwJDhAv0e+Q8ewI4ML5vlSeUpXUbdpnmhYyg/amD03ROuuN6 yXuNaN54jHHO+6EiSn/iB+qXH9E/p1ZwE2DifcP4yChxS9liG2+QsUY+iI/ROSavOzia 8UTKG7t/wuE0peu4TFVeuxA9ersZkNlMhm3us= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=GjT8kafDoROkcvCzm4XVNEPtqB3GpXy8jQxbJzgHewWqPZ/F91z/5QB/uNiapmj9iw Dz4+M9379jMWz6UTGneikW6xHRH8kfJKAml4cK6Fne5KIPHmS2Bo1HF/8zw9NUYOXbUT 0VTC3o3mUhxV0o+rPIfUid2xzuwKjaG2bHw7g= Received: by 10.223.72.6 with SMTP id k6mr3113528faj.46.1293124206957; Thu, 23 Dec 2010 09:10:06 -0800 (PST) Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id 17sm2071749far.19.2010.12.23.09.10.01 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 23 Dec 2010 09:10:02 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Chong Yidong Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: <87r5epkqim.fsf@stupidchicken.com> (Chong Yidong's message of "Sat, 13 Nov 2010 13:49:37 -0500") References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> <87tyjle80w.fsf@gmail.com> <4CDE9942.1010205@gmx.at> <87pqu9dz8b.fsf@gmail.com> <4CDEB6BD.5030402@gmx.at> <87r5epkqim.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Date: Thu, 23 Dec 2010 18:07:53 +0100 Message-ID: <87ei98pgd2.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: 7381 Cc: martin rudalics , Stefan Monnier , 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) Chong Yidong writes: > martin rudalics writes: > >> Stefan, Chong - please consider installing the patch below. >>> >>> +DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, >>> + doc: /* Return WINDOW's use time. > > Installed. Thanks, but we also need a defsubr for it to be useful... :-) diff --git a/src/window.c b/src/window.c index e66fde9..f8031dc 100644 --- a/src/window.c +++ b/src/window.c @@ -7198,6 +7198,7 @@ frame to be redrawn only if it is a tty frame. */); defsubr (&Sprevious_window); defsubr (&Sother_window); defsubr (&Sget_lru_window); + defsubr (&Swindow_use_time); defsubr (&Sget_largest_window); defsubr (&Sget_buffer_window); defsubr (&Sdelete_other_windows); =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 24 04:24:59 2010 Received: (at 7381) by debbugs.gnu.org; 24 Dec 2010 09:25:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PW3tT-00072Q-BK for submit@debbugs.gnu.org; Fri, 24 Dec 2010 04:24:59 -0500 Received: from mailout-de.gmx.net ([213.165.64.22] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PW3tQ-00072D-Uz for 7381@debbugs.gnu.org; Fri, 24 Dec 2010 04:24:58 -0500 Received: (qmail invoked by alias); 24 Dec 2010 09:31:35 -0000 Received: from 62-47-60-95.adsl.highway.telekom.at (EHLO [62.47.60.95]) [62.47.60.95] by mail.gmx.net (mp048) with SMTP; 24 Dec 2010 10:31:35 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19EgeVIAmhEpYMUR/8CbllZ/73rK3ryw576V4XjQa K+k9htHHVNPsqM Message-ID: <4D146875.3080100@gmx.at> Date: Fri, 24 Dec 2010 10:31:33 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> <87tyjle80w.fsf@gmail.com> <4CDE9942.1010205@gmx.at> <87pqu9dz8b.fsf@gmail.com> <4CDEB6BD.5030402@gmx.at> <87r5epkqim.fsf@stupidchicken.com> <87ei98pgd2.fsf@gmail.com> In-Reply-To: <87ei98pgd2.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org, Chong Yidong , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) > Thanks, but we also need a defsubr for it to be useful... :-) Indeed. Chong, please. martin From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 29 06:14:22 2010 Received: (at 7381) by debbugs.gnu.org; 29 Dec 2010 11:14:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PXtz4-0006k6-KG for submit@debbugs.gnu.org; Wed, 29 Dec 2010 06:14:22 -0500 Received: from vm-emlprdomr-05.its.yale.edu ([130.132.50.146]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PXtz3-0006jv-I2 for 7381@debbugs.gnu.org; Wed, 29 Dec 2010 06:14:21 -0500 Received: from furball (bb220-255-229-62.singnet.com.sg [220.255.229.62]) (authenticated bits=0) by vm-emlprdomr-05.its.yale.edu (8.14.4/8.14.4) with ESMTP id oBTBLBVi028589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 29 Dec 2010 06:21:13 -0500 Received: by furball (Postfix, from userid 1000) id 65AA5160C98; Wed, 29 Dec 2010 19:21:10 +0800 (SGT) From: Chong Yidong To: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> <87tyjle80w.fsf@gmail.com> <4CDE9942.1010205@gmx.at> <87pqu9dz8b.fsf@gmail.com> <4CDEB6BD.5030402@gmx.at> <87r5epkqim.fsf@stupidchicken.com> <87ei98pgd2.fsf@gmail.com> Date: Wed, 29 Dec 2010 19:21:10 +0800 In-Reply-To: <87ei98pgd2.fsf@gmail.com> (=?utf-8?B?IsWgdMSbcMOhbiBOxJtt?= =?utf-8?B?ZWMiJ3M=?= message of "Thu, 23 Dec 2010 18:07:53 +0100") Message-ID: <87zkrohljt.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.71 on 130.132.50.146 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 7381 Cc: martin rudalics , Stefan Monnier , 7381@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec writes: > Thanks, but we also need a defsubr for it to be useful... :-) Installed, thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 30 10:59:44 2010 Received: (at 7381) by debbugs.gnu.org; 30 Dec 2010 15:59:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PYKul-0003H3-WF for submit@debbugs.gnu.org; Thu, 30 Dec 2010 10:59:44 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PYKuk-0003Gs-R6 for 7381@debbugs.gnu.org; Thu, 30 Dec 2010 10:59:43 -0500 Received: from rms by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1PYL1H-0006WI-Eo; Thu, 30 Dec 2010 11:06:27 -0500 Content-Type: text/plain; charset=ISO-8859-15 From: Richard Stallman To: Chong Yidong In-reply-to: <87zkrohljt.fsf@stupidchicken.com> (message from Chong Yidong on Wed, 29 Dec 2010 19:21:10 +0800) Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <4CDCF7E0.40406@gmx.at> <87bp5ug4lz.fsf@gmail.com> <4CDD3B9B.8090309@gmx.at> <877hgifv9d.fsf@gmail.com> <4CDD6BDC.4010305@gmx.at> <8739r6foz3.fsf@gmail.com> <4CDD82E2.9070906@gmx.at> <87y68ye66d.fsf@gmail.com> <4CDE4D27.4000306@gmx.at> <87tyjle80w.fsf@gmail.com> <4CDE9942.1010205@gmx.at> <87pqu9dz8b.fsf@gmail.com> <4CDEB6BD.5030402@gmx.at> <87r5epkqim.fsf@stupidchicken.com> <87ei98pgd2.fsf@gmail.com> <87zkrohljt.fsf@stupidchicken.com> Message-Id: Date: Thu, 30 Dec 2010 11:06:27 -0500 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: 7381 Cc: 7381@debbugs.gnu.org, stepnem@gmail.com, monnier@IRO.UMontreal.CA X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: rms@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) I think it not good design to run Lisp code due to switching windows. The existence of the possibility will make debugging much harder. What was the motive for this request? If a window is set up properly, switching away and back won't change it. It will be exactly as you left it. If there is a specific practical problem, let's look for a clean solution rather than add this hook. -- Richard Stallman President, Free Software Foundation 51 Franklin St Boston MA 02110 USA www.fsf.org, www.gnu.org From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 16 19:05:02 2014 Received: (at control) by debbugs.gnu.org; 17 Jan 2014 00:05:02 +0000 Received: from localhost ([127.0.0.1]:54213 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W3wvm-00045B-FZ for submit@debbugs.gnu.org; Thu, 16 Jan 2014 19:05:02 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:58448) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W3wvk-00044i-1O for control@debbugs.gnu.org; Thu, 16 Jan 2014 19:05:00 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1W3wvj-0003xB-Li for control@debbugs.gnu.org; Thu, 16 Jan 2014 19:04:59 -0500 Date: Thu, 16 Jan 2014 19:04:59 -0500 Message-Id: Subject: control message for bug 16436 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -5.3 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.3 (-----) merge 7381 16436 From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 12 04:15:34 2019 Received: (at 7381) by debbugs.gnu.org; 12 Jan 2019 09:15:34 +0000 Received: from localhost ([127.0.0.1]:56508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giFOA-0004Rn-4C for submit@debbugs.gnu.org; Sat, 12 Jan 2019 04:15:34 -0500 Received: from mout.gmx.net ([212.227.17.21]:48605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giFO8-0004RX-1L; Sat, 12 Jan 2019 04:15:32 -0500 Received: from [192.168.1.101] ([213.162.73.238]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MGip3-1gUir62yLx-00DXI4; Sat, 12 Jan 2019 10:15:25 +0100 Message-ID: <5C39B02C.6040309@gmx.at> Date: Sat, 12 Jan 2019 10:15:24 +0100 From: martin rudalics MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= , 7381@debbugs.gnu.org Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> In-Reply-To: <87k4kjfldo.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:dhZ0b7Q58cE3mmTeaz6+tyu4VgfAmPOIQEIj8c4sWfJcyFEwiSH JnM5dj6cibAr4NNkqPpVSYDtfsNOx48GMd9wF0LI8/o0JuInn898xa0Vs+bjCwfyeOWPXpD SMROqjmefxM/GwBSeSqsPiGKpEQb9wqrrykO7UgkEbDPNFMiQiXyTU/jSdjHRXLzdZrutdM nX/hynbFqv2UDvXV7gscA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:AqAesS6h6UQ=:0z5/TjHWBnPQVGiyCI2RTU n58HQZ81tqmlxL0N0LtYT0ku2dqs9rNG2EZs6I634uRW103XzpIPnO510wp9ikwnkMZgAk7HX ru2duc0quRahFjnEB2BfUgK/CtNhXAWhNHV7GIrzJHOesIHfm74L/4XRXrkXK5mgga0IGZbTp hBLxDGGPD7dzEDZ7suHS87gx+ArpxuhD0SKfKY8jE2SWY/thyRQyjTioevXcJawDi8qxmWKEN DdfYLOIumNh7Z42V2unRsk0o9zQtbKmuE0boo/2fN7JZm6J0j+kK+6MpWO2qtD/C1Ny3PP/L+ DMGk/MslHSUoWzq3XqNoWLOqWjiCQAv106uC9xnUjSJVzLfDRZiZc9yNhqdLTuOKUqfesTra6 vEBmqF2o3Cp2B0Ec2lMCDxW3q4E1qqKRhGPyFdKAhUyel8gNYRJVSBlcvDTcRWqCmPPM4irSq pJlh1+LG26kvOuWPIIQQ4QDqqe1Ac/7h5SWjMCvJRlvJKDj9WosyIZRBhdiVjDRPKuCFSLU7j KDLhTUs9GJxjpDcpaLUZ1BInYPPgCUA2+0IJtlY6Emc4ufyaOta7NkX+iLiAiClBq8ZDQN+bP dsFuhLbSWWlYLumwBBFeltoRvHhF4DHatd9MAeTbC7giFCkuDW9SV/e7LE3Vs7SmmcvOQXqA6 1CU0aSvJxp+3UGmcrcuZkc7KSwp76zzjdcTkbtnNi4yVnrvBbqge+KVcE+JdVHbGVIdoaV2FR PNcTfkHtxOqDLtsU4HdGoed1CJLAyXfvhJypquLrAAHwz1pyHiwagUf/mBKG5IeAeqY0IO+7j 7uTOkWnFlmXqzC8xmpKvHHAfXbUBWgDzSUp2eArApNlV85nvBNV9fnpHFwt3TTO5U9D153hNq G7tGwDm0tPZ7uOXO5zkYfB91uGKTG1+IKw3sedfdbDbYS7azNz6Dx9T4+e/FeX X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 7381 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) ;; fixed 7381 27.1 ;; quit > The subject line says it all: could we get a `window-selected-hook' or > `window-selected-functions' or something? > > Use case: I wanted to make myself a command to select the last selected > window (i.e., repeating the command would toggle between two windows). > > After some head-scratching, the best I could come up with is this: > > (defun .goto-mru-window () > (interactive) > (select-window (frame-parameter nil '.last-selected-window))) > > (defadvice select-window (before .save-selected-window activate) > (set-frame-parameter nil '.last-selected-window (selected-window))) > > ...which seems to work most of the time, but using an advice doesn't > feel that great, esp. with C functions. Current master now provides a hook run when redisplay detects that the selected window has changed wrt last redisplay. The hook is called 'window-selection-change-functions' and is described in detail in the Elisp manual. Below I sketch how that hook could be used to provide the behavior you asked for. martin (defvar .old-selected-window (selected-window)) (defun .update-old-selected-window (frame) (unless (eq .update-old-selected-window old-selected-window) (setq .old-selected-window (old-selected-window)))) (add-hook 'window-selection-change-functions '.update-old-selected-window) (defun .goto-mru-window () (interactive) (select-window .old-selected-window)) (global-set-key [(control .)] '.goto-mru-window) From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 12 04:23:19 2019 Received: (at control) by debbugs.gnu.org; 12 Jan 2019 09:23:19 +0000 Received: from localhost ([127.0.0.1]:56526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giFVe-0004eh-N0 for submit@debbugs.gnu.org; Sat, 12 Jan 2019 04:23:18 -0500 Received: from mout.gmx.net ([212.227.17.20]:38635) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giFVd-0004eU-7s for control@debbugs.gnu.org; Sat, 12 Jan 2019 04:23:17 -0500 Received: from [192.168.1.101] ([213.162.73.238]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M7CRe-1hWDQP1qje-00x36j for ; Sat, 12 Jan 2019 10:23:11 +0100 Message-ID: <5C39B1FE.7020002@gmx.at> Date: Sat, 12 Jan 2019 10:23:10 +0100 From: martin rudalics MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: Control message for Bug#7381 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:PfS2R2/bRnKZZzhDgF79rfODk3oqrrmkiifL+HbfRiN76MDjvqR X/RKKx+jHTJqdioxVBDo0kYx4xmDoNR2F3T/cS9wwlnC0SDV7b/y+dHfdrBWI5nuXY8/Ir1 H7F0UrpZf/8hFTG/8Df/BHGFN/s5cEwExMd+g9RVg2uSPPpmUbZsVhNENxK+ypHTJZVwKwN ozLt3DVqIs1A0EDJzVEXA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:3E71gr//mYE=:62Xp//x5WpwclHFgaSiSyV +JGIcJKEg9XhNilQZOVNkTKqIZ9jviNQ6MTeTbmXTyf6a9nv/w5Ft6ODIBmgi8C48bPhMPPWX gVi6Y2u/8/zpK1yer/RHFAli+tAsr5SMyMUnXxKd9j/6QZBiZV6fXitAY/h7FMvKLgzOzhLtZ AYh1vv32D7nK4e6zcuSz+eqgdMX75BcP/HqAKY3ZXkmnd2jnpkvGJ4QAWpf4AcTy0xtyEtVAN 7mLeWI5zAjbie2oAb+C/Gpdc/UOIfmEWK/LdMrlnMLRA2z0wxUX+toNYr+TNjd6HfSZDz5Ho4 9ImkBSlET77IVE/1emmmCUA2T3GdbiqlRt7wClKpoxX2cmM8MmdL/UQEyAhye90DeMwbU570D MDl7WmcizoD2PSJVTA6SqxsvN6kFkE3TIr4P2B81c6rP3zoW6Es+MeCPscRp2iX6XXgLKdI2F SOK20YcRcp+QcO9d0gUKGKky22/L3W+o8sEeoZL47Q/WOsNiQIG0EI98ETl+jSW4B60ojSrS0 v6b+Qdtp4RIG3ErftG5BMX6DBRe0zZKFIEZuXl3YtCOG4ncQ5hhppQSVi2l9SL0DdlUfcundy YzhLlmQpAI5x+9tq92iMzVP4922qSviXINBA/JGAowS39CSHmqxBGobCPjLt796QD3JKT99DO 85jygQe9v/Fe+LPyZTBYsXqJI7PvtpbtsBsBHXek20UM+WLjRH9t0sBHKcYWGOzyDAleHny85 t8FQBi8uVSTh5fAC46Plabm2q2TnM7OpMN+KMFTjnlsjRGOIlDk/PGKeCYBeYuoL/bZO5Z5oW 5fHts1n/SX51xY7Zo1GVoWvb50S2FP+S7vFDSmN/97f84G6B1uhB8mUJAF6MLSA6EvpnnHiHj TVG9kNN/2HIOPAbzREVQUQrPreoSvOSr4QOP71SSRTjeXSZieTli32kV5h4U2v X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) fixed 7381 27.1 quit From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 12 06:46:44 2019 Received: (at 7381) by debbugs.gnu.org; 12 Jan 2019 11:46:44 +0000 Received: from localhost ([127.0.0.1]:56585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giHkR-0003k5-Vu for submit@debbugs.gnu.org; Sat, 12 Jan 2019 06:46:44 -0500 Received: from mail-wm1-f49.google.com ([209.85.128.49]:34866) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giHkQ-0003jk-3m for 7381@debbugs.gnu.org; Sat, 12 Jan 2019 06:46:42 -0500 Received: by mail-wm1-f49.google.com with SMTP id t200so4733114wmt.0 for <7381@debbugs.gnu.org>; Sat, 12 Jan 2019 03:46:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-transfer-encoding; bh=o+hoIq/85hr9jNzvfyFoLkAv4wWc0+/061avs1ixtBU=; b=TDTFQSJyXgOWud7bAjAHfubdYT3NfXVfD4Y2X6ke71Kj0F8SgLMeAlRNXXDpsopGNG 8eDebW8U+YFTQERqYVopOlPog/pb3oWtm8L2UUCbyvlwhIM9o250OnkF40GASmJVBEpC 2idCrCFTLxPA0BOziZ8N6wmaWsSrGzWBjmQ8CZ/KJtvTl9BDWZ5LEZHnCYE5+xhaSk6H Nwh3VjcAZixa/PTr6Ii//F7dFHuivcP2UZ8rwg2h31Pdc5nS4GMX8gpGHIJLi+sHExWY fG1duC8fJ/jgWC+KHg8WqvuSbXzt6FaQyDrsjNGbxz/0468xSnYKLyq8Bg8zChr7FBJR DpXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=o+hoIq/85hr9jNzvfyFoLkAv4wWc0+/061avs1ixtBU=; b=Fyn9mXh5Py/tC+mKvp3JHCEu4OfoD1BZ3sJ6faIU+iVPBcVLQ31R+vwLbONeXmmVvP 9tfycWsF6g8Fe/F9/8XPAiIjhjdZTrHubBOrdqdUaNn+7GkyNBNfO/3N2fdOYbCO+CN0 THP2MrGePghAZL7ycnf5g9YfNDHA1/jZXwW2pVEJD7A8Mz30ZUVXs0KjzFK3KN4NOInY UA34Uq00LFfq7CzkLyxO/Noo8MJKHxoUBLWOkRen40aOUwlRSqYfaqfVLwICZFka4FCe odVDQCMaS3MXfrrbt6CI7oBYlhzsM8fIZ8ElZ6Bx0IoekXXHjXvqlHEvIeny5pRsWGQJ SvNw== X-Gm-Message-State: AJcUukcxPWQS3t51w9CcqKUi9oVEl/PCiQcW56kRMmQy45Y/2gnkVlQu 97FtcdqMcryNL6U1OojNOLk= X-Google-Smtp-Source: ALg8bN4rvw3ON7KWHM48h4wHaH9ZKWKxUeDvMqr3QXp4XesprbFkh7fIMvON50leqzFBNIE8QCs1vg== X-Received: by 2002:a1c:7616:: with SMTP id r22mr5535037wmc.35.1547293596141; Sat, 12 Jan 2019 03:46:36 -0800 (PST) Received: from localhost ([185.112.167.114]) by smtp.gmail.com with ESMTPSA id j24sm78291222wrd.86.2019.01.12.03.46.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 Jan 2019 03:46:35 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: martin rudalics , 7381@debbugs.gnu.org Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: <5C39B02C.6040309@gmx.at> References: <87k4kjfldo.fsf@gmail.com> <5C39B02C.6040309@gmx.at> User-Agent: Notmuch/0.28 (https://notmuchmail.org) Emacs/26.1 (x86_64-pc-linux-gnu) Date: Sat, 12 Jan 2019 12:46:34 +0100 Message-ID: <87lg3qdrol.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 7381 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.9 (/) On Sat, 12 Jan 2019 10:15:24 +0100 martin rudalics wrote: > Current master now provides a hook run when redisplay detects that the > selected window has changed wrt last redisplay. The hook is called > 'window-selection-change-functions' and is described in detail in the > Elisp manual. Thank you very much. Despite still using GNU Emacs daily, I currently don't follow the development version so I can't test the changes, but I really appreciate your getting back to this after so many years. > Below I sketch how that hook could be used to provide > the behavior you asked for. > (defvar .old-selected-window (selected-window)) > > (defun .update-old-selected-window (frame) > (unless (eq .update-old-selected-window old-selected-window) > (setq .old-selected-window (old-selected-window)))) It seems to me this was meant to read (defun .update-old-selected-window (frame) (unless (eq .old-selected-window (old-selected-window)) (setq .old-selected-window (old-selected-window)))) Thanks, =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 12 09:12:28 2019 Received: (at 7381) by debbugs.gnu.org; 12 Jan 2019 14:12:28 +0000 Received: from localhost ([127.0.0.1]:56640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giK1S-0000t6-Lt for submit@debbugs.gnu.org; Sat, 12 Jan 2019 09:12:28 -0500 Received: from mout.gmx.net ([212.227.15.18]:48877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giK1O-0000sq-KE for 7381@debbugs.gnu.org; Sat, 12 Jan 2019 09:12:25 -0500 Received: from [192.168.1.101] ([213.162.73.238]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LZynd-1h7Azd0ClR-00ljYe; Sat, 12 Jan 2019 15:12:16 +0100 Message-ID: <5C39F5BD.7080500@gmx.at> Date: Sat, 12 Jan 2019 15:12:13 +0100 From: martin rudalics MIME-Version: 1.0 To: =?UTF-8?B?xaB0xJtww6FuIE7Em21lYw==?= , 7381@debbugs.gnu.org Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected References: <87k4kjfldo.fsf@gmail.com> <5C39B02C.6040309@gmx.at> <87lg3qdrol.fsf@gmail.com> In-Reply-To: <87lg3qdrol.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:8kI73BWXuti6VObw0Tq8hx6Cjl5wXvFHYhC4hcAprJXgyhFXPYW U23VzVdAJYj0CNSCUM8P8YgUwtYPQsrtaegUkWRZKQ0DVFTc6lVx9zy+T74TmPJlrnyjR9C ABCDnsOTJ5oI5EYGCi0/ENUqHqW1sT5qweM6t9LIxqwHpNQIokeNouNYLkZ86lenW4RVH6B e4Fe7boRr+rkI9rdgi65Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:7OpgqynK06Q=:pyXYHUpCleGM9vMa211isQ nvmDFoGhYvXMKSdviUd9mMSaWzdE5xy8TMJjVw0xWbG4KlMR7/hON7jCN6HGBIVFNEXY0g3Wr 2mYPdubKLnyzH59xKseJy41NlOecA/Z8A/ws6eR5+93txn8XEdyvIifE++jzTyIcaT6+zJtDu dbkRyd2xZyGekVAGfiarP6aVcptp4D8FvS9RuXXMf9R01Yud3aW6RNXyvvxHmBsOygUP1FaPH MN6s1J+uZbXeIo1ABwZ2S5XomIef5L90Ig2W0qmzg0TtTQS7cpAZDSxuRXb/bz/j1mxssglcs n6yqu1+W5ewjpNOenv/0iPduusyCgEfae2FXaQDyEGyI5xrNCmjsZ4dUv29usFWlh1Yew0afU 9xh5Vp/SyNuUZlOWJiCPl7POlqLy5IcfJ52Kp6pXA2NoEY/p3Tb76V0RKYMjM9VhkkwdrKRxu WVkWfVoCEXLABVEFNBtJrFFF8x5D5LxiOnA+N9XXgLyIOEYnUpcERrRNpB1WbUd1cqqhwtm15 3k/E4gadUyAQWVFP+aep4NYDKk5EQ9L2zfP+mwnfoM0Dus+YRTC25D738CafxRBHOdqWTaS45 i0AI4PY4tnirBNkNAI2J6/46DcCPDh9JkS/s2t+IQIYL/7p7dnr158lUOHKSYMwGReTuyChru q5erXt8mA6R+f1uydMPKUKQqSJlFVIUK2MKvMNleWXVTOHEaqLGoyE4phjpdxIo5yg6Y+3gqZ H/q0v9MR/H0UWJWIRRo3guk4aSfJP0E8ERntdHhv2pjuQkm67GCEQa9cS80LpaQPfZv1E0PSh ZkwXrPs28zellUA0EuZmSl7lsVxbupKmCzW4PNRUeSiscWFq5FYSKT+KYzCHwluCHRn5dVUhu N+m8fmLrKl3ay5RzzbyxJ1QgWt/D6bDJUw85wjV8ldRPNoYZ4VSqCA7kTk26qJ X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 7381 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >> (defun .update-old-selected-window (frame) >> (unless (eq .update-old-selected-window old-selected-window) >> (setq .old-selected-window (old-selected-window)))) > > It seems to me this was meant to read > > (defun .update-old-selected-window (frame) > (unless (eq .old-selected-window (old-selected-window)) > (setq .old-selected-window (old-selected-window)))) Indeed. I posted the example to make the point that (defun .update-old-selected-window (frame) (setq .old-selected-window (old-selected-window))) is a bad idea since it would overwrite the last selected window that was different from the currently selected one. BTW, did you ever try something like (defun .goto-mru-window () (interactive) (select-window (get-mru-window nil nil t))) (global-set-key [(control .)] '.goto-mru-window) It should provide the same service for older Emacsen. martin From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 12 09:58:22 2019 Received: (at 7381) by debbugs.gnu.org; 12 Jan 2019 14:58:22 +0000 Received: from localhost ([127.0.0.1]:57042 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giKju-00020M-GE for submit@debbugs.gnu.org; Sat, 12 Jan 2019 09:58:22 -0500 Received: from mail-wr1-f48.google.com ([209.85.221.48]:46483) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giKjt-000208-58 for 7381@debbugs.gnu.org; Sat, 12 Jan 2019 09:58:21 -0500 Received: by mail-wr1-f48.google.com with SMTP id l9so18176686wrt.13 for <7381@debbugs.gnu.org>; Sat, 12 Jan 2019 06:58:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-transfer-encoding; bh=+Fx0SyEiDFJIw/ugHNXuj68fiIDcXn19HZYDuHr6vPg=; b=qmH4RVnE4TjPXcyv/VTvPZqcTRnwRhYDqvhwn90rBzq2MDl+qbowemSLWoQY5bA6w8 IJwI8MSMrsqmuK1Lc1m0fi3+1k8dtm3HrK9yfV31bpmZ46E3wkbJHO9kRBm8SUk9ftAK g1HGGcxOWg0clvlQgLARxsITNzAfs1cdc//Obh/yK2dSLSyF0sTQoGhsaWZgrECDcQ1D Gh+Xfc6MZuiwSVE09dOLAL+lJiG1HcVOnK8gS9LXuL0Thv8trXjrLO4lsUO5s2LUCpPz xT82yoroqHjL8NM0wR/wEC7slmD7vLu6FlIrP/OcjFrOlnpB9sYHB/cFOLwndfhopmE/ Dr4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-transfer-encoding; bh=+Fx0SyEiDFJIw/ugHNXuj68fiIDcXn19HZYDuHr6vPg=; b=aj9gCSBx6Op4dat8k4cELlurH+eL9lxUGOgqg34J6nMvCZqi+OKTRmF1fax02uW0EF 9ljdEY/yw4iPg/fjlJ9B89o38ksDKqrmTw2qK/yjXuQC4+uHoghNh25PBQzbx4xg4A/b Glr9jquIoBMNkXmkHzKqkKzhrgiNYbUU+HUCC44k+SYvjBwbLwDyEb/+f2adPl7oWgJS OlhEDAC7a03S1ILcY6aBv+0r9T9ofiFfoQ4N0dFhJJJBHtG+6Dv3NJFNlEKOFZoP7ShY dCF5pY4FH/A51INfYDv3hZDlMFFco2fpTnQMvRhSoDqPtwA3PbcqCWm4bvxcLOdlvk34 GUxQ== X-Gm-Message-State: AJcUuke0xIb8UBoSU8sRQDJjLRDu+5ws/DX3qdxMYfVRsUsGfErWiv/W sg32JJOdowptbwdMC9Ed3/4= X-Google-Smtp-Source: ALg8bN6slEJSZQtBbR14YcM2imfj68FGin8pcNdtRp6Il3X6JSxI2z28RoPdLpdbuo7CzXW+AfqLAA== X-Received: by 2002:adf:8b83:: with SMTP id o3mr18380854wra.81.1547305094249; Sat, 12 Jan 2019 06:58:14 -0800 (PST) Received: from localhost ([185.112.167.114]) by smtp.gmail.com with ESMTPSA id f10sm3354069wmb.35.2019.01.12.06.58.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 12 Jan 2019 06:58:13 -0800 (PST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: martin rudalics , 7381@debbugs.gnu.org Subject: Re: bug#7381: 24.0.50; Provide a hook run when a window is selected In-Reply-To: <5C39F5BD.7080500@gmx.at> References: <87k4kjfldo.fsf@gmail.com> <5C39B02C.6040309@gmx.at> <87lg3qdrol.fsf@gmail.com> <5C39F5BD.7080500@gmx.at> User-Agent: Notmuch/0.28 (https://notmuchmail.org) Emacs/26.1 (x86_64-pc-linux-gnu) Date: Sat, 12 Jan 2019 15:58:12 +0100 Message-ID: <87h8edexdn.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 7381 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.9 (/) On Sat, 12 Jan 2019 15:12:13 +0100 martin rudalics wrote: > >> (defun .update-old-selected-window (frame) > >> (unless (eq .update-old-selected-window old-selected-window) > >> (setq .old-selected-window (old-selected-window)))) > > > > It seems to me this was meant to read > > > > (defun .update-old-selected-window (frame) > > (unless (eq .old-selected-window (old-selected-window)) > > (setq .old-selected-window (old-selected-window)))) > > Indeed. I posted the example to make the point that > > (defun .update-old-selected-window (frame) > (setq .old-selected-window (old-selected-window))) > > is a bad idea since it would overwrite the last selected window that > was different from the currently selected one. Of course. > BTW, did you ever try something like > > (defun .goto-mru-window () > (interactive) > (select-window (get-mru-window nil nil t))) I don't remember, but given that I do have a `.get-mru-window' function of my own, as well as the fact that e.g. evil-mode's `evil-window-mru' definition doesn't use `get-mru-window' either, makes me think that it either wasn't available at the time or doesn't do what I or evil authors wanted. Thanks again, =C5=A0t=C4=9Bp=C3=A1n From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 12 13:53:25 2019 Received: (at control) by debbugs.gnu.org; 12 Jan 2019 18:53:25 +0000 Received: from localhost ([127.0.0.1]:57108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giOPN-0007Sm-KC for submit@debbugs.gnu.org; Sat, 12 Jan 2019 13:53:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giOPL-0007Sa-Rh for control@debbugs.gnu.org; Sat, 12 Jan 2019 13:53:24 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giOPC-00049z-GH for control@debbugs.gnu.org; Sat, 12 Jan 2019 13:53:15 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1giOPC-00037z-5g for control@debbugs.gnu.org; Sat, 12 Jan 2019 13:53:14 -0500 Subject: control message for bug 7381 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Sat, 12 Jan 2019 13:53:14 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) # e567ac1 close 7381 From unknown Tue Jun 24 17:23:40 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 10 Feb 2019 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator