emacs-devel
[Top][All Lists]
Advanced

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

Re: [ELPA] Add 'cursory' and 'tmr' packages?


From: Philip Kaludercic
Subject: Re: [ELPA] Add 'cursory' and 'tmr' packages?
Date: Thu, 21 Apr 2022 10:30:45 +0000

Protesilaos Stavrou <info@protesilaos.com> writes:

> Hello everyone,
>
> I have two small packages that I would like to offer to GNU ELPA.  See
> attached patches.  What they do, in brief:
>
> * cursory :: Lets the user specify presets of cursor configuration, such
>   as 'cursor-type' and 'blink-cursor-delay', and switch between them on
>   demand.  An example use-case is when one likes to use a block cursor
>   with a relatively fast blink rate for day-to-day editing and a bar
>   cursor with a slower blink rate while reading.
>
>   <https://git.sr.ht/~protesilaos/cursory>

I have two little patch suggestions for cursory:

>From 2dba452823713bb474f68275bd9883f1f58d594e Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Thu, 21 Apr 2022 12:22:45 +0200
Subject: [PATCH 1/2] Simplify the default value of cursory-presets

---
 cursory.el | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/cursory.el b/cursory.el
index a12ca87..f794e4f 100644
--- a/cursory.el
+++ b/cursory.el
@@ -47,23 +47,24 @@
   :group 'cursor)
 
 (defcustom cursory-presets
-  '((bar . ( :cursor-type (bar . 2)
-            :cursor-in-non-selected-windows hollow
-            :blink-cursor-blinks 10
-            :blink-cursor-interval 0.5
-            :blink-cursor-delay 0.2))
-
-    (box  . ( :cursor-type box
-             :cursor-in-non-selected-windows hollow
-             :blink-cursor-blinks 10
-             :blink-cursor-interval 0.5
-             :blink-cursor-delay 0.2))
-
-    (underscore . ( :cursor-type (hbar . 3)
-                   :cursor-in-non-selected-windows hollow
-                   :blink-cursor-blinks 50
-                   :blink-cursor-interval 0.2
-                   :blink-cursor-delay 0.2)))
+  '((bar
+     :cursor-type (bar . 2)
+     :cursor-in-non-selected-windows hollow
+     :blink-cursor-blinks 10
+     :blink-cursor-interval 0.5
+     :blink-cursor-delay 0.2)
+    (box
+     :cursor-type box
+     :cursor-in-non-selected-windows hollow
+     :blink-cursor-blinks 10
+     :blink-cursor-interval 0.5
+     :blink-cursor-delay 0.2)
+    (underscore
+     :cursor-type (hbar . 3)
+     :cursor-in-non-selected-windows hollow
+     :blink-cursor-blinks 50
+     :blink-cursor-interval 0.2
+     :blink-cursor-delay 0.2))
   "Alist of preset configurations for `blink-cursor-mode'.
 
 The car of each cons cell is an arbitrary, user-specified key
-- 
2.34.0

and

>From 062ee5c787b43c91744d80a04d31b9e25bc4268a Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Thu, 21 Apr 2022 12:23:11 +0200
Subject: [PATCH 2/2] Avoid overlong line when defining
 cursory-latest-state-file

---
 cursory.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cursory.el b/cursory.el
index f794e4f..dca159c 100644
--- a/cursory.el
+++ b/cursory.el
@@ -105,7 +105,8 @@ as the corresponding variable."
                   ,(get 'blink-cursor-delay 'custom-type))))
          :key-type symbol))
 
-(defcustom cursory-latest-state-file (locate-user-emacs-file 
"cursory-latest-state")
+(defcustom cursory-latest-state-file
+  (locate-user-emacs-file "cursory-latest-state")
   "File to save the value of `cursory-set-preset'.
 Saving is done by the `cursory-store-latest-preset' function."
   :type 'file
-- 
2.34.0

Also, in `cursory-store-latest-preset' you use lisp-data-mode, but that
was added with Emacs 28.  It shouldn't really be an issue, but "fixing"
it doesn't seem that difficult either:

>From 166be273c46bd0c8718307a68cc8890818a98265 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Thu, 21 Apr 2022 12:29:48 +0200
Subject: [PATCH] Use lisp-data-mode only if avaliable

---
 cursory.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cursory.el b/cursory.el
index dca159c..de1bf4e 100644
--- a/cursory.el
+++ b/cursory.el
@@ -166,8 +166,11 @@ With optional LOCAL as a prefix argument, set the
 Can be assigned to `kill-emacs-hook'."
   (when cursory--style-hist
     (with-temp-file cursory-latest-state-file
-      (insert (concat ";; Auto-generated file;"
-                      " don't edit -*- mode: lisp-data -*-\n"))
+      (insert ";; Auto-generated file; don't edit -*- mode: "
+             (if (<= 28 emacs-major-version)
+                 "lisp-data"
+               "emacs-lisp")
+             " -*-\n"))
       (pp (intern (car cursory--style-hist)) (current-buffer)))))
 
 (defvar cursory-recovered-preset nil
-- 
2.34.0

> * tmr :: A set of utilities to set a timer which plays an alarm and
>   sends a desktop notification once it elapses.  Timers are set with the
>   'tmr' command, which prompts for a unit of time: something like "5" or
>   "5m" is read as "5 minutes", while other valid formats include "5s"
>   (seconds) and "5h" (hours).  A timer can have an arbitrary description
>   associated with it such as "Bake bread".  This is requested when 'tmr'
>   is invoked with a prefix argument.  Timers can be cancelled with
>   another command: it prompts for completion if there are multiple
>   timers else operates on the current one.
>
>   <https://git.sr.ht/~protesilaos/tmr>
>
> Any suggestions or objections?  If not, I will push the changes to
> elpa.git.  Thank you!

I wouldn't object, with or without the above patches.

> All the best,
> Protesilaos (or simply "Prot")

-- 
        Philip Kaludercic

reply via email to

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