[Top][All Lists]

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

Re: [ELPA] new package: sndio.el

From: Omar Polo
Subject: Re: [ELPA] new package: sndio.el
Date: Sun, 14 Nov 2021 19:59:49 +0100
User-agent: mu4e 1.6.9; emacs 29.0.50

Philip Kaludercic <philipk@posteo.net> writes:

> Omar Polo <op@omarpolo.com> writes:
>> Philip Kaludercic <philipk@posteo.net> writes:
>>> Omar Polo <op@omarpolo.com> writes:
>>>> Hello,
>>>> Some time ago to scratch an itch I wrote sndio.el, a package to interact
>>>> with the OpenBSD' audio daemon sndiod(8).  Recently, I've enhanced it a
>>>> bit and added an hydra-like window for a quick interaction and thought
>>>> it may be useful to others, so here's the submission.  It should work
>>>> outside of OpenBSD too provided that you're running sndio and have
>>>> sndioctl(1), but I never tried.
>>> From what I see, if I were to download and run the package on a GNU
>>> System without sndio, there wouldn't be any clear error message
>>> indicating what went wrong, just an error message indicating that
>>> sndioctl has failed, right? (this is just from reading and using faulty
>>> mental evaluation). If the package is to be added to GNU ELPA, you
>>> should probably add a explicit error message (perhaps even at compile
>>> time) to clarify what is missing, and that the package isn't mean to
>>> work on this system.
>> Yes, as things are now if sndio-sndioctl-cmd is not found `sndio-update'
>> fails with a generic error due to process-file not finding the
>> executable.
>> Would something like this be a viable option?
>> --- sndio.el
>> +++ sndio.el
>> @@ -67,6 +67,8 @@
>>  (defun sndio-update ()
>>    "Update the current sndio buffer."
>>    (interactive)
>> +  (unless (executable-find sndio-sndioctl-cmd)
>> +    (error "Can't find executable %s" sndio-sndioctl-cmd))
>>    (when (derived-mode-p 'sndio-mode)
>>      (let ((inhibit-read-only t))
>>        (erase-buffer)
>> (sndio-update is the first function called in both the entrypoints of
>> the package, so it seems a good place for such a check)
> This looks like a good place to add the check.  I just have two
> questions:
> 1. Should an error or a user-error be raised?
> 2. Should the error message be more explicit, and mention that sndio
>    isn't being used on the current system?

TIL the difference between user-error and error, I guess I have to fix
some elisp code I have around... :D

I just committed the following diff

--- sndio.el
+++ sndio.el
@@ -67,6 +67,9 @@
 (defun sndio-update ()
   "Update the current sndio buffer."
+  (unless (executable-find sndio-sndioctl-cmd)
+    (user-error "Can't find executable %s, is sndio installed?"
+                sndio-sndioctl-cmd))
   (when (derived-mode-p 'sndio-mode)
     (let ((inhibit-read-only t))

if it's OK I can tag a version so elpa pick that :)


reply via email to

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