When looking for the type of a file according to its name, Cameleon tries each regular expression in the order they appear in the list, and stops with the first regular expression matching the filename.
You can create menus, menu commands and separators. Menu commands are defined by a label (which will appear in the menu) and a command (internal of external, see 11.4). Activating a menu command launches the associated internal of external command.
Command | Description |
exec | Make the user give a Cameleon command name and execute it. This comment is associated to the following command, thanks to our custom ocamldoc generator. |
mozilla | Make the user give an url and launch mozilla with this url. If no url is given, make the user type it. In this case, the default url begins with http:// or file:///, depending on whether a directory is selected or not. |
Editor | Description |
epeire | Launch epeire (the one installed with Cameleon)
on the given Epeire configuration file. |
gimp | Launch gimp on the given file. |
glade | Launch glade on the given file. |
gv | Launch gv on the given file. |
gvim | Launch a gvim serveur named "CAMELEON_GVIM" or connect to the existing one, if any. |
xfig | Launch xfig on the given file. |
Command | Description |
make | Run make in the selected directory, on the given targets. |
Command | Description |
omom | omom template target uses the selected OCamlmake-o-matic file
to generate the given template in the given target file.
omom does the same after having asked the template and the
target file to the user. |
Editor | Description |
omom | Edit OCamlmake-o-matic files in the graphical editor. |
(* *)
(* This program is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU General Public License for more details. *)
(* *)
(* You should have received a copy of the GNU General Public License *)
(* along with this program; if not, write to the Free Software *)
(* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *)
(* 02111-1307 USA *)
(* *)
(* Contact: Maxence.Guesdon@inria.fr *)
(**************************************************************************) |
(** Utils plugin. This plugin provides some basic commands to show how to create your own plugin.*) |
open Cam_plug
(** Make the user give a Cameleon command name and execute it. This comment is associated to the following command, thanks to our custom ocamldoc generator. @command exec *) |
let exec args =
match args with
| [] ->
(
let coms = Cam_plug.available_commands () in
let com = ref (try List.hd coms with _ -> "") in
let p = Configwin.combo
~f: (fun s -> com := s)
~new_allowed: true
~blank_allowed: false
"Command : "
coms
!com
in
match Configwin.simple_get "execute" [p] with
Configwin.Return_cancel | Configwin.Return_apply -> ()
| Configwin.Return_ok -> Cam_plug.eval !com ()
)
| l ->
let com = String.concat " " l in
Cam_plug.eval com ()
(** Make the user give an url and launch mozilla with this url. If no url is given, make the user type it. In this case, the default url begins with http:// or file:///, depending on whether a directory is selected or not. @command mozilla *) |
let mozilla args =
let url_opt =
match args with
url :: _ -> Some url
| [] ->
GToolbox.input_string ~title: "mozilla"
~text: (match selected_dir() with None -> "http://" | Some s -> "file:///"^s)
"url: "
in
match url_opt with
None -> ()
| Some s -> ignore (Sys.command ("mozilla "^(Filename.quote s)^" &"))
let _ = add_command "exec" "execute a prompted command" exec
let _ = add_command "mozilla" "launch mozilla on a given url" mozilla