From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ami Fischman Newsgroups: gmane.emacs.devel Subject: display-buffer vs. current-buffer vs. post-command-hook Date: Tue, 04 Oct 2016 09:28:23 +0000 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1141a5243961a8053e06afcf X-Trace: blaine.gmane.org 1475573363 21291 195.159.176.226 (4 Oct 2016 09:29:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 4 Oct 2016 09:29:23 +0000 (UTC) To: "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 04 11:29:19 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brM2B-0003xj-9W for ged-emacs-devel@m.gmane.org; Tue, 04 Oct 2016 11:29:11 +0200 Original-Received: from localhost ([::1]:41062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brM29-0006v5-VK for ged-emacs-devel@m.gmane.org; Tue, 04 Oct 2016 05:29:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43901) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brM1d-0006uz-EP for emacs-devel@gnu.org; Tue, 04 Oct 2016 05:28:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brM1b-0001YW-9o for emacs-devel@gnu.org; Tue, 04 Oct 2016 05:28:36 -0400 Original-Received: from mail-io0-x229.google.com ([2607:f8b0:4001:c06::229]:35575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brM1b-0001YB-3z for emacs-devel@gnu.org; Tue, 04 Oct 2016 05:28:35 -0400 Original-Received: by mail-io0-x229.google.com with SMTP id i202so66537315ioi.2 for ; Tue, 04 Oct 2016 02:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fischman-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=mEkrfdUsrzjjkjHaIwCo1SkTeyiu8u7blT410x68STQ=; b=EQ9LtBCqeWvsywbce0HtyMfRLhsHkiL/yV1yp1sd29DLWytmy90gBAn7M+MTPxxOvW S/L0YmhbNKv4ZOwg+8bBpW0Z3A4lK3qEqWDaEYYGjfAH4fp3iZvxG863JmYeOV3St5YE S4+XDILE2ylmAvdqpZQKAOa/sWb0tFyj5FzJHdpVZMNus3iYV4xQRvunh43IaSJmypTi lc/R3GwI7SLLCKR9jAW6wMxP5U69Xbja5QmSTs4UvO8UtAhlADsuwE8B2PDxL1fwfe76 FOqabXjL+PzYLMyZE/7HQ7bVjauOgXgjwa82JT+nHH7Unt3IkwAG+TLDwtB32/fs+uSV ih/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=mEkrfdUsrzjjkjHaIwCo1SkTeyiu8u7blT410x68STQ=; b=mrKgQH14Ab1FJiE1f29St4UMsGx1xhhhkUAHajYcQUjPSghGkFpG0cuo5KYZe8hXCr repR34SvTiJ+IIL1lRevNPAMNaAn49sffeMRcUBgztbWhQ1aslXqAaOlcmsfxc5KLKgA eMumpeKpNzAm/ZhmQgPA9Es7xGY5vE10qtRZjVwsWqz2MspqqBYs9TeA9vZd7zhlXJax s6TtabY7OQZt5gGNIXPiW7Fb61/Kk++ogMufyfig7dFj+7GFf7ex0R2kkOyuERKjJgL8 d/vPW51tzlQWO7f80Ub2RcdcMWu9mhmE1x8odYiBJaKumDyqX+e8nuV6lpBaGmJyZj2c 8/cQ== X-Gm-Message-State: AA6/9RmThTVCTMlKinAxzJyw9Tg3H7puuVI7LpLNkepKyUQrnb+HnDisFwiH1ziqD4bOtkrgCx+EjwafKyuJrA== X-Received: by 10.107.31.141 with SMTP id f135mr3105417iof.5.1475573314044; Tue, 04 Oct 2016 02:28:34 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::229 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207974 Archived-At: --001a1141a5243961a8053e06afcf Content-Type: text/plain; charset=UTF-8 current-buffer returns a stale value immediately after display-buffer returns. The following snippet (saved in x.el), when loaded in 25.1.1 using [google-emacs -Q -l x.el], generates the message: *scratch* *scratch* *Help* demonstrating that (current-buffer) has a stale value after describe-key returns (I expect post to match the [run-at-time 0] value, not the pre value). (progn (setq display-buffer-alist '(("." (lambda (buffer alist) (switch-to-buffer buffer))))) (setq pre (current-buffer)) (describe-key (kbd "SPC")) (setq post (current-buffer)) (run-at-time 0 nil (lambda () (message "%s %s %s" pre post (current-buffer))))) This is an extremely reduced test case that reproduces the problem that is causing https://github.com/mina86/auto-dim-other-buffers.el/issues/10 (AFAICT). Cheers, -a --001a1141a5243961a8053e06afcf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
current-buffer returns a stale value immediately afte= r display-buffer returns.

The following snippet (s= aved in x.el), when loaded in 25.1.1 using [google-emacs -Q -l x.el], gener= ates the message:
*scratch* *scratch* *Help*
demons= trating that (current-buffer) has a stale value after describe-key returns = (I expect post to match the [run-at-time 0] value, not the pre value).

(progn
=C2=A0 (setq display-buffer-alis= t '(("." (lambda (buffer alist) (switch-to-buffer buffer)))))=
=C2=A0 (setq pre (current-buffer))
=C2=A0 (describe-ke= y (kbd "SPC"))
=C2=A0 (setq post (current-buffer))
=C2=A0 (run-at-time 0 nil (lambda () (message "%s %s %s" pr= e post (current-buffer)))))

This is an extre= mely reduced test case that reproduces the problem that is causing https://= github.com/mina86/auto-dim-other-buffers.el/issues/10=C2=A0(AFAICT).

Cheers,
-a
--001a1141a5243961a8053e06afcf--