unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCHES] Add (guix build emacs-utils) and some Emacs packages
@ 2014-08-13  3:50 mhw
  2014-08-13 15:52 ` Ludovic Courtès
  2014-08-13 19:06 ` Guix unable to download from github due to TLS fatal alert Mark H Weaver
  0 siblings, 2 replies; 7+ messages in thread
From: mhw @ 2014-08-13  3:50 UTC (permalink / raw)
  To: guix-devel

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

I've attached patches to add new packages for 'magit', 'paredit',
'emacs-w3m', and 'emacs-wget'.  While working on these packages, I found
that I needed a way to substitute multi-line s-expressions in the elisp
code, in order to replace initializers for variables.

In particular, these patches arrange to initialize certain variables
containing pathnames and program names to absolute paths in the store.
Sometimes the original initializers are multi-line expressions that
search for the correct path using heuristics.

The approach I took was to create a new module (guix build emacs-utils)
containing utilities that use Emacs itself to perform the substitutions.

What do you think?

      Mark



[-- Attachment #2: [PATCH 1/5] Add (guix build emacs-utils) --]
[-- Type: text/x-patch, Size: 5221 bytes --]

From ce477199a135eac797f03c86ce99595bc47affeb Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Sat, 2 Aug 2014 19:24:50 -0400
Subject: [PATCH 1/5] Add (guix build emacs-utils).

* guix/build/emacs-utils.scm: New file.
* Makefile.am (MODULES): Add it.
* .dir-locals.el: Add indentation rules.
---
 .dir-locals.el             |  3 ++
 Makefile.am                |  1 +
 guix/build/emacs-utils.scm | 84 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+)
 create mode 100644 guix/build/emacs-utils.scm

diff --git a/.dir-locals.el b/.dir-locals.el
index 64a680c..16ec640 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -29,6 +29,9 @@
    (eval . (put 'call-with-compressed-output-port 'scheme-indent-function 2))
    (eval . (put 'call-with-decompressed-port 'scheme-indent-function 2))
    (eval . (put 'signature-case 'scheme-indent-function 1))
+   (eval . (put 'emacs-batch-edit-file 'scheme-indent-function 1))
+   (eval . (put 'emacs-substitute-sexps 'scheme-indent-function 1))
+   (eval . (put 'emacs-substitute-vars 'scheme-indent-function 1))
 
    (eval . (put 'syntax-parameterize 'scheme-indent-function 1))
    (eval . (put 'with-monad 'scheme-indent-function 1))
diff --git a/Makefile.am b/Makefile.am
index 6695e7e..eab126a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -73,6 +73,7 @@ MODULES =					\
   guix/build/install.scm			\
   guix/build/activation.scm			\
   guix/build/syscalls.scm			\
+  guix/build/emacs-utils.scm			\
   guix/packages.scm				\
   guix/snix.scm					\
   guix/scripts/download.scm			\
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
new file mode 100644
index 0000000..e407d11
--- /dev/null
+++ b/guix/build/emacs-utils.scm
@@ -0,0 +1,84 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build emacs-utils)
+  #:export (emacs-batch-edit-file
+            emacs-substitute-sexps
+            emacs-substitute-vars))
+
+;;; Commentary:
+;;;
+;;; Tools to programmatically edit files using Emacs,
+;;; e.g. to replace entire s-expressions in elisp files.
+;;;
+;;; Code:
+
+(define %emacs
+  ;; The `emacs' command.
+  (make-parameter "emacs"))
+
+(define (emacs-batch-edit-file file expr)
+  "Load FILE in Emacs using batch mode, and execute the elisp code EXPR."
+  (unless (zero? (system* (%emacs) "--quick" "--batch"
+                          (string-append "--visit=" file)
+                          (format #f "--eval=~S" expr)))
+    (error "emacs-batch-edit-file failed!" file expr)))
+
+(define-syntax emacs-substitute-sexps
+  (syntax-rules ()
+    "Substitute the S-expression immediately following the first occurrence of
+LEADING-REGEXP by the string returned by REPLACEMENT in FILE.  For example:
+
+  (emacs-substitute-sexps \"w3m.el\"
+    (\"defcustom w3m-command\"
+     (string-append w3m \"/bin/w3m\"))
+    (\"defvar w3m-image-viewer\"
+     (string-append imagemagick \"/bin/display\")))
+
+This replaces the default values of the `w3m-command' and `w3m-image-viewer'
+variables declared in `w3m.el' with the results of the `string-append' calls
+above.  Note that LEADING-REGEXP uses Emacs regexp syntax."
+    ((emacs-substitute-sexps file (leading-regexp replacement) ...)
+     (emacs-batch-edit-file file
+       `(progn (progn (goto-char (point-min))
+                      (re-search-forward ,leading-regexp)
+                      (kill-sexp)
+                      (insert " ")
+                      (insert ,(format #f "~S" replacement)))
+               ...
+               (basic-save-buffer))))))
+
+(define-syntax emacs-substitute-vars
+  (syntax-rules ()
+    "Substitute the default value of VARIABLE by the string returned by
+REPLACEMENT in FILE.  For example:
+
+  (emacs-substitute-vars \"w3m.el\"
+    (\"w3m-command\" (string-append w3m \"/bin/w3m\"))
+    (\"w3m-image-viewer\" (string-append imagemagick \"/bin/display\")))
+
+This replaces the default values of the `w3m-command' and `w3m-image-viewer'
+variables declared in `w3m.el' with the results of the `string-append' calls
+above."
+    ((emacs-substitute-vars file (variable replacement) ...)
+     (emacs-substitute-sexps file
+       ((string-append "(def[a-z]+[[:space:]\n]+" variable "\\>")
+        replacement)
+       ...))))
+
+;;; emacs-utils.scm ends here
-- 
1.8.4


[-- Attachment #3: [PATCH 2/5] gnu: Add magit --]
[-- Type: text/x-patch, Size: 3571 bytes --]

From 3878daebbc09122a2c789984e5f822f51eb3c667 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Sat, 2 Aug 2014 22:20:23 -0400
Subject: [PATCH 2/5] gnu: Add magit.

* gnu/packages/emacs.scm (magit): New variable.
---
 gnu/packages/emacs.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index a9cfa19..9149f9b 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com>
 ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -34,6 +35,7 @@
   #:use-module (gnu packages image)
   #:use-module (gnu packages giflib)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages version-control)
   #:use-module ((gnu packages compression)
                 #:renamer (symbol-prefix-proc 'compression:))
   #:use-module (gnu packages xml)
@@ -152,3 +154,53 @@ of the stage in Geiser.  A bundle of Elisp shims orchestrates the dialog
 between the Scheme interpreter, Emacs and, ultimately, the schemer,
 giving her access to live metadata.")
     (license bsd-3)))
+
+(define-public magit
+  (package
+    (name "magit")
+    (version "1.2.0")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "https://github.com/downloads/magit/magit/magit-"
+                                 version ".tar.gz"))
+             (sha256
+              (base32 "1a8vvilhd5y5vmlpsh194qpl4qlg0a1brylfscxcacpfp0cmhlzg"))))
+    (build-system gnu-build-system)
+    (native-inputs `(("texinfo" ,texinfo)))
+    (inputs `(("emacs" ,emacs)
+              ("git" ,git)
+              ("git:gui" ,git "gui")))
+    (arguments
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (guix build emacs-utils))
+       #:imported-modules ((guix build gnu-build-system)
+                           (guix build utils)
+                           (guix build emacs-utils))
+       #:tests? #f  ; no check target
+       #:phases
+       (alist-replace
+        'configure
+        (lambda* (#:key outputs #:allow-other-keys)
+          (let ((out (assoc-ref outputs "out")))
+            (substitute* "Makefile"
+              (("/usr/local") out)
+              (("/etc") (string-append out "/etc")))))
+        (alist-cons-before
+         'build 'patch-exec-paths
+         (lambda* (#:key inputs #:allow-other-keys)
+           (let ((git (assoc-ref inputs "git"))
+                 (git:gui (assoc-ref inputs "git:gui")))
+             (emacs-substitute-vars "magit.el"
+               ("magit-git-executable" (string-append git "/bin/git"))
+               ("magit-gitk-executable" (string-append git:gui "/bin/gitk")))))
+         %standard-phases))))
+    (home-page "http://magit.github.io/")
+    (synopsis "Emacs interface for the Git version control system")
+    (description
+     "With Magit, you can inspect and modify your Git repositories with Emacs.
+You can review and commit the changes you have made to the tracked files, for
+example, and you can browse the history of past changes.  There is support for
+cherry picking, reverting, merging, rebasing, and other common Git
+operations.")
+    (license gpl3+)))
-- 
1.8.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: [PATCH 3/5] gnu: Add paredit --]
[-- Type: text/x-patch, Size: 2973 bytes --]

From cc12fa6243da5a61f1421d1d3dfe64af2cf76102 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Sat, 2 Aug 2014 20:01:48 -0400
Subject: [PATCH 3/5] gnu: Add paredit.

* gnu/packages/emacs.scm (paredit): New variable.
---
 gnu/packages/emacs.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 9149f9b..07fe73a 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -23,6 +23,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages ncurses)
@@ -155,6 +156,51 @@ between the Scheme interpreter, Emacs and, ultimately, the schemer,
 giving her access to live metadata.")
     (license bsd-3)))
 
+(define-public paredit
+  (package
+    (name "paredit")
+    (version "23")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "http://mumble.net/~campbell/emacs/paredit-"
+                                 version ".el"))
+             (sha256
+              (base32 "1np882jzvxckljx3cjz4absyzmc5hw65cs21sjmbic82163m9lf8"))))
+    (build-system trivial-build-system)
+    (inputs `(("emacs" ,emacs)))
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+
+         (let* ((emacs (string-append (assoc-ref %build-inputs "emacs")
+                                      "/bin/emacs"))
+                (source (assoc-ref %build-inputs "source"))
+                (lisp-dir (string-append %output
+                                         "/share/emacs/site-lisp"))
+                (target (string-append lisp-dir "/paredit.el")))
+           (mkdir-p lisp-dir)
+           (copy-file source target)
+           (with-directory-excursion lisp-dir
+             (unless (zero? (system*
+                             emacs "--quick" "--batch"
+                             (format #f "--eval=~S"
+                                     '(byte-compile-file "paredit.el"))))
+               (error "failed to compile paredit.el!")))))))
+    (home-page "http://mumble.net/~campbell/emacs/paredit/")
+    (synopsis "Emacs minor mode for editing parentheses")
+    (description
+     "ParEdit (paredit.el) is a minor mode for performing structured editing
+of S-expression data.  The typical example of this would be Lisp or Scheme
+source code.
+
+ParEdit helps **keep parentheses balanced** and adds many keys for moving
+S-expressions and moving around in S-expressions.  Its behavior can be jarring
+for those who may want transient periods of unbalanced parentheses, such as
+when typing parentheses directly or commenting out code line by line.")
+    (license gpl3+)))
+
 (define-public magit
   (package
     (name "magit")
-- 
1.8.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: [PATCH 4/5] gnu: Add emacs-w3m --]
[-- Type: text/x-patch, Size: 4337 bytes --]

From 77cbe9246651b759d8ff6bb93b06fd523668fb29 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Thu, 24 Jul 2014 11:38:42 -0400
Subject: [PATCH 4/5] gnu: Add emacs-w3m.

* gnu/packages/emacs.scm (emacs-w3m): New variable.
---
 gnu/packages/emacs.scm | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 07fe73a..9e8a793 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -37,6 +37,9 @@
   #:use-module (gnu packages giflib)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages version-control)
+  #:use-module (gnu packages imagemagick)
+  #:use-module (gnu packages w3m)
+  #:use-module (gnu packages autotools)
   #:use-module ((gnu packages compression)
                 #:renamer (symbol-prefix-proc 'compression:))
   #:use-module (gnu packages xml)
@@ -250,3 +253,77 @@ example, and you can browse the history of past changes.  There is support for
 cherry picking, reverting, merging, rebasing, and other common Git
 operations.")
     (license gpl3+)))
+
+\f
+;;;
+;;; Web browsing.
+;;;
+
+(define-public emacs-w3m
+  (package
+    (name "emacs-w3m")
+    (version "1.4.483+0.20120614")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "mirror://debian/pool/main/w/w3m-el/w3m-el_"
+                                 version ".orig.tar.gz"))
+             (sha256
+              (base32 "0ms181gjavnfk79hhv5xl9llik4c6kj0w3c04kgyif8lcy2sxljx"))))
+    (build-system gnu-build-system)
+    (native-inputs `(("autoconf" ,autoconf)))
+    (inputs `(("w3m" ,w3m)
+              ("imagemagick" ,imagemagick)
+              ("emacs" ,emacs)))
+    (arguments
+     '(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (guix build emacs-utils))
+       #:imported-modules ((guix build gnu-build-system)
+                           (guix build utils)
+                           (guix build emacs-utils))
+       #:configure-flags
+       (let ((out (assoc-ref %outputs "out")))
+         (list (string-append "--with-lispdir="
+                              out "/share/emacs/site-lisp")
+               (string-append "--with-icondir="
+                              out "/share/images/emacs-w3m")))
+       #:tests? #f  ; no check target
+       #:phases
+       (alist-cons-before
+        'configure 'pre-configure
+        (lambda _
+          (zero? (system* "autoconf")))
+        (alist-cons-before
+         'build 'patch-exec-paths
+         (lambda* (#:key inputs outputs #:allow-other-keys)
+          (let ((out (assoc-ref outputs "out"))
+                (w3m (assoc-ref inputs "w3m"))
+                (imagemagick (assoc-ref inputs "imagemagick"))
+                (coreutils (assoc-ref inputs "coreutils")))
+            (emacs-substitute-vars "w3m.el"
+              ("w3m-command" (string-append w3m "/bin/w3m"))
+              ("w3m-touch-command" (string-append coreutils "/bin/touch"))
+              ("w3m-image-viewer" (string-append imagemagick "/bin/display"))
+              ("w3m-icon-directory" (string-append out
+                                                   "/share/images/emacs-w3m")))
+            (emacs-substitute-vars "w3m-image.el"
+              ("w3m-imagick-convert-program" (string-append imagemagick
+                                                            "/bin/convert"))
+              ("w3m-imagick-identify-program" (string-append imagemagick
+                                                             "/bin/identify")))
+            #t))
+         (alist-replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys)
+            (and (zero? (system* "make" "install" "install-icons"))
+                 (with-directory-excursion
+                     (string-append (assoc-ref outputs "out")
+                                    "/share/emacs/site-lisp")
+                   (for-each delete-file '("ChangeLog" "ChangeLog.1"))
+                   #t)))
+          %standard-phases)))))
+    (home-page "http://emacs-w3m.namazu.org/")
+    (synopsis "A simple web browser for emacs, based on w3m.")
+    (description
+     "emacs-w3m is an emacs interface for the w3m web browser.")
+    (license gpl2+)))
-- 
1.8.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: [PATCH 5/5] gnu: Add emacs-wget --]
[-- Type: text/x-patch, Size: 2641 bytes --]

From d54e2c12e481f711ff9c533f9dcdd4570e070897 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Sun, 27 Jul 2014 16:37:13 -0400
Subject: [PATCH 5/5] gnu: Add emacs-wget.

* gnu/packages/emacs.scm (emacs-wget): New variable.
---
 gnu/packages/emacs.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 9e8a793..b5300e2 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -39,6 +39,7 @@
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages w3m)
+  #:use-module (gnu packages wget)
   #:use-module (gnu packages autotools)
   #:use-module ((gnu packages compression)
                 #:renamer (symbol-prefix-proc 'compression:))
@@ -327,3 +328,44 @@ operations.")
     (description
      "emacs-w3m is an emacs interface for the w3m web browser.")
     (license gpl2+)))
+
+(define-public emacs-wget
+  (package
+    (name "emacs-wget")
+    (version "0.5.0")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "mirror://debian/pool/main/w/wget-el/wget-el_"
+                                 version ".orig.tar.gz"))
+             (sha256
+              (base32 "10byvyv9dk0ib55gfqm7bcpxmx2qbih1jd03gmihrppr2mn52nff"))))
+    (build-system gnu-build-system)
+    (inputs `(("wget" ,wget)
+              ("emacs" ,emacs)))
+    (arguments
+     '(#:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (guix build emacs-utils))
+       #:imported-modules ((guix build gnu-build-system)
+                           (guix build utils)
+                           (guix build emacs-utils))
+       #:tests? #f  ; no check target
+       #:phases
+       (alist-replace
+        'configure
+        (lambda* (#:key outputs #:allow-other-keys)
+          (substitute* "Makefile"
+            (("/usr/local") (assoc-ref outputs "out"))
+            (("/site-lisp/emacs-wget") "/site-lisp")))
+        (alist-cons-before
+         'build 'patch-exec-paths
+         (lambda* (#:key inputs outputs #:allow-other-keys)
+           (let ((wget (assoc-ref inputs "wget")))
+             (emacs-substitute-vars "wget.el"
+               ("wget-command" (string-append wget "/bin/wget")))))
+         %standard-phases))))
+    (home-page "http://www.emacswiki.org/emacs/EmacsWget")
+    (synopsis "A simple file downloader for emacs, based on wget.")
+    (description
+     "emacs-wget is an emacs interface for the wget file downloader.")
+    (license gpl2+)))
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCHES] Add (guix build emacs-utils) and some Emacs packages
  2014-08-13  3:50 [PATCHES] Add (guix build emacs-utils) and some Emacs packages mhw
@ 2014-08-13 15:52 ` Ludovic Courtès
  2014-08-13 18:36   ` Mark H Weaver
  2014-08-13 19:06 ` Guix unable to download from github due to TLS fatal alert Mark H Weaver
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2014-08-13 15:52 UTC (permalink / raw)
  To: mhw; +Cc: guix-devel

mhw@netris.org skribis:

> I've attached patches to add new packages for 'magit', 'paredit',
> 'emacs-w3m', and 'emacs-wget'.  While working on these packages, I found
> that I needed a way to substitute multi-line s-expressions in the elisp
> code, in order to replace initializers for variables.

This looks very cool.  I had started looking at EMMS and
substitute-sexps and substitute-vars will be very helpful in such cases.

> The approach I took was to create a new module (guix build emacs-utils)
> containing utilities that use Emacs itself to perform the substitutions.
>
> What do you think?

I think it’s great!

Comments below:

> +(define %emacs
> +  ;; The `emacs' command.
> +  (make-parameter "emacs"))

It should be exported.

> +(define-syntax emacs-substitute-vars

Perhaps ‘emacs-substitute-variables’?  (I try to avoid abbreviations in
public names.)

> +         (let* ((emacs (string-append (assoc-ref %build-inputs "emacs")
> +                                      "/bin/emacs"))
> +                (source (assoc-ref %build-inputs "source"))
> +                (lisp-dir (string-append %output
> +                                         "/share/emacs/site-lisp"))
> +                (target (string-append lisp-dir "/paredit.el")))

I find it nicer when the RHSs of ‘let’ are aligned.

> +             (unless (zero? (system*
> +                             emacs "--quick" "--batch"
> +                             (format #f "--eval=~S"
> +                                     '(byte-compile-file "paredit.el"))))
> +               (error "failed to compile paredit.el!")))))))

Perhaps this calls for an ‘emacs-batch-eval’ procedure?

> +    (source (origin
> +             (method url-fetch)
> +             (uri (string-append "mirror://debian/pool/main/w/w3m-el/w3m-el_"
> +                                 version ".orig.tar.gz"))

What about using http://emacs-w3m.namazu.org/emacs-w3m-1.4.4.tar.gz ?

> +    (synopsis "A simple web browser for emacs, based on w3m.")

Just “Simple Web browser for Emacs based on w3m”, with no period.

> +    (synopsis "A simple file downloader for emacs, based on wget.")

Likewise.

Feel free to push with these changes.

Thanks for all of this!

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCHES] Add (guix build emacs-utils) and some Emacs packages
  2014-08-13 15:52 ` Ludovic Courtès
@ 2014-08-13 18:36   ` Mark H Weaver
  0 siblings, 0 replies; 7+ messages in thread
From: Mark H Weaver @ 2014-08-13 18:36 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

> mhw@netris.org skribis:
>
>> I've attached patches to add new packages for 'magit', 'paredit',
>> 'emacs-w3m', and 'emacs-wget'.  While working on these packages, I found
>> that I needed a way to substitute multi-line s-expressions in the elisp
>> code, in order to replace initializers for variables.
>
> This looks very cool.  I had started looking at EMMS and
> substitute-sexps and substitute-vars will be very helpful in such cases.
>
>> The approach I took was to create a new module (guix build emacs-utils)
>> containing utilities that use Emacs itself to perform the substitutions.
>>
>> What do you think?
>
> I think it’s great!
>
> Comments below:
>
>> +(define %emacs
>> +  ;; The `emacs' command.
>> +  (make-parameter "emacs"))
>
> It should be exported.

Indeed!

>> +(define-syntax emacs-substitute-vars
>
> Perhaps ‘emacs-substitute-variables’?  (I try to avoid abbreviations in
> public names.)

Okay, sounds good.

>> +         (let* ((emacs (string-append (assoc-ref %build-inputs "emacs")
>> +                                      "/bin/emacs"))
>> +                (source (assoc-ref %build-inputs "source"))
>> +                (lisp-dir (string-append %output
>> +                                         "/share/emacs/site-lisp"))
>> +                (target (string-append lisp-dir "/paredit.el")))
>
> I find it nicer when the RHSs of ‘let’ are aligned.

Agreed.

>> +             (unless (zero? (system*
>> +                             emacs "--quick" "--batch"
>> +                             (format #f "--eval=~S"
>> +                                     '(byte-compile-file "paredit.el"))))
>> +               (error "failed to compile paredit.el!")))))))
>
> Perhaps this calls for an ‘emacs-batch-eval’ procedure?

Good idea.

>> +    (source (origin
>> +             (method url-fetch)
>> +             (uri (string-append "mirror://debian/pool/main/w/w3m-el/w3m-el_"
>> +                                 version ".orig.tar.gz"))
>
> What about using http://emacs-w3m.namazu.org/emacs-w3m-1.4.4.tar.gz ?

Alas, it is nearly 10 years old, and does not work with Emacs 24.
Attempts to compile it result in several occurrences of the following
error message:
      
   Emacs-w3m of this version does not support Emacs 24; try the
   development version

>> +    (synopsis "A simple web browser for emacs, based on w3m.")
>
> Just “Simple Web browser for Emacs based on w3m”, with no period.
>
>> +    (synopsis "A simple file downloader for emacs, based on wget.")
>
> Likewise.

Thanks, I'll post an updated patch soon.

     Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Guix unable to download from github due to TLS fatal alert
  2014-08-13  3:50 [PATCHES] Add (guix build emacs-utils) and some Emacs packages mhw
  2014-08-13 15:52 ` Ludovic Courtès
@ 2014-08-13 19:06 ` Mark H Weaver
  2014-08-13 21:56   ` Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Mark H Weaver @ 2014-08-13 19:06 UTC (permalink / raw)
  To: guix-devel

I forgot to mention an important problem with the 'magit' package.
  
> +    (source (origin
> +             (method url-fetch)
> +             (uri (string-append "https://github.com/downloads/magit/magit/magit-"
> +                                 version ".tar.gz"))

Guix is currently unable to download the magit tarball.  For now I
worked around it by using 'wget' followed by "guix download
file:///path/to/tarball".

Here's what happens:

--8<---------------cut here---------------start------------->8---
$ guix download https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz
starting download of `guix-file.cszPnB' from `https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz'...
following redirection to `https://cloud.github.com/downloads/magit/magit/magit-1.2.0.tar.gz'...
ERROR: Throw to key `gnutls-error' with args `(#<gnutls-error-enum A TLS fatal alert has been received.> handshake)'.
failed to download "guix-file.cszPnB" from "https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz"
guix download: error: https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz: download failed
--8<---------------cut here---------------end--------------->8---

      Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Guix unable to download from github due to TLS fatal alert
  2014-08-13 19:06 ` Guix unable to download from github due to TLS fatal alert Mark H Weaver
@ 2014-08-13 21:56   ` Ludovic Courtès
  2014-10-14 21:14     ` bug#18524: " Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2014-08-13 21:56 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> Here's what happens:
>
> $ guix download https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz
> starting download of `guix-file.cszPnB' from `https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz'...
> following redirection to `https://cloud.github.com/downloads/magit/magit/magit-1.2.0.tar.gz'...
> ERROR: Throw to key `gnutls-error' with args `(#<gnutls-error-enum A TLS fatal alert has been received.> handshake)'.
> failed to download "guix-file.cszPnB" from "https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz"
> guix download: error: https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz: download failed

I see that as well.  However, other github.com URLs works:

--8<---------------cut here---------------start------------->8---
$ guix download https://github.com/flavio/qjson/archive/0.8.1.tar.gz
starting download of `guix-file.tL8gal' from `https://github.com/flavio/qjson/archive/0.8.1.tar.gz'...
following redirection to `https://codeload.github.com/flavio/qjson/tar.gz/0.8.1'...
https://codeload.github.com/.../0.8.1	100.0% of 71.6 KiB
/gnu/store/fqfm3zm9pzwgic9sz2x8hk8ykm9yhkqw-0.8.1.tar.gz
163fspi0xc705irv79qw861fmh68pjyla9vx3kqiq6xrdhb9834j

$ guix download https://github.com/maebert/jrnl/archive/1.8.4.tar.gz
starting download of `guix-file.oK809e' from `https://github.com/maebert/jrnl/archive/1.8.4.tar.gz'...
following redirection to `https://codeload.github.com/maebert/jrnl/tar.gz/1.8.4'...
https://codeload.github.com/.../1.8.4	100.0% of 162.4 KiB
/gnu/store/cb39bf5ljrglj72bxarcsws241qhw5a8-1.8.4.tar.gz
019ky09sj5i7frmca0imv4jm46mn3f4lzah2wmiwxh22cisj7ksn
--8<---------------cut here---------------end--------------->8---

With debugging enabled in build/download.scm, the relevant part is:

--8<---------------cut here---------------start------------->8---
gnutls: [699|3] HSK[0x104e530]: CLIENT HELLO was queued [249 bytes]
gnutls: [699|7] HWRITE: enqueued [CLIENT HELLO] 249. Total 249 bytes.
gnutls: [699|7] HWRITE FLUSH: 249 bytes in buffer.
gnutls: [699|4] REC[0x104e530]: Preparing Packet Handshake(22) with length: 249 and min pad: 0
gnutls: [699|9] ENC[0x104e530]: cipher: NULL, MAC: MAC-NULL, Epoch: 0
gnutls: [699|7] WRITE: enqueued 254 bytes for 0xe. Total 254 bytes.
gnutls: [699|4] REC[0x104e530]: Sent Packet[1] Handshake(22) in epoch 0 and length: 254
gnutls: [699|7] HWRITE: wrote 1 bytes, 0 bytes left.
gnutls: [699|7] WRITE FLUSH: 254 bytes in buffer.
gnutls: [699|7] WRITE: wrote 254 bytes, 0 bytes left.
gnutls: [699|2] ASSERT: gnutls_buffers.c:1075
gnutls: [699|7] READ: Got 5 bytes from 0xe
gnutls: [699|7] READ: read 5 bytes from 0xe
gnutls: [699|7] RB: Have 0 bytes into buffer. Adding 5 bytes.
gnutls: [699|7] RB: Requested 5 bytes
gnutls: [699|4] REC[0x104e530]: SSL 3.3 Alert packet received. Epoch 0, length: 2
gnutls: [699|4] REC[0x104e530]: Expected Packet Handshake(22)
gnutls: [699|4] REC[0x104e530]: Received Packet Alert(21) with length: 2
gnutls: [699|7] READ: Got 2 bytes from 0xe
gnutls: [699|7] READ: read 2 bytes from 0xe
gnutls: [699|7] RB: Have 5 bytes into buffer. Adding 2 bytes.
gnutls: [699|7] RB: Requested 7 bytes
gnutls: [699|4] REC[0x104e530]: Decrypted Packet[0] Alert(21) with length: 2
gnutls: [699|4] REC[0x104e530]: Alert[2|40] - Handshake failed - was received
--8<---------------cut here---------------end--------------->8---

Wget can be made to fail similarly:

--8<---------------cut here---------------start------------->8---
$ wget --secure-protocol=SSLv3 -O /dev/null https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz
--2014-08-13 23:48:53--  https://github.com/downloads/magit/magit/magit-1.2.0.tar.gz
Resolving github.com... 192.30.252.128
Connecting to github.com|192.30.252.128|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://cloud.github.com/downloads/magit/magit/magit-1.2.0.tar.gz [following]
--2014-08-13 23:48:54--  https://cloud.github.com/downloads/magit/magit/magit-1.2.0.tar.gz
Resolving cloud.github.com... 54.230.44.78, 54.230.44.145, 54.230.44.189, ...
Connecting to cloud.github.com|54.230.44.78|:443... connected.
GnuTLS: A TLS fatal alert has been received.
GnuTLS: received alert [40]: Handshake failed
Unable to establish SSL connection.
--8<---------------cut here---------------end--------------->8---

But its default --secure-protocol=auto just works, although its gnutls.c
just seems to use the default priorities like we do.

Further investigation needed...

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bug#18524: Guix unable to download from github due to TLS fatal alert
  2014-08-13 21:56   ` Ludovic Courtès
@ 2014-10-14 21:14     ` Ludovic Courtès
  2014-10-14 21:50       ` Mark H Weaver
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2014-10-14 21:14 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel, 18524

I had managed to bork ‘set-session-server-name!’ in GnuTLS (which
addresses this bug), so this is fixed in commit 5186158 and upstream:
<https://gitorious.org/gnutls/gnutls/commit/e4e513f43a8bdd9fe50bdd95a7fd213bca2f81b0>.

Sorry about that!

Ludo’.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bug#18524: Guix unable to download from github due to TLS fatal alert
  2014-10-14 21:14     ` bug#18524: " Ludovic Courtès
@ 2014-10-14 21:50       ` Mark H Weaver
  0 siblings, 0 replies; 7+ messages in thread
From: Mark H Weaver @ 2014-10-14 21:50 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel, 18524

ludo@gnu.org (Ludovic Courtès) writes:

> I had managed to bork ‘set-session-server-name!’ in GnuTLS (which
> addresses this bug), so this is fixed in commit 5186158 and upstream:
> <https://gitorious.org/gnutls/gnutls/commit/e4e513f43a8bdd9fe50bdd95a7fd213bca2f81b0>.
>
> Sorry about that!

No worries, thanks for taking care of this!

     Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-14 21:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-13  3:50 [PATCHES] Add (guix build emacs-utils) and some Emacs packages mhw
2014-08-13 15:52 ` Ludovic Courtès
2014-08-13 18:36   ` Mark H Weaver
2014-08-13 19:06 ` Guix unable to download from github due to TLS fatal alert Mark H Weaver
2014-08-13 21:56   ` Ludovic Courtès
2014-10-14 21:14     ` bug#18524: " Ludovic Courtès
2014-10-14 21:50       ` Mark H Weaver

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).