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

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

[nongnu] elpa/shellcop 5102a94f80 05/10: clean code


From: ELPA Syncer
Subject: [nongnu] elpa/shellcop 5102a94f80 05/10: clean code
Date: Wed, 5 Jan 2022 08:59:35 -0500 (EST)

branch: elpa/shellcop
commit 5102a94f80a7d7ff7b6e524ba68672f5895ac822
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    clean code
---
 shellcop.el | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/shellcop.el b/shellcop.el
index 1ad15dea04..aad6766f7c 100644
--- a/shellcop.el
+++ b/shellcop.el
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 2020 Chen Bin
 ;;
-;; Version: 0.0.2
+;; Version: 0.0.3
 ;; Keywords: unix tools
 ;; Author: Chen Bin <chenbin DOT sh AT gmail DOT com>
 ;; URL: https://github.com/redguardtoo/shellcop
@@ -34,7 +34,7 @@
 ;; `shellcop-reset-with-new-command' will,
 ;;   - kill current running process
 ;;   - erase the content in shell buffer
-;;   - If `shellcop-sub-window-has-error-function' return nil in all 
sub-windows, run `shellcop-insert-shell-command-function'
+;;   - If `shellcop-sub-window-has-error-function' return nil in all 
sub-windows, run `shellcop-insert-shell-command-function'.
 ;;
 ;; `shellcop-erase-buffer' erases the content buffer with below names,
 ;;   - "*Messages*" (default)
@@ -81,6 +81,11 @@ If there is error, it returns t."
   :type 'string
   :group 'shellcop)
 
+(defcustom shellcop-wait-time-after-kill-running-job 2
+  "Seconds to wait after kill running job in shell."
+  :type 'number
+  :group 'shellcop)
+
 (defun shellcop-location-detail (str)
   "Get file, line and column from STR."
   (when (string-match "^\\([^:]+\\):\\([0-9]+\\)+\\(:[0-9]+\\)?$" str)
@@ -149,7 +154,8 @@ If ABOVE is t, extract locations above current point; or 
else below current poin
     (forward-line (1- n))))
 
 (defun shellcop-comint-send-input-hack (orig-func &rest args)
-  "Advice `comint-send-input' with ORIG-FUNC and ARGS."
+  "Advice `comint-send-input' with ORIG-FUNC and ARGS.
+Extract file paths when user presses enter key shell."
   (let* ((artifical (nth 1 args))
          locations)
     (cond
@@ -270,9 +276,12 @@ Keep latest N cli program output if it's not nil."
       ;; back to original window
       (select-window orig-w)
 
+      ;; kill current running process
       (comint-interrupt-subjob)
-      ;; wait 2 seconds
-      (sit-for 2)
+
+      ;; wait
+      (sit-for shellcop-wait-time-after-kill-running-job)
+
       (shellcop-erase-one-visible-buffer (buffer-name (current-buffer)))
       (goto-char (point-max))
 



reply via email to

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