Subject: Re: bug#22550: (require 'magit) produces error: "no such file or directory" "dash"

From: Alex Kost <[email-masked]>
Date: Sat, 06 Feb 2016 00:54:42 +0300

myglc2 (2016-02-05 17:52 +0300) wrote:

> Alex Kost <[email-masked]> writes:
[...]
>> The purpose of "M-x guix-edit" Emacs command (and "guix edit" shell
>> command) is just to show you the source code of the package.  This
>> source is usually placed in the store, and you shouldn't edit it.  If
>> you are going to contribute to guix, (info "(guix) Building from Git")
>> is the right way.
>>
>> For "M-x guix-edit", there is a trick that allows to point to any place
>> with packages — setting 'guix-directory' variable.  For example, if you
>> cloned guix to "~/src" directory, after:
>>
>>   (setq guix-directory "~/src/guix")
>>
>> "M-x guix-edit magit" will open "~/src/guix/gnu/packages/emacs.scm" file.
>
> Thank you Alex. This really helps me. FWIW, Here are a couple thoughts:
>
> It was confusing to me that 'guix-edit' shows "Note: file is write
> protected". This behavior made me wonder what was wrong with my setup
> and/or my understanding.

Nothing is wrong.  What you describe is a common Emacs thing when you
open a read-only file.  Emacs displays this message because you open a
file from /gnu/store (which is read-only).  If you run:

  touch /tmp/foo ; chmod 444 /tmp/foo

and then open this /tmp/foo file in Emacs, you'll get the same message.

> This might be improved by:
>
> 1) expanding one of the messages: "Note: file is write protected", or
>    'command-execute: Buffer is read-only: #<buffer screen.scm>' to say,
>    if you want to modify guix see "8.1 Building from Git".

These messages come from Emacs itself, not from any guix code, so I
don't see how to change it (and I actually wouldn't like to do it, as I
think changing a default Emacs behaviour would be more confusing)

> - or -
>
> a) rename the current 'guix-edit' function to guix-inspect',
>    'guix-examine', or'guix-view'.

"M-x guix-edit" Emacs command was named so after "guix edit" shell
command.  I think having "M-x guix-view" which will do the same as "guix
edit" in shell and "M-x guix-edit" which will do something else will be
confusing.

> b) make a new/improved 'guix-edit' that prompts for guix-directory if it
>    is not already not set, perhaps also refering the user to "8.1
>    Building from Git".

As I see it, 'M-x guix-edit' should do the same as 'guix edit' in shell,
i.e. it should open a package file without additional prompting.  OTOH I
think it would be good to improve 'guix-edit' so that with C-u it will
prompt for a directory with guix packages.

-- 
Alex