From unknown Sun Jun 15 08:37:17 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#64283 <64283@debbugs.gnu.org> To: bug#64283 <64283@debbugs.gnu.org> Subject: Status: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top Reply-To: bug#64283 <64283@debbugs.gnu.org> Date: Sun, 15 Jun 2025 15:37:17 +0000 retitle 64283 29.0.91; js-mode's mark-defun does not work correctly when fu= nctions have a comment on top reassign 64283 emacs submitter 64283 Daniel Mart=C3=ADn severity 64283 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 25 09:06:09 2023 Received: (at submit) by debbugs.gnu.org; 25 Jun 2023 13:06:09 +0000 Received: from localhost ([127.0.0.1]:42174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDPRR-00080P-6n for submit@debbugs.gnu.org; Sun, 25 Jun 2023 09:06:09 -0400 Received: from lists.gnu.org ([209.51.188.17]:48290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDPRM-00080C-Mr for submit@debbugs.gnu.org; Sun, 25 Jun 2023 09:06:07 -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 1qDPRK-0003gw-7n for bug-gnu-emacs@gnu.org; Sun, 25 Jun 2023 09:06:02 -0400 Received: from sonic303-20.consmr.mail.ir2.yahoo.com ([77.238.178.201]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDPRH-0005IM-99 for bug-gnu-emacs@gnu.org; Sun, 25 Jun 2023 09:06:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1687698349; bh=Abo+yqJTB0CnHclG/37rJVxToBNieAmkSs2eNfq86oM=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=eWFCzRh8ah1FF7JBfjORQMH4kKR0Pq0pIVo+A6lRifX04AQbxqK+7jVTayhqtZz4v4kYFalry7z00xWlf9/TMFtnSSEpkVJ7VD8PATGbD1HcITsb2jenvyT0CAKVHOWGQoLA/otxyOZFWGVmg+9ZUee4fZiIgE0eY/ukFGD/ZZEG2cE84o5hg6MnYzmNi5J6p6EfVKiqkbIfnWD3xVId3aphPWX9obS80uwdu2Aym1IpTrMGeobptT9PK4QdqcLg/0/c3p4/UfpPmsursFLic4llNBxhdz7wEa7jdiEIoiV9NK0o0JuVcJI4PH+8uKsBbn+K9XfQDYCgGwibg3XPkw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1687698349; bh=1w0iWf+bfz4b7FidSfsnn10OjeMAJ3YoKkeTCistAf1=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=oZUsViZmfD7lzaJPFyYnMVX9ESOmO1oLI3ZLtEuQiO0OE90+nHURj0Y25nf11e5zgF2PI5JNeIG6C4w4T1BdAh4OjNTZQjV66G0USs34RpjcXsHZyCGVSkNyDnxyZgn1KRTbpxyZocit08UXzEKhwJ6Y1PsKnVFYmJyl+SGfO4mCTcUVn3XXPVWuhYqgGZyDHUGFYnqP7+ZYv8bS0/8T7JudI/d49HjPYYVqfJstDxX3TZaVyTt/DGz3Kh+ZNbENOrvuXgN4+piNrzS/SubUo2JOhk1whUVcqcStCdfCxlr7sdf8biP1Frf1yThOTMzOqIVzjT4MVRQ4Nhwetl96BA== X-YMail-OSG: vMLIsTUVM1kW_wwn69POCsd5c.kzBw00i26eFCnZKTH35wcp4UF.F2u4kAgJPPU M4dWKxYdq5kI_AooDDgqeImrFoFmZpOCWLhP77kYrIhtRaVZXFJRXzBhn5C2_91eadyeJfB2j_XC pIdTuvx7hMqRDe0ak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63w-- X-Sonic-MF: X-Sonic-ID: 47741d8f-db61-42f2-989c-f9dad76df4a4 Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ir2.yahoo.com with HTTP; Sun, 25 Jun 2023 13:05:49 +0000 Received: by hermes--production-ir2-7867f454fc-s6g4r (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 35ed41c0e66d184bd4dabdadf3fdff36; Sun, 25 Jun 2023 13:05:46 +0000 (UTC) From: =?utf-8?Q?Daniel_Mart=C3=ADn?= To: bug-gnu-emacs@gnu.org Subject: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top Date: Sun, 25 Jun 2023 15:05:45 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain References: X-Mailer: WebService/1.1.21557 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 5525 Received-SPF: pass client-ip=77.238.178.201; envelope-from=mardani29@yahoo.es; helo=sonic303-20.consmr.mail.ir2.yahoo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) 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: -2.4 (--) This is a regression from Emacs 28.2. emacs -Q C-x b sample.js RET M-x js-mode Paste the following code: function foo() { var value = 1; } /* Hello */ function bar() { var value = 1; } Place the point inside function bar. C-M-h Expected result: Function bar is marked. Actual result: Comment "/* Hello */" is marked. This is probably related to the following regression: When point is between function foo and function bar, C-M-e moves point to the _beginning_ of bar, not to the end of bar. In GNU Emacs 29.0.91 (build 8, aarch64-apple-darwin21.6.0, NS appkit-2113.60 Version 12.6 (Build 21G115)) of 2023-06-07 built on Daniels-MacBook-Pro.local Repository revision: bcc222251e1a750a11e365f2faa641cc56c1169d Repository branch: emacs-29 Windowing system distributor 'Apple', version 10.3.2113 System Description: macOS 12.6.7 Configured using: 'configure 'CFLAGS=-O0 -g3 -fsanitize=address' CPPFLAGS=-I/opt/homebrew/opt/openjdk@11/include' Configured features: ACL GNUTLS JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER PNG SQLITE3 THREADS TOOLKIT_SCROLL_BARS WEBP ZLIB Important settings: value of $LC_CTYPE: UTF-8 locale-coding-system: utf-8-unix Major mode: Shell Minor modes in effect: shell-dirtrack-mode: t comint-fontify-input-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t undelete-frame-mode: t line-number-mode: t indent-tabs-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 emacsbug ido cc-langs whitespace python pcase reposition edebug gnus-msg sort find-dired kmacro cus-start cus-load info-look info apropos display-line-numbers re-builder dabbrev pp mail-extr goto-addr view smerge-mode diff log-view pcvs-util org-element org-persist org-id org-refile avl-tree oc-basic ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time gnus-spec gnus-int gnus-range message sendmail rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win ol-docview ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi org-link-doi org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete org-list org-footnote org-faces org-entities ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold org-fold-core org-keys oc org-loaddefs cal-menu calendar cal-loaddefs org-version org-compat org-macs make-mode ffap grep pcmpl-gnu pcmpl-unix novice etags fileloop generator pulse xref project shortdoc cl-extra proced noutline outline icons add-log rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-enc xmltok yank-media mhtml-mode css-mode eww xdg url-queue thingatpt shr pixel-fill kinsoku url-file svg xml browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util url-parse auth-source eieio eieio-core cl-macs password-cache url-vars mailcap puny mm-url gnus nnheader gnus-util mail-utils range wid-edit mm-util mail-prsvr color sgml-mode facemenu dom vc bug-reference octave misearch multi-isearch js c-ts-common json map cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help ediff-init ediff-util format-spec imenu doc-view filenotify jka-compr image-mode exif vc-git diff-mode easy-mmode vc-dispatcher sh-script rx smie treesit cl-seq executable files-x shell pcomplete compile text-property-search comint ansi-osc ansi-color ring dired-aux dired dired-loaddefs time-date subr-x help-fns radix-tree cl-print byte-opt gv bytecomp byte-compile debug backtrace help-mode find-func cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar 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 kqueue cocoa ns lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 939191 235686) (symbols 48 45772 49) (strings 32 194496 17389) (string-bytes 1 6108451) (vectors 16 74154) (vector-slots 8 2095032 169146) (floats 8 489 580) (intervals 56 136872 727) (buffers 976 123)) From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 25 09:38:37 2023 Received: (at submit) by debbugs.gnu.org; 25 Jun 2023 13:38:38 +0000 Received: from localhost ([127.0.0.1]:42199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDPwr-0000Ly-JU for submit@debbugs.gnu.org; Sun, 25 Jun 2023 09:38:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:34784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDPwo-0000Lm-6c for submit@debbugs.gnu.org; Sun, 25 Jun 2023 09:38:36 -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 1qDPwn-0007g5-Vo for bug-gnu-emacs@gnu.org; Sun, 25 Jun 2023 09:38:34 -0400 Received: from sonic302-20.consmr.mail.ir2.yahoo.com ([87.248.110.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDPwb-0003mP-GJ for bug-gnu-emacs@gnu.org; Sun, 25 Jun 2023 09:38:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1687700298; bh=bfBxXmoLJBKq9+EAh+fudVXX+uWKlLlgBAAj/m+iJdY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=eHldq3sGv7Aue5H2XkZ4RtwufOYD7pH2MfZ0Y+U++7o7F470DMJkmeYdElnrhWs2vluWQ6TX8SJ+sIIauDN7u9xWA+6pzEpxRwrpLTP7Mz9z1jVz47oS9+sdyV1L10ElQV3kZkk1SUj285SbBd3OxHla9tp5m0HusqyYv3xDaSH4BQLg37swF+husQysleeKJ4JfPpJZGt9Ymnvg6WMZzZ1hjIbHeQRl9NxF00nxF6WkpMyAkMI2dKq+pqE3xFRzYt4T3pt9VVkCcWRO3nZPMat+fHKP44SCz3Wlz1rHQnvAPMSCPuBTiFEiyGjClafYZRC2INi1xAKxAs4mm0+AFg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1687700298; bh=4eLV3lxH5HEWacJiRIbaEUACW80jOit71XKes9Wo/fz=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=lb8zTzjT+K71OWQ5mKLYnHdyn7eXcQcltY3SDQTvdngTwnCranAUPKg0Wx3SjctO+C4fEDHB/nqMsTNaP6AsJf2kBNY+xOC3R8b37NNqGtcyu53DeNIh6HBhY4/elhhrHzgSOY87Rx+H2a76aKyigjjrjjAbHfU946v4GNcMLABum3Lv8gunxnfZAIf02Pd4LiciMkGZzLly3/NR0ejtau2j8yWKh7q8e8mW0bsaFhDe1kqL5jjR5dR64Zt8y78dKLz9N8DKOEW01b7k5CrGHHR6nhpd+ZxpjS3fEBL3ZHTUVM0SpKwRoDyy2QDplPjrS3c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pow_kmD0gD5WCRKrZs976uv4guH.ncy6O2w4L.uMyz4zs04WvpBETVV19Fh8A3QrAenR.tBD. lMPA1HCkGs_k_bbs9Yp6vMELqQJTKeteePVbuhmsSw1HL_yghBlmsfW.CAD5zUii9OPA3h_D6n.1 vLxdvbS3TJ0PZN65LZFlQV4jc1Xm1_gP2nQHuSepSWNQ- X-Sonic-MF: X-Sonic-ID: 6d089f29-ecc0-48e0-aebc-abdeec3e5698 Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ir2.yahoo.com with HTTP; Sun, 25 Jun 2023 13:38:18 +0000 Received: by hermes--production-ir2-7867f454fc-z7775 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 135ed97516e4cc6440b90ad178b41026; Sun, 25 Jun 2023 13:38:13 +0000 (UTC) From: =?utf-8?Q?Daniel_Mart=C3=ADn?= To: Daniel =?utf-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Subject: Re: bug#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top References: Date: Sun, 25 Jun 2023 15:38:12 +0200 In-Reply-To: ("Daniel =?utf-8?Q?Mart=C3=ADn?= via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\""'s message of "Sun, 25 Jun 2023 15:05:45 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.21557 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 874 Received-SPF: pass client-ip=87.248.110.83; envelope-from=mardani29@yahoo.es; helo=sonic302-20.consmr.mail.ir2.yahoo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: 64283@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: -2.4 (--) Daniel Mart=C3=ADn via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > This is a regression from Emacs 28.2. > This is the first commit where this bug happens: commit 4489450f37deafb013b1f0fc00c89f0973fda14a Author: Yuan Fu Date: Thu Nov 10 15:00:29 2022 -0800 In end-of-defun, terminate early if no further defun exists =20=20=20=20 Before this change, end-of-defun calls end-of-defun-function even if point is not necessarily at the beginning of a defun (contrary to what end-of-defun-function's docstring claims). Now it terminates early and doesn't call end-of-defun-function. =20=20=20=20 * lisp/emacs-lisp/lisp.el (beginning-of-defun-raw): Update docstring clarifying the return value. (end-of-defun): Terminate early if beginning-of-defun-raw returns nil. From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 25 11:04:56 2023 Received: (at 64283) by debbugs.gnu.org; 25 Jun 2023 15:04:56 +0000 Received: from localhost ([127.0.0.1]:43250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDRIO-0002qb-DF for submit@debbugs.gnu.org; Sun, 25 Jun 2023 11:04:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55036) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDRIM-0002qN-UA for 64283@debbugs.gnu.org; Sun, 25 Jun 2023 11:04:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDRIH-0003a2-Jj; Sun, 25 Jun 2023 11:04:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=w/xCy/+bnmRKyLEEkuKPIzF5IltDH9Fq8ZWl0fhIXe4=; b=H5ejDL4xoe5yIfvFAniP BdQ0XrOyJAToxQv1FxaK1Ss8IhW/zeN+gcFIkVMdPjxCxwqhD3M/K+fdpxDZ/Y63EplT3jSm5eNqF NBC7spBLnSxo9gTKY0pSXVOqUK8vClavKlF0qtCm+JGuFHpoVl50xAvLXh0lzqxsEqXfIR7DbtWVr skuVu5d6lSy18rMq/9X5uVNLwwhsGmiOzZpb/8qfm08ILXHuUqidQycOOJ20pc02d0EW9U5rb8jfI 1rUbrBo0A/vhLebu5cPaWhA2qSeRcQIq7tv80cSVX4LFpNu+RN6AyUyeHEsI9duwNXxGIBCwWIPcv gkElkMgMFf5wew==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDRIG-0007tb-Tb; Sun, 25 Jun 2023 11:04:49 -0400 Date: Sun, 25 Jun 2023 18:05:07 +0300 Message-Id: <83leg7y44c.fsf@gnu.org> From: Eli Zaretskii To: Daniel =?utf-8?Q?Mart=C3=ADn?= , Yuan Fu In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64283 Cc: Dmitry Gutov , 64283@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: -3.3 (---) > Date: Sun, 25 Jun 2023 15:38:12 +0200 > From: Daniel Martín via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Daniel Martín via "Bug reports for GNU Emacs, the Swiss army knife of > text editors" writes: > > > This is a regression from Emacs 28.2. > > > > This is the first commit where this bug happens: > > commit 4489450f37deafb013b1f0fc00c89f0973fda14a > Author: Yuan Fu > Date: Thu Nov 10 15:00:29 2022 -0800 > > In end-of-defun, terminate early if no further defun exists > > Before this change, end-of-defun calls end-of-defun-function even if > point is not necessarily at the beginning of a defun (contrary to what > end-of-defun-function's docstring claims). Now it terminates early > and doesn't call end-of-defun-function. > > * lisp/emacs-lisp/lisp.el (beginning-of-defun-raw): Update docstring > clarifying the return value. > (end-of-defun): Terminate early if beginning-of-defun-raw returns nil. Yuan, could you please look into this? From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 25 16:49:52 2023 Received: (at 64283) by debbugs.gnu.org; 25 Jun 2023 20:49:52 +0000 Received: from localhost ([127.0.0.1]:43735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDWgC-0003k6-7t for submit@debbugs.gnu.org; Sun, 25 Jun 2023 16:49:52 -0400 Received: from sonic307-54.consmr.mail.ir2.yahoo.com ([87.248.110.31]:37839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDWg7-0003jo-RS for 64283@debbugs.gnu.org; Sun, 25 Jun 2023 16:49:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1687726182; bh=f8Eg/HC4/EksX38awvITzUVLoG9X2Kpayxz0IWIZtSg=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=l/2c5m8QTdnlFb0E2ArmyRF7Opp5buz0PxOZFnUp8pMpifMjzLxRtUwLTGIqnuYQUQU8wCPxa+Ao6ewK9xEUWU9DPD/ryawGQdQDfKWsncemm0BGUJ6n7MGVdprOBCLTwDqNJMTwUEXOk36fl10xklTO1RU7P62QMOwGN6RfN9pX7to+HiAbjGb7gawFhG7kOwZuF4bZmP1qCDOiTg/TNxLk8B1m1LavD+hnOdSqHdk3cA9m1RRhukYlY4FjuJBlDvS2J7Mz2qWi8cVX02GVkmNxCUQ0NLJveib7wgAo+m88+jr/J3W42cXPxYdI3/MJnzbCNQA9z5m419jDF0J29Q== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1687726182; bh=b5kIMASm0cJTiS2JL0zAzfTuCp22d6zdVn/BQDmJyX+=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=pli9PFjd9veo+7m03A9O5XbHoZHO/RgUhZhpEZMzFhdoJj9TnZwKp1ZrAt3D5FuI35yPX8cAtMM+YF/ppkGlpZmHNdTpGoN8bmq0V3kVFhBIRdDA5buJX+bnbAMCp6Arhu8KJ08nxsfc/caHZysQ6MmbzX55xAbvYwuwQKq9PTG4AyTtjx1ppx3wIc4WuOnJYSuKPY+PmxBMroqgcqFdnyRJ7e/a3DbQr4GrZ1/qfWh81S4UukGlwM7IAA7G774Drpu9rXl7R8PF6M4mwLBDHtVBVDgqv+TH9Jc3/gpDvlWJ0AMK/qp4pAh8kEzWIlQV1dc38+WNdwSyarEZ+/fIwQ== X-YMail-OSG: FT9dAbQVM1kIS492OchNEkVdfBCm6t1INbM84wvBLLPrirW6qcnf8SFg7wxbRy3 zyd6Aw069SEs_B3WiIHKW2NcYxvrzo6qnMbi1HCZr4RFNzvrZWilAkXYhfUq1v1whqUPXyM7s9_6 Rhb3yHwe4mV7hZpRROBLEd3.JmvoYAdwOd3mJSDmZxlmwcsamsK3Zzy9.68R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ic-MF: X-Sonic-ID: 111415a8-2878-4ee4-bb8e-320ea8569ae0 Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.ir2.yahoo.com with HTTP; Sun, 25 Jun 2023 20:49:42 +0000 Received: by hermes--production-ir2-7867f454fc-dskkf (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID b485d3bb162144e24c307e6190194133; Sun, 25 Jun 2023 20:49:37 +0000 (UTC) From: =?utf-8?Q?Daniel_Mart=C3=ADn?= To: Eli Zaretskii Subject: Re: bug#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top References: <83leg7y44c.fsf@gnu.org> Date: Sun, 25 Jun 2023 22:49:36 +0200 In-Reply-To: <83leg7y44c.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 25 Jun 2023 18:05:07 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Mailer: WebService/1.1.21557 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 7374 X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 64283 Cc: Dmitry Gutov , Yuan Fu , 64283@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: -0.8 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> Date: Sun, 25 Jun 2023 15:38:12 +0200 >> From: Daniel Mart=C3=ADn via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >>=20 >> Daniel Mart=C3=ADn via "Bug reports for GNU Emacs, the Swiss army knife = of >> text editors" writes: >>=20 >> > This is a regression from Emacs 28.2. >> > >>=20 >> This is the first commit where this bug happens: >>=20 >> commit 4489450f37deafb013b1f0fc00c89f0973fda14a >> Author: Yuan Fu >> Date: Thu Nov 10 15:00:29 2022 -0800 >>=20 >> In end-of-defun, terminate early if no further defun exists >>=20=20=20=20=20 >> Before this change, end-of-defun calls end-of-defun-function even if >> point is not necessarily at the beginning of a defun (contrary to wh= at >> end-of-defun-function's docstring claims). Now it terminates early >> and doesn't call end-of-defun-function. >>=20=20=20=20=20 >> * lisp/emacs-lisp/lisp.el (beginning-of-defun-raw): Update docstring >> clarifying the return value. >> (end-of-defun): Terminate early if beginning-of-defun-raw returns ni= l. > > Yuan, could you please look into this? What I see is that, after 4489450f37deafb013b1f0fc00c89f0973fda14a, defun movement may be subtly broken if beginning-of-defun-function does not return non-nil when it found the beginning of a defun. One of the affected modes is js-mode, but who knows if there are more out there. We could either revert 4489450f37deafb013b1f0fc00c89f0973fda14a, because of the incompatibilities it may cause (Yuan, what is the bug it tries to fix?), or maybe adjust js-mode so that it follows the documentation of beginning-of-defun-function and returns non-nil when it found the beginning of a defun. I've attached a patch that follows this second approach, with some unit tests. It fixes the bug on my side. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Make-js-beginning-of-defun-return-non-nil-on-success.patch >From dbd0a48fba90b9a7f2fb291a3d279b6adf3117f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Sun, 25 Jun 2023 22:17:14 +0200 Subject: [PATCH] Make js-beginning-of-defun return non-nil on success * lisp/progmodes/js.el (js-beginning-of-defun): The docstring of beginning-of-defun-function says that this function shall return non-nil when it found the beginning of a defun. This is specially important because the calling code decides when to move point depending on the return value. Make js-beginning-of-defun return non-nil when it found the beginning of a defun. (js--beginning-of-defun-flat): Same for this helper. * test/lisp/progmodes/js-tests.el (js-mode-end-of-defun): Add a unit test. --- lisp/progmodes/js.el | 61 ++++++++++++++++++--------------- test/lisp/progmodes/js-tests.el | 51 +++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 27 deletions(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 414b6eb2baf..a05bd758dbc 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1024,38 +1024,45 @@ js--beginning-of-defun-flat "Helper function for `js-beginning-of-defun'." (let ((pstate (js--beginning-of-defun-raw))) (when pstate - (goto-char (js--pitem-h-begin (car pstate)))))) + (goto-char (js--pitem-h-begin (car pstate))) + t))) (defun js-beginning-of-defun (&optional arg) "Value of `beginning-of-defun-function' for `js-mode'." (setq arg (or arg 1)) - (while (and (not (eobp)) (< arg 0)) - (cl-incf arg) - (when (and (not js-flat-functions) - (or (eq (js-syntactic-context) 'function) - (js--function-prologue-beginning))) - (js-end-of-defun)) - - (if (js--re-search-forward - "\\_" nil t) - (goto-char (js--function-prologue-beginning)) - (goto-char (point-max)))) - - (while (> arg 0) - (cl-decf arg) - ;; If we're just past the end of a function, the user probably wants - ;; to go to the beginning of *that* function - (when (eq (char-before) ?}) - (backward-char)) - - (let ((prologue-begin (js--function-prologue-beginning))) - (cond ((and prologue-begin (< prologue-begin (point))) - (goto-char prologue-begin)) + (let ((found)) + (while (and (not (eobp)) (< arg 0)) + (cl-incf arg) + (when (and (not js-flat-functions) + (or (eq (js-syntactic-context) 'function) + (js--function-prologue-beginning))) + (js-end-of-defun)) + + (if (js--re-search-forward + "\\_" nil t) + (progn (goto-char (js--function-prologue-beginning)) + (setq found t)) + (goto-char (point-max)) + (setq found nil))) + + (while (> arg 0) + (cl-decf arg) + ;; If we're just past the end of a function, the user probably wants + ;; to go to the beginning of *that* function + (when (eq (char-before) ?}) + (backward-char)) - (js-flat-functions - (js--beginning-of-defun-flat)) - (t - (js--beginning-of-defun-nested)))))) + (let ((prologue-begin (js--function-prologue-beginning))) + (cond ((and prologue-begin (< prologue-begin (point))) + (goto-char prologue-begin) + (setq found t)) + + (js-flat-functions + (setq found (js--beginning-of-defun-flat))) + (t + (when (js--beginning-of-defun-nested) + (setq found t)))))) + found)) (defun js--flush-caches (&optional beg _ignored) "Flush the `js-mode' syntax cache after position BEG. diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el index 00fa78e8891..5db92b08f8a 100644 --- a/test/lisp/progmodes/js-tests.el +++ b/test/lisp/progmodes/js-tests.el @@ -237,6 +237,57 @@ "jsx-unclosed-1.jsx" (js-deftest-indent "jsx-unclosed-2.jsx") (js-deftest-indent "jsx.jsx") +;;;; Navigation tests. + +(ert-deftest js-mode-beginning-of-defun () + (with-temp-buffer + (insert "function foo() { + var value = 1; +} + +/** A comment. */ +function bar() { + var value = 1; +} +") + (js-mode) + ;; Move point inside `foo'. + (goto-char 18) + (beginning-of-defun) + (should (bobp)) + ;; Move point between the two functions. + (goto-char 37) + (beginning-of-defun) + (should (bobp)) + ;; Move point inside `bar'. + (goto-char 73) + (beginning-of-defun) + ;; Point should move to the beginning of `bar'. + (should (equal (point) 56)))) + +(ert-deftest js-mode-end-of-defun () + (with-temp-buffer + (insert "function foo() { + var value = 1; +} + +/** A comment. */ +function bar() { + var value = 1; +} +") + (js-mode) + (goto-char (point-min)) + (end-of-defun) + ;; end-of-defun from the beginning of the buffer should go to the + ;; end of `foo'. + (should (equal (point) 37)) + ;; Move point to the beginning of /** A comment. */ + (goto-char 38) + (end-of-defun) + ;; end-of-defun should move point to eob. + (should (eobp)))) + (provide 'js-tests) ;;; js-tests.el ends here -- 2.40.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 26 21:43:01 2023 Received: (at 64283) by debbugs.gnu.org; 27 Jun 2023 01:43:01 +0000 Received: from localhost ([127.0.0.1]:47319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDxjR-0006AT-4u for submit@debbugs.gnu.org; Mon, 26 Jun 2023 21:43:01 -0400 Received: from mail-oi1-f169.google.com ([209.85.167.169]:48404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDxjO-0006AG-Tx for 64283@debbugs.gnu.org; Mon, 26 Jun 2023 21:42:59 -0400 Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3a0423ea74eso2850515b6e.1 for <64283@debbugs.gnu.org>; Mon, 26 Jun 2023 18:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687830173; x=1690422173; 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=v0dL7hcvI1MgjlRexU/VS4kESp8KH+LMa7S2Y8Xsu3w=; b=NOyl7kqQqcSpxX8MNscqjUkTPkXvuPSAd9d9g4WvW6ioUwhMjS8aiZuKK99CJMh9Ly hPE7roK5nUiC6WcHy7G1YwfSeYFaOcQ1Fx8oMcU6j43qAaYfwrDzmaRyEIkWHYgHRLG2 rlxEBkmTHnx5qSp4IZWmj+3w1gm9caO1CD4UhJxRB6I+1K6uFnyavlljMfhIrLAWfm8+ 0lB4oVl9SB6rzOYvYIbj1VB1Q2Xtu52LpUDg628GDkPQuR1JY375VGX21zATTm/9joip G334vxLywUAI2FUA3fFrLkQ3ksxTW8aoykUTYDRqsRVDJ8iZm1JOcRH3wjQjDt92MpZ1 d+OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687830173; x=1690422173; 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=v0dL7hcvI1MgjlRexU/VS4kESp8KH+LMa7S2Y8Xsu3w=; b=aTDyoWqkrYmA+mUBHu5mWzViPxb1aSc+7I5NBr8KnkeqHzaAQWE5wFYcajc8ApG8ll suMrLJ04n/kTV2lM9m5Tl06UoPiUcpTSbDlxHtuTusACvFAbpts9f45Ex3Dp/nbpjdCg qnzSYQNSQDiGyBzB7Yaut7DXmgv9PDLo9YRvL1o7rX3ZNxU4wKUTxebDnvmep0gSJBTS gtm5osPWVgJqq+BYBRQldXj9YsTLza8XCcygUOlzMKa287VZwp2ux+IGERc/j1hcY+3u +lC6WnAIVO/Q47msLGq6dcnotoNUCZ97egB133wh2q5HpeRB4HEI+d6hyj5Vr3U+kkrt Ivnw== X-Gm-Message-State: AC+VfDzs/Ft2DmmZeb1fEeL06kd9pCjb25YMi/7RjIXkdl/wfv8w0Qo0 aShNOkHGymfBZB4ZaMeync0= X-Google-Smtp-Source: ACHHUZ5J7gIzcid/TVPnwnfqxeEGIMzE5puV0Dziz8mqM2sRLaM9RbxrYE5Jeh7udJQMRNoCSsSCTQ== X-Received: by 2002:a05:6808:138a:b0:3a1:e132:dd8b with SMTP id c10-20020a056808138a00b003a1e132dd8bmr4850318oiw.41.1687830172919; Mon, 26 Jun 2023 18:42:52 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id n11-20020a6546cb000000b00528da88275bsm4168863pgr.47.2023.06.26.18.42.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jun 2023 18:42:52 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: bug#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top From: Yuan Fu In-Reply-To: Date: Mon, 26 Jun 2023 18:42:41 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83leg7y44c.fsf@gnu.org> To: =?utf-8?Q?Daniel_Mart=C3=ADn?= X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64283 Cc: Dmitry Gutov , Eli Zaretskii , 64283@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 (-) >=20 > What I see is that, after 4489450f37deafb013b1f0fc00c89f0973fda14a, > defun movement may be subtly broken if beginning-of-defun-function = does > not return non-nil when it found the beginning of a defun. One of the > affected modes is js-mode, but who knows if there are more out there. >=20 > We could either revert 4489450f37deafb013b1f0fc00c89f0973fda14a, = because > of the incompatibilities it may cause (Yuan, what is the bug it tries = to > fix?), or maybe adjust js-mode so that it follows the documentation of > beginning-of-defun-function and returns non-nil when it found the > beginning of a defun. I've attached a patch that follows this second > approach, with some unit tests. It fixes the bug on my side. >=20 > <0001-Make-js-beginning-of-defun-return-non-nil-on-success.patch> The original problem that I tried to solve is that sometimes = end-of-defun-function was called when point isn=E2=80=99t at the = beginning of a defun, contrary to what the documentation claims.=20 I first find out about it when writing defun movement functions for = tree-sitter, but if you revert the commit now tree-sitter defun = functions wouldn=E2=80=99t break: they have change quite a bit since = then and treesit-end-of-defun don=E2=80=99t need to be called at the = beginning of the defun anymore. Yuan= From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 27 07:01:09 2023 Received: (at 64283) by debbugs.gnu.org; 27 Jun 2023 11:01:09 +0000 Received: from localhost ([127.0.0.1]:47736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qE6RY-0007py-LW for submit@debbugs.gnu.org; Tue, 27 Jun 2023 07:01:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qE6RV-0007pJ-Pl for 64283@debbugs.gnu.org; Tue, 27 Jun 2023 07:01:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qE6RQ-00015u-D3; Tue, 27 Jun 2023 07:01:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=FoiqVX2LlifbqOKjuWl6f+K7XoN/TOzO90DRbjm7HoA=; b=K/L60s4CKxvOrvdNsr2A 0LwO67PykMS5GOw8jRoBJO4FbBwA1GqXfhRbHJRYURNvk7Pg3RN9D4HMdl6NT4ybhu6jJsFg1Y701 3RB+CwlVOhs0+2Pg6my/b7UBUqXY7dt+qWU3UotV6gN0FQt0ph6MW2sCl0UJo9p8KAbjMIBqw0Red eONpdxeS4JlI456sI+7IRIZ4lPvIbHRzKcuRgZ7yFL/aEMrSZH0/hhTfvfs0CFfr8fKql+4f5Jr7G G7v9IIS1D51NCFWmW7T354LzFedfDyS7XK4pGLrnqm07q0s7e7YKZx9hsJKu7g6N36TAvfBmG/tJE Bjz1jfLgUs/LEw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qE6RP-0004hP-Sr; Tue, 27 Jun 2023 07:01:00 -0400 Date: Tue, 27 Jun 2023 14:01:21 +0300 Message-Id: <83jzvpw4n2.fsf@gnu.org> From: Eli Zaretskii To: Yuan Fu In-Reply-To: (message from Yuan Fu on Mon, 26 Jun 2023 18:42:41 -0700) Subject: Re: bug#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top References: <83leg7y44c.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64283 Cc: dmitry@gutov.dev, 64283@debbugs.gnu.org, mardani29@yahoo.es 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: -3.3 (---) > From: Yuan Fu > Date: Mon, 26 Jun 2023 18:42:41 -0700 > Cc: Eli Zaretskii , > Dmitry Gutov , > 64283@debbugs.gnu.org > > > > > What I see is that, after 4489450f37deafb013b1f0fc00c89f0973fda14a, > > defun movement may be subtly broken if beginning-of-defun-function does > > not return non-nil when it found the beginning of a defun. One of the > > affected modes is js-mode, but who knows if there are more out there. > > > > We could either revert 4489450f37deafb013b1f0fc00c89f0973fda14a, because > > of the incompatibilities it may cause (Yuan, what is the bug it tries to > > fix?), or maybe adjust js-mode so that it follows the documentation of > > beginning-of-defun-function and returns non-nil when it found the > > beginning of a defun. I've attached a patch that follows this second > > approach, with some unit tests. It fixes the bug on my side. > > > > <0001-Make-js-beginning-of-defun-return-non-nil-on-success.patch> > > The original problem that I tried to solve is that sometimes end-of-defun-function was called when point isn’t at the beginning of a defun, contrary to what the documentation claims. > > I first find out about it when writing defun movement functions for tree-sitter, but if you revert the commit now tree-sitter defun functions wouldn’t break: they have change quite a bit since then and treesit-end-of-defun don’t need to be called at the beginning of the defun anymore. Thanks. Do you (or anyone else) see a problem with the alternative proposed by Daniel? If not, I'd prefer not to revert at this stage, but instead to apply the simple fix Daniel suggested. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 28 16:12:05 2023 Received: (at 64283) by debbugs.gnu.org; 28 Jun 2023 20:12:05 +0000 Received: from localhost ([127.0.0.1]:51753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEbWG-0006bo-Nx for submit@debbugs.gnu.org; Wed, 28 Jun 2023 16:12:05 -0400 Received: from mail-pf1-f174.google.com ([209.85.210.174]:48447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEbWE-0006bJ-Jf for 64283@debbugs.gnu.org; Wed, 28 Jun 2023 16:12:03 -0400 Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-66c729f5618so149508b3a.1 for <64283@debbugs.gnu.org>; Wed, 28 Jun 2023 13:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687983117; x=1690575117; 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=JWTy3GtRvROVK7IckGH+dhFoLwwFc46rBTcCwAHcuOQ=; b=UTRqJNTCwJ/nUeDooBQONGeyA/ksiaRZXaBL50a5I4WMr6Cu626IxwQpxUPiTSHiJQ Cq781blLdiXi3hrbFnU1NAJtMMgh2O+sDPK4YA3kMCjeWOUO8/tHxxBKwP9BeHQIt4PG z++dXnkGbLnyzMiQse183zxQLoxEL3pglwED5c/otkbX14rIowHib9chS/SjM26ZOFed yYBUlupKPDCaB0Q+0OXDLVc7+mS+DYRMeQCp/sHHQt8fudb7YiqbZkgGVrycsE7SnXVM q7ydcRTkvmOOuWGoFHGeeysp0AFo7W+ObJvb9b4PKnCcvlwB2ndyJ1//k5EazQ1aNoVi jUgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687983117; x=1690575117; 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=JWTy3GtRvROVK7IckGH+dhFoLwwFc46rBTcCwAHcuOQ=; b=ahzJ3OQy5aavAU0jYFnJkSTDIV8nAvx7eRx2M2Qqj2wG6ODMksPasYV7fZYj7Jv1HK tehYV6jsrlvxRbl5OTUpz4OQM1jp6kNbueTcxjKPpvFV/OTNICkk96Zq55/82Dz5W9e6 7ELIVw1Ma+jM29zzomjO0xbrlnGDvPQu1Ro3qBZZP6TbN56FnJNIsnLiGGsinMVLeoCr qf/HIZwzqMtrQcsNzk0lPlXdi9pNlq0qDdanwCx+9bweqxoAVCzNSOqnIqS1UJZNiGif Pz/9p+8LbZL5LNAoZz5prc/G6/l2IkRu8eQ+gz6mQ4fKg25XO9xgXNHNZv+MwwU/JzAx aa6w== X-Gm-Message-State: AC+VfDyq2PachcYyIiOO3EBbTvL+lDqa1pCMNUaFOp6IpVLYZYZwcl9+ X8FePKL8Xc/Ifm7M8GLJjys= X-Google-Smtp-Source: ACHHUZ6bZJvXPACH4JzdZ/a/sNIPYiXmrGTLapf3+SsFNyUqF4AxNOFtagF+mKGilUzd44jrGZi3Kw== X-Received: by 2002:a05:6a00:2388:b0:67a:b045:e290 with SMTP id f8-20020a056a00238800b0067ab045e290mr10571505pfc.4.1687983116657; Wed, 28 Jun 2023 13:11:56 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id i14-20020aa78d8e000000b00654228f9e93sm7359348pfr.120.2023.06.28.13.11.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2023 13:11:56 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: bug#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top From: Yuan Fu In-Reply-To: <83jzvpw4n2.fsf@gnu.org> Date: Wed, 28 Jun 2023 13:11:43 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <4A2B5016-C2B2-499C-BBD8-AFCCF676DF96@gmail.com> References: <83leg7y44c.fsf@gnu.org> <83jzvpw4n2.fsf@gnu.org> To: Eli Zaretskii X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64283 Cc: Dmitry Gutov , 64283@debbugs.gnu.org, =?utf-8?Q?Daniel_Mart=C3=ADn?= 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 (-) > On Jun 27, 2023, at 4:01 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Mon, 26 Jun 2023 18:42:41 -0700 >> Cc: Eli Zaretskii , >> Dmitry Gutov , >> 64283@debbugs.gnu.org >>=20 >>>=20 >>> What I see is that, after 4489450f37deafb013b1f0fc00c89f0973fda14a, >>> defun movement may be subtly broken if beginning-of-defun-function = does >>> not return non-nil when it found the beginning of a defun. One of = the >>> affected modes is js-mode, but who knows if there are more out = there. >>>=20 >>> We could either revert 4489450f37deafb013b1f0fc00c89f0973fda14a, = because >>> of the incompatibilities it may cause (Yuan, what is the bug it = tries to >>> fix?), or maybe adjust js-mode so that it follows the documentation = of >>> beginning-of-defun-function and returns non-nil when it found the >>> beginning of a defun. I've attached a patch that follows this = second >>> approach, with some unit tests. It fixes the bug on my side. >>>=20 >>> <0001-Make-js-beginning-of-defun-return-non-nil-on-success.patch> >>=20 >> The original problem that I tried to solve is that sometimes = end-of-defun-function was called when point isn=E2=80=99t at the = beginning of a defun, contrary to what the documentation claims.=20 >>=20 >> I first find out about it when writing defun movement functions for = tree-sitter, but if you revert the commit now tree-sitter defun = functions wouldn=E2=80=99t break: they have change quite a bit since = then and treesit-end-of-defun don=E2=80=99t need to be called at the = beginning of the defun anymore. >=20 > Thanks. >=20 > Do you (or anyone else) see a problem with the alternative proposed by > Daniel? If not, I'd prefer not to revert at this stage, but instead > to apply the simple fix Daniel suggested. I don=E2=80=99t see any problem :-) Yuan= From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 29 01:40:41 2023 Received: (at 64283-done) by debbugs.gnu.org; 29 Jun 2023 05:40:42 +0000 Received: from localhost ([127.0.0.1]:52083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEkOX-0004Ew-Dn for submit@debbugs.gnu.org; Thu, 29 Jun 2023 01:40:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qEkOV-0004Ei-3D for 64283-done@debbugs.gnu.org; Thu, 29 Jun 2023 01:40:40 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qEkOP-0006HG-JP; Thu, 29 Jun 2023 01:40:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=IML3DkjHHeHrASmM4CirQJizTP3RrUCyTKust2OgucU=; b=rgUTAwwBmAxynggLcJdy PL2KgXU+U68ZeL7qLiKfldkUWOSgIdZd9J7OI+CYbHPqYq4XaS+pFJ0n7r898b5Z/UB6dqYeSm1Pc loUAwKT7o0OgRgAcj06emB96xIe0wyAuuW8to1ovViymhL7pOi/0uf7QKA222u880cwUHkZl3cnRb iTpC982ZwaRS4Rfcohttjij8eh3fCU9vW+fq/CnoLXso/KTeiZyx3YoeRuBbzugJ5E1SXXPV3ayJz e9jghirfdUqg09S+UeRKHlRQDspZEI80OVJjunzJl3yDsCA9g5St06jkJO7MaogpTDxuUXZYOfQNb L59KwNLpWW2NLA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qEkOO-0003PK-TG; Thu, 29 Jun 2023 01:40:33 -0400 Date: Thu, 29 Jun 2023 08:41:00 +0300 Message-Id: <83o7kyu8pf.fsf@gnu.org> From: Eli Zaretskii To: Yuan Fu In-Reply-To: <4A2B5016-C2B2-499C-BBD8-AFCCF676DF96@gmail.com> (message from Yuan Fu on Wed, 28 Jun 2023 13:11:43 -0700) Subject: Re: bug#64283: 29.0.91; js-mode's mark-defun does not work correctly when functions have a comment on top References: <83leg7y44c.fsf@gnu.org> <83jzvpw4n2.fsf@gnu.org> <4A2B5016-C2B2-499C-BBD8-AFCCF676DF96@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64283-done Cc: dmitry@gutov.dev, 64283-done@debbugs.gnu.org, mardani29@yahoo.es 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: -3.3 (---) > From: Yuan Fu > Date: Wed, 28 Jun 2023 13:11:43 -0700 > Cc: Daniel Martín , > Dmitry Gutov , > 64283@debbugs.gnu.org > > > > > On Jun 27, 2023, at 4:01 AM, Eli Zaretskii wrote: > > > >> From: Yuan Fu > >> Date: Mon, 26 Jun 2023 18:42:41 -0700 > >> Cc: Eli Zaretskii , > >> Dmitry Gutov , > >> 64283@debbugs.gnu.org > >> > >>> > >>> What I see is that, after 4489450f37deafb013b1f0fc00c89f0973fda14a, > >>> defun movement may be subtly broken if beginning-of-defun-function does > >>> not return non-nil when it found the beginning of a defun. One of the > >>> affected modes is js-mode, but who knows if there are more out there. > >>> > >>> We could either revert 4489450f37deafb013b1f0fc00c89f0973fda14a, because > >>> of the incompatibilities it may cause (Yuan, what is the bug it tries to > >>> fix?), or maybe adjust js-mode so that it follows the documentation of > >>> beginning-of-defun-function and returns non-nil when it found the > >>> beginning of a defun. I've attached a patch that follows this second > >>> approach, with some unit tests. It fixes the bug on my side. > >>> > >>> <0001-Make-js-beginning-of-defun-return-non-nil-on-success.patch> > >> > >> The original problem that I tried to solve is that sometimes end-of-defun-function was called when point isn’t at the beginning of a defun, contrary to what the documentation claims. > >> > >> I first find out about it when writing defun movement functions for tree-sitter, but if you revert the commit now tree-sitter defun functions wouldn’t break: they have change quite a bit since then and treesit-end-of-defun don’t need to be called at the beginning of the defun anymore. > > > > Thanks. > > > > Do you (or anyone else) see a problem with the alternative proposed by > > Daniel? If not, I'd prefer not to revert at this stage, but instead > > to apply the simple fix Daniel suggested. > > I don’t see any problem :-) Thanks. So I've now installed Daniel's patch on the released branch, and I'm therefore closing this bug. From unknown Sun Jun 15 08:37:17 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 27 Jul 2023 11:24:11 +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