GNU bug report logs - #79984
30.1.90; post-command-hook doesn't run after an emacsclient connection

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Spencer Baugh <sbaugh@HIDDEN>; Done: Eli Zaretskii <eliz@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 79984-done <at> debbugs.gnu.org:


Received: (at 79984-done) by debbugs.gnu.org; 17 Jan 2026 16:07:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 17 11:07:46 2026
Received: from localhost ([127.0.0.1]:60329 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vh8q1-00083j-Us
	for submit <at> debbugs.gnu.org; Sat, 17 Jan 2026 11:07:46 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:41074)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vh8pz-00083M-LT
 for 79984-done <at> debbugs.gnu.org; Sat, 17 Jan 2026 11:07:44 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vh8pt-0002Rt-In; Sat, 17 Jan 2026 11:07:37 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=FWMPvLjjgHbb1UmZWfF0/FNmlv2m2R89LcM7kIdeXaM=; b=kvJsTuDeFzoq
 x+5SMKenVFaFofHlU6FSprYfTzhGCOrMoGG5C0Q6MmayRpu7pTODSs45eMdYF6fXRup9R9FzTAd9z
 SQcVyKjowRZ9TP+UAazVGCVGlidUSG5bkOV7ieaqIxWGsgFSNTyNoCxSAMSt35FzfoM4uwxjf3yRB
 2mcIpgeNuTgeyWvbvL6MOUHsCz63XOMS1b8Wknhx0TsoCdgjSS+NabK+PiqOZvJ9XhGXD+K30rnmM
 NlHm1mp4xGi6GH9Emg/PHWBnBSzuTNFnUeLdI+LDWD5wFlqCRMHVOsVJUijOoYeQzFcqV/yfDsE1b
 Rpd2j02x5+o74wUb6qQcag==;
Date: Sat, 17 Jan 2026 18:07:35 +0200
Message-Id: <86cy38ql2w.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <CAO=BR8PGMV8jthXxq3ypi0_WMOsdU_QESHAhiRSjgrGa8zZPAA@HIDDEN>
 (message from Spencer Baugh on Sat, 17 Jan 2026 09:28:19 -0500)
Subject: Re: bug#79984: 30.1.90; post-command-hook doesn't run after an
 emacsclient connection
References: <ierldjarxos.fsf@HIDDEN>
 <jwvqzt1w61r.fsf-monnier+emacs@HIDDEN>
 <ierikebd15r.fsf@HIDDEN> <jwvecozplnu.fsf-monnier+emacs@HIDDEN>
 <ierecozcod6.fsf@HIDDEN> <86y0mfkngv.fsf@HIDDEN>
 <86sec4sag7.fsf@HIDDEN>
 <CAO=BR8PGMV8jthXxq3ypi0_WMOsdU_QESHAhiRSjgrGa8zZPAA@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79984-done
Cc: monnier@HIDDEN, 79984-done <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Spencer Baugh <sbaugh@HIDDEN>
> Date: Sat, 17 Jan 2026 09:28:19 -0500
> Cc: Stefan Monnier <monnier@HIDDEN>, 79984 <at> debbugs.gnu.org
> 
> Yes, the advice of using both pre and post command seems sound, I'll do that.  So this can be closed

Thanks, done.




Notification sent to Spencer Baugh <sbaugh@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Eli Zaretskii <eliz@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 79984 <at> debbugs.gnu.org:


Received: (at 79984) by debbugs.gnu.org; 17 Jan 2026 14:28:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 17 09:28:42 2026
Received: from localhost ([127.0.0.1]:57242 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vh7I9-0005rT-JW
	for submit <at> debbugs.gnu.org; Sat, 17 Jan 2026 09:28:42 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:56797)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1vh7I5-0005qz-EG
 for 79984 <at> debbugs.gnu.org; Sat, 17 Jan 2026 09:28:38 -0500
Received: from mail-lj1-f200.google.com ([209.85.208.200])
 by mxgoog2.mail.janestreet.com with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128)
 (Exim 4.99.1) id 1vh7Hz-00000003HlU-194C for 79984 <at> debbugs.gnu.org;
 Sat, 17 Jan 2026 09:28:31 -0500
Received: by mail-lj1-f200.google.com with SMTP id
 38308e7fff4ca-3832fbb70a1so23879061fa.1
 for <79984 <at> debbugs.gnu.org>; Sat, 17 Jan 2026 06:28:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=janestreet.com; s=google; t=1768660110; x=1769264910; darn=debbugs.gnu.org; 
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=ZMfsGLG1vhtccNtKG8h54ZOz69rWneuO+FIPQ7SqR9A=;
 b=qE/lWI7BRKDz0sezb0LHCIFtUkfFu6qx6sPylQYgj988HjTf35MTcE29BGRcNBP3MK
 H19kqwM7YsOnuP/2l2tlVMnOr1oS8erXnF94KaZILvh2ypmZg7sYOxqrGbB17cviEHIV
 /z3DamsElTtv6eqt8zRuxVXyzM56as+/7zdjw=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1768660111;
 bh=ZMfsGLG1vhtccNtKG8h54ZOz69rWneuO+FIPQ7SqR9A=;
 h=References:In-Reply-To:From:Date:Subject:To:Cc;
 b=t2zW1cXHc4BlMG0llunusg/dxXT/PIxzlYW1JPXG+QyJxXkQ6LcMepD/jJFBUHKvu
 YR1dpFchl6JY7F5bR7RzoufaqrLyXiLG5NgG5vH7xR2vwhVcwJSnIDlV4pbl2+xTju
 OezMVnOKmHOc6vl/Yk4FzxzKpKbVaskjQz9qf3qEqv2azLbPBwVA9fIeRMCgoo63jB
 h70TfO4vRSCbcYcWiBdKvttqRe+ujzAbaDkG2zTOLvpMEBPiu/eJdntWhhEmmVcLyJ
 9JdmPdqC+OneiLozh6x1SYOu7At/TL6WggTf8eRaPjsYNzojYHTmEZ+yZbfBDV1l+Q
 VYnSAQV0jia+Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1768660110; x=1769264910;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=ZMfsGLG1vhtccNtKG8h54ZOz69rWneuO+FIPQ7SqR9A=;
 b=kDFkcOpcJfR0Z8TGvXuhFQ2ScHM2ivbG2YYbh6SNsd/GAL6vMLM0RBcyrfFgdlBf6E
 75kU37aMGWT54ErFgyM74DCGpeAfLJlcvV1sH0wPU8fzPyiAqWTCzA0dzmoChVQMoqI7
 9hAWEPdu4J00x94y0tCKbNaAWYFzVbBU46PG/2XBVI/yKiEpSAEOLidLcCJdJTn0iyRW
 wANPDRAflibERTGsOJ3ICFn9c60ke6QaYDJjJ17Gdx6G+lw9YM0vDIT5gl/nsR7T7o5K
 QlVYC6l4cwD63vk71QjKK4YICHZKXSuhvCoI3qApV/1Lo6cX6Vdr88aNZJE+ErgmZodr
 2jBA==
X-Forwarded-Encrypted: i=1;
 AJvYcCWr8w340wCkUSyXjuknXm66ITdY1R6hRGeA71JNkph7uOnZUTzBzZM01s/OKzYGowUUCBqu4Q==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyzBVRagh/tqXuIIvz5q6PHyk4kMgpern+0YU4bH7FtHVjxjxWv
 u0CvNYkCVqOzwpJtcdgSESphQlYtEKeu37KH3hVPReY8NyjM0yqH2AoZZByt2bxDeP4REIRTJbF
 vaTyZMN4kZEdfFSg60jDEKGqAPrrZtcxLC7uFG7k/x9WJwV75EcIYIFcsK/dWjKaNGxyugB+Yre
 udZtLrbik5He3Eh12wx0IEJR1egWKh/A==
X-Gm-Gg: AY/fxX5NDNhkkVQjDXnOA25c4WKCWKcDUCyUfy8xnGh4caFh6GTM+NssaBvTuFgHikF
 xWEsQ2OGTMMSEI93xyazxGgKQC3TBzyHELfgtqHihxocoF8EJUbZ8dblFgqCgNWdL71P1RxB5zS
 G19AzSPFRkzjUOIE2EAiA4FXKfV20HQBoduBTMaIYeyzNL1D69YyNd5iiXVBegh+LFD6aZgyCAh
 V0By0dqe8i7/AaPhKK07K9wtp+BRotwqsX295eNG116XSVSi38=
X-Received: by 2002:a05:651c:1986:b0:382:6067:a1e7 with SMTP id
 38308e7fff4ca-38386a25ee3mr16043701fa.24.1768660110525; 
 Sat, 17 Jan 2026 06:28:30 -0800 (PST)
X-Received: by 2002:a05:651c:1986:b0:382:6067:a1e7 with SMTP id
 38308e7fff4ca-38386a25ee3mr16043651fa.24.1768660109901; Sat, 17 Jan 2026
 06:28:29 -0800 (PST)
MIME-Version: 1.0
References: <ierldjarxos.fsf@HIDDEN>
 <jwvqzt1w61r.fsf-monnier+emacs@HIDDEN>
 <ierikebd15r.fsf@HIDDEN> <jwvecozplnu.fsf-monnier+emacs@HIDDEN>
 <ierecozcod6.fsf@HIDDEN> <86y0mfkngv.fsf@HIDDEN>
 <86sec4sag7.fsf@HIDDEN>
In-Reply-To: <86sec4sag7.fsf@HIDDEN>
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Sat, 17 Jan 2026 09:28:19 -0500
X-Gm-Features: AZwV_QgBZTRPAT_Loxnf4fRadZ3uMN8TAu5jsWp7bX8op6R3tZbsUDchYMnlyas
Message-ID: <CAO=BR8PGMV8jthXxq3ypi0_WMOsdU_QESHAhiRSjgrGa8zZPAA@HIDDEN>
Subject: Re: bug#79984: 30.1.90; post-command-hook doesn't run after an
 emacsclient connection
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000009453750648964504"
X-Spam-Score: -2.2 (--)
X-Debbugs-Envelope-To: 79984
Cc: Stefan Monnier <monnier@HIDDEN>, 79984 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.2 (---)

--0000000000009453750648964504
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Yes, the advice of using both pre and post command seems sound, I'll do
that.  So this can be closed

On Sat, Jan 17, 2026, 7:14=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wrote:

> Ping! Ping!  Spencer, please respond.
>
> > Cc: monnier@HIDDEN, 79984 <at> debbugs.gnu.org
> > Date: Sat, 03 Jan 2026 12:19:28 +0200
> > From: Eli Zaretskii <eliz@HIDDEN>
> >
> > Ping!  How should we make further progress with this bug report?  Or
> > was it resolved by Stefan's advice below?
> >
> > > Cc: 79984 <at> debbugs.gnu.org
> > > Date: Fri, 12 Dec 2025 17:43:49 -0500
> > > From:  Spencer Baugh via "Bug reports for GNU Emacs,
> > >  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> > >
> > > Stefan Monnier <monnier@HIDDEN> writes:
> > >
> > > >>> [ I assume you're aware that "update default-directory
> > > >>>   based on the location of point" is fundamentally problematic
> since there
> > > >>>   can be several (window-)points at the same time.  ]
> > > >> Yes.  I guess doing this truly correctly would require a
> window-local
> > > >> default-directory.  But this hasn't caused any issues so far, sinc=
e
> > > >> basically almost any command that interacts with the
> default-directory
> > > >> of a buffer, requires actually selecting that buffer first.
> > > >
> > > > That's just an "accident" of the default set of commands.  If someo=
ne
> > > > develops more commands like `scroll-other-window`, they might very
> well
> > > > bump into the same problem.
> > >
> > > That is true.
> > >
> > > >> The specific use-case is that I have a package which provides a
> > > >> special-mode buffer containing a list of project.el projects.  And
> based
> > > >> on what project is under point,
> > > >
> > > > So you want a value of `default-directory` that depends on the text
> under point?
> > >
> > > Eh, sure.
> > >
> > > Really the thing I want is just an easy UI for switching between and
> > > operating on projects, where I can e.g. do M-& in one project, hit C-=
n
> a
> > > few times, then do M-& in another project.  Except not limited to jus=
t
> > > M-&, but which works for any command.  And also you can use any comma=
nd
> > > to navigate the list of projects, like isearch, not just C-n.  This i=
s
> > > just kinda hard...
> > >
> > > >> Setting default-directory via text property sounds a little crazy,
> > > >
> > > > I tend to agree, yet, it seems to be close to what you want.
> > > >
> > > > BTW, please don't try to implement such a crazy feature: I could
> > > > hypothetically be convinced to discuss supporting variables whose
> > > > value depends on the text-properties at point, but I don't want
> > > > to think about supporting `let` bindings for such variables.
> > > > Even just supporting `setq` sounds painfully horrible.
> > >
> > > Don't worry, it is too crazy for me to do it :)
> > >
> > > > My recommendation is to use both `pre-` and `post-command-hook` and
> > > > potentially use a few more hooks to cover a few other situations yo=
u
> may
> > > > bump into.
> > >
> > > Yeah, I guess I'll do that.
> > >
> > > > In any case what you're implementing is a hack.  A less hackish
> > > > solution would involve changing a lot more code to call some functi=
on
> > > > to compute dynamically the `default-directory` to use.  So in eithe=
r
> > > > case you don't cover 100% of the cases.
> > >
> > > Alas, this is so.
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>

--0000000000009453750648964504
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Yes, the advice of using both pre and post command seems =
sound, I&#39;ll do that.=C2=A0 So this can be closed</div><br><div class=3D=
"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">O=
n Sat, Jan 17, 2026, 7:14=E2=80=AFAM Eli Zaretskii &lt;<a href=3D"mailto:el=
iz@HIDDEN">eliz@HIDDEN</a>&gt; wrote:<br></div><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex">Ping! Ping!=C2=A0 Spencer, please respond.<br>
<br>
&gt; Cc: <a href=3D"mailto:monnier@HIDDEN" target=3D"_blank" rel=
=3D"noreferrer">monnier@HIDDEN</a>, <a href=3D"mailto:79984@debbu=
gs.gnu.org" target=3D"_blank" rel=3D"noreferrer">79984 <at> debbugs.gnu.org</a><=
br>
&gt; Date: Sat, 03 Jan 2026 12:19:28 +0200<br>
&gt; From: Eli Zaretskii &lt;<a href=3D"mailto:eliz@HIDDEN" target=3D"_bla=
nk" rel=3D"noreferrer">eliz@HIDDEN</a>&gt;<br>
&gt; <br>
&gt; Ping!=C2=A0 How should we make further progress with this bug report?=
=C2=A0 Or<br>
&gt; was it resolved by Stefan&#39;s advice below?<br>
&gt; <br>
&gt; &gt; Cc: <a href=3D"mailto:79984 <at> debbugs.gnu.org" target=3D"_blank" re=
l=3D"noreferrer">79984 <at> debbugs.gnu.org</a><br>
&gt; &gt; Date: Fri, 12 Dec 2025 17:43:49 -0500<br>
&gt; &gt; From:=C2=A0 Spencer Baugh via &quot;Bug reports for GNU Emacs,<br=
>
&gt; &gt;=C2=A0 the Swiss army knife of text editors&quot; &lt;<a href=3D"m=
ailto:bug-gnu-emacs@HIDDEN" target=3D"_blank" rel=3D"noreferrer">bug-gnu-e=
macs@HIDDEN</a>&gt;<br>
&gt; &gt; <br>
&gt; &gt; Stefan Monnier &lt;<a href=3D"mailto:monnier@HIDDEN" ta=
rget=3D"_blank" rel=3D"noreferrer">monnier@HIDDEN</a>&gt; writes:=
<br>
&gt; &gt; <br>
&gt; &gt; &gt;&gt;&gt; [ I assume you&#39;re aware that &quot;update defaul=
t-directory<br>
&gt; &gt; &gt;&gt;&gt;=C2=A0 =C2=A0based on the location of point&quot; is =
fundamentally problematic since there<br>
&gt; &gt; &gt;&gt;&gt;=C2=A0 =C2=A0can be several (window-)points at the sa=
me time.=C2=A0 ]<br>
&gt; &gt; &gt;&gt; Yes.=C2=A0 I guess doing this truly correctly would requ=
ire a window-local<br>
&gt; &gt; &gt;&gt; default-directory.=C2=A0 But this hasn&#39;t caused any =
issues so far, since<br>
&gt; &gt; &gt;&gt; basically almost any command that interacts with the def=
ault-directory<br>
&gt; &gt; &gt;&gt; of a buffer, requires actually selecting that buffer fir=
st.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; That&#39;s just an &quot;accident&quot; of the default set o=
f commands.=C2=A0 If someone<br>
&gt; &gt; &gt; develops more commands like `scroll-other-window`, they migh=
t very well<br>
&gt; &gt; &gt; bump into the same problem.<br>
&gt; &gt; <br>
&gt; &gt; That is true.<br>
&gt; &gt; <br>
&gt; &gt; &gt;&gt; The specific use-case is that I have a package which pro=
vides a<br>
&gt; &gt; &gt;&gt; special-mode buffer containing a list of project.el proj=
ects.=C2=A0 And based<br>
&gt; &gt; &gt;&gt; on what project is under point,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; So you want a value of `default-directory` that depends on t=
he text under point?<br>
&gt; &gt; <br>
&gt; &gt; Eh, sure.<br>
&gt; &gt; <br>
&gt; &gt; Really the thing I want is just an easy UI for switching between =
and<br>
&gt; &gt; operating on projects, where I can e.g. do M-&amp; in one project=
, hit C-n a<br>
&gt; &gt; few times, then do M-&amp; in another project.=C2=A0 Except not l=
imited to just<br>
&gt; &gt; M-&amp;, but which works for any command.=C2=A0 And also you can =
use any command<br>
&gt; &gt; to navigate the list of projects, like isearch, not just C-n.=C2=
=A0 This is<br>
&gt; &gt; just kinda hard...<br>
&gt; &gt; <br>
&gt; &gt; &gt;&gt; Setting default-directory via text property sounds a lit=
tle crazy,<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; I tend to agree, yet, it seems to be close to what you want.=
<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; BTW, please don&#39;t try to implement such a crazy feature:=
 I could<br>
&gt; &gt; &gt; hypothetically be convinced to discuss supporting variables =
whose<br>
&gt; &gt; &gt; value depends on the text-properties at point, but I don&#39=
;t want<br>
&gt; &gt; &gt; to think about supporting `let` bindings for such variables.=
<br>
&gt; &gt; &gt; Even just supporting `setq` sounds painfully horrible.<br>
&gt; &gt; <br>
&gt; &gt; Don&#39;t worry, it is too crazy for me to do it :)<br>
&gt; &gt; <br>
&gt; &gt; &gt; My recommendation is to use both `pre-` and `post-command-ho=
ok` and<br>
&gt; &gt; &gt; potentially use a few more hooks to cover a few other situat=
ions you may<br>
&gt; &gt; &gt; bump into.<br>
&gt; &gt; <br>
&gt; &gt; Yeah, I guess I&#39;ll do that.<br>
&gt; &gt; <br>
&gt; &gt; &gt; In any case what you&#39;re implementing is a hack.=C2=A0 A =
less hackish<br>
&gt; &gt; &gt; solution would involve changing a lot more code to call some=
 function<br>
&gt; &gt; &gt; to compute dynamically the `default-directory` to use.=C2=A0=
 So in either<br>
&gt; &gt; &gt; case you don&#39;t cover 100% of the cases.<br>
&gt; &gt; <br>
&gt; &gt; Alas, this is so.<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
</blockquote></div>

--0000000000009453750648964504--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79984; Package emacs. Full text available.

Message received at 79984 <at> debbugs.gnu.org:


Received: (at 79984) by debbugs.gnu.org; 17 Jan 2026 12:14:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 17 07:14:40 2026
Received: from localhost ([127.0.0.1]:55735 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vh5CS-0000I1-6j
	for submit <at> debbugs.gnu.org; Sat, 17 Jan 2026 07:14:40 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:56248)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vh5CP-0000HV-V5
 for 79984 <at> debbugs.gnu.org; Sat, 17 Jan 2026 07:14:38 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vh5CJ-0002DV-IA; Sat, 17 Jan 2026 07:14:32 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=da0LOi+H0bBQWyx3/F8MALgS+54aodGjUPPO8ZUb+tc=; b=Jw9f5tL+0v7G
 qB8PzEIKhbqb9rUrfVNrsD78CnZI7fjTKR9g9NdYNpKjY/lTIHLcLma7K319mN9Kt333FdMR3x4e+
 3ViH7JhvDz/cF4VIZyIEo25MqnuwOgV8DE5WT+8MEJLJCSSoFT4hszup+W6zaWNywtrSYNn9Tz5qW
 CHg0ZkoKXjJ6U5/HKzYepIgReSNyJWFjyamjQgsmxfAWtqU4zpcMrqyupLklEujQftJPu3UnA59v/
 x/kVlyz1gu4bdCpTkVAArYvul8u4AJDHuYrxwh94XnOPHEsxEAiBUi5yf8Ezh7DkXcujbXGv7Yc98
 y4zpjTUoWWM9k8rJxTQNUA==;
Date: Sat, 17 Jan 2026 14:14:16 +0200
Message-Id: <86sec4sag7.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: sbaugh@HIDDEN, monnier@HIDDEN
In-Reply-To: <86y0mfkngv.fsf@HIDDEN> (message from Eli Zaretskii on Sat, 03
 Jan 2026 12:19:28 +0200)
Subject: Re: bug#79984: 30.1.90;
 post-command-hook doesn't run after an emacsclient connection
References: <ierldjarxos.fsf@HIDDEN>
 <jwvqzt1w61r.fsf-monnier+emacs@HIDDEN>
 <ierikebd15r.fsf@HIDDEN>
 <jwvecozplnu.fsf-monnier+emacs@HIDDEN> <ierecozcod6.fsf@HIDDEN>
 <86y0mfkngv.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79984
Cc: 79984 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ping! Ping!  Spencer, please respond.

> Cc: monnier@HIDDEN, 79984 <at> debbugs.gnu.org
> Date: Sat, 03 Jan 2026 12:19:28 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> Ping!  How should we make further progress with this bug report?  Or
> was it resolved by Stefan's advice below?
> 
> > Cc: 79984 <at> debbugs.gnu.org
> > Date: Fri, 12 Dec 2025 17:43:49 -0500
> > From:  Spencer Baugh via "Bug reports for GNU Emacs,
> >  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> > 
> > Stefan Monnier <monnier@HIDDEN> writes:
> > 
> > >>> [ I assume you're aware that "update default-directory
> > >>>   based on the location of point" is fundamentally problematic since there
> > >>>   can be several (window-)points at the same time.  ]
> > >> Yes.  I guess doing this truly correctly would require a window-local
> > >> default-directory.  But this hasn't caused any issues so far, since
> > >> basically almost any command that interacts with the default-directory
> > >> of a buffer, requires actually selecting that buffer first.
> > >
> > > That's just an "accident" of the default set of commands.  If someone
> > > develops more commands like `scroll-other-window`, they might very well
> > > bump into the same problem.
> > 
> > That is true.
> > 
> > >> The specific use-case is that I have a package which provides a
> > >> special-mode buffer containing a list of project.el projects.  And based
> > >> on what project is under point,
> > >
> > > So you want a value of `default-directory` that depends on the text under point?
> > 
> > Eh, sure.
> > 
> > Really the thing I want is just an easy UI for switching between and
> > operating on projects, where I can e.g. do M-& in one project, hit C-n a
> > few times, then do M-& in another project.  Except not limited to just
> > M-&, but which works for any command.  And also you can use any command
> > to navigate the list of projects, like isearch, not just C-n.  This is
> > just kinda hard...
> > 
> > >> Setting default-directory via text property sounds a little crazy,
> > >
> > > I tend to agree, yet, it seems to be close to what you want.
> > >
> > > BTW, please don't try to implement such a crazy feature: I could
> > > hypothetically be convinced to discuss supporting variables whose
> > > value depends on the text-properties at point, but I don't want
> > > to think about supporting `let` bindings for such variables.
> > > Even just supporting `setq` sounds painfully horrible.
> > 
> > Don't worry, it is too crazy for me to do it :)
> > 
> > > My recommendation is to use both `pre-` and `post-command-hook` and
> > > potentially use a few more hooks to cover a few other situations you may
> > > bump into.
> > 
> > Yeah, I guess I'll do that.
> > 
> > > In any case what you're implementing is a hack.  A less hackish
> > > solution would involve changing a lot more code to call some function
> > > to compute dynamically the `default-directory` to use.  So in either
> > > case you don't cover 100% of the cases.
> > 
> > Alas, this is so.
> > 
> > 
> > 
> > 
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79984; Package emacs. Full text available.

Message received at 79984 <at> debbugs.gnu.org:


Received: (at 79984) by debbugs.gnu.org; 3 Jan 2026 10:19:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 03 05:19:39 2026
Received: from localhost ([127.0.0.1]:33703 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vbyjS-0003ki-T7
	for submit <at> debbugs.gnu.org; Sat, 03 Jan 2026 05:19:39 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:52554)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vbyjP-0003kF-Ve
 for 79984 <at> debbugs.gnu.org; Sat, 03 Jan 2026 05:19:36 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vbyjK-0000wx-C6; Sat, 03 Jan 2026 05:19:30 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=+HLbrcJBgQPs3cj4dCxMWKWtuKqKG7MPYmzAjF95bk4=; b=NIlFnObPB3QS
 B7TL4xEm8rEano5UcKnlzp9kAWvCJjFXN+XzEiPvFw9kDLX2Pu9yaRekV+W/NgmRn1wNgkmTiN01t
 5s2lh+qa+3UpQvldIHbMGvVJ0zXiQgD7THsa8q+iXQy/gHCUyaSiVAFJgBMIcMof3dojPewCkmycW
 3WKX2RtOUYVWWwdPV1upqXcSCo/9JqDKTvgHNVnYxpEevu672SD2mlD5sO3whqbtpRTyJkCC+3xc2
 2cdluFATl8qA7BKrPWIoKw08/4YToXx6hnwesUKdyUMBxvx3PEpKyocFqyE8FXZLVWq4UmwUPZk+a
 +eZ0KF290hIaiMqT8Dyo7Q==;
Date: Sat, 03 Jan 2026 12:19:28 +0200
Message-Id: <86y0mfkngv.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
In-Reply-To: <ierecozcod6.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#79984: 30.1.90;
 post-command-hook doesn't run after an emacsclient connection
References: <ierldjarxos.fsf@HIDDEN>
 <jwvqzt1w61r.fsf-monnier+emacs@HIDDEN>
 <ierikebd15r.fsf@HIDDEN>
 <jwvecozplnu.fsf-monnier+emacs@HIDDEN> <ierecozcod6.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79984
Cc: monnier@HIDDEN, 79984 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ping!  How should we make further progress with this bug report?  Or
was it resolved by Stefan's advice below?

> Cc: 79984 <at> debbugs.gnu.org
> Date: Fri, 12 Dec 2025 17:43:49 -0500
> From:  Spencer Baugh via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> Stefan Monnier <monnier@HIDDEN> writes:
> 
> >>> [ I assume you're aware that "update default-directory
> >>>   based on the location of point" is fundamentally problematic since there
> >>>   can be several (window-)points at the same time.  ]
> >> Yes.  I guess doing this truly correctly would require a window-local
> >> default-directory.  But this hasn't caused any issues so far, since
> >> basically almost any command that interacts with the default-directory
> >> of a buffer, requires actually selecting that buffer first.
> >
> > That's just an "accident" of the default set of commands.  If someone
> > develops more commands like `scroll-other-window`, they might very well
> > bump into the same problem.
> 
> That is true.
> 
> >> The specific use-case is that I have a package which provides a
> >> special-mode buffer containing a list of project.el projects.  And based
> >> on what project is under point,
> >
> > So you want a value of `default-directory` that depends on the text under point?
> 
> Eh, sure.
> 
> Really the thing I want is just an easy UI for switching between and
> operating on projects, where I can e.g. do M-& in one project, hit C-n a
> few times, then do M-& in another project.  Except not limited to just
> M-&, but which works for any command.  And also you can use any command
> to navigate the list of projects, like isearch, not just C-n.  This is
> just kinda hard...
> 
> >> Setting default-directory via text property sounds a little crazy,
> >
> > I tend to agree, yet, it seems to be close to what you want.
> >
> > BTW, please don't try to implement such a crazy feature: I could
> > hypothetically be convinced to discuss supporting variables whose
> > value depends on the text-properties at point, but I don't want
> > to think about supporting `let` bindings for such variables.
> > Even just supporting `setq` sounds painfully horrible.
> 
> Don't worry, it is too crazy for me to do it :)
> 
> > My recommendation is to use both `pre-` and `post-command-hook` and
> > potentially use a few more hooks to cover a few other situations you may
> > bump into.
> 
> Yeah, I guess I'll do that.
> 
> > In any case what you're implementing is a hack.  A less hackish
> > solution would involve changing a lot more code to call some function
> > to compute dynamically the `default-directory` to use.  So in either
> > case you don't cover 100% of the cases.
> 
> Alas, this is so.
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79984; Package emacs. Full text available.

Message received at 79984 <at> debbugs.gnu.org:


Received: (at 79984) by debbugs.gnu.org; 12 Dec 2025 22:43:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 12 17:43:58 2025
Received: from localhost ([127.0.0.1]:60838 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vUBrh-0007i7-PC
	for submit <at> debbugs.gnu.org; Fri, 12 Dec 2025 17:43:58 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:51395)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1vUBrf-0007hm-4O
 for 79984 <at> debbugs.gnu.org; Fri, 12 Dec 2025 17:43:56 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#79984: 30.1.90; post-command-hook doesn't run after an
 emacsclient connection
In-Reply-To: <jwvecozplnu.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Fri, 12 Dec 2025 14:16:27 -0500")
References: <ierldjarxos.fsf@HIDDEN>
 <jwvqzt1w61r.fsf-monnier+emacs@HIDDEN>
 <ierikebd15r.fsf@HIDDEN>
 <jwvecozplnu.fsf-monnier+emacs@HIDDEN>
Date: Fri, 12 Dec 2025 17:43:49 -0500
Message-ID: <ierecozcod6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1765579429;
 bh=B+wH9cyoRLRnqdVCPn+M8V1qBGcliRg/ZQStoyn4AfY=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=HJwkQyPkaH8gUB2fIw8eoGFPbRf82PlX0OxTkTamlDBtJobxFjGk6DjVdKmTr0wuq
 t35uLrDUzp/YA5lSDo3I7/3MvAeC3nfHps6Y+sISbHM9fgbM4sDC4GBFTroYSej+OI
 dwbbmz1sXimCD8k6SlXDjBHhUU6Eq3hG3OLjtMGwRn7oTHhzoS/dJm4DZoRGLppwr+
 G31ED2Xf1RLSrkeeWIGgip7cTSl4KgMHedi7jmdFOEkBq76GmJRQJksguMCew81uHU
 vyWtEP/t9cYBBCLUhKQkgHFP3Xh7R0HcBccOwOTHSqtAkDm4bAnq/mhJ+Em65b18XI
 SegAvPtv4pvug==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79984
Cc: 79984 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Stefan Monnier <monnier@HIDDEN> writes:

>>> [ I assume you're aware that "update default-directory
>>>   based on the location of point" is fundamentally problematic since there
>>>   can be several (window-)points at the same time.  ]
>> Yes.  I guess doing this truly correctly would require a window-local
>> default-directory.  But this hasn't caused any issues so far, since
>> basically almost any command that interacts with the default-directory
>> of a buffer, requires actually selecting that buffer first.
>
> That's just an "accident" of the default set of commands.  If someone
> develops more commands like `scroll-other-window`, they might very well
> bump into the same problem.

That is true.

>> The specific use-case is that I have a package which provides a
>> special-mode buffer containing a list of project.el projects.  And based
>> on what project is under point,
>
> So you want a value of `default-directory` that depends on the text under point?

Eh, sure.

Really the thing I want is just an easy UI for switching between and
operating on projects, where I can e.g. do M-& in one project, hit C-n a
few times, then do M-& in another project.  Except not limited to just
M-&, but which works for any command.  And also you can use any command
to navigate the list of projects, like isearch, not just C-n.  This is
just kinda hard...

>> Setting default-directory via text property sounds a little crazy,
>
> I tend to agree, yet, it seems to be close to what you want.
>
> BTW, please don't try to implement such a crazy feature: I could
> hypothetically be convinced to discuss supporting variables whose
> value depends on the text-properties at point, but I don't want
> to think about supporting `let` bindings for such variables.
> Even just supporting `setq` sounds painfully horrible.

Don't worry, it is too crazy for me to do it :)

> My recommendation is to use both `pre-` and `post-command-hook` and
> potentially use a few more hooks to cover a few other situations you may
> bump into.

Yeah, I guess I'll do that.

> In any case what you're implementing is a hack.  A less hackish
> solution would involve changing a lot more code to call some function
> to compute dynamically the `default-directory` to use.  So in either
> case you don't cover 100% of the cases.

Alas, this is so.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79984; Package emacs. Full text available.

Message received at 79984 <at> debbugs.gnu.org:


Received: (at 79984) by debbugs.gnu.org; 12 Dec 2025 19:16:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 12 14:16:46 2025
Received: from localhost ([127.0.0.1]:59474 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vU8dB-0000Eo-Lm
	for submit <at> debbugs.gnu.org; Fri, 12 Dec 2025 14:16:46 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29341)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1vU8d8-0000EA-2r
 for 79984 <at> debbugs.gnu.org; Fri, 12 Dec 2025 14:16:43 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2E2AC440B03;
 Fri, 12 Dec 2025 14:16:36 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1765566992;
 bh=gPoPTyAKQzEDfEoAKC8OQ2Dtzx8CTLUxuiCJVIS5Ihg=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Zd3wfiozN3KLVlqV82Pvosqv8BsreG1vWrOUgyRSpxNjW/HH17g+20IAGil0ZDkiT
 DJEC3sVIK3PmOQInVAIT9AJDYfqoCsE6nN+QE5pyXNtkVPXIKDNDPI6YALDfXYaK3P
 vZ+8CEK66ZRVAIIyx9EVt7hI36jKb20hIGQsloYzkG3COPOnqWW39zwxT4aP2Pg/Ku
 uBels274ko2x7VG1+tdSEQxsptyt9XhyLrGou0qmapdLCdmy9M5MdVIIBd6k+F1ZM2
 5CjYS5IijW0DESTDvLUSUnFgW0TlnY7xI8sDsXJH5/o54++Cs74g/3XYsmSwhDoILn
 2Im5UIh7F6edg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id A753C441BD0;
 Fri, 12 Dec 2025 14:16:32 -0500 (EST)
Received: from asado (unknown [190.55.48.190])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9F44A1206B3;
 Fri, 12 Dec 2025 14:16:31 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#79984: 30.1.90; post-command-hook doesn't run after an
 emacsclient connection
In-Reply-To: <ierikebd15r.fsf@HIDDEN>
Message-ID: <jwvecozplnu.fsf-monnier+emacs@HIDDEN>
References: <ierldjarxos.fsf@HIDDEN>
 <jwvqzt1w61r.fsf-monnier+emacs@HIDDEN>
 <ierikebd15r.fsf@HIDDEN>
Date: Fri, 12 Dec 2025 14:16:27 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.192 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79984
Cc: 79984 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> [ I assume you're aware that "update default-directory
>>   based on the location of point" is fundamentally problematic since there
>>   can be several (window-)points at the same time.  ]
> Yes.  I guess doing this truly correctly would require a window-local
> default-directory.  But this hasn't caused any issues so far, since
> basically almost any command that interacts with the default-directory
> of a buffer, requires actually selecting that buffer first.

That's just an "accident" of the default set of commands.  If someone
develops more commands like `scroll-other-window`, they might very well
bump into the same problem.

> The specific use-case is that I have a package which provides a
> special-mode buffer containing a list of project.el projects.  And based
> on what project is under point,

So you want a value of `default-directory` that depends on the text under point?

> Setting default-directory via text property sounds a little crazy,

I tend to agree, yet, it seems to be close to what you want.

BTW, please don't try to implement such a crazy feature: I could
hypothetically be convinced to discuss supporting variables whose
value depends on the text-properties at point, but I don't want
to think about supporting `let` bindings for such variables.
Even just supporting `setq` sounds painfully horrible.

My recommendation is to use both `pre-` and `post-command-hook` and
potentially use a few more hooks to cover a few other situations you may
bump into.  In any case what you're implementing is a hack.  A less
hackish solution would involve changing a lot more code to call some
function to compute dynamically the `default-directory` to use.  So in
either case you don't cover 100% of the cases.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79984; Package emacs. Full text available.

Message received at 79984 <at> debbugs.gnu.org:


Received: (at 79984) by debbugs.gnu.org; 12 Dec 2025 18:07:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 12 13:07:37 2025
Received: from localhost ([127.0.0.1]:58910 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vU7YG-00045c-SE
	for submit <at> debbugs.gnu.org; Fri, 12 Dec 2025 13:07:37 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:45707)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1vU7YE-000456-7z
 for 79984 <at> debbugs.gnu.org; Fri, 12 Dec 2025 13:07:34 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#79984: 30.1.90; post-command-hook doesn't run after an
 emacsclient connection
In-Reply-To: <jwvqzt1w61r.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Thu, 11 Dec 2025 07:45:51 -0500")
References: <ierldjarxos.fsf@HIDDEN>
 <jwvqzt1w61r.fsf-monnier+emacs@HIDDEN>
Date: Fri, 12 Dec 2025 13:07:28 -0500
Message-ID: <ierikebd15r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1765562848;
 bh=j+QzgywNuHR3nSIT4mkbu9R6JxeI5XoOetoIPiiaLAA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=tiFX+c90PLDbXg7pmKHwAo35RGm6PZ9N11QAZKqIGAPfyZNJtbU04otxlRa1wuUxw
 /qs/2tpKB/dLv1B4KRRROKwcCT/pjZzVkDYCohmeVrC3kCeAVSMf8AzXMPuNnE56tt
 KUyTJmrEnxaJoSKpPD40Hnawm+VCNWVqtQbjw2Umpk8xbH4ouSmUZ/7kPMC0mazaCl
 c7kSqbwTGhOv3uvFAQTKlqL80FOuvR9td7sdWyy9TfVbwSL26RQtAgLUqwFYnzZeX9
 HCwhgQjTipPDZqy39L2RNqr2oQ128FuNW3E0eG0W/i5d0ShiC/Al9Az1hlspdlb8lz
 FaW108tvcmzxA==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79984
Cc: 79984 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Stefan Monnier <monnier@HIDDEN> writes:

>> post-command-hook doesn't run after "emacsclient --eval (something)".
>> This can lead to slightly incorrect behavior depending on what's in
>> post-command-hook.
>>
>> For example, I have a post-command-hook which updates default-directory
>> based on the location of point.  Since it doesn't run after an
>> emacsclient connection, default-directory doesn't get updated.  So the
>> next command run after such an emacsclient connection will have an
>> incorrect default-directory.
>>
>> It might be fine to just run post-command-hook after an emacsclient
>> connection?  (Or perhaps there is some other hook which I should be
>> using to update default-directory after a command moves point)
>
> I agree with Eli.  I didn't remember the find-file case of manually
> running `post-command-hook`, but I do remember adding such a thing to
> the query-replace loop and have similarly learned since that it was
> a bad idea.

Reasonable.

> Have you considered using another hook?  E.g. `pre-command-hook`?

I did consider pre-command-hook, but using pre-command-hook to update
default-directory means that the default-directory is at the old value
after each command.  That in turn means that project-mode-line (and
similar things) will show the "old" project, even though any subsequent
command will operate in some different new project, which is confusing.

> [ I assume you're aware that "update default-directory
>   based on the location of point" is fundamentally problematic since there
>   can be several (window-)points at the same time.  ]

Yes.  I guess doing this truly correctly would require a window-local
default-directory.  But this hasn't caused any issues so far, since
basically almost any command that interacts with the default-directory
of a buffer, requires actually selecting that buffer first.

The specific use-case is that I have a package which provides a
special-mode buffer containing a list of project.el projects.  And based
on what project is under point, I want to update default-directory to
the root of that project, so e.g. find-file opens files in that project
and vc-dir-root opens vc-dir in that project.

> Of course, if you want to think of "general solutions" to the kind of
> problem you're hitting, maybe you can think of it as a variant of the
> multiple-major-mode problem (some of the solutions to this problem that
> have been proposed over the years include setting variables
> "text-locally" via overlays or text-properties).

Setting default-directory via text property sounds a little crazy, but
maybe that is actually sane?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79984; Package emacs. Full text available.

Message received at 79984 <at> debbugs.gnu.org:


Received: (at 79984) by debbugs.gnu.org; 11 Dec 2025 12:46:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 11 07:46:12 2025
Received: from localhost ([127.0.0.1]:43650 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTg3c-00053p-BO
	for submit <at> debbugs.gnu.org; Thu, 11 Dec 2025 07:46:12 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:63530)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1vTg3W-00052q-Ua
 for 79984 <at> debbugs.gnu.org; Thu, 11 Dec 2025 07:46:06 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E6F89441627;
 Thu, 11 Dec 2025 07:45:56 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1765457155;
 bh=E61Uwhgol7OuJA1q7CZ3t2woizAjIKBH/Iv09jdgWzc=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=IyHvmzTCxNzOT79ZVA0uEt2Dd0p3TJyQdxoZBERjUXia8uSWM6p1b/6X+Sm3B/rpd
 X6iLLvbXcmUcLQMp/GsDVVhI3xxiOrhSAl/QvuPaFG+6/4MryN8gU/OLTpW6zBn2KQ
 t9lElLA4/GnNrxeKPw/+r7+Hx6fkOhJ2RcstgA6Mt3crD6Bii/BKKvwRQe4ZrVMJ7k
 NMS323gY7gpfyRh6nucn7skW8WMkiVMWrh6I60dyXwvognm8XIqNlysg52KaTSWFgS
 m85ttCeHOJ3NLHcgPYI0UWL9siNMgx40BhXw/WJ2kJxRvt4GE6NFgqi68eAi8u81BR
 HfeiBEszHykCg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D087D44162A;
 Thu, 11 Dec 2025 07:45:55 -0500 (EST)
Received: from asado (unknown [181.28.45.30])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8F821120195;
 Thu, 11 Dec 2025 07:45:54 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#79984: 30.1.90; post-command-hook doesn't run after an
 emacsclient connection
In-Reply-To: <ierldjarxos.fsf@HIDDEN>
Message-ID: <jwvqzt1w61r.fsf-monnier+emacs@HIDDEN>
References: <ierldjarxos.fsf@HIDDEN>
Date: Thu, 11 Dec 2025 07:45:51 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.113 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79984
Cc: 79984 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> post-command-hook doesn't run after "emacsclient --eval (something)".
> This can lead to slightly incorrect behavior depending on what's in
> post-command-hook.
>
> For example, I have a post-command-hook which updates default-directory
> based on the location of point.  Since it doesn't run after an
> emacsclient connection, default-directory doesn't get updated.  So the
> next command run after such an emacsclient connection will have an
> incorrect default-directory.
>
> It might be fine to just run post-command-hook after an emacsclient
> connection?  (Or perhaps there is some other hook which I should be
> using to update default-directory after a command moves point)

I agree with Eli.  I didn't remember the find-file case of manually
running `post-command-hook`, but I do remember adding such a thing to
the query-replace loop and have similarly learned since that it was
a bad idea.

Have you considered using another hook?  E.g. `pre-command-hook`?

[ I assume you're aware that "update default-directory
  based on the location of point" is fundamentally problematic since there
  can be several (window-)points at the same time.  ]

Of course, if you want to think of "general solutions" to the kind of
problem you're hitting, maybe you can think of it as a variant of the
multiple-major-mode problem (some of the solutions to this problem that
have been proposed over the years include setting variables
"text-locally" via overlays or text-properties).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79984; Package emacs. Full text available.

Message received at 79984 <at> debbugs.gnu.org:


Received: (at 79984) by debbugs.gnu.org; 11 Dec 2025 07:30:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 11 02:30:35 2025
Received: from localhost ([127.0.0.1]:41210 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTb8B-0004az-P8
	for submit <at> debbugs.gnu.org; Thu, 11 Dec 2025 02:30:35 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:47214)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vTb85-0004XF-Up
 for 79984 <at> debbugs.gnu.org; Thu, 11 Dec 2025 02:30:28 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1vTb7z-0007to-CQ; Thu, 11 Dec 2025 02:30:19 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=1cQUAM7BVjmfij+oiJHbNYaQNg5QH+G+ASpurWBrYBM=; b=BfRfl/PlDg/q
 O0FL2amoM22SmVv7vWJe3IF+SM909CBsl7eVQkfsIFlr3uKWfKgy1JxVVx6aEk0dkyVLNDR+U7E45
 otzJ1QOC5VK1RHbw/4Bd+OFtg1WX3Ovk+MLBc889MazzsI1ERAa+mRDNyho2Cs4MP/zmbPa6fOPEM
 sqJk2R6rp5xMcVF0I9eifvBckX9H54a+vhT4k23a5GZxYurBOAN0IEkR3G/JiaFD9blojw9vllRT9
 ITJFzyfF3/cuh+v4DNezpEwhsZZTCUDjD2KK4YVp5mggMGJSKFJWL8GpEHQTeEwaHoVIAXzFl2Bpa
 odmwHllvg1hb6V+xgbkaWw==;
Date: Thu, 11 Dec 2025 09:30:16 +0200
Message-Id: <86345hcw6v.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <ierldjarxos.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#79984: 30.1.90;
 post-command-hook doesn't run after an emacsclient connection
References: <ierldjarxos.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79984
Cc: 79984 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 10 Dec 2025 13:36:35 -0500
> From:  Spencer Baugh via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> 
> post-command-hook doesn't run after "emacsclient --eval (something)".
> This can lead to slightly incorrect behavior depending on what's in
> post-command-hook.
> 
> For example, I have a post-command-hook which updates default-directory
> based on the location of point.  Since it doesn't run after an
> emacsclient connection, default-directory doesn't get updated.  So the
> next command run after such an emacsclient connection will have an
> incorrect default-directory.
> 
> It might be fine to just run post-command-hook after an emacsclient
> connection?  (Or perhaps there is some other hook which I should be
> using to update default-directory after a command moves point)

Connection from emacsclient is not a command, it is not handled by the
main command loop, so the post-command-hook is not called as part of
the normal Emacs operation.  It would be wrong to call
post-command-hook in that case.  (The fact that we call
post-command-hook when visiting files is an extra-special feature,
introduced to fix an obscure bug (see bug#6910), and IMNSHO that was
the wrong way of fixing that bug.  But that ship sailed long ago, and
I guess we are stuck with this problem for good.)

server.el has its own hooks:

  server-visit-hook
  server-switch-hook
  server-after-make-frame-hook
  server-done-hook

We could add a hook for processing -eval, if that is desired.  Or we
could add a general server-execute-hook that will be called whenever
the server performs any directive of the client.  We could also add a
hook to be run when a new client connection is accepted.

But I don't think we should make more calls to post-command-hook for
server actions triggered by emacsclient.  It is wrong to design a
feature that depends on post-command-hook when the "command" to be
hooked is something triggered by emacsclient.

Adding Stefan in case he has an opinion.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79984; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Dec 2025 18:36:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 10 13:36:58 2025
Received: from localhost ([127.0.0.1]:35955 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vTP3Z-0007Rh-WC
	for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 13:36:58 -0500
Received: from lists.gnu.org ([2001:470:142::17]:45616)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1vTP3X-0007RF-1T
 for submit <at> debbugs.gnu.org; Wed, 10 Dec 2025 13:36:56 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1vTP3I-0000bm-MG
 for bug-gnu-emacs@HIDDEN; Wed, 10 Dec 2025 13:36:41 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1vTP3F-0002II-Js
 for bug-gnu-emacs@HIDDEN; Wed, 10 Dec 2025 13:36:40 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.1.90; post-command-hook doesn't run after an emacsclient connection
X-Debbugs-Cc: 
Date: Wed, 10 Dec 2025 13:36:35 -0500
Message-ID: <ierldjarxos.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1765391795;
 bh=5iWClgOBv+1lgrWKD4YjLty6NlqDCMOjfHU3/ew15xo=;
 h=From:To:Subject:Date;
 b=Oy5lrjLRKMVp7wPPKCobRHsYv2lTIiNpfBlZ2i2JYbTov3J9TTJ2IPihLI3tH/hE8
 tY/W9DBUhEE05swhsAdGyMGooLS0W1uRiYUqagG9E3sWOsjaMA3jrnykSewEvBMSgS
 ArbTEfgQCENv7b0wLuDFsCy9jQFxavF5ni/LXVtIs6nsBgDqlmrlzKjbii3b10hEQp
 59YpGjULQU9bMIj9jbqLmmc0vUuPnn+ZEE1LR3pruTv8y7a6QGUVn8JKiR/uZ/vBWo
 tHO2WlONrJPQ39yCbVPuT8LlHSvJqIxT5jBleTSFrqTlEqZL+34n3kKyFJOeX8xbXx
 vlEXUFAUHj+eQ==
Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@HIDDEN;
 helo=mxout5.mail.janestreet.com
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)


post-command-hook doesn't run after "emacsclient --eval (something)".
This can lead to slightly incorrect behavior depending on what's in
post-command-hook.

For example, I have a post-command-hook which updates default-directory
based on the location of point.  Since it doesn't run after an
emacsclient connection, default-directory doesn't get updated.  So the
next command run after such an emacsclient connection will have an
incorrect default-directory.

It might be fine to just run post-command-hook after an emacsclient
connection?  (Or perhaps there is some other hook which I should be
using to update default-directory after a command moves point)


In GNU Emacs 30.1.90 (build 90, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2025-12-04 built on
 igm-qws-u22796a
Repository revision: 88878f209ee0f1699952b1ba5fb829c502f5959f
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.10 (Green Obsidian)

Configured using:
 'configure --with-x-toolkit=lucid --without-gpm --without-gconf
 --without-selinux --without-imagemagick --with-modules --with-gif=no
 --with-cairo --with-rsvg --without-compress-install --with-tree-sitter
 --with-native-compilation=aot
 PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/'

Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSYSTEMD
LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM
XINPUT2 XPM LUCID ZLIB




Acknowledgement sent to Spencer Baugh <sbaugh@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#79984; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 17 Jan 2026 16:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.