public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Regtool can't set default value?
@ 2015-09-28 16:46 David Dyer-Bennet
  2015-09-28 17:54 ` Brian Inglis
  0 siblings, 1 reply; 4+ messages in thread
From: David Dyer-Bennet @ 2015-09-28 16:46 UTC (permalink / raw)
  To: cygwin

I'm not sure I'm understanding this right.  I'm trying to duplicate a 
manual setup that works (for making text files in general have an edit 
right-click option that invokes emacsclientw).

In that manual setup, (sorry, using cygwin path notation while referring 
to regedit, of course in regedit the path shows in Windows notation) 
I've set up /root/txtfile/shell/edit/command with a value named 
"(Default)" of type REG_EXPAND_SQ whose data is a (windows-style of 
course) path to emacsclientw.exe (plus some switches plus "%1" for the 
file name at the end).  That works -- the right-click menu for a file 
known to Windows as a txtfile (like foo.txt) has an "edit" entry, which 
when clicked invokes emacsclientw.

I'm trying to create this in a script using cygwin regtool.  I can 
create a key of /root/txtfile/shell/edit with a value of command having 
the right data -- but that of course does not work.  I can create a key 
of /root/txtfile/shell/edit/command with *two* values named (Default), 
the second of which is my value -- but that also does not work.  (And I 
can't delete the first value (Default) even in regedit.)

I clearly don't understand something about the data that Regedit 
displays under the name (Default), and how to create, delete, get, and 
set value to it.

How do I create this simple scenario using regtool?  (It's not actually 
emacs-specific, if you look at the default Windows registry for 
/root/txtfile/shell/open/command you'll find a value named "(Default)" 
of type REG_EXPAND_SZ giving a path to notepad.exe.  If I wanted to 
produce that using regtool, how would I do that?)

(If there's no way to do it with regtool, that's weird, and in 
particular a huge deficit in regtool since configuring preferred 
handling of various file-types seems like one of the things you'd really 
want to be able to do.

(It *ought* to be possible for my script to write a .reg file that it 
then feeds to regedit as an alternative way to do it, and if I can't 
make regtool work I'll try that, but I don't need suggestions about 
that, at least not yet -- I know how to do that, but am currently trying 
to understand regtool, and will only give up if we determine fairly 
authoritatively that regtool can't do what I need.)
-- 
David Dyer-Bennet, dd-b@dd-b.net; http://dd-b.net/
Snapshots: http://dd-b.net/dd-b/SnapshotAlbum/data/
Photos: http://dd-b.net/photography/gallery/
Dragaera: http://dragaera.info    Nikon DSLR photo list: 
http://d4scussion.com

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Regtool can't set default value?
  2015-09-28 16:46 Regtool can't set default value? David Dyer-Bennet
@ 2015-09-28 17:54 ` Brian Inglis
  2015-09-30  2:10   ` David Dyer-Bennet
  2015-09-30  3:43   ` David Dyer-Bennet
  0 siblings, 2 replies; 4+ messages in thread
From: Brian Inglis @ 2015-09-28 17:54 UTC (permalink / raw)
  To: cygwin

David Dyer-Bennet <dd-b <at> dd-b.net> writes:

> 
> I'm not sure I'm understanding this right.  I'm trying to duplicate a 
> manual setup that works (for making text files in general have an edit 
> right-click option that invokes emacsclientw).
> 
> In that manual setup, (sorry, using cygwin path notation while referring 
> to regedit, of course in regedit the path shows in Windows notation) 
> I've set up /root/txtfile/shell/edit/command with a value named 
> "(Default)" of type REG_EXPAND_SQ whose data is a (windows-style of 
> course) path to emacsclientw.exe (plus some switches plus "%1" for the 
> file name at the end).  That works -- the right-click menu for a file 
> known to Windows as a txtfile (like foo.txt) has an "edit" entry, which 
> when clicked invokes emacsclientw.
> 
> I'm trying to create this in a script using cygwin regtool.  I can 
> create a key of /root/txtfile/shell/edit with a value of command having 
> the right data -- but that of course does not work.  I can create a key 
> of /root/txtfile/shell/edit/command with *two* values named (Default), 
> the second of which is my value -- but that also does not work.  (And I 
> can't delete the first value (Default) even in regedit.)
> 
> I clearly don't understand something about the data that Regedit 
> displays under the name (Default), and how to create, delete, get, and 
> set value to it.
> 
> How do I create this simple scenario using regtool?  (It's not actually 
> emacs-specific, if you look at the default Windows registry for 
> /root/txtfile/shell/open/command you'll find a value named "(Default)" 
> of type REG_EXPAND_SZ giving a path to notepad.exe.  If I wanted to 
> produce that using regtool, how would I do that?)
> 
> (If there's no way to do it with regtool, that's weird, and in 
> particular a huge deficit in regtool since configuring preferred 
> handling of various file-types seems like one of the things you'd really 
> want to be able to do.
> 
> (It *ought* to be possible for my script to write a .reg file that it 
> then feeds to regedit as an alternative way to do it, and if I can't 
> make regtool work I'll try that, but I don't need suggestions about 
> that, at least not yet -- I know how to do that, but am currently trying 
> to understand regtool, and will only give up if we determine fairly 
> authoritatively that regtool can't do what I need.)

Use regedit export and import and Cygwin ls /proc/registry as well as
regtool list on your entries to compare what works and what doesn't. 
You will probably find that in your script you need to quote quotes (") and
backslashes (\), possibly multiple times, to get the path strings set
properly - exported .reg files contain backslashed quotes, so getting that
working in a script requires extra backslashes and/or quotes. 
Testing scripts by running via bash -vx script can show useful info like
substitution results. 
Somewhere I can't find just now documents that some tool(s) use "@" to name
(Default) - it is not actually named "(Default)".



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Regtool can't set default value?
  2015-09-28 17:54 ` Brian Inglis
@ 2015-09-30  2:10   ` David Dyer-Bennet
  2015-09-30  3:43   ` David Dyer-Bennet
  1 sibling, 0 replies; 4+ messages in thread
From: David Dyer-Bennet @ 2015-09-30  2:10 UTC (permalink / raw)
  To: cygwin

On 9/28/2015 12:54, Brian Inglis wrote:
> David Dyer-Bennet <dd-b <at> dd-b.net> writes:
>
>>
>> I'm not sure I'm understanding this right.  I'm trying to duplicate a
>> manual setup that works (for making text files in general have an edit
>> right-click option that invokes emacsclientw).
>>
>> In that manual setup, (sorry, using cygwin path notation while referring
>> to regedit, of course in regedit the path shows in Windows notation)
>> I've set up /root/txtfile/shell/edit/command with a value named
>> "(Default)" of type REG_EXPAND_SQ whose data is a (windows-style of
>> course) path to emacsclientw.exe (plus some switches plus "%1" for the
>> file name at the end).  That works -- the right-click menu for a file
>> known to Windows as a txtfile (like foo.txt) has an "edit" entry, which
>> when clicked invokes emacsclientw.
>>
>> I'm trying to create this in a script using cygwin regtool.  I can
>> create a key of /root/txtfile/shell/edit with a value of command having
>> the right data -- but that of course does not work.  I can create a key
>> of /root/txtfile/shell/edit/command with *two* values named (Default),
>> the second of which is my value -- but that also does not work.  (And I
>> can't delete the first value (Default) even in regedit.)
>>
>> I clearly don't understand something about the data that Regedit
>> displays under the name (Default), and how to create, delete, get, and
>> set value to it.
>>
>> How do I create this simple scenario using regtool?  (It's not actually
>> emacs-specific, if you look at the default Windows registry for
>> /root/txtfile/shell/open/command you'll find a value named "(Default)"
>> of type REG_EXPAND_SZ giving a path to notepad.exe.  If I wanted to
>> produce that using regtool, how would I do that?)
>>
>> (If there's no way to do it with regtool, that's weird, and in
>> particular a huge deficit in regtool since configuring preferred
>> handling of various file-types seems like one of the things you'd really
>> want to be able to do.
>>
>> (It *ought* to be possible for my script to write a .reg file that it
>> then feeds to regedit as an alternative way to do it, and if I can't
>> make regtool work I'll try that, but I don't need suggestions about
>> that, at least not yet -- I know how to do that, but am currently trying
>> to understand regtool, and will only give up if we determine fairly
>> authoritatively that regtool can't do what I need.)
>
> Use regedit export and import and Cygwin ls /proc/registry as well as
> regtool list on your entries to compare what works and what doesn't.
> You will probably find that in your script you need to quote quotes (") and
> backslashes (\), possibly multiple times, to get the path strings set
> properly - exported .reg files contain backslashed quotes, so getting that
> working in a script requires extra backslashes and/or quotes.

Not having a quoting problem in regtool; I copy and paste the value set 
by regtool (in the wrong place) to the right place using regedit, and it 
works (also it looks right).  (Quoting looks much messier in .reg files 
for regedit though!  All the things you mention.)

Ooh -- *three* different ways to look at things.  I'm just so *sure* 
that will help :-).  (Wonder how often all three will agree?)  (Thanks, 
had forgotten about /proc/registry).

> Testing scripts by running via bash -vx script can show useful info like
> substitution results.

I've tested pretty thoroughly that the problem is the *location* (name), 
not the value; I'm setting the values correctly.

> Somewhere I can't find just now documents that some tool(s) use "@" to name
> (Default) - it is not actually named "(Default)".

Regedit files use that -- but  using "@" as the value  name in regtool 
doesn't help, it just creates a new one named "@".

Thanks!  Going to go poke at the script with a pointed stick for a while 
longer now.

-- 
David Dyer-Bennet, dd-b@dd-b.net; http://dd-b.net/
Snapshots: http://dd-b.net/dd-b/SnapshotAlbum/data/
Photos: http://dd-b.net/photography/gallery/
Dragaera: http://dragaera.info     Nikon DSLR photo list: 
http://d4scussion.com

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

* Re: Regtool can't set default value?
  2015-09-28 17:54 ` Brian Inglis
  2015-09-30  2:10   ` David Dyer-Bennet
@ 2015-09-30  3:43   ` David Dyer-Bennet
  1 sibling, 0 replies; 4+ messages in thread
From: David Dyer-Bennet @ 2015-09-30  3:43 UTC (permalink / raw)
  To: cygwin

This does it:

regtool add '/root/SystemFileAssociations/text/shell/edit/command'
regtool set '/root/SystemFileAssociations/text/shell/edit/command/' -s 
"$EDITWITHEMACS"

(If $EDITWITHEMACS is set to a suitable value)

On 9/28/2015 12:54, Brian Inglis wrote:
> David Dyer-Bennet <dd-b <at> dd-b.net> writes:
>
>>
>> I'm not sure I'm understanding this right.  I'm trying to duplicate a
>> manual setup that works (for making text files in general have an edit
>> right-click option that invokes emacsclientw).
>>
>> In that manual setup, (sorry, using cygwin path notation while referring
>> to regedit, of course in regedit the path shows in Windows notation)
>> I've set up /root/txtfile/shell/edit/command with a value named
>> "(Default)" of type REG_EXPAND_SQ whose data is a (windows-style of
>> course) path to emacsclientw.exe (plus some switches plus "%1" for the
>> file name at the end).  That works -- the right-click menu for a file
>> known to Windows as a txtfile (like foo.txt) has an "edit" entry, which
>> when clicked invokes emacsclientw.
>>
>> I'm trying to create this in a script using cygwin regtool.  I can
>> create a key of /root/txtfile/shell/edit with a value of command having
>> the right data -- but that of course does not work.  I can create a key
>> of /root/txtfile/shell/edit/command with *two* values named (Default),
>> the second of which is my value -- but that also does not work.  (And I
>> can't delete the first value (Default) even in regedit.)
>>
>> I clearly don't understand something about the data that Regedit
>> displays under the name (Default), and how to create, delete, get, and
>> set value to it.
>>
>> How do I create this simple scenario using regtool?  (It's not actually
>> emacs-specific, if you look at the default Windows registry for
>> /root/txtfile/shell/open/command you'll find a value named "(Default)"
>> of type REG_EXPAND_SZ giving a path to notepad.exe.  If I wanted to
>> produce that using regtool, how would I do that?)
>>
>> (If there's no way to do it with regtool, that's weird, and in
>> particular a huge deficit in regtool since configuring preferred
>> handling of various file-types seems like one of the things you'd really
>> want to be able to do.
>>
>> (It *ought* to be possible for my script to write a .reg file that it
>> then feeds to regedit as an alternative way to do it, and if I can't
>> make regtool work I'll try that, but I don't need suggestions about
>> that, at least not yet -- I know how to do that, but am currently trying
>> to understand regtool, and will only give up if we determine fairly
>> authoritatively that regtool can't do what I need.)
>
> Use regedit export and import and Cygwin ls /proc/registry as well as
> regtool list on your entries to compare what works and what doesn't.
> You will probably find that in your script you need to quote quotes (") and
> backslashes (\), possibly multiple times, to get the path strings set
> properly - exported .reg files contain backslashed quotes, so getting that
> working in a script requires extra backslashes and/or quotes.
> Testing scripts by running via bash -vx script can show useful info like
> substitution results.
> Somewhere I can't find just now documents that some tool(s) use "@" to name
> (Default) - it is not actually named "(Default)".
>
>
>
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>


-- 
David Dyer-Bennet, dd-b@dd-b.net; http://dd-b.net/
Snapshots: http://dd-b.net/dd-b/SnapshotAlbum/data/
Photos: http://dd-b.net/photography/gallery/
Dragaera: http://dragaera.info     Nikon DSLR photo list: 
http://d4scussion.com

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

end of thread, other threads:[~2015-09-30  3:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-28 16:46 Regtool can't set default value? David Dyer-Bennet
2015-09-28 17:54 ` Brian Inglis
2015-09-30  2:10   ` David Dyer-Bennet
2015-09-30  3:43   ` David Dyer-Bennet

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