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

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

[nongnu] elpa/lua-mode 8c28ed5 095/468: Add utility funcs lua-inside-mul


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode 8c28ed5 095/468: Add utility funcs lua-inside-multiline-p and lua-get-multiline-start
Date: Thu, 5 Aug 2021 04:58:14 -0400 (EDT)

branch: elpa/lua-mode
commit 8c28ed53ec64977e56116f7e2834eebc97090c49
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>

    Add utility funcs lua-inside-multiline-p and lua-get-multiline-start
---
 lua-mode.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lua-mode.el b/lua-mode.el
index b54a5b2..f050f2a 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1191,6 +1191,16 @@ mark char as comment delimiter.  Otherwise, remove the 
mark if any."
         (lua-put-char-syntax-table pos (lua-get-multiline-delim-syntax type))
       (set-buffer-modified-p old-modified-p))))
 
+(defsubst lua-inside-multiline-p (&optional pos)
+  (let ((status (syntax-ppss pos)))
+    (or (eq (elt status 3) t)                ;; inside generic string
+        (eq (elt status 7) 'syntax-table)))) ;; inside generic comment
+
+(defun lua-get-multiline-start (&optional pos)
+  (interactive)
+  (when (lua-inside-multiline-p pos) ;; return string/comment start
+    (elt (syntax-ppss pos) 8)))
+
 (defun lua-unmark-multiline-literals (&optional begin end)
   "Clears all Lua multiline construct markers in region
 



reply via email to

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