From 73ab554566c6f05d8a3bb523e293fcaec9b6ef20 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 7 Sep 2024 04:03:02 -0400 Subject: [PATCH] fix(cli): don't auto-invoke pager under powershell Need to find a pager that works on Windows. --- lisp/doom-cli-lib.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lisp/doom-cli-lib.el b/lisp/doom-cli-lib.el index 8be29df1e..e15e911ca 100644 --- a/lisp/doom-cli-lib.el +++ b/lisp/doom-cli-lib.el @@ -1322,16 +1322,18 @@ ARGS are options passed to less. If DOOMPAGER is set, ARGS are ignored." ARGS are options passed to less. If DOOMPAGER is set, ARGS are ignored." (doom-cli--exit - (let ((threshold (ceiling (* (doom-cli-context-height context) - doom-cli-pager-ratio)))) - (if (>= (let ((stdout (doom-cli-context-stdout context))) - (if (fboundp 'buffer-line-statistics) - (car (buffer-line-statistics stdout)) - (with-current-buffer stdout - (count-lines (point-min) (point-max))))) - threshold) - (cons :pager args) - 0)) + (if (equal (getenv "__DOOMSH") "ps1") + 0 + (let ((threshold (ceiling (* (doom-cli-context-height context) + doom-cli-pager-ratio)))) + (if (>= (let ((stdout (doom-cli-context-stdout context))) + (if (fboundp 'buffer-line-statistics) + (car (buffer-line-statistics stdout)) + (with-current-buffer stdout + (count-lines (point-min) (point-max))))) + threshold) + (cons :pager args) + 0))) context)) ;; (defun doom-cli--exit-editor (args context)) ; TODO Launch $EDITOR