Re: Having trouble packaging DefaultEncrypt for Emacs

2017-04-13 Thread Chris Marusich
Alex Kost  writes:

> Alex Kost (2017-04-11 23:04 +0300) wrote:
>
>> Chris Marusich (2017-04-11 00:40 -0700) wrote:
>>
>>> Alex Kost  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


signature.asc
Description: PGP signature


Re: Having trouble packaging DefaultEncrypt for Emacs

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

> Chris Marusich (2017-04-11 00:40 -0700) wrote:
>
>> Alex Kost  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



Re: Having trouble packaging DefaultEncrypt for Emacs

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

> Alex Kost  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



Re: Having trouble packaging DefaultEncrypt for Emacs

2017-04-11 Thread Chris Marusich
Alex Kost  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


signature.asc
Description: PGP signature


Re: Having trouble packaging DefaultEncrypt for Emacs

2017-04-11 Thread Chris Marusich
Alex Kost  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: .  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


signature.asc
Description: PGP signature


Re: Having trouble packaging DefaultEncrypt for Emacs

2017-04-10 Thread Alex Kost
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



Re: Having trouble packaging DefaultEncrypt for Emacs

2017-04-10 Thread Alex Kost
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: .  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



Having trouble packaging DefaultEncrypt for Emacs

2017-04-08 Thread Chris Marusich
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
From f77c1b669d91fb5ff4421da544fb2e6870ff9f56 Mon Sep 17 00:00:00 2001
From: Chris Marusich 
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



signature.asc
Description: PGP signature