Skip navigation.

exploreopera

| Help

Sign up | Help

Linux for Designers

a blog by Eckhard M. Jäger

gEdit Language Reference plugin

, , , , ,

On my way bringing SweeTS - delicious TypoScript development to Linux, i wrote an plugin for opening an external language reference for the language you are editing in gEdit. The additional "gedit-plugins" package must be installed first. The plugin is localized in german and english.

How it works:
* The external language reference can be an PDF, a DocBook XML, a CHM Windows helpfile, a PostScript file or a HTML page
* Copy the files of the gedit_reference_plugin.zip into "~/.gnome2/gedit/plugins"
* Create a folder "help" in "~/.gnome2/gedit/"
* Copy your language references to "~/.gnome2/gedit/help"
* Set the filename of your reference document as the programming language name (you can get the name easily from "View > Highlight Mode"). An example: if you have a CHM documentation "python25.chm" then rename it into "Python.chm"
* Start gEdit and enable the plugin "Language Reference" in the preferences
* After a restart the plugin appears in the help menu
* Assign the shortcut "Alt+F1" to it
* Yelp (Docbook XML), GnoChm (Windows comiled Help CHM), Firefox (HTML) or Evince (PDF, PS) are required
* Error dialogs based on Zenity

So now you have an easy access to your programming guides and preferences :smile:
If you are using Ubuntu you can grap a up-to-date version of GnoCHM at GetDeb.net.

Download:
http://files.myopera.com/area42/files/gedit_reference_plugin.zip

Other gEdit plugins i wrote:
http://my.opera.com/area42/blog/gedit-template-plugin
http://my.opera.com/area42/blog/gedit-browser-preview-plugin
A lot of other gEdit plugins can be found here.

Blender development and projectsBS Contact VRML/X3D on Linux

Comments

avatar
Anonymous writes:

The plugin didn't appear when following your instructions.

As well as this, I had to read each instruction at least 5 times. Next time you make a guide like this, could you at least list the commands to type, so I can learn that way for future reference? I'm sure others are thinking the same thing, or going else where for a guide to this.

Disappointed, cheers, Anonymous.

By anonymous user, # 13. December 2007, 20:01:55

avatar
Hello,

1st: I didn't typed in anything, i did all by mouse in Nautilus
2nd: If you getting problems installing it you should write what kind of system and version you are using
3rd: Did the plugin appeared in the preferences? Have you activate it?
Did you restarted gEdit?
4th: Did you tried starting gEdit from a shell and getting error messages there?

Thanx.

By area42, # 13. December 2007, 20:20:53

avatar
Gocho writes:

A link with some external reference files (PDF, a DocBook XML, a CHM Windows helpfile, a PostScript file or a HTML page) would be great!

The PHP docs are here:
http://www.php.net/download-docs.php

By anonymous user, # 17. December 2007, 09:56:41

avatar
Hi Gocho,

no problem, take a look at:
http://www.pspad.com/en/helpfiles.htm

:smile:

By area42, # 17. December 2007, 11:20:01

avatar
DD writes:

hi there, I get this error:
'
Traceback (most recent call last):
File "/home/pawel/.gnome2/gedit/plugins/reference.py", line 71, in <lambda>
lambda a: self._plugin.on_reference_activate(self._window))])
File "/home/pawel/.gnome2/gedit/plugins/reference.py", line 121, in on_reference_activate
ext = ext.split('.')[1]
IndexError: list index out of range
'
gedit v. 2.20.4
cheers

By anonymous user, # 5. February 2008, 11:21:40

avatar
Hello DD,

thanx for the feedback.
What are the names of the files located in "~/.gnome2/gedit/help"? Are there hidden files?

By area42, # 5. February 2008, 12:39:13

avatar
DD writes:

Hello. :)

~/.gnome2/gedit/help/php.chm ; from php site, link above, english ver opened with gnochm, no hidden files
and from your zip, and no other files:
~/.gnome2/gedit/plugins/reference.py
~/.gnome2/gedit/plugins/reference.gedit-plugin

cheers

By anonymous user, # 5. February 2008, 15:58:05

avatar
Ok,
i will try to find the bug. Thanx.

By area42, # 5. February 2008, 18:19:47

avatar
Hi,

i updated my reference plugin, now it works with unsaved files too. Please read the instructions about the changed naming of your reference documents.

By area42, # 1. March 2008, 21:23:22

avatar
mp writes:

Plugin comes up in list, but when clicking check-box to activate it, selection becomes greyed out and plugin is not activated.

::Ubuntu 7.10, Gedit 2.20.3, Python 2.5 (default install)

Ran from a shell and this was the output:

~/ $ gedit src/deal/deal.c
Traceback (most recent call last):
File "~/.gnome2/gedit/plugins/reference.py", line 29, in <module>
from gpdefs import *
ImportError: No module named gpdefs

** (gedit:1047): WARNING **: Cannot load Python plugin 'Language Reference' since file 'reference' cannot be read.

** (gedit:1047): WARNING **: Error activating plugin 'Language Reference'

By anonymous user, # 4. April 2008, 23:59:15

avatar
Hi,

thanx for the feedback. This is exactly my configuration too.

I have gEdit and gEdit additional plugins installed (in the repros too) and it still works fine.

I will take look at it.

By area42, # 5. April 2008, 08:08:32

avatar
Hi,

i checked it out, you need to install the package gedit-plugins. This is a very usefull package and will add the following features:
* Show/Hide Tabbar: Add a menu entry to show/hide the tabbar.
* Bracket Completion: Automatically adds closing brackets.
* Draw Spaces: Draw Spaces and Tabs
* Embedded Terminal: Embed a terminal in the bottom pane.
* Color Picker: Pick a color from a dialog and insert its hexadecimal representation.
* Session Saver: Save and restore your working sessions
* Join/Split Lines: Join several lines or split long ones
* Smart Spaces: Forget you're not using tabulations.
* Character Map: Insert special characters just by clicking on them.
* Code comment: Comment out or uncomment a selected block of code.

The package is included in Ubuntu.

By area42, # 5. April 2008, 15:42:30

avatar
Miguel Hermo writes:

Great plugin, thank you!!
I had the same problem than some guy before, i get the error:
Traceback (most recent call last):
File "/home/miguel/.gnome2/gedit/plugins/reference.py", line 79, in <lambda>
lambda a: self._plugin.on_reference_activate(self._window))])
File "/home/miguel/.gnome2/gedit/plugins/reference.py", line 127, in on_reference_activate
lang_name = doc.get_language().get_name()
AttributeError: 'NoneType' object has no attribute 'get_name'

---
This error happens when "view>highlighting mode" is set to "none". I suppose this can be trivially solved by checking that "doc" is a "noneType" object, but I'm sorry to say that I know nothing about python so I cannot contribute. :frown:

Also I noted that someone had problems with php, and he/she had the help file for php named as:
~/.gnome2/gedit/help/php.chm

This is not valid, because PHP is listed uppercase on the "highlighting mode" dropdown menu, and *nix is case-sensitive. So it must be named:
~/.gnome2/gedit/help/PHP.chm

The same goes for Python, it must be Python.chm and not python.chm. Just check the list from the menu and copy literally.

Hope it helped!

I hope it's usefull

By anonymous user, # 5. May 2008, 06:31:17

avatar
Thanx. I will update the plugin soon to support the new search features of envince and will try to fix this small issues too.

By area42, # 5. May 2008, 09:17:37

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

Please type this security code : f106e8

Smilies