all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Setting file extensions to be handled by gpg encryption problem
@ 2010-11-04 10:36 bar tomas
  2010-11-04 11:45 ` Bruno Tavernier
  0 siblings, 1 reply; 11+ messages in thread
From: bar tomas @ 2010-11-04 10:36 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I'm using gpg to encrypt files and I would like that files with 'txt'
extension be treated like 'gpg' files.
I read in the doc that this can be controlled with the variable
epa-file-name-regexp
So I added the following line at the end of my .emacs file

(setq epa-file-name-regexp "\\.txt$")

But this has absolutely no effect. I mean, if I create a txt file with
emacs, when I save it I would like for emacs to ask for an encryption
paraphrase, but it does not.

I have very little knowledge of the .emacs file, so maybe the line I
added is wrong?
Many thanks for any help



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

* Re: Setting file extensions to be handled by gpg encryption problem
  2010-11-04 10:36 Setting file extensions to be handled by gpg encryption problem bar tomas
@ 2010-11-04 11:45 ` Bruno Tavernier
  2010-11-04 12:24   ` bar tomas
  0 siblings, 1 reply; 11+ messages in thread
From: Bruno Tavernier @ 2010-11-04 11:45 UTC (permalink / raw)
  To: bar tomas; +Cc: emacs-help

Hi Tomas,

> I'm using gpg to encrypt files and I would like that files with 'txt'
> extension be treated like 'gpg' files.
> I read in the doc that this can be controlled with the variable
> epa-file-name-regexp
> So I added the following line at the end of my .emacs file
>
> (setq epa-file-name-regexp "\\.txt$")
>
> But this has absolutely no effect. I mean, if I create a txt file with
> emacs, when I save it I would like for emacs to ask for an encryption
> paraphrase, but it does not.

I just tried, it indeed does not work with that line only.
You have then to call `epa-file-name-regexp-update' to make it works.

cf describe-variable epa-file-name-regexp
,----
| epa-file-name-regexp is a variable defined in `epa-hook.el'.
| Its value is 
| "\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'"
| 
| Documentation:
| Regexp which matches filenames to be encrypted with GnuPG.
| 
| If you set this outside Custom while epa-file is already enabled, you
| have to call `epa-file-name-regexp-update' after setting it to
| properly update file-name-handler-alist.  Setting this through Custom
| does that automatically.
`----

-- 
Bruno



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

* Re: Setting file extensions to be handled by gpg encryption problem
  2010-11-04 11:45 ` Bruno Tavernier
@ 2010-11-04 12:24   ` bar tomas
  2010-11-04 15:39     ` bar tomas
       [not found]     ` <mailman.2.1288886101.27623.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 11+ messages in thread
From: bar tomas @ 2010-11-04 12:24 UTC (permalink / raw)
  To: Bruno Tavernier; +Cc: emacs-help

Many thanks!
I defined it in custom-set-variables in the .emacs init file, as
suggested in your post and now it works directly:

(custom-set-variables
'(epa-file-name-regexp "\\.txt$"))

Thanks again.


On Thu, Nov 4, 2010 at 11:45 AM, Bruno Tavernier
<tavernier.bruno@gmail.com> wrote:
> Hi Tomas,
>
>> I'm using gpg to encrypt files and I would like that files with 'txt'
>> extension be treated like 'gpg' files.
>> I read in the doc that this can be controlled with the variable
>> epa-file-name-regexp
>> So I added the following line at the end of my .emacs file
>>
>> (setq epa-file-name-regexp "\\.txt$")
>>
>> But this has absolutely no effect. I mean, if I create a txt file with
>> emacs, when I save it I would like for emacs to ask for an encryption
>> paraphrase, but it does not.
>
> I just tried, it indeed does not work with that line only.
> You have then to call `epa-file-name-regexp-update' to make it works.
>
> cf describe-variable epa-file-name-regexp
> ,----
> | epa-file-name-regexp is a variable defined in `epa-hook.el'.
> | Its value is
> | "\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'"
> |
> | Documentation:
> | Regexp which matches filenames to be encrypted with GnuPG.
> |
> | If you set this outside Custom while epa-file is already enabled, you
> | have to call `epa-file-name-regexp-update' after setting it to
> | properly update file-name-handler-alist.  Setting this through Custom
> | does that automatically.
> `----
>
> --
> Bruno
>



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

* Re: Setting file extensions to be handled by gpg encryption problem
  2010-11-04 12:24   ` bar tomas
@ 2010-11-04 15:39     ` bar tomas
  2010-11-05  5:01       ` PJ Weisberg
       [not found]     ` <mailman.2.1288886101.27623.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 11+ messages in thread
From: bar tomas @ 2010-11-04 15:39 UTC (permalink / raw)
  To: emacs-help

Hi,
I just realized that the problem of writing

> (custom-set-variables
> '(epa-file-name-regexp "\\.txt$"))

as I put in my previous post to force emacs to treat txt files with
gpg encryption is that files of extension gpg then do not trigger the
gpg mode.
I tried wrting a regular expression that would include both txt and
gpg extension files like this:

(custom-set-variables
'(epa-file-name-regexp "\(\\.txt$\)\|\(\\.gpg$\)")
)
But there must be an error in my regular expression, because it doesn't work.
Many thanks for any help pointing out my error


On Thu, Nov 4, 2010 at 12:24 PM, bar tomas <bartomas@gmail.com> wrote:
> Many thanks!
> I defined it in custom-set-variables in the .emacs init file, as
> suggested in your post and now it works directly:
>
> (custom-set-variables
> '(epa-file-name-regexp "\\.txt$"))
>
> Thanks again.
>
>
> On Thu, Nov 4, 2010 at 11:45 AM, Bruno Tavernier
> <tavernier.bruno@gmail.com> wrote:
>> Hi Tomas,
>>
>>> I'm using gpg to encrypt files and I would like that files with 'txt'
>>> extension be treated like 'gpg' files.
>>> I read in the doc that this can be controlled with the variable
>>> epa-file-name-regexp
>>> So I added the following line at the end of my .emacs file
>>>
>>> (setq epa-file-name-regexp "\\.txt$")
>>>
>>> But this has absolutely no effect. I mean, if I create a txt file with
>>> emacs, when I save it I would like for emacs to ask for an encryption
>>> paraphrase, but it does not.
>>
>> I just tried, it indeed does not work with that line only.
>> You have then to call `epa-file-name-regexp-update' to make it works.
>>
>> cf describe-variable epa-file-name-regexp
>> ,----
>> | epa-file-name-regexp is a variable defined in `epa-hook.el'.
>> | Its value is
>> | "\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'"
>> |
>> | Documentation:
>> | Regexp which matches filenames to be encrypted with GnuPG.
>> |
>> | If you set this outside Custom while epa-file is already enabled, you
>> | have to call `epa-file-name-regexp-update' after setting it to
>> | properly update file-name-handler-alist.  Setting this through Custom
>> | does that automatically.
>> `----
>>
>> --
>> Bruno
>>
>



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

* Re: Setting file extensions to be handled by gpg encryption problem
       [not found]     ` <mailman.2.1288886101.27623.help-gnu-emacs@gnu.org>
@ 2010-11-04 19:42       ` Stefan Monnier
  0 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2010-11-04 19:42 UTC (permalink / raw)
  To: help-gnu-emacs

> (custom-set-variables
> '(epa-file-name-regexp "\(\\.txt$\)\|\(\\.gpg$\)")
> )

You want something like:

   (custom-set-variables
   '(epa-file-name-regexp "\\.\\(txt\\|gpg\\)\\'"))
or
   (custom-set-variables
   '(epa-file-name-regexp "\\.txt\\'\\|\\.gpg\\'"))

In a string (i.e. with the "...") a \( is just the same as a (, so it's
important to double your backslashes in order for them to be visible to
the regexp engine.

Note how I used \' (match the end of text) rather than $ (match the end
of line).


        Stefan


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

* Re: Setting file extensions to be handled by gpg encryption problem
  2010-11-04 15:39     ` bar tomas
@ 2010-11-05  5:01       ` PJ Weisberg
  2010-11-06 14:15         ` bar tomas
  0 siblings, 1 reply; 11+ messages in thread
From: PJ Weisberg @ 2010-11-05  5:01 UTC (permalink / raw)
  To: bar tomas; +Cc: emacs-help

On Thu, Nov 4, 2010 at 3:39 PM, bar tomas <bartomas@gmail.com> wrote:
> Hi,
> I just realized that the problem of writing
>
>> (custom-set-variables
>> '(epa-file-name-regexp "\\.txt$"))
>
> as I put in my previous post to force emacs to treat txt files with
> gpg encryption is that files of extension gpg then do not trigger the
> gpg mode.
> I tried wrting a regular expression that would include both txt and
> gpg extension files like this:
>
> (custom-set-variables
> '(epa-file-name-regexp "\(\\.txt$\)\|\(\\.gpg$\)")
> )
> But there must be an error in my regular expression, because it doesn't work.
> Many thanks for any help pointing out my error

I haven't actually tried it, but it looks like you mean "(\\.txt$)|(\\.gpg$)"



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

* Re: Setting file extensions to be handled by gpg encryption problem
  2010-11-05  5:01       ` PJ Weisberg
@ 2010-11-06 14:15         ` bar tomas
  2010-11-06 17:20           ` Suvayu Ali
                             ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: bar tomas @ 2010-11-06 14:15 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: emacs-help

Many thanks for your help, but the regular expression you suggest
doesn't seem to capture file names with extension txt or gpg.
I've tried to test it in an emacs buffer and tried both
(\\.txt$)|(\\.gpg$) and (\.txt$)|(\.gpg$) but it doesn't seem to work
either.
Many thanks for any help

Tomas Bar

On Fri, Nov 5, 2010 at 5:01 AM, PJ Weisberg <pj@irregularexpressions.net> wrote:
> On Thu, Nov 4, 2010 at 3:39 PM, bar tomas <bartomas@gmail.com> wrote:
>> Hi,
>> I just realized that the problem of writing
>>
>>> (custom-set-variables
>>> '(epa-file-name-regexp "\\.txt$"))
>>
>> as I put in my previous post to force emacs to treat txt files with
>> gpg encryption is that files of extension gpg then do not trigger the
>> gpg mode.
>> I tried wrting a regular expression that would include both txt and
>> gpg extension files like this:
>>
>> (custom-set-variables
>> '(epa-file-name-regexp "\(\\.txt$\)\|\(\\.gpg$\)")
>> )
>> But there must be an error in my regular expression, because it doesn't work.
>> Many thanks for any help pointing out my error
>
> I haven't actually tried it, but it looks like you mean "(\\.txt$)|(\\.gpg$)"
>



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

* Re: Setting file extensions to be handled by gpg encryption problem
  2010-11-06 14:15         ` bar tomas
@ 2010-11-06 17:20           ` Suvayu Ali
  2010-11-06 18:03           ` Thierry Volpiatto
  2010-11-06 21:11           ` Steve Revilak
  2 siblings, 0 replies; 11+ messages in thread
From: Suvayu Ali @ 2010-11-06 17:20 UTC (permalink / raw)
  To: help-gnu-emacs

On Saturday 06 November 2010 07:15 AM, bar tomas wrote:
> Many thanks for your help, but the regular expression you suggest
> doesn't seem to capture file names with extension txt or gpg.
> I've tried to test it in an emacs buffer and tried both
> (\\.txt$)|(\\.gpg$) and (\.txt$)|(\.gpg$) but it doesn't seem to work
> either.

I think you need to escape the parentheses too. Try,

\\(\\.txt$\\)\\|\\(\\.gpg$\\)

> Many thanks for any help
>
> Tomas Bar

-- 
Suvayu

Open source is the future. It sets us free.



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

* Re: Setting file extensions to be handled by gpg encryption problem
  2010-11-06 14:15         ` bar tomas
  2010-11-06 17:20           ` Suvayu Ali
@ 2010-11-06 18:03           ` Thierry Volpiatto
  2010-11-06 21:11           ` Steve Revilak
  2 siblings, 0 replies; 11+ messages in thread
From: Thierry Volpiatto @ 2010-11-06 18:03 UTC (permalink / raw)
  To: help-gnu-emacs

bar tomas <bartomas@gmail.com> writes:

> Many thanks for your help, but the regular expression you suggest
> doesn't seem to capture file names with extension txt or gpg.
> I've tried to test it in an emacs buffer and tried both
> (\\.txt$)|(\\.gpg$) and (\.txt$)|(\.gpg$) but it doesn't seem to work
> either.
> Many thanks for any help
Here is the default regexp:

"\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'"

Here what you could use:

"\\.gpg\\|\\.txt\\(~\\|\\.~[0-9]+~\\)?\\'"

You don't need two groups.

The second part of the regexp is needed if you want that backup files
of your encrypted files be encrypted (e.g toto.gpg ==> toto.gpg~4~)

> Tomas Bar
>
> On Fri, Nov 5, 2010 at 5:01 AM, PJ Weisberg <pj@irregularexpressions.net> wrote:
>> On Thu, Nov 4, 2010 at 3:39 PM, bar tomas <bartomas@gmail.com> wrote:
>>> Hi,
>>> I just realized that the problem of writing
>>>
>>>> (custom-set-variables
>>>> '(epa-file-name-regexp "\\.txt$"))
>>>
>>> as I put in my previous post to force emacs to treat txt files with
>>> gpg encryption is that files of extension gpg then do not trigger the
>>> gpg mode.
>>> I tried wrting a regular expression that would include both txt and
>>> gpg extension files like this:
>>>
>>> (custom-set-variables
>>> '(epa-file-name-regexp "\(\\.txt$\)\|\(\\.gpg$\)")
>>> )
>>> But there must be an error in my regular expression, because it doesn't work.
>>> Many thanks for any help pointing out my error
>>
>> I haven't actually tried it, but it looks like you mean "(\\.txt$)|(\\.gpg$)"
>>
>
>

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




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

* Re: Setting file extensions to be handled by gpg encryption problem
  2010-11-06 14:15         ` bar tomas
  2010-11-06 17:20           ` Suvayu Ali
  2010-11-06 18:03           ` Thierry Volpiatto
@ 2010-11-06 21:11           ` Steve Revilak
  2010-11-08  9:40             ` bar tomas
  2 siblings, 1 reply; 11+ messages in thread
From: Steve Revilak @ 2010-11-06 21:11 UTC (permalink / raw)
  To: help-gnu-emacs

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

>From: bar tomas

>Many thanks for your help, but the regular expression you suggest
>doesn't seem to capture file names with extension txt or gpg.
>I've tried to test it in an emacs buffer and tried both
>(\\.txt$)|(\\.gpg$) and (\.txt$)|(\.gpg$) but it doesn't seem to work
>either.

Tomas,

I believe that

  (custom-set-variables 
    '(epa-file-name-regexp "\\.\\(txt\\|gpg\\)$"))

may be what you're looking for.

Steve

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: Setting file extensions to be handled by gpg encryption problem
  2010-11-06 21:11           ` Steve Revilak
@ 2010-11-08  9:40             ` bar tomas
  0 siblings, 0 replies; 11+ messages in thread
From: bar tomas @ 2010-11-08  9:40 UTC (permalink / raw)
  To: help-gnu-emacs

Many thanks for all the replies. It works now.

On Sat, Nov 6, 2010 at 9:11 PM, Steve Revilak <steve@srevilak.net> wrote:
>> From: bar tomas
>
>> Many thanks for your help, but the regular expression you suggest
>> doesn't seem to capture file names with extension txt or gpg.
>> I've tried to test it in an emacs buffer and tried both
>> (\\.txt$)|(\\.gpg$) and (\.txt$)|(\.gpg$) but it doesn't seem to work
>> either.
>
> Tomas,
>
> I believe that
>
>  (custom-set-variables    '(epa-file-name-regexp "\\.\\(txt\\|gpg\\)$"))
>
> may be what you're looking for.
>
> Steve
>



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

end of thread, other threads:[~2010-11-08  9:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-04 10:36 Setting file extensions to be handled by gpg encryption problem bar tomas
2010-11-04 11:45 ` Bruno Tavernier
2010-11-04 12:24   ` bar tomas
2010-11-04 15:39     ` bar tomas
2010-11-05  5:01       ` PJ Weisberg
2010-11-06 14:15         ` bar tomas
2010-11-06 17:20           ` Suvayu Ali
2010-11-06 18:03           ` Thierry Volpiatto
2010-11-06 21:11           ` Steve Revilak
2010-11-08  9:40             ` bar tomas
     [not found]     ` <mailman.2.1288886101.27623.help-gnu-emacs@gnu.org>
2010-11-04 19:42       ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.