Received: (at 78530) by debbugs.gnu.org; 21 May 2025 11:20:15 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 21 07:20:15 2025 Received: from localhost ([127.0.0.1]:46076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uHhUc-0004ur-Mb for submit <at> debbugs.gnu.org; Wed, 21 May 2025 07:20:15 -0400 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:44333) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <joaotavora@HIDDEN>) id 1uHhUZ-0004pm-28 for 78530 <at> debbugs.gnu.org; Wed, 21 May 2025 07:20:11 -0400 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-400fa6eafa9so4958188b6e.1 for <78530 <at> debbugs.gnu.org>; Wed, 21 May 2025 04:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747826405; x=1748431205; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MU7O3KLVqs8MK4PnqcfpuGQ30W7h4hy1F9R7M5fTwGU=; b=T76bHv8eUty7HHI99zWmKRRmCNF0Q7s2wIYhSzx9gpU0NA8nyUpmtSxjf2HX2q8oi0 W9TLkfkJaFBOwSXiLF5KDlFgIUEE9z/Srm1CdTJ3kFXJHDQTtAyTYn1Ojof+4rkcYrh/ XeO8LoMVi9L1obc6/oletuZA/xfsYV6/zYmKXYteXXo9ii5hXZSHYFiP6J3EQA4+t7nS Lg+hZkT0XK/nmlfFtXpoBiDj0AysWNRLAvan0lGgAQLQULNLU9e6W/iBMug6arGKwKU0 xG1UMyRR1RXc83P97oUCyyBH33KQ2iQk+k3g/dwjF215AXkbszgTxcguvwuyRG/UHZAL 0o+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747826405; x=1748431205; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MU7O3KLVqs8MK4PnqcfpuGQ30W7h4hy1F9R7M5fTwGU=; b=cLaD8Cgjvi0FpX5PyU6japx9PvhS18xt5WSuJzmT5eGSAj6XwqIirkw/+st8YkOSRx NiL3NteM92g0xzvHuC9bsXabzV0s5jCEuaCcRByPBGYBfBWCov29VIY2myMQ1dwYv6RQ 4HAdkaJYh5NImVeQ2ZuyNEh6FPt4vc+xzYkmq9oV3ZNlaMlwkh3eqDOWww4HSq36PdHE ogHtcSzxsS4hyiQ8/Cl93T/2LkCEskRRvNSW5tqO6/rzXwbNrQdSkLSh09iKnT5C6cua tSnQgpmYBDM9k8cMXLDWHoAJ9lZdQOOIE9stJbUtY4iUXF5k0rPPhrl/U8ndqUeMBNOG P1BQ== X-Gm-Message-State: AOJu0Yz+y0Tl4jx4jD20ufuXC/Jy5Jaz4OIIzs8+bYwV4QLR0JiAoJ0F PcDcnkHDD8GGErn8FTzf1rEQEArE89rRfZtbPMagNZJ+yd8WtfuCvqMnNYdDMHRC4dgbiTa9hdl EJk7jJxB6b1MQtAPYGY7Inj1QDCiIinc= X-Gm-Gg: ASbGncvbspp4YTV+T1OfcXPfnO01lRTX4RF76/eFybn8ByuX0klnoEcsk8p6JO3HTXR iAyEOACveADIwcDPuFgq+LoICQib27Cs0jQMihBDgeOdIrOS4CUYwHFSU4Z9cvNWGIKkWRUm7al ZzZ1zF/7wSEdZUWCoHigU2vYhN2xNReaA= X-Google-Smtp-Source: AGHT+IF5H9QKuwZAjvj1cYlV5cmJVbtXaa7q67GmpunzbxT/Axqw78k8YpDLdFrG3MH5en5WMxefm9XaUZ1fsTkrBUU= X-Received: by 2002:a05:6808:80c2:b0:404:e2fe:ee9b with SMTP id 5614622812f47-404e2fef081mr9352495b6e.15.1747826403318; Wed, 21 May 2025 04:20:03 -0700 (PDT) MIME-Version: 1.0 References: <C109BFA6-1DB1-48F6-83FF-3490E36561C5@HIDDEN> In-Reply-To: <C109BFA6-1DB1-48F6-83FF-3490E36561C5@HIDDEN> From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= <joaotavora@HIDDEN> Date: Wed, 21 May 2025 12:20:39 +0100 X-Gm-Features: AX0GCFuqhsJVGD2eZvK4BMvYuLp6UM6ZmTBdia-psAxEWO-oC3CdOLsAVmJVev8 Message-ID: <CALDnm52xuSoA9BGSqX6-8qGpOx=9bwGJ2mpebuiHu71NRnckDA@HIDDEN> Subject: Re: bug#78530: 31.0.50; [PATCH] eglot-code-action-suggestion doesn't call the callback function in the original buffer To: Yuan Fu <casouri@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78530 Cc: 78530 <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.0 (-) Good catch, good analysis and great commit message. Just please rename the subject line of the commit message to start with "Eglot: " if you can. Makes it easier to identify. For example= : Eglot: always call ElDoc callbacks in correct buffer Then add a reference to this bug#78530 and push at will. Jo=C3=A3o
bug-gnu-emacs@HIDDEN
:bug#78530
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 21 May 2025 07:42:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 21 03:42:50 2025 Received: from localhost ([127.0.0.1]:44032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uHe6D-0002M6-Jz for submit <at> debbugs.gnu.org; Wed, 21 May 2025 03:42:49 -0400 Received: from lists.gnu.org ([2001:470:142::17]:48418) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1uHe68-0002LM-6v for submit <at> debbugs.gnu.org; Wed, 21 May 2025 03:42:47 -0400 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 <casouri@HIDDEN>) id 1uHe62-0003Rv-Ee for bug-gnu-emacs@HIDDEN; Wed, 21 May 2025 03:42:38 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <casouri@HIDDEN>) id 1uHe60-0002xo-OK for bug-gnu-emacs@HIDDEN; Wed, 21 May 2025 03:42:38 -0400 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-73c17c770a7so7004511b3a.2 for <bug-gnu-emacs@HIDDEN>; Wed, 21 May 2025 00:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747813355; x=1748418155; darn=gnu.org; h=to:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=0o+uWU1d/sZZb7Z0d/o/b1GOndnb6WMTqcIe0fbZnuY=; b=SuH/8dsSQG1G9+WMcqSAdtDG765z3/Nqv0zGpW7n+hvMjenmLzv50fyK2uRpG993oS GMFu/v/+kXnadgNx2IN4A66ZeEUYWKYZrdWc/QpACUaQcowLioOQKhNO6iPLl5M8Uu9e kXOew6chcSQ2aGeXxaci3NCgE2PysmX6U/b2g7EuX65/Yg1c83zYBUVZ6RPTRRezcjvm 885K+ouPKCFM3iv1aOM6mcYKFILl8qYN8qEKJkjrbG1ouUWqC8E8vyTGgRAMi89juYO+ xG2H5EZJ8Q+BsXKpb4GQ6SNnjeYCUg3EeIWP8OcUTsf/Ou7N4t7LmpH+2Uv7rjQfgO82 HlsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747813355; x=1748418155; h=to:date:message-id:subject:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0o+uWU1d/sZZb7Z0d/o/b1GOndnb6WMTqcIe0fbZnuY=; b=xURjZn7LoiERsjO83321b+gDbUWCSXNBmntAKybBWYeYJ9kevEKRMEWFUrrr+dTMNk cFDhasaLcMj5OFZRQyXkb8Szws59gtXTZ3kYkzoAEnwN7a8mcUVPuF9RoPF8uemdLsBG gGbq+5wKAS/aejlYEJq5KvY4MVZVgMtJ3XVMeSPMir/IxgjjrHa5BpnIssWP5JbS5U0H F5Q1AGqhD2QQRSKiGhhe73zrjQ/2yeLxtRIlLXW7yjOphry3ChQAiQ8ziHcPnZ7PNWR4 y4ujZb7ULTii1CkPYji0lCynM/C9Jv2dEvTJ2P+9Ua5UsXPGVFnyYrJPLg7SUiW4a6Bh 1EYg== X-Gm-Message-State: AOJu0YyAtp5A8VOdZaAfpdqFceVUHVwbSiYfFcMLzbGbvGd0nFc7m5q4 tyMT2iUTASyG78wHSe6WNbZYQXDvYrO/j3NpYAd/0fV6RI942USifcbwiMICkQ== X-Gm-Gg: ASbGnctO+D8nvVXyKMP+n1yP58hj48AgqTEjXFvES+zUkeYacNLc6KbwabYboFv+H42 gQQWV1daTJILxK92HpAqA8GNzM8cY5DRmr1bWCwAnlmw222mC0qzOBFSb7FSE854LlV+NROreAJ 32TngiqWVDga3mnLvbrKQASWgBkXXRB5sbM0oCJ6H5u86csUVHLY+oBXcI6CXBndQBbg76Ft8EL mLNnY8nXQiEZF0P3G0lvtr/+Wv76xXSWfLWASOj074t5xcb5io1P2G4J4Z2dKOtRhC+OHpBMXFw ZKBIdn1wtlWcpSdFF32XD4q7GzyaFjF7V2rI7IuRN4pPDSIxAGuNkqhE4MOXcqMH6pD1/MvlTWI 2qVHP2kQyj+odr1J6dZj1BG2PtXAyMy5QfT4= X-Google-Smtp-Source: AGHT+IGQEACzDc9CxBxuW5xb7jUgjeY/hDCiVqiqYpANQ+TcRVWQIp762NLhUxp2XVFbaDOSaPLb3w== X-Received: by 2002:a05:6a21:103:b0:1fe:90c5:7d00 with SMTP id adf61e73a8af0-216219c82fcmr33211518637.28.1747813353393; Wed, 21 May 2025 00:42:33 -0700 (PDT) Received: from smtpclient.apple (c-24-4-247-194.hsd1.ca.comcast.net. [24.4.247.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-231d4adb3a2sm87530775ad.57.2025.05.21.00.42.32 for <bug-gnu-emacs@HIDDEN> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 May 2025 00:42:32 -0700 (PDT) From: Yuan Fu <casouri@HIDDEN> Content-Type: multipart/mixed; boundary="Apple-Mail=_E636F0BA-AD06-41F0-9B31-BEEC4A5D7D94" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Subject: 31.0.50; [PATCH] eglot-code-action-suggestion doesn't call the callback function in the original buffer Message-Id: <C109BFA6-1DB1-48F6-83FF-3490E36561C5@HIDDEN> Date: Wed, 21 May 2025 00:42:21 -0700 To: Bug Report Emacs <bug-gnu-emacs@HIDDEN> X-Mailer: Apple Mail (2.3826.500.181.1.5) Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=casouri@HIDDEN; helo=mail-pf1-x42b.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 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, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) 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.0 (/) --Apple-Mail=_E636F0BA-AD06-41F0-9B31-BEEC4A5D7D94 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 X-Debbugs-CC: joaotavora@HIDDEN Copying from the commit message: Some minor modes adds their own eldoc display function to 'eldoc-display-functions' hook buffer-locally. So when eldoc uses 'eldoc-display-functions' to display docs, it should use the buffer-local value of the hook. In 'eldoc--invoke-strategy', the code that runs 'eldoc-display-functions' hook is wrapped in a callback function that eventually gets passed to each documentation function in 'eldoc-documentation-functions'. So now it's the documentation functions' responsibility to call the eldoc callback in the original buffer. All the eglot documentation functions indeed do that, using 'eglot--when-buffer-window' to switch to the original buffer when calling the eldoc callback. Except for 'eglot-code-action-suggestion'. This patch fixes that. This bug was originally reported on eldoc-box [1]. The user found that eldoc-box's display function are rarely used, while the minor mode is turned on. This patch fixes the issue. [1] = https://github.com/casouri/eldoc-box/issues/126#issuecomment-2896611278 I think we should fix the eldoc callback function so it always uses the hook value of the hook in the original buffer; at the very least we should document the pitfall in the docstring of eldoc-documentation-functions. Jo=C3=A3o, WDYT? Yuan --Apple-Mail=_E636F0BA-AD06-41F0-9B31-BEEC4A5D7D94 Content-Disposition: attachment; filename=eglot-code-action.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="eglot-code-action.patch" Content-Transfer-Encoding: quoted-printable =46rom=200a0a72d16b2508b629f1bda8caddac8844452707=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20<casouri@HIDDEN>=0ADate:=20Wed,=20= 21=20May=202025=2000:23:15=20-0700=0ASubject:=20[PATCH]=20Make=20= eglot-code-action-suggestion=20call=20callback=20in=20orig=0A=20buffer=0A= =0ASome=20minor=20modes=20adds=20their=20own=20eldoc=20display=20= function=20to=0A'eldoc-display-functions'=20hook=20buffer-locally.=20=20= So=20when=20eldoc=0Auses=20'eldoc-display-functions'=20to=20display=20= docs,=20it=20should=20use=0Athe=20buffer-local=20value=20of=20the=20= hook.=0A=0AIn=20'eldoc--invoke-strategy',=20the=20code=20that=20runs=0A= 'eldoc-display-functions'=20hook=20is=20wrapped=20in=20a=20callback=20= function=0Athat=20eventually=20gets=20passed=20to=20each=20documentation=20= function=20in=0A'eldoc-documentation-functions'.=20So=20now=20it's=20the=20= documentation=0Afunctions'=20responsibility=20to=20call=20the=20eldoc=20= callback=20in=20the=0Aoriginal=20buffer.=0A=0AAll=20the=20eglot=20= documentation=20functions=20indeed=20do=20that,=20using=0A= 'eglot--when-buffer-window'=20to=20switch=20to=20the=20original=20buffer=20= when=0Acalling=20the=20eldoc=20callback.=20Except=20for=0A= 'eglot-code-action-suggestion'.=0A=0AThis=20patch=20fixes=20that.=0A=0A= This=20bug=20was=20originally=20reported=20on=20eldoc-box=20[1].=20The=20= user=0Afound=20that=20eldoc-box's=20display=20function=20are=20rarely=20= used,=20while=0Athe=20minor=20mode=20is=20turned=20on.=20This=20patch=20= fixes=20the=20issue.=0A=0A[1]=20= https://github.com/casouri/eldoc-box/issues/126#issuecomment-2896611278=0A= =0A*=20lisp/progmodes/eglot.el=20(eglot-code-action-suggestion):=20Move=0A= the=20funcall=20form=20into=20the=20eglot--when-buffer-window=20form.=0A= ---=0A=20lisp/progmodes/eglot.el=20|=204=20++--=0A=201=20file=20changed,=20= 2=20insertions(+),=202=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/eglot.el=20b/lisp/progmodes/eglot.el=0Aindex=20= 6f6b05a393d..5bb825189f2=20100644=0A---=20a/lisp/progmodes/eglot.el=0A= +++=20b/lisp/progmodes/eglot.el=0A@@=20-4168,8=20+4168,8=20@@=20= eglot-code-action-suggestion=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= 'display=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20`((margin=20= left-margin)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ,tooltip)))))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (setq=20eglot--suggestion-overlay=20ov)))))=0A-=20=20=20=20=20=20=20=20=20= (when=20use-text-p=20(funcall=20cb=20blurb)))=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(setq=20eglot--suggestion-overlay=20ov))))=0A= +=20=20=20=20=20=20=20=20=20=20=20(when=20use-text-p=20(funcall=20cb=20= blurb))))=0A=20=20=20=20=20=20=20=20:hint=20:textDocument/codeAction)=0A=20= =20=20=20=20=20=20(and=20use-text-p=20t))))=0A=20=0A--=20=0A2.39.5=20= (Apple=20Git-154)=0A=0A= --Apple-Mail=_E636F0BA-AD06-41F0-9B31-BEEC4A5D7D94--
Yuan Fu <casouri@HIDDEN>
:joaotavora@HIDDEN, bug-gnu-emacs@HIDDEN
.
Full text available.joaotavora@HIDDEN, bug-gnu-emacs@HIDDEN
:bug#78530
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.