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

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

[elpa] externals/javaimp ae115d66ed: Use scope open-brace as argument to


From: Filipp Gunbin
Subject: [elpa] externals/javaimp ae115d66ed: Use scope open-brace as argument to javaimp--beg-of-defun-decl
Date: Tue, 26 Jul 2022 10:41:19 -0400 (EDT)

branch: externals/javaimp
commit ae115d66ed90b4a6768e3bf90c5b851f9532aa69
Author: Filipp Gunbin <fgunbin@fastmail.fm>
Commit: Filipp Gunbin <fgunbin@fastmail.fm>

    Use scope open-brace as argument to javaimp--beg-of-defun-decl
---
 javaimp.el | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/javaimp.el b/javaimp.el
index 8c2a4460e5..a1daeeafed 100644
--- a/javaimp.el
+++ b/javaimp.el
@@ -789,8 +789,8 @@ form as CLASS-ALIST in return value of
 (defsubst javaimp-imenu--make-entry (scope)
   (list (javaimp-scope-name scope)
         (if imenu-use-markers
-            (copy-marker (javaimp-scope-start scope))
-          (javaimp-scope-start scope))
+            (copy-marker (javaimp-scope-open-brace scope))
+          (javaimp-scope-open-brace scope))
         #'javaimp-imenu--function
         scope))
 
@@ -876,10 +876,10 @@ nested in methods are not included, see
                    (not (javaimp-scope-parent s)))
                  scopes))))
 
-(defun javaimp-imenu--function (_index-name index-position _scope)
+(defun javaimp-imenu--function (_index-name index-position scope)
   (if-let ((decl-beg (javaimp--beg-of-defun-decl index-position)))
       (goto-char decl-beg)
-    (goto-char index-position)
+    (goto-char (javaimp-scope-start scope))
     (back-to-indentation)))
 
 
@@ -1085,14 +1085,15 @@ buffer."
              ;; Move to target sibling
              (let ((scope (nth target-idx siblings)))
                (goto-char (or (javaimp--beg-of-defun-decl
-                               (javaimp-scope-start scope) parent-start)
+                               (javaimp-scope-open-brace scope) parent-start)
                               (javaimp-scope-open-brace scope)))))
             (siblings
              ;; Move to start of first/last sibling
-             (goto-char (javaimp-scope-open-brace
-                         (car (if (< target-idx 0)
-                                  siblings
-                                (last siblings))))))
+             (let* ((scope (car (if (< target-idx 0)
+                                    siblings
+                                  (last siblings))))
+                    (pos (javaimp-scope-open-brace scope)))
+               (goto-char (or (javaimp--beg-of-defun-decl pos) pos))))
             (parent-start
              (goto-char parent-start)
              ;; Move forward one line unless closing brace is on the
@@ -1192,7 +1193,7 @@ PREV-INDEX gives the index of the method itself."
                      siblings))
               (next-beg-decl
                (javaimp--beg-of-defun-decl
-                (javaimp-scope-start next) parent-beg))
+                (javaimp-scope-open-brace next) parent-beg))
               (beg-decl
                (let ((tmp pos))
                  ;; pos may be inside arg list or some other nested
@@ -1226,7 +1227,7 @@ PREV-INDEX gives the index of the method itself."
                             (not (memq (javaimp-scope-type scope)
                                        '(array-init simple-statement 
statement)))
                             (javaimp--beg-of-defun-decl
-                             (javaimp-scope-start scope)))
+                             (javaimp-scope-open-brace scope)))
                        (javaimp-scope-start scope)))
         (message "%s %s at position %d"
                  (javaimp-scope-type scope) (javaimp-scope-name scope)



reply via email to

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