emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 798bd12 2/2: Fix tcl-mode indentation of namespaced code


From: Lars Ingebrigtsen
Subject: master 798bd12 2/2: Fix tcl-mode indentation of namespaced code
Date: Mon, 8 Feb 2021 01:34:03 -0500 (EST)

branch: master
commit 798bd1273c5ba85427952e6eee22c8eeda58e85e
Author: Anticrisis <anticrisisg@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix tcl-mode indentation of namespaced code
    
    * lisp/progmodes/tcl.el (tcl-calculate-indent): Fix indentation
    when using namespaces (bug#44834).
    (tcl-beginning-of-defun-function): Remove.  This partially reverts
    cd5bb4bf3dbad8941d25823f398b595b8f0edbb9.
    
    Copyright-paperwork-exempt: yes
---
 lisp/progmodes/tcl.el            | 29 +++++------------------------
 test/lisp/progmodes/tcl-tests.el |  1 -
 2 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 0a0118a..82e1343 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -651,7 +651,6 @@ already exist."
   (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))
 
 
@@ -849,14 +848,12 @@ Returns nil if line starts inside a string, t if in a 
comment."
           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 @@ Returns nil if line starts inside a string, t if in a 
comment."
 ;; 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 cf1ed28..e55eb6d 100644
--- a/test/lisp/progmodes/tcl-tests.el
+++ b/test/lisp/progmodes/tcl-tests.el
@@ -74,7 +74,6 @@
 
 ;; 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"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]