OSDN Git Service

cleaning (iigrep-sentinel)
authorHiraoka <khi@users.osdn.me>
Sat, 10 Dec 2022 11:01:20 +0000 (20:01 +0900)
committerHiraoka <khi@users.osdn.me>
Sat, 10 Dec 2022 11:01:20 +0000 (20:01 +0900)
iigrep.el

index 5072c00..e8b7f13 100644 (file)
--- a/iigrep.el
+++ b/iigrep.el
@@ -275,19 +275,18 @@ This value is also used for identification of iigrep processes.")
 (defvar *iigrep-post-sentinel* nil)
 
 (defun iigrep-sentinel (proc msg)
-  (when (member (process-status proc) '(exit signal))
-    (let ((buf (iigrep-buffer)))
-      (when buf
-        (with-current-buffer buf
-          (let* ((hits (count-lines (point-min) (point-max)))
-                 (s (format "%s" hits)))
-            (when (> hits 0)
-              (put-text-property 0 (length s) 'face (iigrep-get-counts-face hits) s)
-              (let ((message-log-max nil))
-                (message "%s hits" s))
-              (when (and *iigrep-post-sentinel*
-                         (eq (process-status proc) 'exit))
-                (funcall *iigrep-post-sentinel* hits iigrep-last-pattern)))))))))
+  (let ((stat (process-status proc))
+        (buf (iigrep-buffer)))
+    (when (and buf (member stat '(exit signal)))
+      (with-current-buffer buf
+        (let* ((hits (count-lines (point-min) (point-max)))
+               (s (format "%s" hits)))
+          (when (> hits 0)
+            (put-text-property 0 (length s) 'face (iigrep-get-counts-face hits) s)
+            (let ((message-log-max nil))
+              (message "%s hits" s))
+            (when (and *iigrep-post-sentinel* (eq stat 'exit))
+              (funcall *iigrep-post-sentinel* hits iigrep-last-pattern))))))))
 
 (defun iigrep-kill-process ()
   (mapcar (lambda (p)