unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Anticrisis <anticrisisg@gmail.com>
To: 44834@debbugs.gnu.org
Subject: bug#44834: Fix for failing indentation of Tcl procs nested in namespace
Date: Thu, 21 Jan 2021 15:17:41 -1000	[thread overview]
Message-ID: <CAHJtA0xNmrw8A0DMWab5gwUavnV-osPtqqyrgPF81-PK9WViVA@mail.gmail.com> (raw)
In-Reply-To: <87sg8zk4lj.fsf@precedence.co.uk>

[-- Attachment #1: Type: text/plain, Size: 668 bytes --]

This patch corrects the problem by partially backing out changes
introduced in this commit 2 1/2 years ago:

https://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/progmodes/tcl.el?id=cd5bb4bf3dbad8941d25823f398b595b8f0edbb9

The patch removes the customized tcl-beginning-of-defun-function in
favor of relying on the existing lisp mechanism. It preserves the
customized tcl-end-of-defun-function because that is required for some
test cases.

The expected-failing test was marked as succeeding.

This is a minor change. I did not refer to any code outside of emacs
itself in investigating and correcting this bug. I will not be able to
provide additional paperwork.

[-- Attachment #2: tcl-beginning-of-defun-patch.txt --]
[-- Type: text/plain, Size: 2261 bytes --]

diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 0a0118a5eb..c294a2af22 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -651,7 +651,6 @@ tcl-mode
   (setq-local add-log-current-defun-function
        #'tcl-add-log-defun)
 
-  (setq-local beginning-of-defun-function #'tcl-beginning-of-defun-function)
    (setq-local end-of-defun-function #'tcl-end-of-defun-function))
 
 \f
@@ -849,14 +848,12 @@ tcl-calculate-indent
            state
            containing-sexp
            found-next-line)
-      (cond
-       (parse-start
+
+      (if parse-start
           (goto-char parse-start))
-       ((not (beginning-of-defun))
-        ;; If we're not in a function, don't use
-        ;; `tcl-beginning-of-defun-function'.
-        (let ((beginning-of-defun-function nil))
-          (beginning-of-defun))))
+
+      (beginning-of-defun)
+
       (while (< (point) indent-point)
         (setq parse-start (point))
         (setq state (parse-partial-sexp (point) indent-point 0))
@@ -1035,22 +1032,6 @@ tcl-indent-exp
 ;; Interfaces to other packages.
 ;;
 
-(defun tcl-beginning-of-defun-function (&optional arg)
-  "`beginning-of-defun-function' for Tcl mode."
-  (when (or (not arg) (= arg 0))
-    (setq arg 1))
-  (let* ((search-fn (if (> arg 0)
-                        ;; Positive arg means to search backward.
-                        #'re-search-backward
-                      #'re-search-forward))
-         (arg (abs arg))
-         (result t))
-    (while (and (> arg 0) result)
-      (unless (funcall search-fn tcl-proc-regexp nil t)
-        (setq result nil))
-      (setq arg (1- arg)))
-    result))
-
 (defun tcl-end-of-defun-function ()
   "`end-of-defun-function' for Tcl mode."
   ;; Because we let users redefine tcl-proc-list, we don't really know
diff --git a/test/lisp/progmodes/tcl-tests.el b/test/lisp/progmodes/tcl-tests.el
index cf1ed2896e..e55eb6d901 100644
--- a/test/lisp/progmodes/tcl-tests.el
+++ b/test/lisp/progmodes/tcl-tests.el
@@ -74,7 +74,6 @@ tcl-mode-namespace-indent
 
 ;; From bug#44834
 (ert-deftest tcl-mode-namespace-indent-2 ()
-  :expected-result :failed
   (with-temp-buffer
     (tcl-mode)
     (let ((text "namespace eval Foo {\n    proc foo {} {}\n\n    proc bar {}{}}\n"))

  parent reply	other threads:[~2021-01-22  1:17 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 23:58 bug#44834: 27.1; Tcl mode enforces bad indentation following proc within a namespace Morgan Willcock
2021-01-08 22:21 ` bug#44834: change severity Anticrisis
2021-01-08 23:04 ` bug#44834: Patch to provide failing test for bug 44834 Anticrisis
2021-01-09  1:24   ` Anticrisis
2021-01-10 12:10     ` Lars Ingebrigtsen
2021-01-10 18:41       ` Anticrisis
2021-01-11 15:17         ` Lars Ingebrigtsen
2021-01-22  1:17 ` Anticrisis [this message]
2021-01-27  4:37   ` bug#44834: Fix for failing indentation of Tcl procs nested in namespace Lars Ingebrigtsen
2021-02-06 21:51     ` Anticrisis
2021-02-07  5:47       ` Richard Stallman
2021-02-07  7:26         ` Anticrisis
2021-02-06 22:55     ` Dmitry Gutov
2021-02-07  5:47       ` Richard Stallman
2021-02-07 11:40         ` Lars Ingebrigtsen
2021-02-08  3:44           ` Richard Stallman
2021-02-08  6:30             ` Lars Ingebrigtsen
2021-02-09  6:07               ` Richard Stallman
2021-02-09  8:24                 ` Lars Ingebrigtsen
2021-02-09 15:40                   ` Eli Zaretskii
2021-02-10  5:32                     ` Richard Stallman
2021-02-10 15:08                       ` Eli Zaretskii
2021-02-11 13:39                         ` Richard Stallman
2021-02-11 14:00                           ` Lars Ingebrigtsen
2021-02-11 14:39                           ` Eli Zaretskii
2021-02-12  5:48                             ` Richard Stallman
2021-02-12  5:48                             ` Richard Stallman
2021-02-12  7:26                               ` Eli Zaretskii
2021-02-12  8:14                             ` Lars Ingebrigtsen
2021-02-12 11:16                               ` Eli Zaretskii
2021-02-13  3:26                               ` Richard Stallman
2021-02-13 11:37                                 ` Lars Ingebrigtsen
2021-02-13 12:25                                 ` Dmitry Gutov
2021-02-16  5:19                                   ` Richard Stallman
2021-02-16 12:05                                     ` Dmitry Gutov
2021-02-16 12:06                                       ` Lars Ingebrigtsen
2021-02-16 15:38                                         ` Eli Zaretskii
2021-02-16 16:29                                           ` Lars Ingebrigtsen
2021-02-16 17:15                                           ` Juri Linkov
2021-02-16 18:53                                             ` Eli Zaretskii
2021-02-18  6:12                                             ` Richard Stallman
2021-02-18 14:08                                               ` Eli Zaretskii
2021-02-18 14:15                                           ` Dmitry Gutov
2021-02-17  4:12                                         ` Richard Stallman
2021-02-10 15:24                       ` Lars Ingebrigtsen
2021-02-10 16:03                         ` Matt Armstrong
2021-02-11 13:39                         ` Richard Stallman
2021-02-11 14:41                           ` Eli Zaretskii
2021-02-11 14:49                             ` Dmitry Gutov
2021-02-12  5:48                             ` Richard Stallman
2021-01-22 19:37 ` bug#44834: Patch also closes bug#44083 Anticrisis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHJtA0xNmrw8A0DMWab5gwUavnV-osPtqqyrgPF81-PK9WViVA@mail.gmail.com \
    --to=anticrisisg@gmail.com \
    --cc=44834@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).