unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* new nongnu elpa package candidate: cpupower
@ 2021-11-03 21:10 Stephen Meister
  2021-11-07  5:21 ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Meister @ 2021-11-03 21:10 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 944 bytes --]

Hi All,
  For consideration, a patch to
https://git.savannah.gnu.org/git/emacs/nongnu.git .  It adds a package for
interacting with the cpupower command (where available).

From f3e158645ebfbd84c40c2610e6a22f86860c3bdd Mon Sep 17 00:00:00 2001
From: smeister <pallagun@gmail.com>
Date: Wed, 3 Nov 2021 08:16:29 -0400
Subject: [PATCH] * elpa-packages (cpupower): New package

---
 elpa-packages | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/elpa-packages b/elpa-packages
index 0de123b1dc..4b0a2b1340 100644
--- a/elpa-packages
+++ b/elpa-packages
@@ -40,6 +40,9 @@
   :ignored-files ("clojure-mode-extra-font-locking.el" "doc" "test"
"test.clj")
   :news "CHANGELOG.md")

+ ("cpupower"            :url "
https://gitlab.com/steve-emacs-stuff/cpupower-el.git"
+  :ignored-files ("README.md" "COPYING"))
+
  ("crux" :url "https://github.com/bbatsov/crux")

  ("cyberpunk-theme" :url "https://github.com/n3mo/cyberpunk-theme.el"
-- 
2.32.0

[-- Attachment #2: Type: text/html, Size: 1526 bytes --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2021-11-03 21:10 new nongnu elpa package candidate: cpupower Stephen Meister
@ 2021-11-07  5:21 ` Stefan Monnier
  2021-11-07  5:44   ` Stefan Monnier
  2021-11-07 15:39   ` Stephen Meister
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2021-11-07  5:21 UTC (permalink / raw)
  To: Stephen Meister; +Cc: emacs-devel

Hi Stephen,

Stephen Meister [2021-11-03 17:10:48] wrote:
>   For consideration, a patch to
> https://git.savannah.gnu.org/git/emacs/nongnu.git .  It adds a package for
> interacting with the cpupower command (where available).

AFAICT you're the sole author/contributor to this package, right?
Would you be willing to sign the copyright paperwork such that we can
include the package into GNU ELPA?
That would be much better.

If so, please fill the form below and send it as instructed to the FSF,
so they can send you the relevant paperwork to sign,


        Stefan


Please email the following information to assign@gnu.org, and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]
Emacs

[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]


[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]


[For the copyright registration, what country are you a citizen of?]


[What year were you born?]


[Please write your email address here.]


[Please write your postal address here.]





[Which files have you changed so far, and which new files have you written
so far?]




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2021-11-07  5:21 ` Stefan Monnier
@ 2021-11-07  5:44   ` Stefan Monnier
  2021-11-07 16:52     ` Stephen Meister
  2021-11-07 15:39   ` Stephen Meister
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2021-11-07  5:44 UTC (permalink / raw)
  To: Stephen Meister; +Cc: emacs-devel

One more thing: indeed you don't need the (setq lexical-binding t), and
furthermore it can be harmful (it can cause other (unrelated) code to be
treated as using `lexical-binding` even tho that code was written for
the old, dynamically scoped, dialect of ELisp).


        Stefan


Stefan Monnier [2021-11-07 01:21:55] wrote:

> Hi Stephen,
>
> Stephen Meister [2021-11-03 17:10:48] wrote:
>>   For consideration, a patch to
>> https://git.savannah.gnu.org/git/emacs/nongnu.git .  It adds a package for
>> interacting with the cpupower command (where available).
>
> AFAICT you're the sole author/contributor to this package, right?
> Would you be willing to sign the copyright paperwork such that we can
> include the package into GNU ELPA?
> That would be much better.
>
> If so, please fill the form below and send it as instructed to the FSF,
> so they can send you the relevant paperwork to sign,
>
>
>         Stefan
>
>
> Please email the following information to assign@gnu.org, and we
> will send you the assignment form for your past and future changes.
>
> Please use your full legal name (in ASCII characters) as the subject
> line of the message.
> ----------------------------------------------------------------------
> REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES
>
> [What is the name of the program or package you're contributing to?]
> Emacs
>
> [Did you copy any files or text written by someone else in these changes?
> Even if that material is free software, we need to know about it.]
>
>
> [Do you have an employer who might have a basis to claim to own
> your changes?  Do you attend a school which might make such a claim?]
>
>
> [For the copyright registration, what country are you a citizen of?]
>
>
> [What year were you born?]
>
>
> [Please write your email address here.]
>
>
> [Please write your postal address here.]
>
>
>
>
>
> [Which files have you changed so far, and which new files have you written
> so far?]




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2021-11-07  5:21 ` Stefan Monnier
  2021-11-07  5:44   ` Stefan Monnier
@ 2021-11-07 15:39   ` Stephen Meister
  2021-11-07 22:22     ` Stefan Monnier
  1 sibling, 1 reply; 13+ messages in thread
From: Stephen Meister @ 2021-11-07 15:39 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

You're correct, I am the sole author of the package.  I'd be happy to sign
the copyright paperwork and have begun that process.

On Sun, Nov 7, 2021 at 1:21 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> Would you be willing to sign the copyright paperwork such that we can
> include the package into GNU ELPA?
>

[-- Attachment #2: Type: text/html, Size: 656 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2021-11-07  5:44   ` Stefan Monnier
@ 2021-11-07 16:52     ` Stephen Meister
  0 siblings, 0 replies; 13+ messages in thread
From: Stephen Meister @ 2021-11-07 16:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 506 bytes --]

On Sun, Nov 7, 2021 at 1:44 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> One more thing: indeed you don't need the (setq lexical-binding t), and
> furthermore it can be harmful (it can cause other (unrelated) code to be
>

Ah, excellent.  This was something I was curious about.  I had been using
that as a crutch during development and I wasn't entirely sure about it
outside of that context.

I've made changes as suggested, lightly tested and version bumped to 1.0.2

Thanks for the feedback!

[-- Attachment #2: Type: text/html, Size: 921 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2021-11-07 15:39   ` Stephen Meister
@ 2021-11-07 22:22     ` Stefan Monnier
  2022-01-01  6:56       ` Stefan Kangas
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2021-11-07 22:22 UTC (permalink / raw)
  To: Stephen Meister; +Cc: emacs-devel

> You're correct, I am the sole author of the package.
> I'd be happy to sign the copyright paperwork and have begun that process.

Excellent, thank you.
Let me know when the FSF confirms reception of your signed paperwork,


        Stefan




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2021-11-07 22:22     ` Stefan Monnier
@ 2022-01-01  6:56       ` Stefan Kangas
  2022-05-05 17:00         ` Stephen Meister
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Kangas @ 2022-01-01  6:56 UTC (permalink / raw)
  To: Stefan Monnier, Stephen Meister; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> You're correct, I am the sole author of the package.
>> I'd be happy to sign the copyright paperwork and have begun that process.
>
> Excellent, thank you.
> Let me know when the FSF confirms reception of your signed paperwork,

Any news here?  Thanks in advance.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2022-01-01  6:56       ` Stefan Kangas
@ 2022-05-05 17:00         ` Stephen Meister
  2022-05-05 19:01           ` Stefan Monnier
  2022-05-06 23:20           ` Richard Stallman
  0 siblings, 2 replies; 13+ messages in thread
From: Stephen Meister @ 2022-05-05 17:00 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Stefan Monnier, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 574 bytes --]

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

-steve

On Sat, Jan 1, 2022 at 1:56 AM Stefan Kangas <stefankangas@gmail.com> wrote:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
> >> You're correct, I am the sole author of the package.
> >> I'd be happy to sign the copyright paperwork and have begun that
> process.
> >
> > Excellent, thank you.
> > Let me know when the FSF confirms reception of your signed paperwork,
>
> Any news here?  Thanks in advance.
>

[-- Attachment #2: Type: text/html, Size: 1036 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2022-05-05 17:00         ` Stephen Meister
@ 2022-05-05 19:01           ` Stefan Monnier
  2022-05-05 19:20             ` Stefan Monnier
  2022-05-06 23:20           ` Richard Stallman
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2022-05-05 19:01 UTC (permalink / raw)
  To: Stephen Meister; +Cc: Stefan Kangas, emacs-devel

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))
 




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2022-05-05 19:01           ` Stefan Monnier
@ 2022-05-05 19:20             ` Stefan Monnier
  2022-05-06 17:40               ` Stephen Meister
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2022-05-05 19:20 UTC (permalink / raw)
  To: Stephen Meister; +Cc: Stefan Kangas, emacs-devel

Stefan Monnier [2022-05-05 15:01:07] wrote:
>  ;; Author: Stephen Meister

Oh, and also this should be a valid email address so elpa.gnu.org can
send you notifications.  E.g.:

    ;; Author: Stephen Meister <pallagun@gmail.com>


-- Stefan




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2022-05-05 19:20             ` Stefan Monnier
@ 2022-05-06 17:40               ` Stephen Meister
  0 siblings, 0 replies; 13+ messages in thread
From: Stephen Meister @ 2022-05-06 17:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

Thanks for the comments & feedback, I'm still new to lisp so it's very
appreciated.  I've updated using your patch and hopefully addressed all
other points.

I've pushed to gitlab and version bumped to 1.0.4

If there's anything else I can do to help please let me know, thanks!

-steve

On Thu, May 5, 2022 at 3:20 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> Stefan Monnier [2022-05-05 15:01:07] wrote:
> >  ;; Author: Stephen Meister
>
> Oh, and also this should be a valid email address so elpa.gnu.org can
> send you notifications.  E.g.:
>
>     ;; Author: Stephen Meister <pallagun@gmail.com>
>
>
> -- Stefan
>
>

[-- Attachment #2: Type: text/html, Size: 1198 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2022-05-05 17:00         ` Stephen Meister
  2022-05-05 19:01           ` Stefan Monnier
@ 2022-05-06 23:20           ` Richard Stallman
  2022-05-07 19:12             ` Stephen Meister
  1 sibling, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2022-05-06 23:20 UTC (permalink / raw)
  To: Stephen Meister; +Cc: stefankangas, monnier, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

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

Does this mean that cpupower can go in GNU ELPA?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: new nongnu elpa package candidate: cpupower
  2022-05-06 23:20           ` Richard Stallman
@ 2022-05-07 19:12             ` Stephen Meister
  0 siblings, 0 replies; 13+ messages in thread
From: Stephen Meister @ 2022-05-07 19:12 UTC (permalink / raw)
  To: rms; +Cc: Stefan Kangas, Stefan Monnier, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

I believe it can, yes.  Though I'd be happy if those with more knowledge
confirmed that or corrected me.

Though, from checking the elpa.gnu.org site, it appears that it is already
there right now.
-steve


On Fri, May 6, 2022 at 7:20 PM Richard Stallman <rms@gnu.org> wrote:

> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > Sorry for the embarrassing delay.  Yes, I was able to get everything
> sent
>   > in and approved by Craig Topham.  The code on my assignment is
> RT:1776586.
>
> Does this mean that cpupower can go in GNU ELPA?
>
> --
> Dr Richard Stallman (https://stallman.org)
> Chief GNUisance of the GNU Project (https://gnu.org)
> Founder, Free Software Foundation (https://fsf.org)
> Internet Hall-of-Famer (https://internethalloffame.org)
>
>
>

[-- Attachment #2: Type: text/html, Size: 1654 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-05-07 19:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 21:10 new nongnu elpa package candidate: cpupower Stephen Meister
2021-11-07  5:21 ` Stefan Monnier
2021-11-07  5:44   ` Stefan Monnier
2021-11-07 16:52     ` Stephen Meister
2021-11-07 15:39   ` Stephen Meister
2021-11-07 22:22     ` Stefan Monnier
2022-01-01  6:56       ` Stefan Kangas
2022-05-05 17:00         ` Stephen Meister
2022-05-05 19:01           ` Stefan Monnier
2022-05-05 19:20             ` Stefan Monnier
2022-05-06 17:40               ` Stephen Meister
2022-05-06 23:20           ` Richard Stallman
2022-05-07 19:12             ` Stephen Meister

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).