emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/d-mode b413942 198/346: Tighten K&R region detection


From: ELPA Syncer
Subject: [nongnu] elpa/d-mode b413942 198/346: Tighten K&R region detection
Date: Sun, 29 Aug 2021 11:00:30 -0400 (EDT)

branch: elpa/d-mode
commit b4139423f89c76f728262defc4cd1cee145a1d1d
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>

    Tighten K&R region detection
    
    Don't return a positive when inside the runtime arg list of templated
    function.
---
 d-mode.el | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/d-mode.el b/d-mode.el
index 2afd78d..8d5370c 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -983,10 +983,12 @@ Key bindings:
   (save-excursion
     ;; If we're in a macro, our search range is restricted to it.  Narrow to
     ;; the searchable range.
-    (let* (before-lparen
+    (let* ((start (point))
+          before-lparen
           after-rparen
           (pp-count-out 20)    ; Max number of paren/brace constructs before
                                ; we give up.
+          knr-start
           c-last-identifier-range)
 
       (catch 'knr
@@ -1027,13 +1029,21 @@ Key bindings:
                              (eq (c-backward-token-2) 0)
                              (eq (d--on-func-identifier) (point)))))
 
+                  ;; Check that we're outside of the template arg list 
(D-specific).
+                  (progn
+                    (setq knr-start
+                          (progn (goto-char after-rparen)
+                                 (c-forward-syntactic-ws)
+                                 (when (eq (char-after) ?\()
+                                   (c-go-list-forward)
+                                   (c-forward-syntactic-ws))
+                                 (point)))
+                    (<= knr-start start))
+
                   ;; (... original c-in-knr-argdecl logic omitted here ...)
                   t)
                  ;; ...Yes.  We've identified the function's argument list.
-                 (throw 'knr
-                        (progn (goto-char after-rparen)
-                               (c-forward-syntactic-ws)
-                               (point)))
+                 (throw 'knr knr-start)
                ;; ...No.  The current parens aren't the function's arg list.
                (goto-char before-lparen))
 



reply via email to

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