branch: elpa/lua-mode
commit 32b56399c82c240c59fbc9a81bf64324fcafad71
Author: immerrr <[email protected]>
Commit: immerrr <[email protected]>

    Fix wrong imenu generic expression, add one more regexp to match 'x = 
function(...)' definitions
---
 lua-mode.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lua-mode.el b/lua-mode.el
index c97a7f7..4c1a7ff 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -580,9 +580,12 @@ Groups 6-9 can be used in any of argument regexps."
   "Default expressions to highlight in Lua mode.")
 
 (defvar lua-imenu-generic-expression
-  ;; Very rough expression, but probably it's for the best, since it's used for
-  ;; navigation. --immerrr
-  '((nil "^[ \t]*\\(?:local[ \t]+\\)?function[ \t]+[[:alnum:]_:.]" 1))
+  ;; This regexp matches expressions which look like function
+  ;; definitions, but are not necessarily allowed by Lua syntax.  This
+  ;; is done on purpose to avoid frustration when making a small error
+  ;; might cause a function get hidden from imenu index. --immerrr
+  '((nil "^[ \t]*\\(?:local[ \t]+\\)?function[ \t]+\\([[:alnum:]_:.]+\\)" 1)
+    (nil "^[ \t]*\\(?:local[ \t]+\\)?\\(\\_<[[:alnum:]_:.]+\\_>\\)[ \t]*=\[ 
\t]*\\_<function\\_>" 1))
   "Imenu generic expression for lua-mode.  See `imenu-generic-expression'.")
 
 (defvar lua-sexp-alist '(("then" . "end")

Reply via email to