Subject: [bug#28832] [PATCH 1/3] gnu: Add emacs-json-reformat.

From: Alex Kost <[email-masked]>
Date: Thu, 21 Dec 2017 01:10:30 +0300

Oleg Pykhalov (2017-12-20 06:26 +0300) wrote:

> Alex Kost <[email-masked]> writes:
>
>> and I would make it more robust: there is a
>> problem with this code: (string-drop "geiser" 6) does not return what
>> you mean
>
> Yes, because "geiser" differs from most of Emacs packages:
>
>     ls
> /gnu/store/7rl2k8ismmyq9ic6ha6vzv38a3hrrni2-emacs-dash-2.13.0/share/emacs/site-lisp/guix.d/dash-2.13.0/
>     dash-autoloads.el  dash.el  dash.elc  dash-functional.el  dash-functional.elc
>
>     ls /gnu/store/7lh77fmapmjjv3kj2q69dy58kjniw9am-geiser-0.9/share/emacs/site-lisp/
>     geiser-autodoc.el    geiser-chibi.elc	…
>
> Maybe we just need to fix "geiser"?

Sorry, I don't understand what you mean.  What is wrong with geiser and
why/how should it be fixed?

Also do other non-"emacs-" packages (magit, emms) have the same problem?

>> , and (string-drop "dash" 6) errors!
>
> Do you really mean emacs-dash or dash?  For me both succeeded.

I meant just "dash" name.

> As I see emacs-dash is OK, except "emacs-minimal" in EMACSLOADPATH.
> Here is a log-file with DEBUG-INPUTS:

No-no, I didn't mean that the build process of 'emacs-dash' would fail,
I meant that your code uses 'string-drop' and it may fail:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (string-drop "dash" 6)
ERROR: In procedure string-drop:
Value out of range 0 to 4: 6

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> 
--8<---------------cut here---------------end--------------->8---

All I wanted to say is that emacs inputs do not necessarily have
"emacs-" prefix.  For example, 'emacs-direnv' and 'emacs-ag' packages
have "dash" input, but not "emacs-dash".

But now I see that it's not a problem: I mistakenly thought that the
names are taken from the input names, but now I see they are extracted
from the store file names, so my above concern is not relevant :-)

>> I think we shouldn't rely on the assumption that all emacs inputs have
>> "emacs-" prefix
>
> Then, how to determine that a package is Emacs package?

I don't know :-)  'emacs-inputs' is probably the best way.

>> , so I think
>> this procedure should check whether the input name begins with "emacs-"
>> before trying to remove this substring.
>>> +                                     "-" version))
>>> +                                  name+version)
>>> +                         input)))))
>>> +            (fold alist-delete (emacs-inputs inputs) '("emacs" "source")))
>>
>> Since you already take only emacs inputs, is it really needed to remove
>> "emacs" and "source"?  I mean emacs inputs do not contain "emacs" and
>> "source" anyway, right?
>
> emacs inputs contain "emacs-minimal" and "source".
> So we actually need to remove "emacs-minimal" instead "emacs".

or maybe both? since some packages uses 'emacs' instead of
'emacs-minimal' (emacs-auctex, emacs-exwm, etc.).

-- 
Alex