From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Howard Melman Newsgroups: gmane.emacs.bugs Subject: bug#65411: 29.1; setopt of xref-after-jump-hook gives warning Date: Mon, 21 Aug 2023 09:19:23 -0400 Message-ID: References: <83h6otwwsp.fsf@gnu.org> <5B343C6B-DE9E-4BC2-8963-AFE9353E062D@gmail.com> <83edjxwpkj.fsf@gnu.org> <665BB487-07C8-4B9D-8CAA-CE8ECFA6C8E4@gmail.com> <83jztovc3g.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39425"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65411@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 21 15:20:19 2023 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 1qY4pP-000A5R-7Q for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Aug 2023 15:20:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qY4p6-0003yd-Lg; Mon, 21 Aug 2023 09:20:00 -0400 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 1qY4p5-0003yU-Tf for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2023 09:19:59 -0400 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 1qY4p5-0005Fp-Kt for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2023 09:19:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qY4p7-00070g-MF for bug-gnu-emacs@gnu.org; Mon, 21 Aug 2023 09:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Howard Melman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Aug 2023 13:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65411 X-GNU-PR-Package: emacs Original-Received: via spool by 65411-submit@debbugs.gnu.org id=B65411.169262397726911 (code B ref 65411); Mon, 21 Aug 2023 13:20:01 +0000 Original-Received: (at 65411) by debbugs.gnu.org; 21 Aug 2023 13:19:37 +0000 Original-Received: from localhost ([127.0.0.1]:55853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qY4oi-0006zy-Ec for submit@debbugs.gnu.org; Mon, 21 Aug 2023 09:19:36 -0400 Original-Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]:45379) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qY4og-0006zl-VI for 65411@debbugs.gnu.org; Mon, 21 Aug 2023 09:19:35 -0400 Original-Received: by mail-vs1-xe33.google.com with SMTP id ada2fe7eead31-44d3a5cd2f9so712886137.3 for <65411@debbugs.gnu.org>; Mon, 21 Aug 2023 06:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692623967; x=1693228767; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eEL1V1GpejN2Jun2QB3io8bkWZJAtw10T2uBp94dDO8=; b=B2sXv1BNEnT+vUTKLJwe41h0P7PDMpb4O8ndzlBur/Nnou1R0kaUjV4PU9UPOFrwxH oHfCAWEM/6gdwB/4QPVPYQGsKxgaORIVwV20OK7Mt/OnetCREzU8gD8PuYV00p39RAt1 n5kZqGzoMfQcso+/Z0tAlZOlgCCrrEB76mS4cQE0m5wr9h8N8E4+br/WCzbl8GUMtgoX aDP1Q9GHEql6kGulq7cPP9HtzR1itIOydWe9Bh4jvEN9bkT5sidGWrP7OXpK0e/v6yK8 ykNnWFLhLz2SXGHUYVBvJ8uFukQt05dVJPt30zmpOnVvjlhf8ir4kwN55VPPEx1kPYIn 3vZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692623967; x=1693228767; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eEL1V1GpejN2Jun2QB3io8bkWZJAtw10T2uBp94dDO8=; b=Vx0H6dpp2vTLKn4Yl33XN0GyMKseiyfRxypogEheZzdmEeScc6+8t/MpaSBxdkZhVi hbqktvlxiciF1BEQWdJVib+n+AQoklNqO1acloo81AV+08U47LTEU9X4ENLbs3cE3tqq 82epJBvDC5uhBNaf9FhvAAO42aWlN3uVQpmvCxYmlkb1w9njK/WQaVZQdhkFtQgy8mWn VP5R/it6q4guDLW1o9llJL5rlXqyDruUwJScOImQo9F/b4fVlssXDg14xYVK2iJc2ksd ea4XfIgrqRjVW3jp+sKlxAH3eHT+p+zuqFCEHEbM0nqG+UHXv6fH3xQ5F7Ah84JLScpz xWzQ== X-Gm-Message-State: AOJu0YyjC0sgXwqplDPqtFB7KDrwyYf3/8GrxztXRLLkLBJXZn+BOXDU w4GljYdXB6+3hm1qCJhYqTc= X-Google-Smtp-Source: AGHT+IGY7K2TVYzmw4ze67twme6x/OWwf03V/5lRN/q0NUUPf+jdOYK1AQqeYR3hjvZXfG8pUniS6g== X-Received: by 2002:a05:6102:354f:b0:447:55b0:bceb with SMTP id e15-20020a056102354f00b0044755b0bcebmr5222926vss.0.1692623966778; Mon, 21 Aug 2023 06:19:26 -0700 (PDT) Original-Received: from smtpclient.apple (pool-108-26-231-137.bstnma.fios.verizon.net. [108.26.231.137]) by smtp.gmail.com with ESMTPSA id n8-20020a0ce548000000b0063d14bfa5absm2939198qvm.36.2023.08.21.06.19.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2023 06:19:25 -0700 (PDT) In-Reply-To: <83jztovc3g.fsf@gnu.org> X-Mailer: Apple Mail (2.3696.120.41.1.4) 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:268094 Archived-At: > On Aug 21, 2023, at 8:01 AM, Eli Zaretskii wrote: > >> From: Howard Melman >> Date: Sun, 20 Aug 2023 20:21:39 -0400 >> Cc: 65411@debbugs.gnu.org >> >>>> So why does it fail using setopt? >>> >>> Because until xref is loaded, Emacs doesn't know that >>> 'xref-pulse-momentarily' is a symbol of function, whereas the >>> defcustom's type is 'hook', which stands for "a list of functions". >> >> Well, that must be correct because doing this also worked fine: >> >> (declare-function xref-pulse-momentarily "xref" ()) >> (setopt xref-after-jump-hook '(reposition-window xref-pulse-momentarily)) >> Thanks for the continued responses. >> So I guess setopt defers the type check? > > No, it just verifies that the symbol's function slot is valid. I'd call that part of the type check, is it doing other stuff too? >> I get the error when the hook is run (at which time xref is loaded >> so I'm still confused about that). > > declare-function doesn't provider an actual function definition, it > just provides a declaration. IOW, you lie to Emacs, and Emacs bites > you when it can ;-) Yes, I understand declare-function, but it feels extra mean that Emacs decides it wants to bite for something and waits until after I correct that to do so. ;) >> I'm familiar with reading the lisp code but the innards of custom and >> the c code are a bit beyond me. Is it the custom-check-value property >> in setopt--set? > > Yes. > >> If I'm supposed to resolve this warning on my own, then a comment >> in setopt--set or something in setopt's docstring (or the manual) >> mentioning the asynchrony would help. > > setopt is a non-interactive version of defcustom. Like defcustom will > not accept a value that contradicts the :type of the option, so will > setopt. I don't think there's anything subtle to be documented here. But something seems off. Let me reiterate, I put this in my init: (setopt xref-after-jump-hook '(reposition-window xref-pulse-momentarily)) The value is properly formatted and is what custom would store in custom-file had I used M-x custom. In fact, if put this in the custom-file's custom-set-variables' call: '(xref-after-jump-hook '(reposition-window xref-pulse-momentarily)) and restart emacs, it works fine, with no warning at init or run time. So setopt behaves differently than defcustom, for the same value, giving an unclear warning (with extra parentheses around the value which I didn't put there and not mentioning anything being undefined) at an odd time where the cause is already resolved at warning time. I don't see how "Like defcustom will not accept a value that contradicts the :type of the option, so will setopt." is the issue here. Howard