branch: elpa/gnu-indent
commit 1166673bcf284e3ccf6406b6f63432563878f637
Author: Akib Azmain Turja <a...@disroot.org>
Commit: Akib Azmain Turja <a...@disroot.org>

    Some minor cleanup
---
 gnu-indent.el | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/gnu-indent.el b/gnu-indent.el
index 1a37851e96..989cebd71c 100644
--- a/gnu-indent.el
+++ b/gnu-indent.el
@@ -51,18 +51,17 @@
 ;; Autoload so that users can set it as file local variable without
 ;; warning.
 ;;;###autoload
-(progn
-  (defcustom gnu-indent-options nil
-    "Arguments to pass to GNU Indent."
-    :type '(repeat string)
-    :safe (lambda (val)
-            (let ((valid t))
-              (while (and valid val)
-                (unless (stringp (car val))
-                  (setq valid nil))
-                (setq val (cdr val)))
-              valid))
-    :group 'gnu-indent))
+(defcustom gnu-indent-options nil
+  "Arguments to pass to GNU Indent."
+  :type '(repeat string)
+  :safe (lambda (val)
+          (let ((valid t))
+            (while (and valid val)
+              (unless (stringp (car val))
+                (setq valid nil))
+              (setq val (cdr val)))
+            valid))
+  :group 'gnu-indent)
 
 ;;;###autoload
 (defun gnu-indent-region (beg end)
@@ -88,16 +87,14 @@ When called non-interactively, indent text between BEG and 
END."
             (send-region process beg end)
             (process-send-eof process)
             (redisplay)
-            (while (process-live-p process)
-              (sleep-for 0.01))
+            (while (accept-process-output process 0.01))
             (unless (eq (process-exit-status process) 0)
-              (display-buffer (process-buffer process))
+              (pop-to-buffer (process-buffer process))
               (error "GNU Indent exited with non-zero status"))
             (save-restriction
               (let ((inhibit-read-only t))
                 (narrow-to-region beg end)
-                (insert-file-contents temp-file nil nil nil
-                                      t))))
+                (insert-file-contents temp-file nil nil nil t))))
         (delete-file temp-file)))
     (when (called-interactively-p 'interactive)
       (message "Indenting...done"))))
@@ -112,7 +109,6 @@ When called non-interactively, indent text between BEG and 
END."
 (define-minor-mode gnu-indent-mode
   "Indent buffer automatically with GNU Indent."
   :lighter " GNU-Indent"
-  :keymap nil
   (if gnu-indent-mode
       (add-hook 'before-save-hook #'gnu-indent-buffer nil t)
     (remove-hook 'before-save-hook #'gnu-indent-buffer t)))

Reply via email to