Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-17 Thread Klaus-Dieter Bauer
In previous discussions, has Windows been taken into account? From what I
could find, even Microsoft software uses stub-program if a specific version
of a program should be launched. So it seems safe to assume that there is
no good mechanism to make the destinction work in windows.

An advantage of a likely non-conflicting file-extension like .zimwiki
would be easy cross-platform mime-type handling. Seeing how the mime-type
issue seems to make a lot of work, isn't it actually a good point to
re-discuss the extension issue?

regards, Klaus


2012/12/16 Jaap Karssenberg jaap.karssenb...@gmail.com

 On Sat, Dec 15, 2012 at 10:41 PM, Svenn Are Bjerkem
 svenn.bjer...@googlemail.com wrote:
  Isn't it more wise to use a different extension than .txt for the zim
  markup files? I guess this has been pointed out some times in the
  past? Use .zxt or .zml or .zimwiki so that .txt is reserved for pure
  text files and no need to use processing overhead on file headers to
  decide if it is a zim markup file or a pure text file attachment. .txt
  has been around longer than zim, and I have always thought it to be a
  bit 'egoistic' to grab this for a special purpose for one particular
  application.

 Yes, this has been discussed more than once on this list before. I
 personally don't think re-opening the discussion at this time will
 bring any new ideas to the table.

 Regards,

 Jaap

 ___
 Mailing list: https://launchpad.net/~zim-wiki
 Post to : zim-wiki@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~zim-wiki
 More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-17 Thread Svenn Are Bjerkem
On 17 December 2012 12:31, Klaus-Dieter Bauer
bauer.klaus.die...@gmail.com wrote:
 An advantage of a likely non-conflicting file-extension like .zimwiki
 would be easy cross-platform mime-type handling. Seeing how the mime-type
 issue seems to make a lot of work, isn't it actually a good point to
 re-discuss the extension issue?

That is the mime-type handling part of the argument to change .txt to
something less frequently used.

The other argument is that zim could painlessly be put on top of an
already existing file hierarchy if it hadn't been for the fact that
zim claims posess of all files ending in .txt for its own purpose,
with obvious unwanted side effects as .txt has been used for text
files of other formats than zim markup language.

I searched for .txt in the zim source, and I wonder if it is as simple
as changing the .txt posfixes in the stores/files.py and then do a
batch file rename of .txt files in all existing zim notebooks?
The fact that the file extension is hardcoded to .txt is actually a
TODO in the stores/files.py.

-- 
Svenn

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-16 Thread Jaap Karssenberg
On Sat, Dec 15, 2012 at 10:41 PM, Svenn Are Bjerkem
svenn.bjer...@googlemail.com wrote:
 Isn't it more wise to use a different extension than .txt for the zim
 markup files? I guess this has been pointed out some times in the
 past? Use .zxt or .zml or .zimwiki so that .txt is reserved for pure
 text files and no need to use processing overhead on file headers to
 decide if it is a zim markup file or a pure text file attachment. .txt
 has been around longer than zim, and I have always thought it to be a
 bit 'egoistic' to grab this for a special purpose for one particular
 application.

Yes, this has been discussed more than once on this list before. I
personally don't think re-opening the discussion at this time will
bring any new ideas to the table.

Regards,

Jaap

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-12 Thread Marcel Stimberg
Hi Jaap,

 Turns out that if I specify the rule for *.txt indeed ubuntu /
 nautilus get it right, but now several other appplications (based on
 spec  0.16) think all text files are zim pages :(
oh, that's bad news :-/ Could you be a bit more specific about which
other applications have issues? If it is a Ubuntu vs. other
distributions thing, we could keep the change for Ubuntu as a patch in
the Ubuntu package at least? Either way, it seems that the only
generally applicable solution is to change the file extension...

Cheers,
  Marcel

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-12 Thread Jaap Karssenberg
On Wed, Dec 12, 2012 at 4:09 PM, Marcel Stimberg
stimb...@users.sourceforge.net wrote:
 Turns out that if I specify the rule for *.txt indeed ubuntu /
 nautilus get it right, but now several other appplications (based on
 spec  0.16) think all text files are zim pages :(

 oh, that's bad news :-/ Could you be a bit more specific about which
 other applications have issues? If it is a Ubuntu vs. other
 distributions thing, we could keep the change for Ubuntu as a patch in
 the Ubuntu package at least? Either way, it seems that the only
 generally applicable solution is to change the file extension...

For one the python xdg module implements the old spec - that is how
I found out, zim itself can no longer tell text files apart when I
define the glob.

Then I tested the perl File::MimeInfo library (disclaimer: I wrote
this one myself a few years back) and it has the same flaw, so it is
not implementation specific, but really depends on how the spec works
out for this case :(

This will affect all other applications using the same libraries.

Arguably these libraries should be fixed. Plus we should test what is
implemented in KDE / xfce / ... to test we don't break any mayor
desktop environment.

Regards,

Jaap

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-11 Thread Jaap Karssenberg
On Sun, Dec 9, 2012 at 2:25 PM, Jaap Karssenberg
jaap.karssenb...@gmail.com wrote:
 Thanks for looking into this. Just read up on the latest version of
 the spec, and indeed this is now the recommended behavior. Makes
 sense.

 In previous versions of the spec this was done with the magic rule
 priority, but this was ignored by many implementations.

 Will update rules in zim's mime definition.

Had to reverse the update :(

Turns out that if I specify the rule for *.txt indeed ubuntu /
nautilus get it right, but now several other appplications (based on
spec  0.16) think all text files are zim pages :(

Will at least need to fix zim's own xdg mime implementation, but
afraid I can't turn on this rule without breaking some desktops...

Regards,

Jaap

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-09 Thread Jaap Karssenberg
On Wed, Dec 5, 2012 at 6:13 PM, Marcel Stimberg
stimb...@users.sourceforge.net wrote:
 Hi Bill and Jaap,

 The Ubuntu Dash allows the input of search terms to select a file. This
 can be used to identify a specific Zim page - quite a useful feature.
 However, as Zim pages are stored as *.txt files, the Dash opens them in the
 default text editor rather than Zim. This cancels out the usefulness :-).
 yes, I realized the same a while ago -- it quite limits the usefulness
 of the Zeitgeist integration as well (which makes recently used Zim
 pages appear in the dash).

 Actually zim already does this. We install a rule in the mime type
 information database that matches the header in zim  page files.

 Unfortunately not all other applications respect this rule and give instead
 preference to the default rule for the .txt extension. Ubuntu file
 management being one such case where this rule is ignored.
 I had a look at this issue a while ago and there did not seem to be an
 easy solution apart from changing the file extension. I was about to
 draft a bug report to the xdgmime library (which is ultimately used by
 GNOME when deciding about the filetype) when I realized that there is
 actually a problem in zim's mimetype specification: It does not define
 the *.txt extension as a glob pattern. Looking at the GIO source
 code the logic behind content type determination is:
 * Get a list of possible mimetypes for the filename from xdgmime
 * If none or more than one result is returned, look at the content of the file
 The problem is that for .txt files, only one result is returned in the
 first step, as only text/plain defines it as a glob pattern:
 $ rgrep *.txt /usr/share/mime/packages/*.xml
 /usr/share/mime/packages/freedesktop.org.xml:glob pattern=*.txt/

 After adding the same line to /usr/share/mime/packages/zim.xml (and
 updating the mime database), opening zim pages from the dash works
 like a charm!

 Thanks Bill for making me look into this again :)
 Best,
   Marcel

Thanks for looking into this. Just read up on the latest version of
the spec, and indeed this is now the recommended behavior. Makes
sense.

In previous versions of the spec this was done with the magic rule
priority, but this was ignored by many implementations.

Will update rules in zim's mime definition.

Regards,

Jaap

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


[Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-05 Thread Bill Oldroyd
This request is specific to Ubuntu. I have no idea whether it is 
relevant to other operating systems.


The Ubuntu Dash allows the input of search terms to select a file. This 
can be used to identify a specific Zim page - quite a useful feature. 
However, as Zim pages are stored as *.txt files, the Dash opens them in 
the default text editor rather than Zim. This cancels out the usefulness 
:-).


Is it possible Zim could use a dedicated file type for it's pages and 
thus automatically load pages in Zim when they are run ?.


Or, is there any other way a Zim page can be recognised by the dash ?.

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-05 Thread Jaap Karssenberg
On Wed, Dec 5, 2012 at 11:48 AM, Bill Oldroyd billoldr...@gmail.com wrote:

 This request is specific to Ubuntu. I have no idea whether it is relevant
 to other operating systems.

 The Ubuntu Dash allows the input of search terms to select a file. This
 can be used to identify a specific Zim page - quite a useful feature.
 However, as Zim pages are stored as *.txt files, the Dash opens them in the
 default text editor rather than Zim. This cancels out the usefulness :-).

 Is it possible Zim could use a dedicated file type for it's pages and thus
 automatically load pages in Zim when they are run ?.

 Or, is there any other way a Zim page can be recognised by the dash ?.


Actually zim already does this. We install a rule in the mime type
information database that matches the header in zim  page files.

Unfortunately not all other applications respect this rule and give instead
preference to the default rule for the .txt extension. Ubuntu file
management being one such case where this rule is ignored.

There has been a lot of discussion already on changing the file extension
for zim, but so far no consensus and no work defined.

One work around would be to write a small shell script that distinguishes
between zim pages and other text files and set that as the default
application to open text files.

Regards,

Jaap
___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp


Re: [Zim-wiki] Ubuntu Dash and Zim txt files

2012-12-05 Thread Marcel Stimberg
Hi Bill and Jaap,

 The Ubuntu Dash allows the input of search terms to select a file. This
 can be used to identify a specific Zim page - quite a useful feature.
 However, as Zim pages are stored as *.txt files, the Dash opens them in the
 default text editor rather than Zim. This cancels out the usefulness :-).
yes, I realized the same a while ago -- it quite limits the usefulness
of the Zeitgeist integration as well (which makes recently used Zim
pages appear in the dash).

 Actually zim already does this. We install a rule in the mime type
 information database that matches the header in zim  page files.

 Unfortunately not all other applications respect this rule and give instead
 preference to the default rule for the .txt extension. Ubuntu file
 management being one such case where this rule is ignored.
I had a look at this issue a while ago and there did not seem to be an
easy solution apart from changing the file extension. I was about to
draft a bug report to the xdgmime library (which is ultimately used by
GNOME when deciding about the filetype) when I realized that there is
actually a problem in zim's mimetype specification: It does not define
the *.txt extension as a glob pattern. Looking at the GIO source
code the logic behind content type determination is:
* Get a list of possible mimetypes for the filename from xdgmime
* If none or more than one result is returned, look at the content of the file
The problem is that for .txt files, only one result is returned in the
first step, as only text/plain defines it as a glob pattern:
$ rgrep *.txt /usr/share/mime/packages/*.xml
/usr/share/mime/packages/freedesktop.org.xml:glob pattern=*.txt/

After adding the same line to /usr/share/mime/packages/zim.xml (and
updating the mime database), opening zim pages from the dash works
like a charm!

Thanks Bill for making me look into this again :)
Best,
  Marcel

___
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zim-wiki
More help   : https://help.launchpad.net/ListHelp