emacs-devel
[Top][All Lists]
Advanced

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

Re: new nongnu elpa package candidate: cpupower


From: Stefan Monnier
Subject: Re: new nongnu elpa package candidate: cpupower
Date: Thu, 05 May 2022 15:01:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stephen Meister [2022-05-05 13:00:19] wrote:
> Sorry for the embarrassing delay.

Welcome to the club.

> Yes, I was able to get everything sent in and approved by Craig
> Topham.  The code on my assignment is RT:1776586.

Great, thanks.
I just added `cpupower` to `elpa.git`.

The patch below includes a change to the Copyright line without which
elpa.gnu.org will refrain from creating tarballs for your package.


        Stefan


diff --git a/.elpaignore b/.elpaignore
new file mode 100644
index 0000000000..5ecd9c64ad
--- /dev/null
+++ b/.elpaignore
@@ -0,0 +1 @@
+COPYING
diff --git a/.gitignore b/.gitignore
index 016d3b1692..5b4e87ea34 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
-*.elc
\ No newline at end of file
+*.elc
+/cpupower-autoloads.el
+/cpupower-pkg.el
diff --git a/cpupower.el b/cpupower.el
index c635c772c2..72dfbf525f 100644
--- a/cpupower.el
+++ b/cpupower.el
@@ -1,6 +1,6 @@
 ;;; cpupower.el --- cpupower command interface  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2021 Stephen Meister
+;; Copyright (C) 2021  Free Software Foundation, Inc.
 
 ;; Author: Stephen Meister
 ;; URL: https://gitlab.com/steve-emacs-stuff/cpupower-el
@@ -51,7 +51,7 @@
   "cpupower command, might need a 'sudo' infront of it and you
 might need to enable this command for your user in /etc/sudoers"
   :type '(string)
-  :group 'cpupower)
+  :group 'cpupower)                     ;FIXME: No such group?
 
 (defcustom cpupower-enable-logging
   nil
@@ -108,14 +108,15 @@ acceptible version."
   (let ((is-valid (cpupower--with-cache-slot :valid
                     (cl-member (cpupower--get-version)
                                cpupower--compatible-versions
-                               :test 'string-equal))))
+                               :test #'string-equal))))
     (unless is-valid
       (let ((version (cpupower--get-version)))
         (if (null version)
             (error "Unable to communicate with cpupower (shell command: 
\"%s\")"
                    cpupower-cmd)
           (error "Invalid cpu power version %s.  Must be one of: %s"
-                 version (mapconcat 'identity cpupower--compatible-versions ", 
")))))))
+                 version (mapconcat #'identity
+                                    cpupower--compatible-versions ", ")))))))
 
 (defun cpupower--get-num-cpus ()
   "Return the number of CPUs on this system."
@@ -128,9 +129,9 @@ acceptible version."
 @todo - this should probably find governors which work for _all_
 cpus but currently it just finds _all_ governors."
   (cpupower--with-cache-slot :governors
-    (seq-uniq
+    (seq-uniq                   ;FIXME: Missing #'equal test function?
      (mapcan
-      'split-string
+      #'split-string
       (cpupower--parse-find (cpupower--run "--cpu all frequency-info")
                             "available cpufreq governors:"
                             "\n")))))
@@ -146,6 +147,7 @@ be checked before executing any commands."
     (let ((command (format "%s %s" cpupower-cmd subcommand)))
       (when cpupower-enable-logging
         (message "cpupower.el cmd: %s" command))
+      ;; FIXME: Why launch a shell when `call-process' would do?
       (shell-command command (current-buffer))
       (buffer-string))))
 
@@ -186,11 +188,12 @@ function returns: (\"and\" \"too\")
 This is indented as the primary way for humans to see this
 information."
   (interactive)
-  (let ((governors (seq-uniq (cpupower-get-current-governors) 'string-equal))
-        (frequencies (mapcar 'cpupower--format-KHz 
(cpupower-get-current-frequencies))))
+  (let ((governors (seq-uniq (cpupower-get-current-governors) #'string-equal))
+        (frequencies (mapcar #'cpupower--format-KHz
+                             (cpupower-get-current-frequencies))))
     (message "Governor: %s [ %s ] (version: %s)"
-             (mapconcat 'identity governors ", ")
-             (mapconcat 'identity frequencies ", ")
+             (mapconcat #'identity governors ", ")
+             (mapconcat #'identity frequencies ", ")
              (cpupower--get-version))))
 
 (defun cpupower-set-governor (governor)
@@ -209,11 +212,11 @@ When called interactively (PRINT-MESSAGE will be true) it 
will
 message the user with current CPU frequencies."
   (interactive "p")
   (let* ((output (cpupower--run "--cpu all frequency-info -f"))
-         (frequencies (mapcar 'string-to-number
+         (frequencies (mapcar #'string-to-number
                               (cpupower--parse-find output "frequency:"))))
     (when print-message
       (message (format "CPU Frequencies: %s"
-                       (mapconcat 'cpupower--format-KHz frequencies ", "))))
+                       (mapconcat #'cpupower--format-KHz frequencies ", "))))
     frequencies))
 
 (defun cpupower-get-current-governors (&optional print-message)
@@ -228,8 +231,8 @@ message the user with current CPU governors"
                             (cpupower--parse-find output "governor"))))
     (when print-message
       (message (format "CPU Governors: %s"
-                       (mapconcat 'identity
-                                  (seq-uniq governors 'string-equal)
+                       (mapconcat #'identity
+                                  (seq-uniq governors #'string-equal)
                                   ", "))))
     governors))
 




reply via email to

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