From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Unsafe local variable in eglot.el Date: Thu, 9 Mar 2023 09:31:36 +0000 Message-ID: References: <83mt4m2w23.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34282"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 09 10:32:20 2023 Return-path: Envelope-to: ged-emacs-devel@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 1paCdH-0008k6-7I for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Mar 2023 10:32:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1paCcs-000060-Os; Thu, 09 Mar 2023 04:31:54 -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 1paCcq-00005h-SD for emacs-devel@gnu.org; Thu, 09 Mar 2023 04:31:53 -0500 Original-Received: from mail-oo1-xc32.google.com ([2607:f8b0:4864:20::c32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1paCco-0005k5-RT; Thu, 09 Mar 2023 04:31:52 -0500 Original-Received: by mail-oo1-xc32.google.com with SMTP id e12-20020a4ae0cc000000b00525034ca5e9so193079oot.0; Thu, 09 Mar 2023 01:31:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678354308; 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=aaJ/V9aOl7jYCUFtNTJKzfLvGlrPjZv17M8bXRjy178=; b=Dtm9oecaBktwWalKqTbiKhPhlimNCQmRUuZpzGAhbcVuselzIbrPQsdCoWv1l209Sp JL6QbEwnC2IHogGSaXEYnMaNiMq+A4jaPr4QdNoeZ61005fG1l5MXeZyllaz/qxmnqVh XCG/e/S9lTvucT1zVqHG0igoSHNWNawP4qMOXkQzz+0yE5aToTq8hsrXfxAvXRImeWef jGF+j6ALCj9Ky1nO4+S+mmIGOiLEpg1c76bCYCJhOi+gkqfQSvFUs7ShZH1HRiqQYcPN MrWZpxH73W2dVtLN7ekp3nXV2NYt9aDXLs+84fJswi878CfzYi+l+6gWR6xuJGRpdU7Z /DyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678354308; 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=aaJ/V9aOl7jYCUFtNTJKzfLvGlrPjZv17M8bXRjy178=; b=egH4m+Ktf0XQxHRJ1P7+QnH1u6j/1HTSUWhwFDKRMbXEi5YQKEulPUX6FhNsZbVX2o ZBSD9jVQ4E98DOjnEmhx/0VKfkhQikXM/VrCDgtgS4/K6DFtSiGMtwWyqpApHdiCdbuh TFQ2WykOErIYVBSxhGel0/bDgx52ZLZKlSxcF0TrIE361odDGAu9goTYJZq9gLVNaKBK OH8yYx49pfIfiQqwP1lTy/6mXvsGRA1wWePcV2NDplTypnv+PdroVPCP2bLMIIt4d/8u 3PbTRitUD1ESrGruMubMa0t1VJD1Eqh7sm7i29sGvT037gFUDEbYqYSQYqGEeuZ4fhTP fMZw== X-Gm-Message-State: AO0yUKX7BEKuWnR2J2m+6jOD+WEn+18YFcc17fasBBOp49/NesU4AmwZ 2A4bBo/jDtxMb1ID3xBvhfYu6Ox4mGghOy5tKvTfIXtPGx8= X-Google-Smtp-Source: AK7set+QNe8py/rNnadpWS0ALE3WkzZf1iszI8ziCRkXmOsYmV39CJOfIlbgChvVUc3iXcSUqOvqNXHqicHgDJiK3wA= X-Received: by 2002:a4a:6502:0:b0:525:2a18:e6eb with SMTP id y2-20020a4a6502000000b005252a18e6ebmr7195824ooc.1.1678354307909; Thu, 09 Mar 2023 01:31:47 -0800 (PST) In-Reply-To: <83mt4m2w23.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::c32; envelope-from=joaotavora@gmail.com; helo=mail-oo1-xc32.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304175 Archived-At: On Thu, Mar 9, 2023 at 8:00=E2=80=AFAM Eli Zaretskii wrote: > > Jo=C3=A3o, > > This recent change: > > commit 0a4b1c0102d4062d24e19340f863b9df25e07ab3 > Author: Joao T=C3=A1vora > AuthorDate: Wed Mar 1 13:24:07 2023 +0000 > Commit: Joao T=C3=A1vora > CommitDate: Wed Mar 1 13:27:06 2023 +0000 > > ; Eglot: improve bug-reference-url-format/bug-reference-url-regexp > > * lisp/progmodes/eglot.el (eglot--debbugs-or-github-bug-uri): New h= elper. > > causes trouble when visiting eglot.el. I've reproduced it with cd path/to/Emacs src/emacs -Q lisp/progmodes/eglot.el But curiously, this doesn't reproduce it src/emacs -Q C-h f eglot RET C-x o TAB RET ;; to visit the "eglot.el" link Why is that? Anyway, I just followed the docstring: bug-reference-url-format is a variable defined in `bug-reference.el'. Its value is `eglot--debbugs-or-github-bug-uri' Local in buffer eglot.el; global value is nil Format used to turn a bug number into a URL. The bug number is supplied as a string, so this should have a single %s. This can also be a function designator; it is called without arguments and should return a string. It can use `match-string' to get parts matched against `bug-reference-bug-regexp', specifically: 1. issue kind (bug, patch, rfe &c) 2. issue number. There is no default setting for this, it must be set per file. If you set it to a symbol in the file Local Variables section, you need to add a `bug-reference-url-format' property to it: (put 'my-bug-reference-url-format 'bug-reference-url-format t) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ so that it is considered safe, see `enable-local-variables'. > First, this pops up the "variable may not be safe" buffer about the > variable bug-reference-url-format, even if I use Emacs 29, let alone > if I use older Emacs versions. > > And second, if I say "y" to the "apply unsafe variable" prompt, then > with the following jit-lock settings: > > (setq jit-lock-stealth-time 16) > (setq jit-lock-stealth-nice 0.5) > (setq jit-lock-stealth-verbose t) > (setq jit-lock-defer-contextually t) > (setq jit-lock-stealth-load 20) > > I get an error from jit-lock-stealth's timer: > > Error running timer =E2=80=98jit-lock-stealth-fontify=E2=80=99: (void-f= unction eglot--debbugs-or-github-bug-uri) > > The only way of avoiding these two issues is to say "n" to the prompt > asking whether to apply the variable, but that's not really a good > workaround, is it? > > Can these problems be solved, please, preferably in a way that older > Emacsen will also be happy (since Eglot is an ELPA package)? Maybe the function can be autoloaded? But is a significant number of people using older emacsen to edit Emacs's lisp/progmodes/eglot.el? As far as I've seen just now, if you launch an older Emacs to edit Emacs code, you warnings about unsafe local variables in Emacs's own top-evel .dir-locals.el. Until a solution is found, feel free to revert this change, because this is just a minor convenience, and mostly just for me (though it _is_ quite convenient). Jo=C3=A3o