You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(defunlua-get-symbol ()
(let* ((line-start (if (derived-mode-p'inferior-lua-mode)
;; Working on a shell buffer: use prompt end.
(cdr (lua-util-comint-last-prompt))
(line-beginning-position)))
(start
(save-excursion
(if (not (re-search-backward
(lua-rx ;; find the current-word
(or whitespace open-paren close-paren string-delimiter))
line-start
t1))
line-start
(forward-char (length (match-string-no-properties0)))
(point))))
(end (save-excursion
(if (not (re-search-forward
(lua-rx ;; find the current-word
(or whitespace open-paren close-paren string-delimiter))
(point-max)
t1))
(line-end-position)
(backward-char (length (match-string-no-properties0)))
(point))
))
(sym (buffer-substring start end))
)
sym))
(defunlua-jump-to-define-command (sym)
(format
(concat"if(type(%s) ~= \"function\")then print(\"no\") ""else local info = debug.getinfo(%s);""local src = info.source; ""local line = info.linedefined ;""local ret = src ..\":\".. line;print(ret) end \n")
sym sym))
(defunlua-jump-to-define ()
(interactive)
(let* ((proc (get-buffer-process (current-buffer)))
(sym (lua-get-symbol))
ret source line)
(setq ret (lua-shell-run proc (lua-jump-to-define-command sym)))
(if (equal (car ret) "no")
(message"not found function define or not a function")
(setqsource (car ret))
(cond
((string-match"^@\\([^:]+\\):\\([0-9]+\\)"source)
(setq line (match-string2source)
source (match-string1source))
(find-filesource)
(goto-line (string-to-number line)))
((string-match"=\\[C\\]:""=[C]:")
(message"C Function"))
(t
(print (format"not Know Pattern:%s" ret)))
))))
;;(switch-to-buffer lua-shell-completion-native-redirect-buffer)
(defunlua-shell-run (processinput-to-send)
"Get completions using native readline for PROCESS.When IMPORT is non-nil takes precedence over INPUT forcompletion."
(with-current-buffer (process-buffer process )
(let* ((original-filter-fn (process-filter process))
(redirect-buffer (get-buffer-create
lua-shell-completion-native-redirect-buffer))
)
;; Ensure restoring the process filter, even if the user quits;; or there's some other error.
(unwind-protect
(with-current-buffer redirect-buffer
;; Cleanup the redirect buffer
(erase-buffer)
;; Mimic `comint-redirect-send-command', unfortunately it;; can't be used here because it expects a newline in the;; command and that's exactly what we are trying to avoid.
(let ((comint-redirect-echo-input nil)
(comint-redirect-completed nil)
(comint-redirect-perform-sanity-check nil)
(comint-redirect-insert-matching-regexp t)
(comint-redirect-finished-regexp
"> ")
(comint-redirect-output-buffer redirect-buffer))
;; Compatibility with Emacs 24.x. Comint changed and;; now `comint-redirect-filter' gets 3 args. This;; checks which version of `comint-redirect-filter' is;; in use based on its args and uses `apply-partially';; to make it up for the 3 args case.
(if (= (length
(help-function-arglist'comint-redirect-filter)) 3)
(set-process-filter
process (apply-partially#'comint-redirect-filter original-filter-fn))
(set-process-filter process #'comint-redirect-filter))
(process-send-string process input-to-send)
;; Grab output until our dummy completion used as;; output end marker is found.
(when (lua-shell-accept-process-output
process lua-shell-completion-native-output-timeout
comint-redirect-finished-regexp)
(cl-remove-duplicates
(split-string
(buffer-substring-no-properties
(line-beginning-position) (point-min))
"[ \f\t\n\r\v()]+"t)
:test#'string=))
)
)
(set-process-filter process original-filter-fn)))))
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: