From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: `auto-dim-other-windows` -- scrutiny invited Date: Wed, 03 Apr 2013 15:11:47 +0200 Message-ID: <874nfng3n0.fsf@web.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1364994727 13358 80.91.229.3 (3 Apr 2013 13:12:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Apr 2013 13:12:07 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 03 15:12:33 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UNNUP-0002KS-F1 for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Apr 2013 15:12:33 +0200 Original-Received: from localhost ([::1]:42388 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNNU0-0000DL-K9 for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Apr 2013 09:12:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNNTn-0000D9-CL for help-gnu-emacs@gnu.org; Wed, 03 Apr 2013 09:11:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNNTi-0004Kr-EM for help-gnu-emacs@gnu.org; Wed, 03 Apr 2013 09:11:55 -0400 Original-Received: from mout.web.de ([212.227.17.12]:53008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNNTi-0004Kg-4l for help-gnu-emacs@gnu.org; Wed, 03 Apr 2013 09:11:50 -0400 Original-Received: from drachen.dragon ([92.74.136.91]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0Lh6fv-1V0p6J0GIR-00oHCX; Wed, 03 Apr 2013 15:11:48 +0200 Mail-Followup-To: help-gnu-emacs@gnu.org, help-gnu-emacs@gnu.org In-Reply-To: (=?utf-8?Q?=22=C3=93scar?= Fuentes"'s message of "Wed, 03 Apr 2013 00:19:23 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Provags-ID: V02:K0:CeNPRelW0s2LUpww7ow2JrmUf7fLZdWpVYvSEhYGmf6 y4l7o0kyDs1WSZ0OW+47CULB8J32uDI/y+WzcerAA87v98w/05 0m8ZsvQjyWEPk81kp3fdM7yZY6HbLwfC4XvZUAmKvwML61qBTL Cg6umLmv0dbtpJVRvp4Z+SfROVgfGIfUpS5D0LBh9c5auYPmlQ xxPHDXVoquyylseLF1AiN0F5gz4EBq5/C4oPnqbGzQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:89929 Archived-At: =C3=93scar Fuentes writes: > Steven Degutis writes: > > > (defun auto-dim-other-windows () > > (make-face 'sd/dimmed-font) > > (set-face-attribute 'sd/dimmed-font nil :background "black") > > > > (defun sd/prominantize-current-buffer (fn) > > (buffer-face-set 'sd/dimmed-font) > > (funcall fn) > > (buffer-face-set nil)) > > > > (defmacro sd/advise-window-changing-fn (fn) > > `(defadvice ,fn (around window-changing-fn-advice activate) > > (sd/prominantize-current-buffer (lambda () ad-do-it)))) > > > > (sd/advise-window-changing-fn other-window) > > (sd/advise-window-changing-fn other-frame) > > (sd/advise-window-changing-fn next-buffer) > > (sd/advise-window-changing-fn previous-buffer) > > (sd/advise-window-changing-fn quit-window) > > (sd/advise-window-changing-fn mouse-select-window)) > > Interesting idea. > > Some observations (in case you already are interested on bugs & > enhancements): > > Newly created windows doesn't show the effect (to replicate just do M-x > 2). It is necessary to have different buffers on each window and move > the cursor form one to another one time to trigger the background > change. One could use `window-configuration-change-hook' for that. In general, I don't think it's a good idea to advice Emacs primitives for that purpose. And probably it will be hard to find all necessary functions to advice. What if the user has defined own commands to select windows? Or uses other packages that do so, e.g. winner? That's why I suggested using `post-command-hook' instead. Regards, Michael.