[Eric] Eric4 and javascript files

Detlev Offenbach detlev at die-offenbachs.de
Fri May 20 17:18:28 BST 2011


On Freitag, 20. Mai 2011, lizard at blue.dyn-o-saur.com wrote:
> Hi,
> 
> this is the command i came up with yesterday night too.
> I extracted it from Project/ProjectOthersBrowser.py.
> The problem is that eric relies on the mimetypes.guess_type AND needs
> the change you already mentioned in /etc/mime.types.
> If you take a look into mimetypes.py on your system you see that
> /etc/mime.types
> is not the only file that gets parsed to find the mime type. It is the
> first file
> in an list. Entries in the later files may overwrite entries made from
> former ones.
> On my system i have an additional file that gets parsed
> /etc/httpd/conf/mime.types that
> itself has an entry for .js files. It is application/javascript of
> course. This file comes
> from the Apache installation and I advise against changing it.
> After removing Apache test wise from my system Eric4 works as expected.

Thanks for this explanation. 

> 
> On Thu, 19 May 2011 19:37:45 +0200, Detlev Offenbach wrote:
> > Hello,
> > 
> > please perform the following steps in a Python shell
> > 
> > import mimetypes
> > print mimetypes.guess_type(<filename goes here>)
> > 
> > and check, that the first entry is either None or text/... That is
> > the same
> > logic eric uses to decide to open it with the editor or pass it on to
> > your
> > system (i.e. default application).
> > 
> > On Mittwoch, 18. Mai 2011, lizard at blue.dyn-o-saur.com wrote:
> >> Thank you for your response.
> >> My /etc/mime.types has the entry you mention and it is the only one.
> >> grep js /etc/mime.types
> >> 758:text/x-js					js
> >> 
> >> I noticed that xdg-mime query filetype static/menu.js lists the js
> >> file
> >> as application/javascript. I changed this using kcmshell4 filetypes
> >> where i set another
> >> extension for application/javascript and created an entry text/x-js
> >> with .js associated
> >> and no application in the list. xdg-mime query filetype list a js
> >> file
> >> now as  text/x-js
> >> Eric4 still does not work as expected. It asks me for an application
> >> when i click on an
> >> .js file in the project. Of course this happens because i have not
> >> associated an application
> >> with this mime type.
> >> 
> >> 
> >> 
> >> 
> >> On Wed, 18 May 2011 19:19:05 +0200, Detlev Offenbach wrote:
> >> On Mittwoch, 18. Mai 2011, lizard at blue.dyn-o-saur.com wrote:
> >> Hi.
> >> I am using Eric4 4.4.13 as supplied by archlinux. I try to edit .js
> >> file but it is not working as expected.
> >> I am able to load .js files from command line or through the
> >> File->Open
> >> menu but when trying to edit .js files
> >> within an project eric4 starts kwrite. I modified /etc/mime.types
> >> but
> >> this shows no effect.
> >> 
> >> My /etc/mime.types has an entry of "text/x-js js" for javascript. It
> >> works
> >> fine over here. eric uses the mime type to determine, if the file is
> >> a
> >> text
> >> file (i.e. mime type starts with 'text/'). If so, the internal
> >> editor
> >> is used.
> >> If not, the standard application of the system is used. Please check
> >> your
> >> /etc/mime.types for such an entry and if it is there check, that it
> >> is
> >> not
> >> overwritten later on in the file by something starting with e.g.
> >> application/.
> >> 
> >> I also changed
> >> the file type association in kde which changes what editor Eric4/kde
> >> starts for .js files. I even put eric4
> >> as editor for .js file in kde. Then eric4 starts another eric4 with
> >> the
> >> .js file but not in the same project.
> >> I read on the mailing list that this is no new problem.
> >> Unfortunately i
> >> did not found a solution.
> >> Does anybody have an advice?
> >> _______________________________________________
> >> Eric mailing list
> >> Eric at riverbankcomputing.com
> >> http://www.riverbankcomputing.com/mailman/listinfo/eric
> >> _______________________________________________
> >> Eric mailing list
> >> Eric at riverbankcomputing.com
> >> http://www.riverbankcomputing.com/mailman/listinfo/eric


-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the Eric mailing list