From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: john muhl Newsgroups: gmane.emacs.bugs Subject: bug#70515: 30.0.50; which-function-mode error in lua-ts-mode Date: Mon, 22 Apr 2024 10:29:47 -0500 Message-ID: <87edax76oz.fsf@pub.pink> References: <87y1957977.fsf@pub.pink> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22511"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.10.8; emacs 30.0.50 To: 70515@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 22 17:35:15 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ryvhK-0005XY-R6 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Apr 2024 17:35:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryvh3-0000nH-Mu; Mon, 22 Apr 2024 11:34:57 -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 1ryvgw-0000mo-PN for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 11:34:52 -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 1ryvgs-00045P-Fy for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 11:34:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ryvh8-0006Ch-4r for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 11:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: john muhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Apr 2024 15:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70515 X-GNU-PR-Package: emacs Original-Received: via spool by 70515-submit@debbugs.gnu.org id=B70515.171380005923586 (code B ref 70515); Mon, 22 Apr 2024 15:35:02 +0000 Original-Received: (at 70515) by debbugs.gnu.org; 22 Apr 2024 15:34:19 +0000 Original-Received: from localhost ([127.0.0.1]:46438 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryvgR-00068M-7o for submit@debbugs.gnu.org; Mon, 22 Apr 2024 11:34:19 -0400 Original-Received: from wfout6-smtp.messagingengine.com ([64.147.123.149]:54229) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryvgK-00066o-Vm for 70515@debbugs.gnu.org; Mon, 22 Apr 2024 11:34:17 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfout.west.internal (Postfix) with ESMTP id 762311C00103 for <70515@debbugs.gnu.org>; Mon, 22 Apr 2024 11:33:50 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 22 Apr 2024 11:33:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1713800029; x=1713886429; bh=FrM38pCwSA D3B9M+3+70VWUpcnXYWzBSjuJGmUf7QRY=; b=y37HnMazN2gH+SN5BOnzl7QzJP UXLzGnYW1a8ewBYCAfIxHsuK4aXhQHSWneefFtJshFO0HGY50lBb/45lKmj8Y/0P XppvE5EvdW4YjPZF2Zk7NEgpxc7ZEzIBbik4Z7oblGF4RxelK/lchvh7qq9FDtqe 6ajNWU4LqyXxZXMbj2AwGXxbnEBwxAiGuLTLvt602fPqlz+DzjLOX5HpPlU/JpIf 26e4K90wn78KhHoR1a7dcv8D2NgZ8HAbcmh0L3kIu2b3F0QiWAe9/GMufoOYhgZL fJlA3WFTJeTwOQXXiZxL9QPXxNduAIxKH1Hxs6sMBJDE8r6gDl0GHSuOtLPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1713800029; x=1713886429; bh=FrM38pCwSAD3B9M+3+70VWUpcnXY WzBSjuJGmUf7QRY=; b=iezKRH/LuXSsslyaja3DUBRmDFffT3qMgxsYOIMLFTBH OWBBGX7CypCGKfH3pdtwLF+JFYBde3GVohZcy2f5uflp8JVX1uYlzRhI+p6Aewmi LgJpCjwXuHvNjUK7bTi897qy3O9id3PY6lADztyODTVz6vZAdA+6Sz/oTesiZPqR VOlQJbkpDknYnGciOAwTt673x9T+F9tLirpP1Q9VHgudZ17afayhcMerLgSuR+5i jaANOFoHD5j997eMD8TqeFFCS682W5QYspG2oWoiZ5eByhbFzMNq4ynMbsLUECXL K2pBtPJQtickPQCHcO17opOAkdjZlqX0qRKiFmumyg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudekledgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpehffgfhvffuffgjkfggtgesmhdtre ertderjeenucfhrhhomhepjhhohhhnuchmuhhhlhcuoehjmhesphhusgdrphhinhhkqeen ucggtffrrghtthgvrhhnpedvudfgkedtleellefhtddvtdeuiedtfeetvdeiudevjeehge euhfegveevffeuteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehjmhesphhusgdrphhinhhk X-ME-Proxy: Feedback-ID: i74194916:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for <70515@debbugs.gnu.org>; Mon, 22 Apr 2024 11:33:49 -0400 (EDT) In-reply-to: <87y1957977.fsf@pub.pink> 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:283832 Archived-At: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-which-function-error-in-lua-ts-mode-bug-70515.patch >From f4d09165ab78d09e97dbf0ac9402d43de7a7c7cd Mon Sep 17 00:00:00 2001 From: john muhl Date: Sat, 20 Apr 2024 21:19:27 -0500 Subject: [PATCH] Fix which-function error in lua-ts-mode (bug#70515) * lisp/progmodes/lua-ts-mode.el (lua-ts-mode): Remove incorrect usage of 'which-func-functions'. * test/lisp/progmodes/lua-ts-mode-tests.el: (lua-ts-test-which-function): Add test. * test/lisp/progmodes/lua-ts-mode-resources/which-function.lua: New file. --- lisp/progmodes/lua-ts-mode.el | 5 +---- .../lua-ts-mode-resources/which-function.lua | 3 +++ test/lisp/progmodes/lua-ts-mode-tests.el | 11 +++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 test/lisp/progmodes/lua-ts-mode-resources/which-function.lua diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 45ea8ec9a81..06663e5bd0e 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -764,7 +764,7 @@ lua-ts-mode "vararg_expression")))) (text "comment")))) - ;; Imenu/Outline. + ;; Imenu/Outline/Which-function. (setq-local treesit-simple-imenu-settings `(("Requires" "\\`function_call\\'" @@ -776,9 +776,6 @@ lua-ts-mode lua-ts--named-function-p nil))) - ;; Which-function. - (setq-local which-func-functions (treesit-defun-at-point)) - ;; Align. (setq-local align-indent-before-aligning t) diff --git a/test/lisp/progmodes/lua-ts-mode-resources/which-function.lua b/test/lisp/progmodes/lua-ts-mode-resources/which-function.lua new file mode 100644 index 00000000000..621d818461c --- /dev/null +++ b/test/lisp/progmodes/lua-ts-mode-resources/which-function.lua @@ -0,0 +1,3 @@ +local function f(x) + print(x) +end diff --git a/test/lisp/progmodes/lua-ts-mode-tests.el b/test/lisp/progmodes/lua-ts-mode-tests.el index 565e6f91dbd..a7b637d18d1 100644 --- a/test/lisp/progmodes/lua-ts-mode-tests.el +++ b/test/lisp/progmodes/lua-ts-mode-tests.el @@ -23,6 +23,7 @@ (require 'ert-font-lock) (require 'ert-x) (require 'treesit) +(require 'which-func) (ert-deftest lua-ts-test-indentation () (skip-unless (treesit-ready-p 'lua)) @@ -37,6 +38,16 @@ lua-ts-test-font-lock (let ((treesit-font-lock-level 4)) (ert-font-lock-test-file (ert-resource-file "font-lock.lua") 'lua-ts-mode))) +(ert-deftest lua-ts-test-which-function () + (skip-unless (treesit-ready-p 'lua)) + (with-temp-buffer + (insert-file-contents (ert-resource-file "which-function.lua")) + (lua-ts-mode) + (which-function-mode) + (goto-char (point-min)) + (should (equal "f" (which-function))) + (which-function-mode -1))) + (provide 'lua-ts-mode-tests) ;;; lua-ts-mode-tests.el ends here -- 2.41.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable john muhl writes: > -- test.lua > local function f(x) > print(x) > end > > emacs -Q test.lua > M-x which-function-mode > > Error running timer =E2=80=98which-func-update=E2=80=99: > (error "Error in which-func-update: > (invalid-function #)") > > Patch to follow. > > In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu) of 2024-04-21 built > on localhost > Repository revision: 4773ecb93193495f141e5d60c0c5ded58eaa2c98 > Repository branch: master > System Description: Fedora Linux 39 (Thirty Nine) > > Configured using: > 'configure --without-x --without-native-compilation' > > Configured features: > ACL DBUS GMP GNUTLS GPM LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY > INOTIFY PDUMPER SECCOMP SOUND SQLITE3 THREADS TREE_SITTER XIM ZLIB > > Important settings: > value of $LANG: en_US.UTF-8 > locale-coding-system: utf-8-unix > > Major mode: Lua > > Minor modes in effect: > which-function-mode: t > tooltip-mode: t > global-eldoc-mode: t > show-paren-mode: t > electric-indent-mode: t > menu-bar-mode: t > file-name-shadow-mode: t > global-font-lock-mode: t > font-lock-mode: t > minibuffer-regexp-mode: t > line-number-mode: t > transient-mark-mode: t > auto-composition-mode: t > auto-encryption-mode: t > auto-compression-mode: t > > Load-path shadows: > None found. > > Features: > (shadow sort mail-extr emacsbug message mailcap yank-media puny dired > dnd dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg > rfc6068 epg-config gnus-util text-property-search time-date subr-x > mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils > mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr > mail-utils cus-start cus-load which-func imenu cl-seq lua-ts-mode > treesit cl-loaddefs cl-lib comint regexp-opt ansi-osc ansi-color ring > term/xterm xterm byte-opt gv bytecomp byte-compile rmc iso-transl > tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks > lisp-float-type elisp-mode tabulated-list replace newcomment text-mode > lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch > easymenu timer select mouse jit-lock font-lock syntax font-core > term/tty-colors frame minibuffer nadvice seq simple cl-generic > indonesian philippine cham georgian utf-8-lang misc-lang vietnamese > tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek > romanian slovak czech european ethiopic indian cyrillic chinese > composite emoji-zwj charscript charprop case-table epa-hook > jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs > theme-loaddefs faces cus-face macroexp files window text-properties > overlay sha1 md5 base64 format env code-pages mule custom widget keymap > hashtable-print-readable backquote threads dbusbind inotify multi-tty > make-network-process emacs) > > Memory information: > ((conses 16 66424 9105) (symbols 48 7625 0) (strings 32 18124 1778) > (string-bytes 1 437334) (vectors 16 8799) (vector-slots 8 77160 4863) > (floats 8 28 1) (intervals 56 253 2) (buffers 992 11)) --=-=-=--