[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 4a203b9 172/468: add lua-send-defun (a lua-send-p
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 4a203b9 172/468: add lua-send-defun (a lua-send-proc replacement) |
Date: |
Thu, 5 Aug 2021 04:58:30 -0400 (EDT) |
branch: elpa/lua-mode
commit 4a203b9e35b057d07adb4454f70fc7cc5d9f1904
Author: Leonardo Etcheverry <leo@kalio.net>
Commit: Leonardo Etcheverry <leo@kalio.net>
add lua-send-defun (a lua-send-proc replacement)
This patch creates a new `lua-send-defun` function which refactors the
existing `lua-send-proc` to use `lua-send-region` instead of its current
implementation (which basically reimplments `lua-send-region` inline.)
It also fixes the issue where `lua-send-proc` would send the _previous_
function when point is at the beggining of the `function` keyword.
---
lua-mode.el | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/lua-mode.el b/lua-mode.el
index 4f79e82..ecfa78b 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1222,6 +1222,28 @@ If `lua-process' is nil or dead, start a new process
first."
(interactive)
(lua-send-region (line-beginning-position) (line-end-position)))
+(defun lua-send-defun (pos)
+ "Send the function definition around point to lua subprocess."
+ (interactive "d")
+ (save-excursion
+ (let ((start (if (save-match-data (looking-at "^function[ \t]"))
+ ;; point already at the start of "function".
+ ;; We need to handle this case explicitly since
+ ;; lua-beginning-of-proc will move to the
+ ;; beginning of the _previous_ function.
+ (point)
+ ;; point is not at the beginning of function, move
+ ;; there and bind start to that position
+ (lua-beginning-of-proc)
+ (point)))
+ (end (progn (lua-end-of-proc) (point))))
+
+ ;; make sure point is in a function defintion before sending to
+ ;; the subprocess
+ (if (and (>= pos start) (< pos end))
+ (lua-send-region start end)
+ (error "Not on a function definition")))))
+
(defun lua-send-region (start end)
"Send region to lua subprocess."
(interactive "r")
- [nongnu] elpa/lua-mode 9645322 124/468: lua-indent-line: add lua-indent-string-contents custom variable to enable indenting multiline strings if necessary (issue #6), (continued)
- [nongnu] elpa/lua-mode 9645322 124/468: lua-indent-line: add lua-indent-string-contents custom variable to enable indenting multiline strings if necessary (issue #6), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 99ef499 129/468: Make lua-automark variables buffer local, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2ce253c 133/468: lua-automark: fix multiline comments recognition which was failing when there was a single-line comment previously, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5a81583 140/468: Restore compatibility with Emacs22 and earlier that was broken when patching lua-mode-abbrev-table (should fix #11), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e498788 142/468: lua-calculate-indentation: add comments, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1e61379 111/468: Fix most of compile-time warnings, add couple FIXMEs, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d6232fe 119/468: lua-find-regexp: check if match-beginning should be ignored too, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c23fb54 127/468: lua-automark: mark only those buffer parts that may have changed their syntactical meaning, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode dfdbd85 143/468: lua-cont-eol-regexp: add missing keywords "if", "until" and "elseif", Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 612b1e7 166/468: Fixed misplaced paranthesis., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4a203b9 172/468: add lua-send-defun (a lua-send-proc replacement),
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 58da3f9 066/468: Remove comment about setting lua-mode-map: not required anymore, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e3a4390 092/468: lua-mark-all-multiline-literals: add default keybinding "lua-prefix C-; ", Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode fa1ef23 107/468: lua-mode-map: dont evaluate at compile-time (fix byte-compilation error), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e9a17ba 120/468: Added autoload for (add-to-list 'interpreter-mode-alist '("lua" . lua-mode)), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 509700f 130/468: lua--automark-update-start-pos: rewind to beginning of line to make sure newly inserted multiline literal delimiters are recognized, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 066d042 139/468: Merge pull request #12 from vhallac/vh-indentation-mods, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 39cf29e 141/468: Whoops! Add missing parenthesis, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 66cd58a 171/468: Fix test_indentation.sh, add basic_blocks.lua indentation test, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4b27305 097/468: Add safe default target to makefile, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ddcd8b8 102/468: Makefile: specify dist contents explicitly, Philip Kaludercic, 2021/08/05