Oleg Pykhalov (2017-12-29 20:44 +0300) wrote: > Hello Alex, Guix > > Alex Kost <[email protected]> writes: > >> Hello, Emacs-Guix (Emacs interface for GNU Guix) version 0.3.4 has been >> released. It may be installed with "guix package -i emacs-guix". >> >> The main new features are: > > By the way, 'guix-edit' supports a new behavior: > > Read symbol at point and if it is a package name, return it. If it > is not a package name or if current command has a prefix argument, > read the name from minibuffer. > > (from 'guix-read-package-name-at-point' documentation string).
Oh, right, I forgot about it, sorry :-) (this feature is also the Oleg's idea) >> 1. "M-x guix-hash": it prompts for a file, calculates its hash and puts >> it into kill-ring (i.e., you can insert it with "C-y"). If it is >> called on a directory, it ignores VCS files (like "guix hash >> --recursive --exclude-vcs"). Also it supports dired-mode. Thanks to >> ng0 for the idea of this command! > > I like this, but as I undertand it works only with files or directories > locally. Yes, it is the analog of "guix hash", so it works with local files only. > Could we do something like: > > (defun guix-download (url) > (interactive "sDownload URL: ") > (insert (shell-command-to-string (concat "guix download " > url > " 2>/dev/null" > "| tail -n 1" > "| tr -d '\n'")))) > > which will download a thing and paste a hash at the cursor position. I wouldn't like to have such a wrapper for a shell command as using "Guix REPL" would be faster. Although the main problem is: what you suggest is a *synchronous* command, and downloading files may take a long time, so Emacs will become unresponsive until the file will be downloaded and its hash will be calculated. > We have a 'guix-devel-download-package-source', but it basically the > same as a shell command 'guix download PACKAGE' which requires to copy > hash manually. What we probably want is to get a hash into Emacs > kill-ring as guix-hash does. I don't see how this can be done. Is it OK for you that this downloading will happen synchronously? Or do you have ideas how it can be implemented otherwise? -- Alex
