unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Having trouble packaging DefaultEncrypt for Emacs
@ 2017-04-09  0:21 Chris Marusich
  2017-04-10 10:10 ` Alex Kost
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Marusich @ 2017-04-09  0:21 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 2054 bytes --]

Hi,

I'm trying to package DefaultEncrypt:

https://www.emacswiki.org/emacs/DefaultEncrypt

I've made a package definition (see attached patch), and it builds
without error.  I've installed it into my user profile.  Per the
documentation, I've added the following to my ~/.emacs:

  (require 'jl-encrypt)

However, when I start Emacs, I get the following warning:

--8<---------------cut here---------------start------------->8---
Warning (initialization): An error occurred while loading ‘/home/marusich/.emacs’:

File error: Cannot open load file, No such file or directory, jl-encrypt
--8<---------------cut here---------------end--------------->8---

Why is this happening?  How can I fix it?  I'm still a bit of an Emacs
newbie, so maybe there's an obvious solution I'm unaware of.

I've also noticed that the elisp file gets installed with the name
"jl-encrypt.el.el", which seems weird, but I don't know if that's
related to the preceding issue:

--8<---------------cut here---------------start------------->8---
$ tree -a $(./pre-inst-env guix build --rounds=2 --keep-failed emacs-default-encrypt)
/gnu/store/3dcbalb6zgc7a7iizni3hyzy6llb6c6p-emacs-default-encrypt-4.3
└── share
    └── emacs
        └── site-lisp
            └── guix.d
                └── default-encrypt-4.3
                    ├── default-encrypt-autoloads.el
                    ├── jl-encrypt.el.el
                    └── jl-encrypt.el.elc
--8<---------------cut here---------------end--------------->8---

Why does the ".el" suffix appear twice?  Is it causing the preceding
problem?  I tried changing

  (require 'jl-encrypt)

to

  (require 'jl-encrypt.el)

but it didn't fix the problem.

I don't know why the require statement is failing, and I don't know why
the elisp file is being installed with an ".el.el" suffix.  I'd love to
use this module and package it for everyone, so if you have any advice,
please let me know.  Thank you in advance!

-- 
Chris

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-emacs-default-encrypt.patch --]
[-- Type: text/x-patch, Size: 2019 bytes --]

From f77c1b669d91fb5ff4421da544fb2e6870ff9f56 Mon Sep 17 00:00:00 2001
From: Chris Marusich <cmmarusich@gmail.com>
Date: Sat, 8 Apr 2017 15:16:52 -0700
Subject: [PATCH] gnu: Add emacs-default-encrypt.

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

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 3db31f207..63d9da03e 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -4057,3 +4057,30 @@ jQuery and Bootstrap resources included via osscdn.")
     (description
      "This Emacs package highlights the s-exp at the current position.")
     (license license:gpl3+)))
+
+(define-public emacs-default-encrypt
+  (package
+    (name "emacs-default-encrypt")
+    (version "4.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             ;; A versioned, signed copy of this package is avialable on the
+             ;; home page, but 'guix download' fails to download it.
+             "https://github.com/emacsmirror/emacswiki.org/raw/master/jl-encrypt.el"))
+       (sha256
+        (base32
+         "16i3rlfp3jxlqvndn8idylhmczync3gwmy8a019v29vyr48rnnr0"))))
+    (build-system emacs-build-system)
+    (home-page "https://www.informationelle-selbstbestimmung-im-internet.de/Emacs.html")
+    (synopsis "Automatically encrypt and sign Gnus messages")
+    (description
+     "DefaultEncrypt is designed to be used with Gnus.  It automatically
+encrypts messages that you send (e.g., email) when public keys for all
+recipients are available, and it protects you from accidentally sending
+un-encrypted messages.  It can also be configured to automatically sign
+messages that you send.  For details and instructions on how to use
+DefaultEncrypt, please refer to the home page or read the comments in the
+source file, @file{jl-encrypt.el}.")
+    (license license:gpl3+)))
-- 
2.12.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Having trouble packaging DefaultEncrypt for Emacs
  2017-04-09  0:21 Having trouble packaging DefaultEncrypt for Emacs Chris Marusich
@ 2017-04-10 10:10 ` Alex Kost
  2017-04-10 10:31   ` Alex Kost
  2017-04-11  7:40   ` Chris Marusich
  0 siblings, 2 replies; 8+ messages in thread
From: Alex Kost @ 2017-04-10 10:10 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel

Chris Marusich (2017-04-08 17:21 -0700) wrote:

> Hi,
>
> I'm trying to package DefaultEncrypt:
>
> https://www.emacswiki.org/emacs/DefaultEncrypt
>
> I've made a package definition (see attached patch), and it builds
> without error.  I've installed it into my user profile.  Per the
> documentation, I've added the following to my ~/.emacs:
>
>   (require 'jl-encrypt)

I recommend to never do this "hard" requirement.  As you can see, it
may break your .emacs.  Better do it like this:

  (require 'jl-encrypt nil t)

or if you want some warning message:

  (unless (require 'jl-encrypt nil t)
    (message "Something is not good: jl-encrypt was not loaded"))

Note, however, that in most cases (not in this case) using "require" is
not needed at all!  Usually it is enough to have the generated
autoloads.  For example, if you install 'magit', you don't need to (and
shouldn't!) put "(require 'magit)" in your emacs config.  You can use
"M-x magit-status" right away as 'magit-status' command is "autoloaded".

> However, when I start Emacs, I get the following warning:
>
> Warning (initialization): An error occurred while loading ‘/home/marusich/.emacs’:
>
> File error: Cannot open load file, No such file or directory, jl-encrypt
>
>
> Why is this happening?  How can I fix it?  I'm still a bit of an Emacs
> newbie, so maybe there's an obvious solution I'm unaware of.
>
> I've also noticed that the elisp file gets installed with the name
> "jl-encrypt.el.el", which seems weird, but I don't know if that's
> related to the preceding issue:

This weird file name is the root of the problem: a single-package file
should have the following file name: <name-version.el>.  So try to add
'file-name' to the origin (see below).

[...]
> +(define-public emacs-default-encrypt
> +  (package
> +    (name "emacs-default-encrypt")
> +    (version "4.3")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append
> +             ;; A versioned, signed copy of this package is avialable on the
> +             ;; home page, but 'guix download' fails to download it.
> +             "https://github.com/emacsmirror/emacswiki.org/raw/master/jl-encrypt.el"))

Why do you use this third-party unversioned file instead of the original
source from the upstream? (it even has a GnuPG signature!):

  https://www.informationelle-selbstbestimmung-im-internet.de/emacs/jl-encrypt4.1/jl-encrypt.el

I found it on the home-page.

Add the following line here to fix ".el.el" problem:

          (file-name (string-append "jl-encrypt-" version ".el"))

> +       (sha256
> +        (base32
> +         "16i3rlfp3jxlqvndn8idylhmczync3gwmy8a019v29vyr48rnnr0"))))
> +    (build-system emacs-build-system)
> +    (home-page "https://www.informationelle-selbstbestimmung-im-internet.de/Emacs.html")
> +    (synopsis "Automatically encrypt and sign Gnus messages")
> +    (description
> +     "DefaultEncrypt is designed to be used with Gnus.  It automatically
> +encrypts messages that you send (e.g., email) when public keys for all
> +recipients are available, and it protects you from accidentally sending
> +un-encrypted messages.  It can also be configured to automatically sign
> +messages that you send.  For details and instructions on how to use
> +DefaultEncrypt, please refer to the home page or read the comments in the
> +source file, @file{jl-encrypt.el}.")
> +    (license license:gpl3+)))

-- 
Alex

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

* Re: Having trouble packaging DefaultEncrypt for Emacs
  2017-04-10 10:10 ` Alex Kost
@ 2017-04-10 10:31   ` Alex Kost
  2017-04-11  8:22     ` Chris Marusich
  2017-04-11  7:40   ` Chris Marusich
  1 sibling, 1 reply; 8+ messages in thread
From: Alex Kost @ 2017-04-10 10:31 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel

Alex Kost (2017-04-10 13:10 +0300) wrote:

> Chris Marusich (2017-04-08 17:21 -0700) wrote:
[...]
>> +(define-public emacs-default-encrypt
>> +  (package
>> +    (name "emacs-default-encrypt")
>> +    (version "4.3")
>> +    (source
>> +     (origin
>> +       (method url-fetch)
>> +       (uri (string-append
>> +             ;; A versioned, signed copy of this package is avialable on the
>> +             ;; home page, but 'guix download' fails to download it.
>> +             "https://github.com/emacsmirror/emacswiki.org/raw/master/jl-encrypt.el"))
>
> Why do you use this third-party unversioned file instead of the original
> source from the upstream? (it even has a GnuPG signature!):
>
>   https://www.informationelle-selbstbestimmung-im-internet.de/emacs/jl-encrypt4.1/jl-encrypt.el

Sorry, I failed to read your comment above the URL :-)

So the error is:

--8<---------------cut here---------------start------------->8---
Starting download of /tmp/guix-file.ugdVEh
From https://www.informationelle-selbstbestimmung-im-internet.de/emacs/jl-encrypt4.1/jl-encrypt.el...
ERROR: Bad media-type header component: text/plain

failed to download "/tmp/guix-file.ugdVEh" from "https://www.informationelle-selbstbestimmung-im-internet.de/emacs/jl-encrypt4.1/jl-encrypt.el"
guix download: error: https://www.informationelle-selbstbestimmung-im-internet.de/emacs/jl-encrypt4.1/jl-encrypt.el: download failed
--8<---------------cut here---------------end--------------->8---

IIUC, we had a similar problem before, and it is considered to be the
upstream problem.  Look at the following message, for example:

http://lists.gnu.org/archive/html/guix-devel/2015-09/msg00578.html

-- 
Alex

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

* Re: Having trouble packaging DefaultEncrypt for Emacs
  2017-04-10 10:10 ` Alex Kost
  2017-04-10 10:31   ` Alex Kost
@ 2017-04-11  7:40   ` Chris Marusich
  2017-04-11 20:04     ` Alex Kost
  1 sibling, 1 reply; 8+ messages in thread
From: Chris Marusich @ 2017-04-11  7:40 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

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

Alex Kost <alezost@gmail.com> writes:

> Chris Marusich (2017-04-08 17:21 -0700) wrote:
>
>> Hi,
>>
>> I'm trying to package DefaultEncrypt:
>>
>> https://www.emacswiki.org/emacs/DefaultEncrypt
>>
>> I've made a package definition (see attached patch), and it builds
>> without error.  I've installed it into my user profile.  Per the
>> documentation, I've added the following to my ~/.emacs:
>>
>>   (require 'jl-encrypt)
>
> I recommend to never do this "hard" requirement.  As you can see, it
> may break your .emacs.  Better do it like this:
>
>   (require 'jl-encrypt nil t)
>
> or if you want some warning message:
>
>   (unless (require 'jl-encrypt nil t)
>     (message "Something is not good: jl-encrypt was not loaded"))

I did not know this!  Thank you for sharing your knowledge.  I chose to
use the "unless" form so I would know if it ever failed to load.

> Note, however, that in most cases (not in this case) using "require" is
> not needed at all!  Usually it is enough to have the generated
> autoloads.  For example, if you install 'magit', you don't need to (and
> shouldn't!) put "(require 'magit)" in your emacs config.  You can use
> "M-x magit-status" right away as 'magit-status' command is "autoloaded".

That's good to know.  I guess this module didn't do the "autoload magic"
that some modules, like magit, do?

>> However, when I start Emacs, I get the following warning:
>>
>> Warning (initialization): An error occurred while loading
>> ‘/home/marusich/.emacs’:
>>
>> File error: Cannot open load file, No such file or directory, jl-encrypt
>>
>>
>> Why is this happening?  How can I fix it?  I'm still a bit of an Emacs
>> newbie, so maybe there's an obvious solution I'm unaware of.
>>
>> I've also noticed that the elisp file gets installed with the name
>> "jl-encrypt.el.el", which seems weird, but I don't know if that's
>> related to the preceding issue:
>
> This weird file name is the root of the problem: a single-package file
> should have the following file name: <name-version.el>.  So try to add
> 'file-name' to the origin (see below).

Aha!  Yes, that fixed it.  I was so close!  Thank you for taking the
time to help me finish this up.  I am now happily using jl-encrypt.
It's automatically signing my email and protecting me from sending email
in cleartext when I should be encrypting it otherwise!  Great stuff.

Patch incoming!  :-)

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Having trouble packaging DefaultEncrypt for Emacs
  2017-04-10 10:31   ` Alex Kost
@ 2017-04-11  8:22     ` Chris Marusich
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Marusich @ 2017-04-11  8:22 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

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

Alex Kost <alezost@gmail.com> writes:

> So the error is:
>
> Starting download of /tmp/guix-file.ugdVEh
> From https://www.informationelle-selbstbestimmung-im-internet.de/emacs/jl-encrypt4.1/jl-encrypt.el...
> ERROR: Bad media-type header component: text/plain
>
> failed to download "/tmp/guix-file.ugdVEh" from "https://www.informationelle-selbstbestimmung-im-internet.de/emacs/jl-encrypt4.1/jl-encrypt.el"
> guix download: error: https://www.informationelle-selbstbestimmung-im-internet.de/emacs/jl-encrypt4.1/jl-encrypt.el: download failed
>
> IIUC, we had a similar problem before, and it is considered to be the
> upstream problem.  Look at the following message, for example:
>
> http://lists.gnu.org/archive/html/guix-devel/2015-09/msg00578.html

I've sent an email privately to the DefaultEncrypt author asking them to
fix this.  If they do, I'll update the origin URI.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Having trouble packaging DefaultEncrypt for Emacs
  2017-04-11  7:40   ` Chris Marusich
@ 2017-04-11 20:04     ` Alex Kost
  2017-04-12  7:59       ` Alex Kost
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Kost @ 2017-04-11 20:04 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel

Chris Marusich (2017-04-11 00:40 -0700) wrote:

> Alex Kost <alezost@gmail.com> writes:
>
>> Note, however, that in most cases (not in this case) using "require" is
>> not needed at all!  Usually it is enough to have the generated
>> autoloads.  For example, if you install 'magit', you don't need to (and
>> shouldn't!) put "(require 'magit)" in your emacs config.  You can use
>> "M-x magit-status" right away as 'magit-status' command is "autoloaded".
>
> That's good to know.  I guess this module didn't do the "autoload magic"
> that some modules, like magit, do?

Unlike such packages as magit, this package doesn't provide any
interactive command (thus there is no point to autoload anything), it
just extends the existing Emacs functionality when it is loaded.  It
does so simply by adding a couple of hooks, so if you would like to
avoid loading this package on Emacs start, you can add these hooks
yourself:

(add-hook 'gnus-message-setup-hook 'mml-secure-encrypt-if-possible)
(add-hook 'message-send-hook 'mml-secure-check-encryption-p)

If you add the above 2 lines to your emacs config (instead of the
"require" line), "jl-encrypt" package will not be loaded on Emacs
start.  It will be loaded when you'll begin to write a message.

-- 
Alex

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

* Re: Having trouble packaging DefaultEncrypt for Emacs
  2017-04-11 20:04     ` Alex Kost
@ 2017-04-12  7:59       ` Alex Kost
  2017-04-13  7:38         ` Chris Marusich
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Kost @ 2017-04-12  7:59 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel

Alex Kost (2017-04-11 23:04 +0300) wrote:

> Chris Marusich (2017-04-11 00:40 -0700) wrote:
>
>> Alex Kost <alezost@gmail.com> writes:
>>
>>> Note, however, that in most cases (not in this case) using "require" is
>>> not needed at all!  Usually it is enough to have the generated
>>> autoloads.  For example, if you install 'magit', you don't need to (and
>>> shouldn't!) put "(require 'magit)" in your emacs config.  You can use
>>> "M-x magit-status" right away as 'magit-status' command is "autoloaded".
>>
>> That's good to know.  I guess this module didn't do the "autoload magic"
>> that some modules, like magit, do?
>
> Unlike such packages as magit, this package doesn't provide any
> interactive command (thus there is no point to autoload anything), it
> just extends the existing Emacs functionality when it is loaded.  It
> does so simply by adding a couple of hooks, so if you would like to
> avoid loading this package on Emacs start, you can add these hooks
> yourself:
>
> (add-hook 'gnus-message-setup-hook 'mml-secure-encrypt-if-possible)
> (add-hook 'message-send-hook 'mml-secure-check-encryption-p)

Oops, I forgot one thing:

  (autoload 'mml-secure-encrypt-if-possible "jl-encrypt")
  (autoload 'mml-secure-check-encryption-p "jl-encrypt")

> If you add the above 2 lines to your emacs config (instead of the
> "require" line), "jl-encrypt" package will not be loaded on Emacs
> start.  It will be loaded when you'll begin to write a message.

-- 
Alex

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

* Re: Having trouble packaging DefaultEncrypt for Emacs
  2017-04-12  7:59       ` Alex Kost
@ 2017-04-13  7:38         ` Chris Marusich
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Marusich @ 2017-04-13  7:38 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

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

Alex Kost <alezost@gmail.com> writes:

> Alex Kost (2017-04-11 23:04 +0300) wrote:
>
>> Chris Marusich (2017-04-11 00:40 -0700) wrote:
>>
>>> Alex Kost <alezost@gmail.com> writes:
>>>
>>>> Note, however, that in most cases (not in this case) using "require" is
>>>> not needed at all!  Usually it is enough to have the generated
>>>> autoloads.  For example, if you install 'magit', you don't need to (and
>>>> shouldn't!) put "(require 'magit)" in your emacs config.  You can use
>>>> "M-x magit-status" right away as 'magit-status' command is "autoloaded".
>>>
>>> That's good to know.  I guess this module didn't do the "autoload magic"
>>> that some modules, like magit, do?
>>
>> Unlike such packages as magit, this package doesn't provide any
>> interactive command (thus there is no point to autoload anything), it
>> just extends the existing Emacs functionality when it is loaded.  It
>> does so simply by adding a couple of hooks, so if you would like to
>> avoid loading this package on Emacs start, you can add these hooks
>> yourself:
>>
>> (add-hook 'gnus-message-setup-hook 'mml-secure-encrypt-if-possible)
>> (add-hook 'message-send-hook 'mml-secure-check-encryption-p)
>
> Oops, I forgot one thing:
>
>   (autoload 'mml-secure-encrypt-if-possible "jl-encrypt")
>   (autoload 'mml-secure-check-encryption-p "jl-encrypt")
>
>> If you add the above 2 lines to your emacs config (instead of the
>> "require" line), "jl-encrypt" package will not be loaded on Emacs
>> start.  It will be loaded when you'll begin to write a message.

Neat!  I didn't know much about the "autoload" stuff.  I've read the
section in the manual, and thanks to these examples, it makes more
sense.  Thank you!

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2017-04-13  7:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-09  0:21 Having trouble packaging DefaultEncrypt for Emacs Chris Marusich
2017-04-10 10:10 ` Alex Kost
2017-04-10 10:31   ` Alex Kost
2017-04-11  8:22     ` Chris Marusich
2017-04-11  7:40   ` Chris Marusich
2017-04-11 20:04     ` Alex Kost
2017-04-12  7:59       ` Alex Kost
2017-04-13  7:38         ` Chris Marusich

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