From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: StrawberryTea Newsgroups: gmane.emacs.bugs Subject: bug#69259: 30.0.50; (get-pos-property 9483 'cursor-intangible) gives args-out-of-range error in folded magit buffer Date: Wed, 21 Feb 2024 17:29:54 -0600 Message-ID: <87y1bdmlwa.fsf@strawberrytea.xyz> References: <87msrxo4ji.fsf@strawberrytea.xyz> <861q98r64n.fsf@gnu.org> <871q97b09m.fsf@strawberrytea.xyz> <86zfvum21y.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29321"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.10.8; emacs 30.0.50 Cc: Eli Zaretskii , Jonas Bernoulli , 69259@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 22 00:36:05 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rcw88-0007CW-48 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Feb 2024 00:36:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcw7q-0000dj-Fa; Wed, 21 Feb 2024 18:35:42 -0500 Original-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 ) id 1rcw7n-0000cu-If for bug-gnu-emacs@gnu.org; Wed, 21 Feb 2024 18:35:40 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcw7n-0000lr-9q for bug-gnu-emacs@gnu.org; Wed, 21 Feb 2024 18:35:39 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rcw89-0007Vx-Q8 for bug-gnu-emacs@gnu.org; Wed, 21 Feb 2024 18:36:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: StrawberryTea Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Feb 2024 23:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69259 X-GNU-PR-Package: emacs Original-Received: via spool by 69259-submit@debbugs.gnu.org id=B69259.170855853628816 (code B ref 69259); Wed, 21 Feb 2024 23:36:01 +0000 Original-Received: (at 69259) by debbugs.gnu.org; 21 Feb 2024 23:35:36 +0000 Original-Received: from localhost ([127.0.0.1]:52869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcw7j-0007Uf-Ma for submit@debbugs.gnu.org; Wed, 21 Feb 2024 18:35:36 -0500 Original-Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:41083) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rcw7h-0007UD-HP for 69259@debbugs.gnu.org; Wed, 21 Feb 2024 18:35:34 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id D39E53200B0C; Wed, 21 Feb 2024 18:35:03 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 21 Feb 2024 18:35:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= strawberrytea.xyz; h=cc:cc:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1708558503; x=1708644903; bh=4ZtriMyZkQpIATnGXGitfBoUc76QzUBqrjS8MEKmqgM=; b= SEH1aEMCFzBdLP1cQgLeyP4/aC01U6r5ELsyll58tl+21CzlFlCbgTIKVMKZZ0xJ F/HjEeBobc8sPH7cHJBPAkLXuU0QJ4plz8ACN2Mcon9BK1JwgA4pChkLItwHHsRG aTsylMTJFJIAAUssVPOEs/uEomca5uuMmMepvqIDR5EkTbYcE61RlxogDLCzNz0M H22XIb6ep4muieCXfIf6V3Mj9vXW9B3a1hMCAw+qKZqLtH1zRJo3JNVqS+xg46g4 cXzmUzzV8qftOFTt2EzAU8gYqSEcSxWapqGmb+OMosYoMyPHlI0m4WM38g4l8RsS HAOxZp9dPVP5rvUNCEIeRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1708558503; x=1708644903; bh=4ZtriMyZkQpIATnGXGitfBoUc76Q zUBqrjS8MEKmqgM=; b=msoKQGVuw0yodorP3TO+SsNBgb0Sht1BV/cDpa4p1vpm srx4fM2QmQVLmAlupLZUKForusvkfxfDmMHigFo4iY6BxFJPF/TPt3FLXe+d7IeA QnsqQu4KrjckVKyV7KIsSmDlizh1mId0pAvZc7Rxc5TA54KJTRYCWjk577VwCL3M X0Ne7+HTMoVidpQ+1hYZ4soEhNVQ8iBNgkAjjnJmFz5UkBJTA3FMuuEUHbnh2aLW XxchnDfG7sBDSP/eURrx2AHO9lSG26PRkPreopTHla1Vk3W18egQkrIVmuiqtBPK cjnvnQsOdZhxIV6rnqRYdwyWp0qPziKPMcD16ERncg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeefgdduudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdefhedmnecujfgurhephffvvefuffhffggjkfggtgesmhdtreertder jeenucfhrhhomhepufhtrhgrfigsvghrrhihvfgvrgcuoehlohhokhesshhtrhgrfigsvg hrrhihthgvrgdrgiihiieqnecuggftrfgrthhtvghrnhephfelleffvdeijeetgfdtvdfg hfegfedvtefgjeefveejteegudekveelvdeluefhnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheplhhoohhksehsthhrrgifsggvrhhrhihtvggr rdighiii X-ME-Proxy: Feedback-ID: id85149b6:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Feb 2024 18:35:02 -0500 (EST) In-reply-to: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280423 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thanks for the explanation Stefan and Eli. I ended up making a PR to magit.= And I think Tarsius is going to merge it. He just asked me to test it after he = made a small change. Sincerely, StrawberryTea modified lisp/magit-section.el @@ -1635,10 +1635,14 @@ evaluated its BODY. Admittedly that=E2=80=99s a bi= t of a hack.=E2=80=9C (setq magit-section-pre-command-section (magit-current-section))) (defun magit-section-post-command-hook () =E2=80=A2 (cursor-sensor-move-to-tangible (selected-window)) =E2=80=A2 (when (or magit=E2=80=93context-menu-buffer =E2=80=A2 magit=E2=80=93context-menu-section) =E2=80=A2 (magit-menu-highlight-point-section)) =E2=81=83 (let ((window (selected-window))) =E2=81=83 ;; The command may have used `set-window-buffer=E2=80=99 to change =E2=81=83 ;; the window=E2=80=99s buffer without changing the current buffe= r. =E2=81=83 (when (eq (current-buffer) (window-buffer window)) =E2=81=83 (cursor-sensor-move-to-tangible window) =E2=81=83 (when (or magit=E2=80=93context-menu-buffer =E2=81=83 magit=E2=80=93context-menu-section) =E2=81=83 (magit-menu-highlight-point-section)))) (unless (memq this-command =E2=80=99(magit-refresh magit-refresh-all)) (magit-section-update-highlight))) Stefan Monnier writes: > Eli wrote: >> I think cursor-sensor is written under the assumption that the >> selected window=E2=80=99s buffer is also the current buffer, and if so, >> magit-post-command-hook should abide by that protocol. Stefan, am I >> right? > > Not `cursor-sensor.el` in its entirety, but > `cursor-sensor-move-to-tangible` presumes that it is called with the > current-buffer already set to (window-buffer window). > > StrawberryTea wrote: >> Why exactly are the window-buffer and the current-buffer different? > > Good question. AFAIK the code that runs `post-command-hook` normally > tries to avoid such situations. > >> I think this has to do with persp-mode. My guess is that when it sets >> the new window configuration, the current-buffer is not updated to the >> new window=E2=80=99s buffer immediately. > > Could be a =E2=80=9Cbad citizen=E2=80=9D on `post-command-hook`, indeed, = which messes up > subsequent functions on the hook. Maybe the code that runs > `post-command-hook` should be more careful to (re)set current-buffer > after each function, but it seems easier to fix the rare functions which > mess it up. > > Stefan --=-=-=--