branch: elpa/lua-mode
commit 2fc3251424c9048409f218fb9b31dc63771071a6
Author: Nikita Bloshchanevich <[email protected]>
Commit: Nikita Bloshchanevich <[email protected]>
`lua-funcname-at-point': don't modify the syntax
Use `re-search-forward' + `re-search-backward', which is much less hacky and
should be faster, as no syntax table needs to be copied.
---
lua-mode.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index a5f5d6a..4618a6d 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -2021,10 +2021,13 @@ Create a Lua process if one doesn't already exist."
(defun lua-funcname-at-point ()
"Get current Name { '.' Name } sequence."
- ;; FIXME: copying/modifying syntax table for each call may incur a penalty
- (with-syntax-table (copy-syntax-table)
- (modify-syntax-entry ?. "_")
- (current-word t)))
+ (save-excursion
+ (save-match-data
+ (re-search-backward "\\`\\|[^A-Za-z.]")
+ ;; NOTE: `point' will be either at the start of the buffer or on a
+ ;; non-symbol character.
+ (re-search-forward "\\([A-Za-z]+\\(?:.[A-Za-z]+\\)*\\)")
+ (match-string 1))))
(defun lua-search-documentation ()
"Search Lua documentation for the word at the point."