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 13:54:36 -0500 Message-ID: References: <87ehersl1c.fsf@wanadoo.es> <87r4irr1gp.fsf@wanadoo.es> <87mwtfr0sl.fsf@wanadoo.es> <87ip43qycu.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bacc400a9a65804d9796205 X-Trace: ger.gmane.org 1365015299 4396 80.91.229.3 (3 Apr 2013 18:54:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Apr 2013 18:54:59 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: =?ISO-8859-1?Q?=D3scar_Fuentes?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 03 20:55:26 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 1UNSqD-0008KG-Rq for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Apr 2013 20:55:26 +0200 Original-Received: from localhost ([::1]:51717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNSpo-0004bG-SS for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Apr 2013 14:55:00 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNSpU-0004aU-TK for help-gnu-emacs@gnu.org; Wed, 03 Apr 2013 14:54:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNSpR-0005UW-U8 for help-gnu-emacs@gnu.org; Wed, 03 Apr 2013 14:54:40 -0400 Original-Received: from mail-da0-x22c.google.com ([2607:f8b0:400e:c00::22c]:52900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNSpR-0005UH-L0 for help-gnu-emacs@gnu.org; Wed, 03 Apr 2013 14:54:37 -0400 Original-Received: by mail-da0-f44.google.com with SMTP id z20so785908dae.31 for ; Wed, 03 Apr 2013 11:54:36 -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:cc:content-type; bh=TA31KV0qHUKH+2+nOXSuyL12awvCpxlV/nr+Wb9bjgs=; b=TQ/40ql4xRVxGWI42Z630Y3/2u7II0rwKbCfk+KMPwSp8/lldwoETPsEbmxoOXEzKj 61+nG9k4wMckWZQ1d90uEcgBDEhDszSPYMs3Gfkg/YbLh3upnF4WZc0MTDWmUcz/Daxt 9PxepARfOV/pNohEfQdQnYS7XxLTaG5P90rMZNOd8EIpOVUEvFHH5kZhEwbkh1Z/USmG r83jN4SAYApAf83Zxcg/DxJPuZ8ydeeLFt/fOaA22KgINZHmFzJvtu9hTtXbRceUbVzw +0EgO/zQdzDHBSOfo8Y5G6I0KcszzDfrn19ltm6sfhmn0+KbPUi1ybSH836s1X80OAmE 5bQw== X-Received: by 10.66.154.164 with SMTP id vp4mr5075624pab.89.1365015276396; Wed, 03 Apr 2013 11:54:36 -0700 (PDT) Original-Received: by 10.70.6.100 with HTTP; Wed, 3 Apr 2013 11:54:36 -0700 (PDT) In-Reply-To: <87ip43qycu.fsf@wanadoo.es> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c00::22c 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:89959 Archived-At: --047d7bacc400a9a65804d9796205 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Seems legit. But then how do users typically install it? It's not like other minor modes which are part of a hook. Do they just do "auto-dim-other-buffers-mode" and it's enabled globally until they disable it the same way or quit emacs? Funny, melpa *just* updated it a few minutes ago, and it's already about to be woefully out of date again. At least the version in melpa right now is much more efficient than the last one. -Steven On Wed, Apr 3, 2013 at 1:10 PM, =D3scar Fuentes wrote: > Steven Degutis writes: > > > So it's more conventional to use a minor-mode to do this than just two > > functions? > > > > If so, is it considerably more difficult to implement it as a minor-mod= e? > > And would the code look any cleaner? > > From the POV of the user a minor mode is an standard interface for > customizing Emacs with active features. For instance, he can query Emacs > about which modes are active at any moment (M-x describe-mode). Emacs > provides some sugar for making it easy to implement minor modes. A minor > mode for this feature would be quite simple and could be implemented > with something like (not tested): > > (define-minor-mode auto-dim-other-windows-mode > "Dim the background of non-selected windows > > blah, blah, blah (more info here)" > > (if auto-dim-other-windows-mode > (auto-dim-other-windows-mode-disable) > (auto-dim-other-windows-mode-enable)) > > where auto-dim-other-windows-mode-enable/disable are the functions your > current implementation is using. > > As you can see, the code overhead is minimal. > --047d7bacc400a9a65804d9796205 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Seems legit. But then how do users typically install it? I= t's not like other minor modes which are part of a hook. Do they just d= o "auto-dim-other-buffers-mode" and it's enabled globally unt= il they disable it the same way or quit emacs?

Funny, melpa *just* updated it a few minutes ago, and it'= ;s already about to be woefully out of date again. At least the version in = melpa right now is much more efficient than the last one.

-Steven


On Wed, Apr 3, 2013 at 1:10 PM, =D3scar Fuentes <ofv@wanado= o.es> wrote:
Steven Degutis <sbdegutis@gmail.com> writes:

> So it's more conventional to use a minor-mode to do this than just= two
> functions?
>
> If so, is it considerably more difficult to implement it as a minor-mo= de?
> And would the code look any cleaner?

From the POV of the user a minor mode is an standard interface for customizing Emacs with active features. For instance, he can query Emacs about which modes are active at any moment (M-x describe-mode). Emacs
provides some sugar for making it easy to implement minor modes. A minor mode for this feature would be quite simple and could be implemented
with something like (not tested):

(define-minor-mode auto-dim-other-windows-mode
=A0 "Dim the background of non-selected windows

=A0 blah, blah, blah (more info here)"

=A0 (if auto-dim-other-windows-mode
=A0 =A0 =A0 (auto-dim-other-windows-mode-disable)
=A0 =A0 (auto-dim-other-windows-mode-enable))

where auto-dim-other-windows-mode-enable/disable are the functions your
current implementation is using.

As you can see, the code overhead is minimal.

--047d7bacc400a9a65804d9796205--