From unknown Sat Jun 21 10:19:07 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#65912 <65912@debbugs.gnu.org> To: bug#65912 <65912@debbugs.gnu.org> Subject: Status: 2023-08-31; Fix xref errors when matching in unvisited files Reply-To: bug#65912 <65912@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:19:07 +0000 retitle 65912 2023-08-31; Fix xref errors when matching in unvisited files reassign 65912 auctex submitter 65912 David Fussner severity 65912 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 06:01:14 2023 Received: (at submit) by debbugs.gnu.org; 13 Sep 2023 10:01:14 +0000 Received: from localhost ([127.0.0.1]:60873 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgMgL-00006P-8J for submit@debbugs.gnu.org; Wed, 13 Sep 2023 06:01:13 -0400 Received: from lists.gnu.org ([2001:470:142::17]:48060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgMgI-000065-Tu for submit@debbugs.gnu.org; Wed, 13 Sep 2023 06:01:12 -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 ) id 1qgMg7-00045d-FA for bug-auctex@gnu.org; Wed, 13 Sep 2023 06:01:00 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgMg4-0004Wt-Ht for bug-auctex@gnu.org; Wed, 13 Sep 2023 06:00:59 -0400 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-53fa455cd94so4773491a12.2 for ; Wed, 13 Sep 2023 03:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1694599254; x=1695204054; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=4+G8SNv1tSw9sQmxjg+/hHG3IPnCqXsA6O96Cksu+g0=; b=rnidYtmPtSf3pBIrjJSZpWtrdYxvYnWTOcauo6C603SbfXmCnBJrQcm1l3LGq5gR7k liTkkyOY11g0nttSqp3UOJvWybilkK0QVNASqOSr99yIRFdlloGWQTO31bdiFziOfL59 LMUrpgabHZAjiLn3d2MmFbXqUbJf8htEzEN1NpH/K2aFX7MgFAPETeHZJxs4yfbOSv9O xYBY0Zlw/6h+36UsA4fWkNucwVfhAaRcL3bM6p4S68T4lLLgQL0655IkR4B2hMB25leU Zh/1lWPWgiE1w6vOWJdKOVMiH4vOCOi9Xjgh+jHsEUuEk6DhwiCoWgPJRhURHGQRlyF2 NbrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694599254; x=1695204054; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4+G8SNv1tSw9sQmxjg+/hHG3IPnCqXsA6O96Cksu+g0=; b=W87CEEFpG+FU1yvZnIm+ktMR2Uzr6ZdF40JzgTj95pzgqn9z6Ou1jX9zD/TrvU6W8+ 7ReQosrsSkQEy/PBr0S4zsAro3S4TSjLvhJcZuAXyvjvbsIPvr4MaxJtlGpxKNZGOMWK OFdSb3z4aoSYyGrMX6Azd7LHtlyi8rh4du23rsNwcve9RgyBAIlTt8liBHYQmpWUtuZP VDbIC6D49fQatfXMAEhNGEUdIVH2Mreh+Fnd2kRjlI4Cw51SyJnRwLI7amWZqWVfGAct lBeKLzZ8z5KStN2PaHBtwVsgaKczpYuQAlE3Bn9S/XJqlrewhVbNTS1nmPlbm0cu6FCQ /1fg== X-Gm-Message-State: AOJu0YwbcAgey2hANlXVeiClVluno2vYAhsqNfULvnYwBaaDjWnsoVth UJKWXeKRmYTtulnBShsxl6FLY66BfatBX1TV+rJzGilqJ082oQ== X-Google-Smtp-Source: AGHT+IFI+SU/SrrKKaOzxCc7U/mbrbQbYUC1uMEUw0/3WLAxync3Ivk7+rT9+S2/ANaTtSkydIcfTk0+OCFc5c+JDo0= X-Received: by 2002:a17:90b:46c1:b0:263:fbe5:2125 with SMTP id jx1-20020a17090b46c100b00263fbe52125mr1751114pjb.15.1694599253443; Wed, 13 Sep 2023 03:00:53 -0700 (PDT) MIME-Version: 1.0 From: David Fussner Date: Wed, 13 Sep 2023 11:00:41 +0100 Message-ID: Subject: 2023-08-31; Fix xref errors when matching in unvisited files To: bug-auctex@gnu.org Content-Type: multipart/mixed; boundary="0000000000008a61ac06053aa269" Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=dfussner@googlemail.com; helo=mail-pg1-x52e.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-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --0000000000008a61ac06053aa269 Content-Type: text/plain; charset="UTF-8" Hi. I've been working on getting the main xref commands working in TeX files, and ran into a couple of issues. To reproduce the first one, in an empty directory put something like the following text into a file, mwe.ltx (the file extension matters -- please don't try .tex, as that encounters a separate bug which is better fixed in Emacs itself, I think): \documentclass[12pt]{article} \usepackage{fontspec} \usepackage{xparse} \ExplSyntaxOn \bool_new:N \g__hook_debug_bool \cs_new_eq:NN \__hook_debug:n \use_none:n \ExplSyntaxOff \begin{document} \thispagestyle{empty} \end{document} Then copy mwe.ltx to mwe2.ltx, and visit mwe.ltx without visiting mwe2.ltx. Place point on "fontspec" and hit M-?, RTN, then "..." to choose a search directory, then choose the current one (the default). Here I see this error: Font-lock trying to use keywords before setting them up The end of the backtrace looks like this: Debugger entered--Lisp error: (error "Font-lock trying to use keywords before setting th...") signal(error ("Font-lock trying to use keywords before setting th...")) error("Font-lock trying to use keywords before setting th...") font-lock-compile-keywords((("\\\\\\(?:\\(?:verb\\*?\\)\\)\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^]..." (1 "\"") (2 ".") (3 "\"")) ("\\(\\\\\\)end *{\\(?:\\(?:filecontents\\*?\\|verbatim\\*?\\)..." (1 "|" t)) ("^[ \11]*\\\\begin *{\\(?:\\(?:filecontents\\*?\\|verbatim\\..." (1 "|" t))) t) font-lock-fontify-syntactic-keywords-region(1 22) #f(compiled-function (start end) #)(1 22) syntax-propertize(22) xref--collect-matches-1("\\_" "~/src/testing/mwe2.ltx" 2 1 22 0) The compiled function here is font-latex--make-syntax-propertize-function, which is a wrapper for syntax-propertize-via-font-lock, which is a standard value for syntax-propertize-function, but the in-tree tex-mode.el uses a different function, and the error doesn't appear there. Here syntax-propertize-via-font-lock calls font-lock-fontify-syntactic-keywords-region, which calls font-lock-compile-keywords, which errors out because in the temporary buffer (" *xref-temp*") we haven't yet called font-lock-set-defaults. The in-tree bibtex.el uses the same syntax-propertize-function but doesn't error here, because it calls font-lock-set-defaults, with a comment explaining why, at the end of the definition of bibtex-mode itself. If you visit both mwe2.ltx and mwe.ltx, the error won't appear, because the font-locking mechanism calls font-lock-set-defaults when setting up the buffer. I enclose a patch (0001), which puts the required call, with a comment, at the end of font-latex-set-syntactic-keywords, which seems to work for all the AUCTeX modes, but there may be a better place for it. If you apply patch 0001, and make sure font-latex.el is reloaded, you can then see the next bug: in specific cases, xref-find-references reports a hit only in visited files, despite there being identical text in the unvisited one. To reproduce, move point in mwe.ltx from "fontspec" to "\__hook_debug:n", then call M-? just as before. You'll only see the hit in mwe.ltx in the xref buffer, not the one in mwe2.ltx. The problem is that the search string called by xref-find-references has the format "\\_<%s\\_>", so that any search term which doesn't start and end with chars having either word or symbol syntax won't be returned. Now, assuming that parsing is enabled, AUCTeX does the right thing here and parses this file as containing expl3 constructs, and therefore gives "_" symbol syntax. Unfortunately, the style file expl3.el will not be applied to temporary, non-file-visiting buffers like " *xref-temp*", because the find-file-hook set at the end of VirTeX-common-initialization won't be called in such buffers. The attached patch (0002) parses and applies styles in the temp buffer, and only in such non-file-visiting buffers. It does so both in LaTeX-common-initialization and in plain-TeX-common-initialization, which I think covers all the modes. My profoundest apologies for the long bug report, and thanks, David. Emacs : GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.31, cairo version 1.16.0) of 2023-09-11 Package: 2023-08-31 current state: ============== (setq AUCTeX-date "2023-08-31" window-system 'x LaTeX-version "2e" TeX-style-path '("/usr/local/var/auctex" "/home/dfussner/src/auctex/style" "/home/dfussner/.emacs.d/auctex/auto" "/home/dfussner/.emacs.d/auctex/style" "auto" "style") TeX-auto-save t TeX-parse-self t TeX-master nil TeX-command-list '(("TeX" "%(PDF)%(tex) %(file-line-error) %`%(extraopts) %S%(PDFout)%(mode)%' %(output-dir) %t" TeX-run-TeX nil (plain-tex-mode ams-tex-mode texinfo-mode) :help "Run plain TeX") ("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX") ("Makeinfo" "makeinfo %(extraopts) %(o-dir) %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with Info output") ("Makeinfo HTML" "makeinfo %(extraopts) %(o-dir) --html %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with HTML output") ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %(output-dir) %t" TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX") ("ConTeXt" "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt once") ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion") ("BibTeX" "bibtex %(O?aux)" TeX-run-BibTeX nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode context-mode) :help "Run BibTeX") ("Biber" "biber %(output-dir) %s" TeX-run-Biber nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run Biber") ("Texindex" "texindex %s.??" TeX-run-command nil (texinfo-mode) :help "Run Texindex") ("Texi2dvi" "%(PDF)texi2dvi %t" TeX-run-command nil (texinfo-mode) :help "Run Texi2dvi or Texi2pdf") ("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file") ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command) ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Generate PostScript file") ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Convert DVI file to PostScript") ("Dvipdfmx" "dvipdfmx -o %(O?pdf) %d" TeX-run-dvipdfmx nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Convert DVI file to PDF with dvipdfmx") ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Convert PostScript file to PDF") ("Glossaries" "makeglossaries %(d-dir) %s" TeX-run-command nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run makeglossaries to create glossary file") ("Index" "makeindex %(O?idx)" TeX-run-index nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run makeindex to create index file") ("upMendex" "upmendex %(O?idx)" TeX-run-index t (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run upmendex to create index file") ("Xindy" "texindy %s" TeX-run-command nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help "Run xindy to create index file") ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness") ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for common mistakes") ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document") ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files") ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files") ("Other" "" TeX-run-command t t :help "Run an arbitrary command") ) ) --0000000000008a61ac06053aa269 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Fix-xref-error-when-matching-in-unvisited-files.patch" Content-Disposition: attachment; filename="0001-Fix-xref-error-when-matching-in-unvisited-files.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lmhkgw480 RnJvbSA2ZGYyNzkwNjViZDcxM2MzYTliNDUyNDg2MDYzMTczMmRhMTUxOWExIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBEYXZpZCBGdXNzbmVyIDxkZnVzc25lckBnb29nbGVtYWlsLmNv bT4KRGF0ZTogTW9uLCAyMCBNYXIgMjAyMyAxNjo1NzoyNyArMDAwMApTdWJqZWN0OiBbUEFUQ0gg MS8yXSBGaXggeHJlZiBlcnJvciB3aGVuIG1hdGNoaW5nIGluIHVudmlzaXRlZCBmaWxlcwoKKiBm b250LWxhdGV4LmVsIChmb250LWxhdGV4LXNldC1zeW50YWN0aWMta2V5d29yZHMpOiBBZGQgY2Fs bCB0bwpmb250LWxvY2stc2V0LWRlZmF1bHRzIHRvIGZpeCBhbiBlcnJvciB3aGVuIHhyZWYtZmlu ZC1yZWZlcmVuY2VzIHRyaWVzCnRvIGZvbnRpZnkgdGhlIHNlYXJjaCByZXN1bHRzIGluIHRoZSAi ICp4cmVmLXRlbXAqIiBidWZmZXIuCi0tLQogZm9udC1sYXRleC5lbCB8IDkgKysrKysrKy0tCiAx IGZpbGUgY2hhbmdlZCwgNyBpbnNlcnRpb25zKCspLCAyIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdp dCBhL2ZvbnQtbGF0ZXguZWwgYi9mb250LWxhdGV4LmVsCmluZGV4IDhmYzU2N2UyLi41YWRkYTMx NCAxMDA2NDQKLS0tIGEvZm9udC1sYXRleC5lbAorKysgYi9mb250LWxhdGV4LmVsCkBAIC0xMTE2 LDkgKzExMTYsMTQgQEAgaGF2ZSBjaGFuZ2VkLiIKICAgOzsgICAgICAgKGFwcGVuZCBmb250LWxh dGV4LXN5bnRhY3RpYy1rZXl3b3JkcwogICA7OyAgICAgICAgICAgICAgIDs7IEZvciBkb2NUZVgg Y29tbWVudC1pbi1kb2MuCiAgIDs7ICAgICAgICAgICAgICAgJygoIlxcKFxcXlxcKVxcXkEiICgx IChmb250LWxhdGV4LWRvY3RleC1eXkEpKSkpKSkKLSAgOzsgRmluYWxseSwgY29tcHV0ZSBvdXIg YHN5bnRheC1wcm9wZXJ0aXplLWZ1bmN0aW9uJyBhbmV3LgorICA7OyBDb21wdXRlIG91ciBgc3lu dGF4LXByb3BlcnRpemUtZnVuY3Rpb24nIGFuZXcuCiAgIChzZXRxLWxvY2FsIHN5bnRheC1wcm9w ZXJ0aXplLWZ1bmN0aW9uCi0gICAgICAgICAgICAgIChmb250LWxhdGV4LS1tYWtlLXN5bnRheC1w cm9wZXJ0aXplLWZ1bmN0aW9uKSkpCisgICAgICAgICAgICAgIChmb250LWxhdGV4LS1tYWtlLXN5 bnRheC1wcm9wZXJ0aXplLWZ1bmN0aW9uKSkKKyAgOzsgV2UgbWF5IGJlIHVzaW5nIHRoZSBtb2Rl IHByb2dyYW1tYXRpY2FsbHkgdG8gZXh0cmFjdCBkYXRhLCBhbmQgd2UKKyAgOzsgdGhlbiBuZWVk IHRoaXMgdG8gYmUgc2V0IHVwIGZpcnN0IHNvIHRoYXQgYSBjb21tYW5kIGxpa2UKKyAgOzsgYHhy ZWYtZmluZC1yZWZlcmVuY2VzJyBkb2Vzbid0IGJ1ZyBvdXQgd2hlbiBtYXRjaGluZyBoaXRzIGlu CisgIDs7IGZpbGVzIHRoYXQgRW1hY3MgaXNuJ3QgdmlzaXRpbmcuCisgIChmb250LWxvY2stc2V0 LWRlZmF1bHRzKSkKIAogCiA7OzsgU3ludGFjdGljIGZvbnRpZmljYXRpb24KLS0gCjIuMzUuOAoK --0000000000008a61ac06053aa269 Content-Type: text/x-patch; charset="US-ASCII"; name="0002-Fix-xref-error-when-matching-in-unvisited-files.patch" Content-Disposition: attachment; filename="0002-Fix-xref-error-when-matching-in-unvisited-files.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lmhkhc0t1 RnJvbSBmOTBjNDY3NzdhOGM3NTY1YTFjZDM0ZmU0YWJkZTYyYWMyZjE0ZDlmIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBEYXZpZCBGdXNzbmVyIDxkZnVzc25lckBnb29nbGVtYWlsLmNv bT4KRGF0ZTogV2VkLCAxMyBTZXAgMjAyMyAxMDoxNDo0MCArMDEwMApTdWJqZWN0OiBbUEFUQ0gg Mi8yXSBGaXggeHJlZiBlcnJvciB3aGVuIG1hdGNoaW5nIGluIHVudmlzaXRlZCBmaWxlcwoKKiBs YXRleC5lbCAoTGFUZVgtY29tbW9uLWluaXRpYWxpemF0aW9uKToKKiBwbGFpbi10ZXguZWwgKHBs YWluLVRlWC1jb21tb24taW5pdGlhbGl6YXRpb24pOiBBZGQgY2FsbHMgdG8KVGVYLXVwZGF0ZS1z dHlsZSB0byBmaXggbWlzc2VkIG1hdGNoZXMgd2hlbiB4cmVmLWZpbmQtcmVmZXJlbmNlcwpzZWFy Y2hlcyB1bnZpc2l0ZWQgZmlsZXMuCi0tLQogbGF0ZXguZWwgICAgIHwgOCArKysrKysrLQogcGxh aW4tdGV4LmVsIHwgOCArKysrKysrLQogMiBmaWxlcyBjaGFuZ2VkLCAxNCBpbnNlcnRpb25zKCsp LCAyIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2xhdGV4LmVsIGIvbGF0ZXguZWwKaW5kZXgg NTQ4YjE4YTkuLmQ0YTU0NjdhIDEwMDY0NAotLS0gYS9sYXRleC5lbAorKysgYi9sYXRleC5lbApA QCAtODg0Myw3ICs4ODQzLDEzIEBAIGZ1bmN0aW9uIHdvdWxkIHJldHVybiBub24tbmlsIGFuZCBg KG1hdGNoLXN0cmluZyAxKScgd291bGQgcmV0dXJuCiAgIDs7IFNldCBMYVRlWC1zcGVjaWZpYyBo ZWxwIG1lc3NhZ2VzIGZvciBlcnJvciBzbyB0aGF0IGl0J3MgYXZhaWxhYmxlCiAgIDs7IGluIGBU ZVgtaGVscC1lcnJvcicuCiAgIChzZXRxLWxvY2FsIFRlWC1lcnJvci1kZXNjcmlwdGlvbi1saXN0 LWxvY2FsCi0gICAgICAgICAgICAgIExhVGVYLWVycm9yLWRlc2NyaXB0aW9uLWxpc3QpKQorICAg ICAgICAgICAgICBMYVRlWC1lcnJvci1kZXNjcmlwdGlvbi1saXN0KQorICA7OyBDb21wbGV0ZSBz dHlsZSBpbml0aWFsaXphdGlvbiBpbiBidWZmZXJzIHdoaWNoIGRvbid0IHZpc2l0IGZpbGVzCisg IDs7IGFuZCB3aGljaCBhcmUgdGhlcmVmb3JlIG1pc3NlZCBieSB0aGUgc2V0dGluZyBvZiBgZmlu ZC1maWxlLWhvb2snCisgIDs7IGluIGBWaXJUZVgtY29tbW9uLWluaXRpYWxpemF0aW9uJy4gIFRo aXMgaXMgbmVjZXNzYXJ5IGZvcgorICA7OyBgeHJlZi1maW5kLXJlZmVyZW5jZXMnLCBmb3IgZXhh bXBsZS4KKyAgKHVubGVzcyBidWZmZXItZmlsZS10cnVlbmFtZQorICAgIChUZVgtdXBkYXRlLXN0 eWxlKSkpCiAKIChkZWZ1biBMYVRlWC1pbWVudS1jcmVhdGUtaW5kZXgtZnVuY3Rpb24gKCkKICAg IkltZW51IHN1cHBvcnQgZnVuY3Rpb24gZm9yIExhVGVYLiIKZGlmZiAtLWdpdCBhL3BsYWluLXRl eC5lbCBiL3BsYWluLXRleC5lbAppbmRleCAwODAwYjJmMy4uMWUxM2FjYzYgMTAwNjQ0Ci0tLSBh L3BsYWluLXRleC5lbAorKysgYi9wbGFpbi10ZXguZWwKQEAgLTI0NCw3ICsyNDQsMTMgQEAgb2Yg YHBsYWluLVRlWC1tb2RlLWhvb2snLiIKICAgICJwYXJpbmRlbnQiCiAgICAiYmFzZWxpbmVza2lw IgogICAgInBhcnNraXAiKQotICAoVGVYLXJ1bi1zdHlsZS1ob29rcyAiVEVYIikpCisgIChUZVgt cnVuLXN0eWxlLWhvb2tzICJURVgiKQorICA7OyBDb21wbGV0ZSBzdHlsZSBpbml0aWFsaXphdGlv biBpbiBidWZmZXJzIHdoaWNoIGRvbid0IHZpc2l0IGZpbGVzCisgIDs7IGFuZCB3aGljaCBhcmUg dGhlcmVmb3JlIG1pc3NlZCBieSB0aGUgc2V0dGluZyBvZiBgZmluZC1maWxlLWhvb2snCisgIDs7 IGluIGBWaXJUZVgtY29tbW9uLWluaXRpYWxpemF0aW9uJy4gIFRoaXMgaXMgbmVjZXNzYXJ5IGZv cgorICA7OyBgeHJlZi1maW5kLXJlZmVyZW5jZXMnLCBmb3IgZXhhbXBsZS4KKyAgKHVubGVzcyBi dWZmZXItZmlsZS10cnVlbmFtZQorICAgIChUZVgtdXBkYXRlLXN0eWxlKSkpCiAKIAogOzs7IE1p c2NlbGxhbmVvdXMKLS0gCjIuMzUuOAoK --0000000000008a61ac06053aa269-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 08:46:41 2023 Received: (at 65912) by debbugs.gnu.org; 14 Sep 2023 12:46:41 +0000 Received: from localhost ([127.0.0.1]:37922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qglk1-0001yg-6a for submit@debbugs.gnu.org; Thu, 14 Sep 2023 08:46:41 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:57746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgljz-0001yT-IU for 65912@debbugs.gnu.org; Thu, 14 Sep 2023 08:46:40 -0400 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5778fe9d183so724478a12.3 for <65912@debbugs.gnu.org>; Thu, 14 Sep 2023 05:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1694695587; x=1695300387; darn=debbugs.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=4ONO2ms3wjjDNtJIQFJ7+kJn9BjFXARGyGmTPgtnZIE=; b=nv8mjGh4HJRUvHGZjtEoRS3uUK/a682iLL+2uTJieCDPQKTCDcTGad0zdR+T+Tc9Fs IOtaaU+/tSmtiMGewRW5k06aK8SsucB8oOBnMQJG1gxTxEHdT7AyOYzteVFeL0yW0sAm ut3iwyYpCoRW/dV1M4INKuTFHZ9jP6T8cXObckO3iWOf8+EMXh89wTyVsCicuajErhqn EYr5/LBczmIFTc58gathrc4I680qzHBuJe6dqk4MIIjd46yK06VmAl5JYpxxF/JqBVH6 1npksSAxva932fJyeNvFDvVH10yDB/hLPLnKYrc89f5sBcu/7+NqBva2wz+qdBBClkxh gumg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694695587; x=1695300387; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4ONO2ms3wjjDNtJIQFJ7+kJn9BjFXARGyGmTPgtnZIE=; b=WQl1JVjCzwa6dKOq4CATIfVj6p1/w8jeEsyVTEn1EzJOUwdnBqBJLFRBP/YaKj0QzD DaAlUHtMeAay8O2qClfIIg9SdKhp86nTofShpT1FKcSdHbPSOG1M4GRpAgYuw29fOpTf V74zQgiEjZ4y7N31vFqCzA+4RGPl8PTpLNHKRuqrzQvJxZVbVg9oV2w793hZ5WGRTrYy 0xRfmIR1xo+s5HsuknFxyHmBjiqN7D3goiboSo7CndQ3eDhUtHPQAzsad6Nk1uqLa4w6 +5f+fDY6DAhZjqq+LIpVhd02YhTJUZCGJlMv/0lgIS7IJXRbnGBqa2SPGLnX5/7nisJ/ dMqw== X-Gm-Message-State: AOJu0YyTxJVnXd073CfkAs6IxIznQOkQz2JEHu4NVKciBHEUc4stTJXi Y4DRBVwXIxooA36FCAC1JhWmHYicE6N7RyYdshLdnpnUOPXFHw== X-Google-Smtp-Source: AGHT+IGeVSfEC6C1CSa73jA/wJaX4HPoEqGZ6ooFMxOiU+T5xgu3tUfY3ledVV4jD9SHBFL1YqAU7AA5ifohJE1gHkk= X-Received: by 2002:a17:90a:ab86:b0:26f:b228:faea with SMTP id n6-20020a17090aab8600b0026fb228faeamr4582752pjq.18.1694695587331; Thu, 14 Sep 2023 05:46:27 -0700 (PDT) MIME-Version: 1.0 From: David Fussner Date: Thu, 14 Sep 2023 13:46:15 +0100 Message-ID: Subject: 2023-08-31; Fix xref errors when matching in unvisited files To: 65912@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65912 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, As my initial report mentioned, I've been working on getting xref commands to work in TeX buffers (see bug 53749), and while we've not exactly reached a consensus on how this might best be done, I was reminded by Dmitry Gutov that I really should check with the AUCTeX developers about how you might like to go about using such functionality, whenever it reaches its final form, in AUCTeX. Currently, if you look at the latest patch in 53749 you'll see that I've added a TeX-mode hook in tex-mode.el, with a note wondering whether such a thing should be in AUCTeX instead. (The other AUCTeX-specific stuff is just accounting for differences in the syntax table between the in-tree modes and the AUCTeX modes.) If this is the right place to ask such a question, I wondered whether you'd prefer that such a hook be called somewhere in AUCTeX (or not at all), and / or whether you might prefer it to be behind some sort of option so that it wouldn't be turned on by default. Personally, as an AUCTeX user myself, I don't find the current state of xref commands in TeX buffers very useful, but opinions may differ and I'd certainly be happy to remove the call from tex-mode.el should you desire it. Sorry if this is the wrong place to ask this question! David. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 01:45:37 2023 Received: (at 65912) by debbugs.gnu.org; 15 Sep 2023 05:45:37 +0000 Received: from localhost ([127.0.0.1]:41826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh1e5-00041j-3Z for submit@debbugs.gnu.org; Fri, 15 Sep 2023 01:45:37 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:52126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh1e2-00041X-Ef for 65912@debbugs.gnu.org; Fri, 15 Sep 2023 01:45:35 -0400 Received: from localhost (42-144-34-11.rev.home.ne.jp [42.144.34.11]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id EE30C60; Fri, 15 Sep 2023 14:45:25 +0900 (JST) From: Ikumi Keita To: David Fussner Subject: Re: bug#65912: 2023-08-31; Fix xref errors when matching in unvisited files In-reply-to: References: Comments: In-reply-to David Fussner via bug-auctex via Bug reporting list for AUCTeX message dated "Wed, 13 Sep 2023 11:00:41 +0100." X-Mailer: MH-E 8.6+git; nmh 1.7.1; Emacs 29.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Fri, 15 Sep 2023 14:45:17 +0900 Message-ID: <61356.1694756717@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65912 Cc: 65912@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hi David, thanks for raising these issues. >>>>> David Fussner via bug-auctex via Bug reporting list for AUCTeX writes: > I enclose a patch (0001), which puts the required call, with a comment, at > the end of font-latex-set-syntactic-keywords, which seems to work for > all the AUCTeX modes, but there may be a better place for it. 1. This breaks doctex fontification. Doctex mode calls `font-latex-setup' twice; once in `VirTeX-common-initialization', once in `docTeX-mode'. Since the first one calls `font-lock-set-defaults' which sets the variable `font-lock-set-defaults' to t (and `major-mode' isn't `doctex-mode' yet), the second call to `font-lock-set-defaults' does nothing and doctex specific fontification isn't taken into account. Adding (setq font-lock-set-defaults nil) before (funcall TeX-install-font-lock) in `docTeX-mode' addresses this problem. 2. I think better place for `(font-lock-set-defaults)' is `font-latex-setup' rather than `font-latex-set-syntactic-keywords'; the latter is sometimes called afterwards by AUCTeX style files. I modified your proposal to make the attached patch. This fixes your first bug keeping the doctex fontification. > If you apply patch 0001, and make sure font-latex.el is reloaded, you > can then see the next bug: in specific cases, xref-find-references > reports a hit only in visited files, despite there being identical text > in the unvisited one. I confirmed the reported result. > The attached patch (0002) parses and applies styles in the temp > buffer, and only in such non-file-visiting buffers. It does so both in > LaTeX-common-initialization and in plain-TeX-common-initialization, > which I think covers all the modes. It seems reasonable basically. However, this makes two regression tests fail: 2 unexpected results: FAILED LaTeX-filling FAILED LaTeX-style-hook-with-class-option I thought the following advice in latex-test.el is interfering badly: ---------------------------------------------------------------------- ;; We need to ensure that font-lock has put the syntax properties ;; already which won't happen in batch mode. So trigger font-lock ;; immediately. (define-advice LaTeX-common-initialization (:after ()) (font-lock-ensure)) ---------------------------------------------------------------------- However, the failures remain even after I deleted this advice. I haven't figured out what's going on yet. (Maybe the failures only appear in batch mode and aren't real issues.) Does anyone out there have insights? Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=patch Content-Description: revised patch diff --git a/font-latex.el b/font-latex.el index 8fc567e2..92eb7046 100644 --- a/font-latex.el +++ b/font-latex.el @@ -1353,7 +1353,13 @@ triggers Font Lock to recognize the change." ;; Make sure fontification will be refreshed if a user sets variables ;; influencing fontification in her file-local variables section. - (add-hook 'hack-local-variables-hook #'font-latex-after-hacking-local-variables t t)) + (add-hook 'hack-local-variables-hook #'font-latex-after-hacking-local-variables t t) + + ;; We may be using the mode programmatically to extract data, and we + ;; then need this to be set up first so that a command like + ;; `xref-find-references' doesn't bug out when matching hits in + ;; files that Emacs isn't visiting. + (font-lock-set-defaults)) (defun font-latex-update-font-lock (&optional _syntactic-kws) "Tell font-lock about updates of fontification rules. diff --git a/latex.el b/latex.el index 3abb00f2..a7f236e8 100644 --- a/latex.el +++ b/latex.el @@ -8068,6 +8068,7 @@ runs the hooks in `docTeX-mode-hook'." TeX-comment-start-regexp "\\(?:%\\(?:<[^>]+>\\)?\\)") (setq TeX-base-mode-name "docTeX") (TeX-set-mode-name) + (setq font-lock-set-defaults nil) (funcall TeX-install-font-lock)) ;; Enable LaTeX abbrevs in docTeX mode buffer. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 02:37:38 2023 Received: (at 65912) by debbugs.gnu.org; 15 Sep 2023 06:37:38 +0000 Received: from localhost ([127.0.0.1]:41870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh2SP-0005Rb-91 for submit@debbugs.gnu.org; Fri, 15 Sep 2023 02:37:37 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:58740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh2SG-0005RD-0C for 65912@debbugs.gnu.org; Fri, 15 Sep 2023 02:37:35 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-31c3df710bdso1610577f8f.1 for <65912@debbugs.gnu.org>; Thu, 14 Sep 2023 23:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1694759835; x=1695364635; 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=kRqRyIXIYJYNXAX4FLzF2KjSTyU0HpUd8eF3fh6+Hso=; b=TfmOIbvVcsSZ8plqg99AyZCbO+5ixrNiU7rBEbsp+kUCjz0iw+md/G3LitAOhPkpdn 38+AwjmZhjYPz9sQzoziYMZMpDjZAUCZ6U0lyCI03wbO1QTZ0ZqghxgqVep+Heife9sN ZY76Fg/LFv5Vy8q5INbNt6+04E+OTlLP/N6EMe3TpI377GmHLGnexISWgEdAWy8M5hCo BdIA8rRYK69rWEciDyT6K/2QErj1VP3VL3h0xoN2iH5zNGzr95I5GRXfKld5Lz4CXJ3u UnY6pIifGl86cfouJcPsWtffKqOxvEV/4toyWFtjJO7d5EVbwRd3j56OauIpNJ8/KSYf ISoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694759835; x=1695364635; h=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=kRqRyIXIYJYNXAX4FLzF2KjSTyU0HpUd8eF3fh6+Hso=; b=MDanu4xBA2glH9qQJfPgNhfwycLBdbPk4YWYikSD6PlmD9r4NjnDg6xkWl2mCvixsV jj0Bt0KonhpUD7GiBSMVVBuRXogEOFMI27aXsiUfLayhpgqU+K3LpToPwhM0oO+vfK9c lpx1OCZaGgZm4P/kim/uGQpzJgQHIGIPPhHiAiuM6okPH7K0TJ/YVGIly/FoAUmzxANX BhoxMHcCrEdQCKxvTJiEmqs74dcHaQQwQ5KsskBpq1ADpX9SNLQngSIygbmeqpEcHrWZ 4rt44FoNCi87Mf3zdJbchTW6nHD47ZbCgI7cIHMj8bXhE57+n3H61Y7nkIJYJTv8T5k6 ZrcA== X-Gm-Message-State: AOJu0YyaWMSMBwdwkwhJlcjdhuyhyYHpE9Nf3CKwkBOTGwC+3Y5Hzgj6 oafWA32JBh4Qy7C13XHnHm8mqYGdXLUnX1d+XUJFVUyTG7M= X-Google-Smtp-Source: AGHT+IGAQXEUo5uypoSOinvH4a2XXlJ3ZhRVvZt5+w46lqd5ZKT59OWmcNAvZosSimRCdjtQMBbL1Eararsx+MdOLOE= X-Received: by 2002:a5d:42ce:0:b0:319:74b5:b67d with SMTP id t14-20020a5d42ce000000b0031974b5b67dmr514573wrr.66.1694759834654; Thu, 14 Sep 2023 23:37:14 -0700 (PDT) MIME-Version: 1.0 References: <61356.1694756717@localhost> In-Reply-To: <61356.1694756717@localhost> From: David Fussner Date: Fri, 15 Sep 2023 07:37:01 +0100 Message-ID: Subject: Re: bug#65912: 2023-08-31; Fix xref errors when matching in unvisited files To: Ikumi Keita Content-Type: multipart/alternative; boundary="000000000000ec9b3306056005be" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65912 Cc: 65912@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000ec9b3306056005be Content-Type: text/plain; charset="UTF-8" Thanks Ikumi. I should have run more tests myself, so apologies for making it harder for you. I'll let you know if I figure anything out. David. On Fri, 15 Sept 2023, 06:45 Ikumi Keita, wrote: > Hi David, thanks for raising these issues. > > >>>>> David Fussner via bug-auctex via Bug reporting list for AUCTeX < > bug-auctex@gnu.org> writes: > > > I enclose a patch (0001), which puts the required call, with a comment, > at > > the end of font-latex-set-syntactic-keywords, which seems to work for > > all the AUCTeX modes, but there may be a better place for it. > > 1. This breaks doctex fontification. Doctex mode calls > `font-latex-setup' twice; once in `VirTeX-common-initialization', > once in `docTeX-mode'. Since the first one calls > `font-lock-set-defaults' which sets the variable > `font-lock-set-defaults' to t (and `major-mode' isn't `doctex-mode' > yet), the second call to `font-lock-set-defaults' does nothing and > doctex specific fontification isn't taken into account. > Adding > (setq font-lock-set-defaults nil) > before (funcall TeX-install-font-lock) in `docTeX-mode' addresses > this problem. > > 2. I think better place for `(font-lock-set-defaults)' is > `font-latex-setup' rather than `font-latex-set-syntactic-keywords'; > the latter is sometimes called afterwards by AUCTeX style files. > > I modified your proposal to make the attached patch. This fixes your > first bug keeping the doctex fontification. > > > If you apply patch 0001, and make sure font-latex.el is reloaded, you > > can then see the next bug: in specific cases, xref-find-references > > reports a hit only in visited files, despite there being identical text > > in the unvisited one. > > I confirmed the reported result. > > > The attached patch (0002) parses and applies styles in the temp > > buffer, and only in such non-file-visiting buffers. It does so both in > > LaTeX-common-initialization and in plain-TeX-common-initialization, > > which I think covers all the modes. > > It seems reasonable basically. However, this makes two regression tests > fail: > 2 unexpected results: > FAILED LaTeX-filling > FAILED LaTeX-style-hook-with-class-option > > I thought the following advice in latex-test.el is interfering badly: > ---------------------------------------------------------------------- > ;; We need to ensure that font-lock has put the syntax properties > ;; already which won't happen in batch mode. So trigger font-lock > ;; immediately. > (define-advice LaTeX-common-initialization (:after ()) > (font-lock-ensure)) > ---------------------------------------------------------------------- > However, the failures remain even after I deleted this advice. I haven't > figured out what's going on yet. (Maybe the failures only appear in > batch mode and aren't real issues.) Does anyone out there have insights? > > Regards, > Ikumi Keita > #StandWithUkraine #StopWarInUkraine > > --000000000000ec9b3306056005be Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Ikumi. I should have run more tests myself, so apo= logies for making it harder for you. I'll let you know if I figure anyt= hing out.

David.=C2=A0

On= Fri, 15 Sept 2023, 06:45 Ikumi Keita, <ikumi@ikumi.que.jp> wrote= :
Hi David, thanks for raising thes= e issues.

>>>>> David Fussner via bug-auctex via Bug reporting list fo= r AUCTeX <bug-auctex@gnu.org> writes:

> I enclose a patch (0001), which puts the required call, with a comment= , at
> the end of font-latex-set-syntactic-keywords, which seems to work for<= br> > all the AUCTeX modes, but there may be a better place for it.

1. This breaks doctex fontification. Doctex mode calls
=C2=A0 =C2=A0`font-latex-setup' twice; once in `VirTeX-common-initializ= ation',
=C2=A0 =C2=A0once in `docTeX-mode'. Since the first one calls
=C2=A0 =C2=A0`font-lock-set-defaults' which sets the variable
=C2=A0 =C2=A0`font-lock-set-defaults' to t (and `major-mode' isn= 9;t `doctex-mode'
=C2=A0 =C2=A0yet), the second call to `font-lock-set-defaults' does not= hing and
=C2=A0 =C2=A0doctex specific fontification isn't taken into account. =C2=A0 =C2=A0Adding
(setq font-lock-set-defaults nil)
=C2=A0 =C2=A0before (funcall TeX-install-font-lock) in `docTeX-mode' ad= dresses
=C2=A0 =C2=A0this problem.

2. I think better place for `(font-lock-set-defaults)' is
=C2=A0 =C2=A0`font-latex-setup' rather than `font-latex-set-syntactic-k= eywords';
=C2=A0 =C2=A0the latter is sometimes called afterwards by AUCTeX style file= s.

I modified your proposal to make the attached patch. This fixes your
first bug keeping the doctex fontification.

> If you apply patch 0001, and make sure font-latex.el is reloaded, you<= br> > can then see the next bug: in specific cases, xref-find-references
> reports a hit only in visited files, despite there being identical tex= t
> in the unvisited one.

I confirmed the reported result.

> The attached patch (0002) parses and applies styles in the temp
> buffer, and only in such non-file-visiting buffers. It does so both in=
> LaTeX-common-initialization and in plain-TeX-common-initialization, > which I think covers all the modes.

It seems reasonable basically. However, this makes two regression tests
fail:
2 unexpected results:
=C2=A0 =C2=A0FAILED=C2=A0 LaTeX-filling
=C2=A0 =C2=A0FAILED=C2=A0 LaTeX-style-hook-with-class-option

I thought the following advice in latex-test.el is interfering badly:
----------------------------------------------------------------------
;; We need to ensure that font-lock has put the syntax properties
;; already which won't happen in batch mode.=C2=A0 So trigger font-lock=
;; immediately.
(define-advice LaTeX-common-initialization (:after ())
=C2=A0 (font-lock-ensure))
----------------------------------------------------------------------
However, the failures remain even after I deleted this advice. I haven'= t
figured out what's going on yet. (Maybe the failures only appear in
batch mode and aren't real issues.) Does anyone out there have insights= ?

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine

--000000000000ec9b3306056005be-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 17 09:02:54 2023 Received: (at 65912) by debbugs.gnu.org; 17 Sep 2023 13:02:55 +0000 Received: from localhost ([127.0.0.1]:49385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhrQM-00080s-7E for submit@debbugs.gnu.org; Sun, 17 Sep 2023 09:02:54 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:56784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhrQJ-00080h-9n for 65912@debbugs.gnu.org; Sun, 17 Sep 2023 09:02:52 -0400 Received: from localhost (42-144-34-11.rev.home.ne.jp [42.144.34.11]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 48B5D5C; Sun, 17 Sep 2023 22:02:41 +0900 (JST) From: Ikumi Keita To: David Fussner Subject: Re: bug#65912: 2023-08-31; Fix xref errors when matching in unvisited files In-reply-to: References: <61356.1694756717@localhost> Comments: In-reply-to David Fussner message dated "Fri, 15 Sep 2023 07:37:01 +0100." X-Mailer: MH-E 8.6+git; nmh 1.7.1; Emacs 29.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Sun, 17 Sep 2023 22:02:40 +0900 Message-ID: <73088.1694955760@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65912 Cc: 65912@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hi David, > On Fri, 15 Sept 2023, 06:45 Ikumi Keita, wrote: >> It seems reasonable basically. However, this makes two regression tests >> fail: >> 2 unexpected results: >> FAILED LaTeX-filling >> FAILED LaTeX-style-hook-with-class-option >> >> I thought the following advice in latex-test.el is interfering badly: >> ---------------------------------------------------------------------- >> ;; We need to ensure that font-lock has put the syntax properties >> ;; already which won't happen in batch mode. So trigger font-lock >> ;; immediately. >> (define-advice LaTeX-common-initialization (:after ()) >> (font-lock-ensure)) >> ---------------------------------------------------------------------- >> However, the failures remain even after I deleted this advice. I haven't >> figured out what's going on yet. (Maybe the failures only appear in >> batch mode and aren't real issues.) Does anyone out there have insights? I think I now understand the reason. Some of the style hooks presume that the file local variables are already established. Therefore, I have to arrange regression tests so that `TeX-update-style' in `latex-mode' runs inside `let' form where relevant variables are bound. Attached is my current proposal. >> > The attached patch (0002) parses and applies styles in the temp >> > buffer, and only in such non-file-visiting buffers. It does so both in >> > LaTeX-common-initialization and in plain-TeX-common-initialization, LaTeX-common-initialization isn't a suitable place because of the following reasons: 1. LaTeX mode makes addtion to `TeX-update-style-hook' after it calls LaTeX-common-initialization. 2. It is legitimate for style hooks to assume that they are called after mode hooks (e.g. LaTeX-mode-hook) run. I moved the call to TeX-update-style at the last of latex-mode, plain-tex-mode and ams-tex-mode. This doesn't cover context mode, but I think it doesn't harm. It still doesn't wait mode hooks in doctex mode since doctex mode is defined by `define-derived-mode', but I'd postpone that issue for now. I'll do I can do in feature/fix-mode-names-overlap branch later. >> > which I think covers all the modes. Actually it (and my patch as well) doesn't cover Texinfo mode, but I suppose texinfo mode is out of the scope for the first place. Is this right? Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=patch2 Content-Description: New patch diff --git a/font-latex.el b/font-latex.el index 8fc567e2..4c49f99e 100644 --- a/font-latex.el +++ b/font-latex.el @@ -1353,7 +1353,13 @@ triggers Font Lock to recognize the change." ;; Make sure fontification will be refreshed if a user sets variables ;; influencing fontification in her file-local variables section. - (add-hook 'hack-local-variables-hook #'font-latex-after-hacking-local-variables t t)) + (add-hook 'hack-local-variables-hook #'font-latex-after-hacking-local-variables t t) + + ;; We may be using the mode programmatically to extract data, and we + ;; then need this to be set up first so that a command like + ;; `xref-find-references' doesn't bug out when matching hits in + ;; files that Emacs isn't visiting. (bug#65912) + (font-lock-set-defaults)) (defun font-latex-update-font-lock (&optional _syntactic-kws) "Tell font-lock about updates of fontification rules. diff --git a/latex.el b/latex.el index 3abb00f2..ef9f5f0d 100644 --- a/latex.el +++ b/latex.el @@ -8045,7 +8045,14 @@ of `LaTeX-mode-hook'." filladapt-mode) (turn-off-filladapt-mode)) ;; Set up flymake backend, see latex-flymake.el - (add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t)) + (add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t) + + ;; Complete style initialization in buffers which don't visit files + ;; and which are therefore missed by the setting of `find-file-hook' + ;; in `VirTeX-common-initialization'. This is necessary for + ;; `xref-find-references', for example. (bug#65912) + (unless buffer-file-truename + (TeX-update-style))) (TeX-abbrev-mode-setup doctex-mode) @@ -8068,6 +8075,8 @@ runs the hooks in `docTeX-mode-hook'." TeX-comment-start-regexp "\\(?:%\\(?:<[^>]+>\\)?\\)") (setq TeX-base-mode-name "docTeX") (TeX-set-mode-name) + ;; Force doctex specific fontification rules. + (setq font-lock-set-defaults nil) (funcall TeX-install-font-lock)) ;; Enable LaTeX abbrevs in docTeX mode buffer. diff --git a/plain-tex.el b/plain-tex.el index 0800b2f3..b4c78fe4 100644 --- a/plain-tex.el +++ b/plain-tex.el @@ -135,7 +135,13 @@ of `plain-TeX-mode-hook'." (add-hook 'tool-bar-mode-hook #'plain-TeX-maybe-install-toolbar nil t) (plain-TeX-maybe-install-toolbar) (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'plain-TeX-mode-hook) - (TeX-set-mode-name)) + (TeX-set-mode-name) + ;; Complete style initialization in buffers which don't visit files + ;; and which are therefore missed by the setting of `find-file-hook' + ;; in `VirTeX-common-initialization'. This is necessary for + ;; `xref-find-references', for example. (bug#65912) + (unless buffer-file-truename + (TeX-update-style))) (defun plain-TeX-common-initialization () "Common initialization for plain TeX like modes." @@ -308,7 +314,13 @@ of `AmS-TeX-mode-hook'." (setq TeX-base-mode-name "AmS-TeX") (setq TeX-command-default "AmSTeX") (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'AmS-TeX-mode-hook) - (TeX-set-mode-name)) + (TeX-set-mode-name) + ;; Complete style initialization in buffers which don't visit files + ;; and which are therefore missed by the setting of `find-file-hook' + ;; in `VirTeX-common-initialization'. This is necessary for + ;; `xref-find-references', for example. (bug#65912) + (unless buffer-file-truename + (TeX-update-style))) (defcustom AmSTeX-clean-intermediate-suffixes TeX-clean-default-intermediate-suffixes diff --git a/tests/context/context-test.el b/tests/context/context-test.el index cc7c8d54..4eeab4b6 100644 --- a/tests/context/context-test.el +++ b/tests/context/context-test.el @@ -24,12 +24,6 @@ (require 'ert) (require 'context) -;; We need to ensure that font-lock has put the syntax properties -;; already which won't happen in batch mode. So trigger font-lock -;; immediately. -(define-advice ConTeXt-mode-common-initialization (:after ()) - (font-lock-ensure)) - (AUCTeX-set-ert-path 'ConTeXt-indent-test/in "context-indentation-in.tex" diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el index 40f9633a..94150ac0 100644 --- a/tests/latex/font-latex-test.el +++ b/tests/latex/font-latex-test.el @@ -27,12 +27,6 @@ (defvar font-lock-beg) (defvar font-lock-end) -;; We need to ensure that font-lock has put the syntax properties -;; already which won't happen in batch mode. So trigger font-lock -;; immediately. -(define-advice LaTeX-common-initialization (:after ()) - (font-lock-ensure)) - (ert-deftest font-latex-three-dollars () "Test three consecutive dollar is ignored." ;; When the function `font-latex-match-dollar-math' encounters three diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el index fbd64e09..13cbf482 100644 --- a/tests/latex/latex-test.el +++ b/tests/latex/latex-test.el @@ -24,12 +24,6 @@ (require 'ert) (require 'latex) -;; We need to ensure that font-lock has put the syntax properties -;; already which won't happen in batch mode. So trigger font-lock -;; immediately. -(define-advice LaTeX-common-initialization (:after ()) - (font-lock-ensure)) - (AUCTeX-set-ert-path 'LaTeX-indent-tabular-test/in "tabular-in.tex" @@ -174,11 +168,10 @@ (should (string= (with-temp-buffer (insert-file-contents LaTeX-filling/in) - (LaTeX-mode) (let ((fill-column 70) (LaTeX-shortvrb-chars '(?\")) (TeX-parse-self t)) - (TeX-update-style t) + (LaTeX-mode) (search-forward "Lorem") (fill-paragraph) @@ -416,9 +409,8 @@ backend=biber % here is a comment ;; dvipdfmx option should not trigger `TeX-PDF-from-DVI' for ;; XeLaTeX document - (latex-mode) (let ((TeX-engine 'xetex)) - (TeX-update-style)) + (LaTeX-mode)) (should TeX-PDF-mode) (should (not (TeX-PDF-from-DVI))) (should (not (member "dvipdfmx" TeX-active-styles))) diff --git a/tests/latex/texmathp-test.el b/tests/latex/texmathp-test.el index 121af22c..a18df63a 100644 --- a/tests/latex/texmathp-test.el +++ b/tests/latex/texmathp-test.el @@ -55,7 +55,6 @@ (should-not (with-temp-buffer (insert "a $b$ \\verb|$| c ") (LaTeX-mode) - (font-lock-ensure) (texmathp))) (should-not (with-temp-buffer @@ -67,7 +66,6 @@ $ \\end{verbatim} c") (LaTeX-mode) - (font-lock-ensure) (texmathp))))) ;;; texmathp-test.el ends here --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 17 09:52:29 2023 Received: (at 65912) by debbugs.gnu.org; 17 Sep 2023 13:52:29 +0000 Received: from localhost ([127.0.0.1]:49521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhsCI-0003fI-5r for submit@debbugs.gnu.org; Sun, 17 Sep 2023 09:52:29 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:55722) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhsCC-0003f1-Oe for 65912@debbugs.gnu.org; Sun, 17 Sep 2023 09:52:24 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-274928c74b0so1984893a91.3 for <65912@debbugs.gnu.org>; Sun, 17 Sep 2023 06:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1694958727; x=1695563527; 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=5okkURgvAD0UcmZx7Gk4t+a3kCYZT/IBPark4URJ8gY=; b=LtPeIvG0JvEtJ4yFa3E3euPeykkA22tdD/KcizZ4FzquVTcX2AxklCgvtXzJDydu75 PsZ+kh7iUIY8oukP7gCYlT2p1nRTW019NtXcs4aor5FiH6vqyXgNPToiE1ilpPQZewSJ rz59Ana7OMKBzrWwPGJl5qGwk5gBmIEg0Jf+anfxtHYa22B+NHpdbbKRxYCfPPdwIipK 0EK+rqZ/yKrKBKhCUpmWASp00b8Y4Yk7OqnnsMd38phEEhea9SY5a5CcgucudNquD4gZ /NElmh2PaFhv+FDEm0CjnhPwG5WV36I8mOf/ciDXwjCVaNrf7jKqyS9zG+ZDLUpO4uKu lrRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694958727; x=1695563527; h=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=5okkURgvAD0UcmZx7Gk4t+a3kCYZT/IBPark4URJ8gY=; b=oklNruFYdOZba0gwTLTMPM0JFP0VOvB9H0Qwu7oKREPeOxLIzWP9JVW6uttFb0ByRp 8Awtho6ITmESCp6ZoEi1wLvfVr3ZmKx+mjkPK9ZLEkrKO+WQkxQSh1WCt3U+YF2y/70M toE6PROsVjxCEK+kOatiSPvKY7EGIBVAyQ8fF1c2UrM3BnrBYRqtcggvWo/GDMgcxIPM yNArTgZ38hR6LhzoDiOFAHy1Rc3KDkyQCCc4JRlkW/OtMXN1bpoIcis7Ub6n9DE5kj1S tCXMupXCD3+7PsSYyjbcoZXLLgjUmZjTH4Cj6eAJGPU+ZrvLYBP+GIffZ9TxyZr5iJnb sQrA== X-Gm-Message-State: AOJu0YySkpz2DowHpN1EWD/XFNWcVF2lCJj9kwxe8p/YpGUnZJXdgfo9 /nwljFOd8nPGB+8d0NEumWkiM5ndqHmSZFuQqbPGu52i2sI= X-Google-Smtp-Source: AGHT+IGOHadsNB+HpD3Mv5FZQo0/p2tgCVtIO1NgW3sYGxX6O6WG1haIwVCRnoqkJ5GMPFZs/T9gfToUq3kRxCR2MFE= X-Received: by 2002:a17:90a:d70b:b0:268:1068:4464 with SMTP id y11-20020a17090ad70b00b0026810684464mr5935771pju.30.1694958727035; Sun, 17 Sep 2023 06:52:07 -0700 (PDT) MIME-Version: 1.0 References: <61356.1694756717@localhost> <73088.1694955760@localhost> In-Reply-To: <73088.1694955760@localhost> From: David Fussner Date: Sun, 17 Sep 2023 14:51:53 +0100 Message-ID: Subject: Re: bug#65912: 2023-08-31; Fix xref errors when matching in unvisited files To: Ikumi Keita Content-Type: multipart/alternative; boundary="000000000000d57fb606058e5413" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65912 Cc: 65912@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000d57fb606058e5413 Content-Type: text/plain; charset="UTF-8" Hi Keita, Thanks for this. Texinfo mode is out of scope, so I'll have a look and get back to you once I'm back on the computer. To be honest, other changes might also make this fix unnecessary, depending on what Dmitry thinks works best. Best, and I'll be in touch. David. On Sun, 17 Sept 2023, 14:02 Ikumi Keita, wrote: > Hi David, > > > On Fri, 15 Sept 2023, 06:45 Ikumi Keita, wrote: > >> It seems reasonable basically. However, this makes two regression tests > >> fail: > >> 2 unexpected results: > >> FAILED LaTeX-filling > >> FAILED LaTeX-style-hook-with-class-option > >> > >> I thought the following advice in latex-test.el is interfering badly: > >> ---------------------------------------------------------------------- > >> ;; We need to ensure that font-lock has put the syntax properties > >> ;; already which won't happen in batch mode. So trigger font-lock > >> ;; immediately. > >> (define-advice LaTeX-common-initialization (:after ()) > >> (font-lock-ensure)) > >> ---------------------------------------------------------------------- > >> However, the failures remain even after I deleted this advice. I haven't > >> figured out what's going on yet. (Maybe the failures only appear in > >> batch mode and aren't real issues.) Does anyone out there have insights? > > I think I now understand the reason. Some of the style hooks presume > that the file local variables are already established. Therefore, > I have to arrange regression tests so that `TeX-update-style' in > `latex-mode' runs inside `let' form where relevant variables are bound. > > Attached is my current proposal. > > >> > The attached patch (0002) parses and applies styles in the temp > >> > buffer, and only in such non-file-visiting buffers. It does so both in > >> > LaTeX-common-initialization and in plain-TeX-common-initialization, > > LaTeX-common-initialization isn't a suitable place because of the > following reasons: > 1. LaTeX mode makes addtion to `TeX-update-style-hook' after it calls > LaTeX-common-initialization. > 2. It is legitimate for style hooks to assume that they are called after > mode hooks (e.g. LaTeX-mode-hook) run. > I moved the call to TeX-update-style at the last of latex-mode, > plain-tex-mode and ams-tex-mode. This doesn't cover context mode, but I > think it doesn't harm. > It still doesn't wait mode hooks in doctex mode since doctex mode is > defined by `define-derived-mode', but I'd postpone that issue for now. > I'll do I can do in feature/fix-mode-names-overlap branch later. > > >> > which I think covers all the modes. > > Actually it (and my patch as well) doesn't cover Texinfo mode, but I > suppose texinfo mode is out of the scope for the first place. Is this > right? > > Regards, > Ikumi Keita > #StandWithUkraine #StopWarInUkraine > > --000000000000d57fb606058e5413 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Keita,

Th= anks for this. Texinfo mode is out of scope, so I'll have a look and=C2= =A0get back to you once I'm back on the computer.

To be honest, other changes might also make t= his fix unnecessary, depending on what Dmitry thinks works best.=C2=A0

Best, and I'll be in tou= ch.=C2=A0

David.=C2=A0

On Sun, 17 Sept 2023, 14:02 Ikumi Keita, <ikumi@ikumi.que.jp> wrote:
Hi David,

> On Fri, 15 Sept 2023, 06:45 Ikumi Keita, <ikumi@ikumi.que.jp>= ; wrote:
>> It seems reasonable basically. However, this makes two regression = tests
>> fail:
>> 2 unexpected results:
>> FAILED=C2=A0 LaTeX-filling
>> FAILED=C2=A0 LaTeX-style-hook-with-class-option
>>
>> I thought the following advice in latex-test.el is interfering bad= ly:
>> ------------------------------------------------------------------= ----
>> ;; We need to ensure that font-lock has put the syntax properties<= br> >> ;; already which won't happen in batch mode.=C2=A0 So trigger = font-lock
>> ;; immediately.
>> (define-advice LaTeX-common-initialization (:after ())
>> (font-lock-ensure))
>> ------------------------------------------------------------------= ----
>> However, the failures remain even after I deleted this advice. I h= aven't
>> figured out what's going on yet. (Maybe the failures only appe= ar in
>> batch mode and aren't real issues.) Does anyone out there have= insights?

I think I now understand the reason. Some of the style hooks presume
that the file local variables are already established. Therefore,
I have to arrange regression tests so that `TeX-update-style' in
`latex-mode' runs inside `let' form where relevant variables are bo= und.

Attached is my current proposal.

>> > The attached patch (0002) parses and applies styles in the te= mp
>> > buffer, and only in such non-file-visiting buffers. It does s= o both in
>> > LaTeX-common-initialization and in plain-TeX-common-initializ= ation,

LaTeX-common-initialization isn't a suitable place because of the
following reasons:
1. LaTeX mode makes addtion to `TeX-update-style-hook' after it calls =C2=A0 =C2=A0LaTeX-common-initialization.
2. It is legitimate for style hooks to assume that they are called after =C2=A0 =C2=A0mode hooks (e.g. LaTeX-mode-hook) run.
I moved the call to TeX-update-style at the last of latex-mode,
plain-tex-mode and ams-tex-mode. This doesn't cover context mode, but I=
think it doesn't harm.
It still doesn't wait mode hooks in doctex mode since doctex mode is defined by `define-derived-mode', but I'd postpone that issue for n= ow.
I'll do I can do in feature/fix-mode-names-overlap branch later.

>> > which I think covers all the modes.

Actually it (and my patch as well) doesn't cover Texinfo mode, but I suppose texinfo mode is out of the scope for the first place. Is this
right?

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine

--000000000000d57fb606058e5413-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 17 13:20:15 2023 Received: (at 65912) by debbugs.gnu.org; 17 Sep 2023 17:20:15 +0000 Received: from localhost ([127.0.0.1]:51319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhvRO-0006NS-Lj for submit@debbugs.gnu.org; Sun, 17 Sep 2023 13:20:15 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:54781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhvRJ-0006N7-4k for 65912@debbugs.gnu.org; Sun, 17 Sep 2023 13:20:12 -0400 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-271d9823cacso3042215a91.1 for <65912@debbugs.gnu.org>; Sun, 17 Sep 2023 10:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1694971195; x=1695575995; 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=DpyPPwaMvkLhY1JylctYxvJb+FdnzyI3Olz9LwmAxrY=; b=Yf1+d65dN/r7FAPITh2e51cP01tnu+Nt6hypD1HBVEYNDU+NA2gLVcPBR0rc63DUlY Sjel1dDEwVDPYUjqoLCYWHn5M2tyLyq484JsehOPmqw0E6TIlSlqAvpBO9OV19/5N2oS LOGct8+UJ9dqVoDeqmQNO4Z7mP/VBULRbOAadUSXVWZ8xygEdkl0Iw1fcL3SG84T6Po7 +eY8YSm7zmSvLkrqpry2+wES9H/TkICmtZbaq9TbmoWq5gLTXxEWBbnEuJsEWpdUt94B O++cgTE2R9wlPbaCFHjK9QWNwCGYJ1Rc996KQE7EhGENT0exjj0DPwi61Q5OSbSLuffZ M1DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694971195; x=1695575995; h=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=DpyPPwaMvkLhY1JylctYxvJb+FdnzyI3Olz9LwmAxrY=; b=CC9iDi6kyMR4zyGCQaw1Te5Pv7FFBWhn02W86inR4XLlB6R3A5FEwxEGYfv8N59kuX 629SX1MLo2X2LpgZD5ozhE/q83KmGPTQoXsRHSPIdIrkBHl9ulbJaelrlz4ZPbJ1ydP9 t3zqd4t64vqmx9w+b9zF3fEcHR1XNQ+gNv/lFEfMFX/0gibJ1kflOBO84F83AW5gPCUN bng57uTEkSg7PRNfpZA7KFzJfpv0gq090MHItC8oIxcMXdIPBiV76q7To8f4JOnrLcwL 10NecTne2ekG7Tx5hQoWEDqxzVwxGjPYrcCrY+SM6VNnSc1fWb/T2dtMAJtCH2tPg1Tb JRXQ== X-Gm-Message-State: AOJu0YzipgT+/xi2uLVGRRrCnwyhmZ1H48XNHe7VaNMjkZ2c1NZDZBoi 8p68vrAilXKlVHTqNoYA5URCF9eJgXvWquYb0yRQhs+Y2LcpZw== X-Google-Smtp-Source: AGHT+IH2Qu1pqWQz9e9eI8nYHSiSaZDzd0XXeg+5oUsdaFMJv6d3SYVq8e5Tu1aEtJQDWVqFE60K8LLxhZ+u46bAhGg= X-Received: by 2002:a17:90a:f3cf:b0:271:90d6:f335 with SMTP id ha15-20020a17090af3cf00b0027190d6f335mr6507897pjb.25.1694971195099; Sun, 17 Sep 2023 10:19:55 -0700 (PDT) MIME-Version: 1.0 References: <61356.1694756717@localhost> <73088.1694955760@localhost> In-Reply-To: From: David Fussner Date: Sun, 17 Sep 2023 18:19:43 +0100 Message-ID: Subject: Re: bug#65912: 2023-08-31; Fix xref errors when matching in unvisited files To: Ikumi Keita Content-Type: multipart/alternative; boundary="000000000000fd10c60605913b11" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65912 Cc: 65912@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000fd10c60605913b11 Content-Type: text/plain; charset="UTF-8" Strike that last paragraph please, Keita. Whatever the new backend looks like, it will always be possible to continue to use the old one, so these fixes will be important no matter what I come up with. Sorry for the noise. David. On Sun, 17 Sept 2023, 14:51 David Fussner, wrote: > Hi Keita, > > Thanks for this. Texinfo mode is out of scope, so I'll have a look and get > back to you once I'm back on the computer. > > To be honest, other changes might also make this fix unnecessary, > depending on what Dmitry thinks works best. > > Best, and I'll be in touch. > > David. > > On Sun, 17 Sept 2023, 14:02 Ikumi Keita, wrote: > >> Hi David, >> >> > On Fri, 15 Sept 2023, 06:45 Ikumi Keita, wrote: >> >> It seems reasonable basically. However, this makes two regression tests >> >> fail: >> >> 2 unexpected results: >> >> FAILED LaTeX-filling >> >> FAILED LaTeX-style-hook-with-class-option >> >> >> >> I thought the following advice in latex-test.el is interfering badly: >> >> ---------------------------------------------------------------------- >> >> ;; We need to ensure that font-lock has put the syntax properties >> >> ;; already which won't happen in batch mode. So trigger font-lock >> >> ;; immediately. >> >> (define-advice LaTeX-common-initialization (:after ()) >> >> (font-lock-ensure)) >> >> ---------------------------------------------------------------------- >> >> However, the failures remain even after I deleted this advice. I >> haven't >> >> figured out what's going on yet. (Maybe the failures only appear in >> >> batch mode and aren't real issues.) Does anyone out there have >> insights? >> >> I think I now understand the reason. Some of the style hooks presume >> that the file local variables are already established. Therefore, >> I have to arrange regression tests so that `TeX-update-style' in >> `latex-mode' runs inside `let' form where relevant variables are bound. >> >> Attached is my current proposal. >> >> >> > The attached patch (0002) parses and applies styles in the temp >> >> > buffer, and only in such non-file-visiting buffers. It does so both >> in >> >> > LaTeX-common-initialization and in plain-TeX-common-initialization, >> >> LaTeX-common-initialization isn't a suitable place because of the >> following reasons: >> 1. LaTeX mode makes addtion to `TeX-update-style-hook' after it calls >> LaTeX-common-initialization. >> 2. It is legitimate for style hooks to assume that they are called after >> mode hooks (e.g. LaTeX-mode-hook) run. >> I moved the call to TeX-update-style at the last of latex-mode, >> plain-tex-mode and ams-tex-mode. This doesn't cover context mode, but I >> think it doesn't harm. >> It still doesn't wait mode hooks in doctex mode since doctex mode is >> defined by `define-derived-mode', but I'd postpone that issue for now. >> I'll do I can do in feature/fix-mode-names-overlap branch later. >> >> >> > which I think covers all the modes. >> >> Actually it (and my patch as well) doesn't cover Texinfo mode, but I >> suppose texinfo mode is out of the scope for the first place. Is this >> right? >> >> Regards, >> Ikumi Keita >> #StandWithUkraine #StopWarInUkraine >> >> --000000000000fd10c60605913b11 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Strike that last paragraph please, Keita. Whatever the ne= w backend looks like, it will always be possible to continue to use the old= one, so these fixes will be important no matter what I come up with.

Sorry for the noise.=C2=A0

David.=C2=A0

On Sun, 17 Sep= t 2023, 14:51 David Fussner, <dfussner@googlemail.com> wrote:
Hi Keita,

Thanks for this. Texinfo mode is out of scope, so I'll have a look a= nd=C2=A0get back to you once I'm back on the computer.

To be honest, other changes might also m= ake this fix unnecessary, depending on what Dmitry thinks works best.=C2=A0=

Best, and I'll be i= n touch.=C2=A0

David.=C2= =A0

On Sun, 17 Sept 2023, 14:02 Ikumi Keita, <ikumi@ikumi.que.jp> wrote:
Hi David,

> On Fri, 15 Sept 2023, 06:45 Ikumi Keita, <
ikumi@ikumi.qu= e.jp> wrote:
>> It seems reasonable basically. However, this makes two regression = tests
>> fail:
>> 2 unexpected results:
>> FAILED=C2=A0 LaTeX-filling
>> FAILED=C2=A0 LaTeX-style-hook-with-class-option
>>
>> I thought the following advice in latex-test.el is interfering bad= ly:
>> ------------------------------------------------------------------= ----
>> ;; We need to ensure that font-lock has put the syntax properties<= br> >> ;; already which won't happen in batch mode.=C2=A0 So trigger = font-lock
>> ;; immediately.
>> (define-advice LaTeX-common-initialization (:after ())
>> (font-lock-ensure))
>> ------------------------------------------------------------------= ----
>> However, the failures remain even after I deleted this advice. I h= aven't
>> figured out what's going on yet. (Maybe the failures only appe= ar in
>> batch mode and aren't real issues.) Does anyone out there have= insights?

I think I now understand the reason. Some of the style hooks presume
that the file local variables are already established. Therefore,
I have to arrange regression tests so that `TeX-update-style' in
`latex-mode' runs inside `let' form where relevant variables are bo= und.

Attached is my current proposal.

>> > The attached patch (0002) parses and applies styles in the te= mp
>> > buffer, and only in such non-file-visiting buffers. It does s= o both in
>> > LaTeX-common-initialization and in plain-TeX-common-initializ= ation,

LaTeX-common-initialization isn't a suitable place because of the
following reasons:
1. LaTeX mode makes addtion to `TeX-update-style-hook' after it calls =C2=A0 =C2=A0LaTeX-common-initialization.
2. It is legitimate for style hooks to assume that they are called after =C2=A0 =C2=A0mode hooks (e.g. LaTeX-mode-hook) run.
I moved the call to TeX-update-style at the last of latex-mode,
plain-tex-mode and ams-tex-mode. This doesn't cover context mode, but I=
think it doesn't harm.
It still doesn't wait mode hooks in doctex mode since doctex mode is defined by `define-derived-mode', but I'd postpone that issue for n= ow.
I'll do I can do in feature/fix-mode-names-overlap branch later.

>> > which I think covers all the modes.

Actually it (and my patch as well) doesn't cover Texinfo mode, but I suppose texinfo mode is out of the scope for the first place. Is this
right?

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine

--000000000000fd10c60605913b11-- From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 19 02:20:08 2023 Received: (at 65912) by debbugs.gnu.org; 19 Sep 2023 06:20:08 +0000 Received: from localhost ([127.0.0.1]:55152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiU5g-00038m-Af for submit@debbugs.gnu.org; Tue, 19 Sep 2023 02:20:08 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:60582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiU5b-00038L-PX for 65912@debbugs.gnu.org; Tue, 19 Sep 2023 02:20:07 -0400 Received: from localhost (42-144-34-11.rev.home.ne.jp [42.144.34.11]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 68FA35C; Tue, 19 Sep 2023 15:19:52 +0900 (JST) From: Ikumi Keita To: David Fussner Subject: Re: bug#65912: 2023-08-31; Fix xref errors when matching in unvisited files In-reply-to: References: <61356.1694756717@localhost> <73088.1694955760@localhost> Comments: In-reply-to David Fussner message dated "Sun, 17 Sep 2023 18:19:43 +0100." X-Mailer: MH-E 8.6+git; nmh 1.7.1; Emacs 29.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <85442.1695104386.1@localhost> Date: Tue, 19 Sep 2023 15:19:46 +0900 Message-ID: <85445.1695104386@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65912 Cc: 65912@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi David, >>>>> David Fussner writes: > Strike that last paragraph please, Keita. Whatever the new backend looks > like, it will always be possible to continue to use the old one, so these > fixes will be important no matter what I come up with. I pushed the fix to the git repo. I modified the addition of `font-lock-set-defaults' in `font-latex-setup' to run only in temporal buffers in order to minimize influence on the behavior for file-visiting buffers. I'll close this bug. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 19 02:20:35 2023 Received: (at control) by debbugs.gnu.org; 19 Sep 2023 06:20:35 +0000 Received: from localhost ([127.0.0.1]:55155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiU67-00039o-Lz for submit@debbugs.gnu.org; Tue, 19 Sep 2023 02:20:35 -0400 Received: from smtp1a.inetd.co.jp ([210.129.88.11]:60588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiU66-00039g-0B for control@debbugs.gnu.org; Tue, 19 Sep 2023 02:20:34 -0400 Received: from localhost (42-144-34-11.rev.home.ne.jp [42.144.34.11]) by smtp1a.inetd.co.jp (Postfix) with ESMTPA id 848D35C for ; Tue, 19 Sep 2023 15:20:24 +0900 (JST) To: control@debbugs.gnu.org From: Ikumi Keita Subject: control message for bug #65912 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <85455.1695104418.1@localhost> Date: Tue, 19 Sep 2023 15:20:18 +0900 Message-ID: <85456.1695104418@localhost> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 65912 quit From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 19 03:26:46 2023 Received: (at 65912) by debbugs.gnu.org; 19 Sep 2023 07:26:46 +0000 Received: from localhost ([127.0.0.1]:55251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiV8A-0001wq-6A for submit@debbugs.gnu.org; Tue, 19 Sep 2023 03:26:46 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:62686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiV85-0001wW-7U for 65912@debbugs.gnu.org; Tue, 19 Sep 2023 03:26:45 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2749ce1aa37so2594960a91.0 for <65912@debbugs.gnu.org>; Tue, 19 Sep 2023 00:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20230601; t=1695108386; x=1695713186; 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=IIYULoFnwEFFrIvjYu6SMhwrzHuN6GzECfvc07ahr/0=; b=SDIj0xQ4H46lfzuA28sOPNIo/b3fVW2K2kxYtJdsc4YjeY44t/Dv+Xd6+VaYCekUwC +SNN48D4L/LcQJwqRb41uYGoM4jjU0lrLfD5k2KNm9Jm0B0JkcqaK2UK/lR+Lv92p4Hk 5BHmKRLYMPLxWsur59Dlc0u+66sQJkwdbuDWGqdHSqJsw+EbScAylKfHfLWHU3vl8dyw 8xblJx4inJvQFGAeyDcQqa20RDSMcNYJC20BiJ7z3PA5ILgPUwm21VW7PxyH/uBd0Btg 9I1IenDTPNPBBDqJclsW5wOgloChZySmBa7sEF8JOW5TIwChgLJbyxT4Ll8qBFEKGNQV eeDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695108386; x=1695713186; h=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=IIYULoFnwEFFrIvjYu6SMhwrzHuN6GzECfvc07ahr/0=; b=eOQUSA8DJK09Qm+DFe+eE6bC9wHlb5uQWqwSL2rs1i7Am6Np74/CeLtleJU+E1G2WU l22yTS55exdjMewCRtRZO/7dcjlD1sE7eTOmBo4nzy4lb3cdUXBlHWp3KWFNv7lU9aQ+ cFxZgei0lTzIhC3JJDq7DWVZ/QTAmYDpo1JsGbeZtwtZVBLsUQiZnjkTFaTLyI2ivcrw g9EtTPuaspPI6yD08y02VeEz+b+CUv/1xswHGjjWkw+N8XeGrjDnpc6XgHdXpUtHykEr AvHlh1z7/CySHCsn/KQfBz/hGK5OauGIYiQuwakqcQknPXaurCe4s3FleJNHAwI8QmD3 Rtbw== X-Gm-Message-State: AOJu0Yz3pMQ3nwOL0QgC9ppeNzJO04R3CYIQsV8WkK76oQ5Z5HpreZC1 uPYwDlLcEjiPZIVcCU3+zAiXCf6WewTnS+h1d4Dy0Vj1vRs= X-Google-Smtp-Source: AGHT+IEQw7scki4FdqmHmSW2MIwa8rH1vnyVZGdC33lk5BUYlZwEI4ZqpFTvgj7nx40AKKuMED+jDuakA4oCg4tK7o8= X-Received: by 2002:a17:90a:2a87:b0:26f:392f:f901 with SMTP id j7-20020a17090a2a8700b0026f392ff901mr2196562pjd.14.1695108386335; Tue, 19 Sep 2023 00:26:26 -0700 (PDT) MIME-Version: 1.0 References: <61356.1694756717@localhost> <73088.1694955760@localhost> <85445.1695104386@localhost> In-Reply-To: <85445.1695104386@localhost> From: David Fussner Date: Tue, 19 Sep 2023 08:26:15 +0100 Message-ID: Subject: Re: bug#65912: 2023-08-31; Fix xref errors when matching in unvisited files To: Ikumi Keita Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65912 Cc: 65912@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) It all looks good here. Thank you, Keita! On Tue, 19 Sept 2023 at 07:19, Ikumi Keita wrote: > > Hi David, > > >>>>> David Fussner writes: > > Strike that last paragraph please, Keita. Whatever the new backend looks > > like, it will always be possible to continue to use the old one, so these > > fixes will be important no matter what I come up with. > > I pushed the fix to the git repo. I modified the addition of > `font-lock-set-defaults' in `font-latex-setup' to run only in temporal > buffers in order to minimize influence on the behavior for file-visiting > buffers. > > I'll close this bug. > > Regards, > Ikumi Keita > #StandWithUkraine #StopWarInUkraine From unknown Sat Jun 21 10:19:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 17 Oct 2023 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator