From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Steven Degutis Newsgroups: gmane.emacs.help Subject: Re: `auto-dim-other-windows` -- scrutiny invited Date: Wed, 3 Apr 2013 08:19:49 -0500 Message-ID: References: <874nfng3n0.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec520f493620fc304d974b578 X-Trace: ger.gmane.org 1364995222 21539 80.91.229.3 (3 Apr 2013 13:20:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Apr 2013 13:20:22 +0000 (UTC) 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:20:49 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 1UNNcN-000858-Og for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Apr 2013 15:20:47 +0200 Original-Received: from localhost ([::1]:44726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNNbu-0002Bd-Tg for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Apr 2013 09:20:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNNbd-000273-TC for help-gnu-emacs@gnu.org; Wed, 03 Apr 2013 09:20:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNNbS-000791-Fq for help-gnu-emacs@gnu.org; Wed, 03 Apr 2013 09:20:01 -0400 Original-Received: from mail-pa0-f53.google.com ([209.85.220.53]:42279) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNNbS-00078u-78 for help-gnu-emacs@gnu.org; Wed, 03 Apr 2013 09:19:50 -0400 Original-Received: by mail-pa0-f53.google.com with SMTP id bh4so894259pad.26 for ; Wed, 03 Apr 2013 06:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=AhwTOe5K3r2OAS9UV9ftSPrG5zkMj2OFigNqf9dXBuo=; b=Lxj7OJLBCuJgez0SOWAHJebbJvtJ8zypf3d8Fsco/9QDA8GmtJR09KQEeY4Tre1kij SSYb84S3fMY26TrFl00ZddwsHRnC495Je5fk6kfEzFJLJlI5sdIzdwfEMeKg4IXm+5IL PXHOtulbdGk5PjbT8pl7Pi0lWUBNQigS3JNVs4hl2zAMwva6wJPvUBCPuSnCUmsgEjBi mwGFZrToUbPZXXj6xDhfThe8NXST2Z5vjWjSy/Bzgs4AKDYjFNBlx8mxCLcOa5erHl78 K1TI6GgaBknFnRQIpiRVPATsVbw75YRH93co3DnPhcajLqHBfhKZkBa43XDQtKRO+oXY mepQ== X-Received: by 10.66.6.42 with SMTP id x10mr3118923pax.218.1364995189376; Wed, 03 Apr 2013 06:19:49 -0700 (PDT) Original-Received: by 10.70.6.100 with HTTP; Wed, 3 Apr 2013 06:19:49 -0700 (PDT) In-Reply-To: <874nfng3n0.fsf@web.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.53 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:89930 Archived-At: --bcaec520f493620fc304d974b578 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks. `post-command-hook` works better than `window-configuration-change-hook`. -Steven On Wed, Apr 3, 2013 at 8:11 AM, Michael Heerdegen wrote: > =D3scar 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. > > --bcaec520f493620fc304d974b578 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks. `post-command-hook` works better than `window-conf= iguration-change-hook`.

-Steven


On Wed, Apr 3, 2013 = at 8:11 AM, Michael Heerdegen <michael_heerdegen@web.de> wrote:
=D3scar Fuentes <ofv@wanadoo.es> writes:

> Steven Degutis <sbdegutis@gm= ail.com> writes:
>
> > =A0 =A0 (defun auto-dim-other-windows ()
> > =A0 =A0 =A0 (make-face 'sd/dimmed-font)
> > =A0 =A0 =A0 (set-face-attribute 'sd/dimmed-font nil :backgrou= nd "black")
> >
> > =A0 =A0 =A0 (defun sd/prominantize-current-buffer (fn)
> > =A0 =A0 =A0 =A0 (buffer-face-set 'sd/dimmed-font)
> > =A0 =A0 =A0 =A0 (funcall fn)
> > =A0 =A0 =A0 =A0 (buffer-face-set nil))
> >
> > =A0 =A0 =A0 (defmacro sd/advise-window-changing-fn (fn)
> > =A0 =A0 =A0 =A0 `(defadvice ,fn (around window-changing-fn-advice= activate)
> > =A0 =A0 =A0 =A0 =A0 =A0(sd/prominantize-current-buffer (lambda ()= ad-do-it))))
> >
> > =A0 =A0 =A0 (sd/advise-window-changing-fn other-window)
> > =A0 =A0 =A0 (sd/advise-window-changing-fn other-frame)
> > =A0 =A0 =A0 (sd/advise-window-changing-fn next-buffer)
> > =A0 =A0 =A0 (sd/advise-window-changing-fn previous-buffer)
> > =A0 =A0 =A0 (sd/advise-window-changing-fn quit-window)
> > =A0 =A0 =A0 (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 d= o M-x
> 2). It is necessary to have different buffers on each window and move<= br> > 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 primitiv= es
for that purpose. =A0And probably it will be hard to find all necessary
functions to advice. =A0What if the user has defined own commands to
select windows? =A0Or uses other packages that do so, e.g. winner?
That's why I suggested using `post-command-hook' instead.


Regards,

Michael.


--bcaec520f493620fc304d974b578--