Subject: Re: bug#58307: 29.0.50; Fix battery mode over TRAMP on *BSD

From: Manuel Giraud <[email-masked]>
Date: Thu, 06 Oct 2022 16:34:46 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> Manuel Giraud <[email-masked]> writes:
>
>> Thank you Stefan and Michael!
>>
>> Here is an updated version.  My wording in the comment might not be
>> correct.  Best regards.
>
> Thanks; pushed to Emacs 29 (with some whitespace changes to get the
> line length under 80).

Thanks.  And here is an update on top of it with the suggestion of
Stefan Monnier on the list.  FWIW, it still works for me.
>From dbf45fa6677dc6ac71988db39afa54f3527a48b3 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <[email-masked]>
Date: Thu, 6 Oct 2022 16:03:34 +0200
Subject: [PATCH] ; * lisp/battery.el (battery-bsd-apm): No need for
 `executable-find'.

---
 lisp/battery.el | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lisp/battery.el b/lisp/battery.el
index a874f0640e..8de80109c6 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -938,16 +938,14 @@ battery-bsd-apm
 %t Remaining time (to charge or discharge) in the form `h:min'"
   (let* ((os-name (car (split-string
                         ;; FIXME: Can't we use something like `system-type'?
-                        (battery--call-process-to-string
-                         (executable-find "uname")))))
+                        (battery--call-process-to-string "uname"))))
          (apm-flag (pcase os-name
                      ("OpenBSD" "mP")
                      ("FreeBSD" "st")
                      (_         "ms")))
          (apm-args (concat "-abl" apm-flag))
          (apm-output (split-string
-                      (battery--call-process-to-string
-                       (executable-find "apm") apm-args)))
+                      (battery--call-process-to-string "apm" apm-args)))
          (indices (pcase os-name
                     ;; FreeBSD's manpage documents that multiple
                     ;; outputs are ordered by "the order in which
-- 
2.37.3

-- 
Manuel Giraud