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: Hooks for new buffers? Date: Thu, 4 Apr 2013 15:12:25 -0500 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bf0c1b8cfd2e404d98e9647 X-Trace: ger.gmane.org 1365106375 15518 80.91.229.3 (4 Apr 2013 20:12:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Apr 2013 20:12:55 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 04 22:13:21 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 1UNqX9-0005pR-1a for geh-help-gnu-emacs@m.gmane.org; Thu, 04 Apr 2013 22:13:19 +0200 Original-Received: from localhost ([::1]:40119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNqWk-0002Wj-4M for geh-help-gnu-emacs@m.gmane.org; Thu, 04 Apr 2013 16:12:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNqWR-0002UM-Ff for help-gnu-emacs@gnu.org; Thu, 04 Apr 2013 16:12:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNqWI-0002wW-Sx for help-gnu-emacs@gnu.org; Thu, 04 Apr 2013 16:12:35 -0400 Original-Received: from mail-pd0-f182.google.com ([209.85.192.182]:33735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNqWI-0002wQ-MB for help-gnu-emacs@gnu.org; Thu, 04 Apr 2013 16:12:26 -0400 Original-Received: by mail-pd0-f182.google.com with SMTP id 3so1614331pdj.27 for ; Thu, 04 Apr 2013 13:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=LeW20GW67diM62heVTLSaIAtjSqp9rF0zSqQaOd78To=; b=ZfXRjy8PxgjA/NDDHnp4eSPypEK+I4yYokQiZ726TDx+feBMLslpS3PMtbXdhNeVfb quekQgsa6FA8tHjq388oeKI2cImYzQD+BXtx4nyibxvU063ihYC02EmfETJhoIxA9V4m bzGlqmwB6XvA83tY10Kvo3aalERCXaCQ3gDKOHVNDCjS1ctHF2TBxXQOs7JRsUscd1DZ 5myCXkVObTbvY8oYdn26LIn7kVvRIh0sJEPHrVsdDiptXd8l4Ejtzyb4nzV/PH5pB1CI 8zdhvftDFQdZUH7OrVIPwfYMjwBF0YNeJPEjBgiem7VaqRBwzTqGo9d6ahBPqS5iY8lw JHjA== X-Received: by 10.66.117.196 with SMTP id kg4mr11268561pab.95.1365106345625; Thu, 04 Apr 2013 13:12:25 -0700 (PDT) Original-Received: by 10.70.6.100 with HTTP; Thu, 4 Apr 2013 13:12:25 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.192.182 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:89991 Archived-At: --047d7bf0c1b8cfd2e404d98e9647 Content-Type: text/plain; charset=ISO-8859-1 I wrote auto-dim-other-buffers.el ( https://github.com/sdegutis/auto-dim-other-buffers.el) a few days ago, which applies a "dimmed" face to non-current buffers. It adds to post-command-hook and after-change-major-mode-hook, the first as a catch-all "something changed" and the second as a hacky way of saying "a new buffer just got created". This mostly works. But sometimes new buffers are created that don't change major modes. For example, *magit-process* gets created at some point, and when I show it via $ inside magit-status, it's not dimmed. So it's not changing major modes. When I show the buffer via $, it probably triggers the post-command-hook, but my hook tries to be efficient, by only looking at the previous current-buffer and the new current-buffer. And this isn't either of those, since it just shows up in a new window but isn't given focus. I'm sure there are other situations like this. The easiest way to solve this is to find a hook that's called when new buffers are created, even if that's not its official purpose. Apparently after-change-major-mode-hook isn't enough, presumably because these never changed major modes. So is there such a hook? And if not, is there at least some hook that happens whenever new windows are opened? -Steven --047d7bf0c1b8cfd2e404d98e9647 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I wrote auto-dim-other-buffers.el (https://github.com/sdegutis/auto= -dim-other-buffers.el) a few days ago, which applies a "dimmed&quo= t; face to non-current buffers.

It adds to post-command-hook and after-change-major-mode-hoo= k, the first as a catch-all "something changed" and the second as= a hacky way of saying "a new buffer just got created".

This mostly works. But sometimes new buffers are create= d that don't change major modes. For example, *magit-process* gets crea= ted at some point, and when I show it via $ inside magit-status, it's n= ot dimmed. So it's not changing major modes.

When I show the buffer via $, it probably trigger= s the post-command-hook, but my hook tries to be efficient, by only looking= at the previous current-buffer and the new current-buffer. And this isn= 9;t either of those, since it just shows up in a new window but isn't g= iven focus. I'm sure there are other situations like this.

The easiest way to solve this is to find a = hook that's called when new buffers are created, even if that's not= its official purpose. Apparently after-change-major-mode-hook isn't en= ough, presumably because these never changed major modes. So is there such = a hook?

And if not, is there at least some hook tha= t happens whenever new windows are opened?

-Steven
--047d7bf0c1b8cfd2e404d98e9647--