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

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

[nongnu] elpa/kotlin-mode a2c2628d55 104/162: Merge pull request #27 fro


From: ELPA Syncer
Subject: [nongnu] elpa/kotlin-mode a2c2628d55 104/162: Merge pull request #27 from trevorsummerssmith/more-focus
Date: Sat, 29 Jan 2022 08:25:27 -0500 (EST)

branch: elpa/kotlin-mode
commit a2c2628d55c4e8b018ffe9f55ca38d89302a1bbc
Merge: ebcf6f3730 734b08408c
Author: Gregg Hernandez <greggory.hz@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #27 from trevorsummerssmith/more-focus
    
    Add send-{block,buffer,line,region}-and-focus functions
---
 kotlin-mode.el | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/kotlin-mode.el b/kotlin-mode.el
index 2183f4998a..8b6e68e872 100644
--- a/kotlin-mode.el
+++ b/kotlin-mode.el
@@ -54,17 +54,31 @@
   :type 'string
   :group 'kotlin)
 
+(defun kotlin-do-and-repl-focus (f &rest args)
+  (apply f args)
+  (pop-to-buffer kotlin-repl-buffer))
+
 (defun kotlin-send-region (start end)
   "Send current region to Kotlin interpreter."
   (interactive "r")
   (comint-send-region kotlin-repl-buffer start end)
   (comint-send-string kotlin-repl-buffer "\n"))
 
+(defun kotlin-send-region-and-focus (start end)
+  "Send current region to Kotlin interpreter and switch to it."
+  (interactive "r")
+  (kotlin-do-and-repl-focus 'kotlin-send-region start end))
+
 (defun kotlin-send-buffer ()
   "Send whole buffer to Kotlin interpreter."
   (interactive)
   (kotlin-send-region (point-min) (point-max)))
 
+(defun kotlin-send-buffer-and-focus ()
+  "Send whole buffer to Kotlin interpreter and switch to it."
+  (interactive)
+  (kotlin-do-and-repl-focus 'kotlin-send-buffer))
+
 (defun kotlin-send-block ()
   (interactive)
   (let* ((p (point)))
@@ -72,12 +86,22 @@
     (kotlin-send-region (region-beginning) (region-end))
     (goto-char p)))
 
+(defun kotlin-send-block-and-focus ()
+  "Send block to Kotlin interpreter and switch to it."
+  (interactive)
+  (kotlin-do-and-repl-focus 'kotlin-send-block))
+
 (defun kotlin-send-line ()
   (interactive)
   (kotlin-send-region
    (line-beginning-position)
    (line-end-position)))
 
+(defun kotlin-send-line-and-focus ()
+  "Send current line to Kotlin interpreter and switch to it."
+  (interactive)
+  (kotlin-do-and-repl-focus 'kotlin-send-line))
+
 (defun kotlin-repl ()
   "Launch a Kotlin REPL using `kotlin-command' as an inferior mode."
   (interactive)



reply via email to

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