unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Kost <alezost@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: myglc2 <myglc2@gmail.com>, 22550@debbugs.gnu.org
Subject: bug#22550: (require 'magit) produces error: "no such file or directory" "dash"
Date: Sun, 07 Feb 2016 11:14:01 +0300	[thread overview]
Message-ID: <87io210wfq.fsf@gmail.com> (raw)
In-Reply-To: <87h9hm2eue.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sat, 06 Feb 2016 13:38:49 +0100")

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

Ludovic Courtès (2016-02-06 15:38 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> myglc2 (2016-02-05 17:52 +0300) wrote:
>
> [...]
>
>>> 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.
>
> Yes, that would be nice.  However, AIUI, it would require spawning a new
> Guix REPL for this specific ‘guix-directory’ value, no?

No, not at all.  The attached patch implements this.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-emacs-C-u-M-x-guix-edit-prompts-for-directory.patch --]
[-- Type: text/x-patch, Size: 2248 bytes --]

From 292c5f137f6cc3cf72e71e2dd5fa40f38fc7d7bb Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Sun, 7 Feb 2016 11:08:57 +0300
Subject: [PATCH] emacs: 'C-u M-x guix-edit' prompts for directory.

* emacs/guix-base.el (guix-find-location, guix-edit): Add optional
  'directory' argument.
---
 emacs/guix-base.el | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 9f9f258..8282f2d 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -63,17 +63,17 @@ This directory is used to define location of the packages.")
 
 (add-hook 'guix-after-start-repl-hook 'guix-set-directory)
 
-(defun guix-find-location (location)
+(defun guix-find-location (location &optional directory)
   "Go to LOCATION of a package.
 LOCATION is a string of the form:
 
   \"PATH:LINE:COLUMN\"
 
 If PATH is relative, it is considered to be relative to
-`guix-directory'."
+DIRECTORY (`guix-directory' by default)."
   (cl-multiple-value-bind (path line col)
       (split-string location ":")
-    (let ((file (expand-file-name path guix-directory))
+    (let ((file (expand-file-name path (or directory guix-directory)))
           (line (string-to-number line))
           (col  (string-to-number col)))
       (find-file file)
@@ -113,12 +113,19 @@ See `guix-packages-profile'."
                     (guix-packages-profile profile generation system?)))
 
 ;;;###autoload
-(defun guix-edit (id-or-name)
-  "Edit (go to location of) package with ID-OR-NAME."
-  (interactive (list (guix-read-package-name)))
+(defun guix-edit (id-or-name &optional directory)
+  "Edit (go to location of) package with ID-OR-NAME.
+See `guix-find-location' for the meaning of package location and
+DIRECTORY.
+Interactively, with prefix argument, prompt for DIRECTORY."
+  (interactive
+   (list (guix-read-package-name)
+         (when current-prefix-arg
+           (read-directory-name "Directory with Guix modules: "
+                                guix-directory))))
   (let ((loc (guix-package-location id-or-name)))
     (if loc
-        (guix-find-location loc)
+        (guix-find-location loc directory)
       (message "Couldn't find package location."))))
 
 \f
-- 
2.6.3


  reply	other threads:[~2016-02-07  8:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-04  4:15 bug#22550: (require 'magit) produces error: "no such file or directory" "dash" myglc2
2016-02-04 13:17 ` Alex Kost
2016-02-04 15:16   ` myglc2
2016-02-04 20:00     ` Alex Kost
2016-02-04 23:40       ` myglc2
2016-02-05  8:43         ` Alex Kost
2016-02-05 14:52           ` myglc2
2016-02-05 21:54             ` Alex Kost
2016-02-06 12:38               ` Ludovic Courtès
2016-02-07  8:14                 ` Alex Kost [this message]
2016-02-08  9:22                   ` Ludovic Courtès
2016-02-10  7:46                     ` Alex Kost
2016-02-07  8:56       ` Alex Kost
2016-02-08  2:52         ` myglc2
2016-02-08  9:19           ` Alex Kost
2016-03-06 14:47       ` myglc2
2016-03-07  9:14         ` Alex Kost
2016-03-07 20:03           ` myglc2
2016-03-08  9:25             ` Alex Kost
2016-03-08 13:49               ` myglc2
2016-03-09 10:58                 ` Alex Kost
2016-03-09 14:47                   ` myglc2
2016-03-24 16:20           ` Alex Kost
2016-03-25 15:20             ` myglc2
2016-03-26  0:08               ` Alex Kost
2016-03-26  2:51                 ` myglc2
2016-02-08  9:55 ` bug#22550: Fixed Alex Kost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87io210wfq.fsf@gmail.com \
    --to=alezost@gmail.com \
    --cc=22550@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=myglc2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.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).