Revision: 1577
http://svn.sourceforge.net/geany/?rev=1577&view=rev
Author: eht16
Date: 2007-05-26 02:23:44 -0700 (Sat, 26 May 2007)
Log Message:
-----------
Better to use setptr macro.
Modified Paths:
--------------
trunk/src/filetypes.c
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2007-05-26 09:03:02 UTC (rev 1576)
+++ trunk/src/filetypes.c 2007-05-26 09:23:44 UTC (rev 1577)
@@ -654,15 +654,14 @@
filetype *filetypes_detect_from_filename(const gchar *utf8_filename)
{
GPatternSpec *pattern;
+ gchar *base_filename;
gint i, j;
// to match against the basename of the file(because of Makefile*)
+ base_filename = g_path_get_basename(utf8_filename);
#ifdef G_OS_WIN32
- gchar *tmp = g_path_get_basename(utf8_filename);
- gchar *base_filename = g_utf8_strdown(tmp, -1);
- g_free(tmp);
-#else
- gchar *base_filename = g_path_get_basename(utf8_filename);
+ // use lower case basename
+ setptr(base_filename, g_utf8_strdown(base_filename, -1));
#endif
for(i = 0; i < GEANY_MAX_FILE_TYPES; i++)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1574
http://svn.sourceforge.net/geany/?rev=1574&view=rev
Author: ntrel
Date: 2007-05-25 09:00:13 -0700 (Fri, 25 May 2007)
Log Message:
-----------
Show SVN revision as '>=' because 'svn up' may not have caused a
re-run of configure.
Show build date as 'on or after' compilation of about.o.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/about.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-05-25 15:19:23 UTC (rev 1573)
+++ trunk/ChangeLog 2007-05-25 16:00:13 UTC (rev 1574)
@@ -6,7 +6,7 @@
* geany.glade, src/callbacks.c, src/callbacks.h, src/geany.h,
src/interface.c, src/main.c, src/ui_utils.c:
Improve sensitivity of recent files sub menus.
- * src/filetypes.c: Add shebank-like detection for XML files.
+ * src/filetypes.c: Add shebang-like detection for XML files.
2007-05-25 Nick Treleaven <nick.treleaven(a)btinternet.com>
@@ -16,6 +16,10 @@
Remove note about editing build commands manually.
* src/build.c, doc/geany.docbook:
Add support for %e, %f in project run command.
+ * src/about.c:
+ Show SVN revision as '>=' because 'svn up' may not have caused a
+ re-run of configure.
+ Show build date as 'on or after' compilation of about.o.
2007-05-24 Nick Treleaven <nick.treleaven(a)btinternet.com>
Modified: trunk/src/about.c
===================================================================
--- trunk/src/about.c 2007-05-25 15:19:23 UTC (rev 1573)
+++ trunk/src/about.c 2007-05-25 16:00:13 UTC (rev 1574)
@@ -143,8 +143,9 @@
gtk_box_pack_start(GTK_BOX(header_hbox), header_image, FALSE,FALSE,0);
header_label = gtk_label_new(NULL);
gtk_label_set_use_markup(GTK_LABEL(header_label), TRUE);
- // print the subversion revision if it is available
- g_snprintf(buffer, sizeof(buffer), HEADER, (utils_str_equal(REVISION, "-1")) ? "" : " (" REVISION ")");
+ // print the subversion revision generated by ./configure if it is available
+ g_snprintf(buffer, sizeof(buffer), HEADER,
+ (utils_str_equal(REVISION, "-1")) ? "" : "svn >= " REVISION);
gtk_label_set_markup(GTK_LABEL(header_label), buffer);
gtk_widget_show(header_label);
gtk_box_pack_start(GTK_BOX(header_hbox), header_label, FALSE,FALSE,0);
@@ -196,7 +197,7 @@
gtk_label_set_justify(GTK_LABEL(builddate_label), GTK_JUSTIFY_CENTER);
gtk_label_set_selectable(GTK_LABEL(builddate_label), TRUE);
gtk_label_set_use_markup(GTK_LABEL(builddate_label), TRUE);
- g_snprintf(buffer2, sizeof(buffer2), _("(built on %s)"), __DATE__);
+ g_snprintf(buffer2, sizeof(buffer2), _("(built on or after %s)"), __DATE__);
g_snprintf(buffer, sizeof(buffer), BUILDDATE, buffer2);
gtk_label_set_markup(GTK_LABEL(builddate_label), buffer);
gtk_misc_set_padding(GTK_MISC(builddate_label), 2, 2);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1573
http://svn.sourceforge.net/geany/?rev=1573&view=rev
Author: eht16
Date: 2007-05-25 08:19:23 -0700 (Fri, 25 May 2007)
Log Message:
-----------
Add shebank-like detection for XML files.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/filetypes.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-05-25 14:42:43 UTC (rev 1572)
+++ trunk/ChangeLog 2007-05-25 15:19:23 UTC (rev 1573)
@@ -6,6 +6,7 @@
* geany.glade, src/callbacks.c, src/callbacks.h, src/geany.h,
src/interface.c, src/main.c, src/ui_utils.c:
Improve sensitivity of recent files sub menus.
+ * src/filetypes.c: Add shebank-like detection for XML files.
2007-05-25 Nick Treleaven <nick.treleaven(a)btinternet.com>
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2007-05-25 14:42:43 UTC (rev 1572)
+++ trunk/src/filetypes.c 2007-05-25 15:19:23 UTC (rev 1573)
@@ -574,7 +574,7 @@
gchar *line = sci_get_line(doc_list[idx].sci, 0);
filetype *ft = NULL;
- if (strlen(line) > 2 && line[0] == '#' && line[1]=='!')
+ if (strlen(line) > 2 && line[0] == '#' && line[1] == '!')
{
/// TODO does g_path_get_basename() also work under Win32 for Unix filenames?
gchar *basename_interpreter = g_path_get_basename(line + 2);
@@ -609,7 +609,21 @@
g_free(basename_interpreter);
}
+ // detect XML files
+ if (strncmp(line, "<?xml", 5) == 0)
+ {
+ // HTML and DocBook files might also start with <?xml, so detect them based on filename
+ // extension and use the detected filetype, else assume XML
+ ft = filetypes_detect_from_filename(doc_list[idx].file_name);
+ if (FILETYPE_ID(ft) != GEANY_FILETYPES_HTML &&
+ FILETYPE_ID(ft) != GEANY_FILETYPES_DOCBOOK &&
+ FILETYPE_ID(ft) != GEANY_FILETYPES_PERL && // Perl, Python and PHP only to be safe
+ FILETYPE_ID(ft) != GEANY_FILETYPES_PHP &&
+ FILETYPE_ID(ft) != GEANY_FILETYPES_PYTHON)
+ ft = filetypes[GEANY_FILETYPES_XML];
+ }
+
g_free(line);
return ft;
}
@@ -624,6 +638,7 @@
return filetypes[GEANY_FILETYPES_ALL];
// try to find a shebang and if found use it prior to the filename extension
+ // also checks for <?xml
ft = find_shebang(idx);
if (ft != NULL) return ft;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1570
http://svn.sourceforge.net/geany/?rev=1570&view=rev
Author: ntrel
Date: 2007-05-25 05:03:35 -0700 (Fri, 25 May 2007)
Log Message:
-----------
Add support for %e, %f in project run command.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/geany.docbook
trunk/src/build.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-05-25 11:39:10 UTC (rev 1569)
+++ trunk/ChangeLog 2007-05-25 12:03:35 UTC (rev 1570)
@@ -1,3 +1,12 @@
+2007-05-25 Nick Treleaven <nick.treleaven(a)btinternet.com>
+
+ * doc/geany.docbook:
+ Comment out stopping make process.
+ Remove note about editing build commands manually.
+ * src/build.c, doc/geany.docbook:
+ Add support for %e, %f in project run command.
+
+
2007-05-24 Nick Treleaven <nick.treleaven(a)btinternet.com>
* src/utils.h:
Modified: trunk/doc/geany.docbook
===================================================================
--- trunk/doc/geany.docbook 2007-05-25 11:39:10 UTC (rev 1569)
+++ trunk/doc/geany.docbook 2007-05-25 12:03:35 UTC (rev 1570)
@@ -1262,13 +1262,31 @@
</para>
<para>
The <emphasis>Base path</emphasis> field is used as the directory to run the
- Make command in.
+ Make and Make custom commands in.
</para>
+ <section><title>Run command</title>
<para>
- The <emphasis>Run</emphasis> command overrides the default run command. You can
- set this to the executable or main script file for the project, and append any
- command-line arguments.
+ The <emphasis>Run</emphasis> command overrides the default run command. You can
+ set this to the executable or main script file for the project, and append any
+ command-line arguments.
</para>
+ <para>
+ The following variables can be used:
+ </para>
+ <para>
+ <itemizedlist>
+ <listitem><para>
+ %f - complete filename without path
+ </para></listitem>
+ <listitem><para>
+ %e - filename without path and without extension
+ </para></listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ See <xref linkend="filetypes_build_settings"/> for details.
+ </para>
+ </section>
</section>
<section>
<title>Close Project</title>
@@ -1417,19 +1435,35 @@
paths and compile flags for the compiler, any library names and paths for the
linker, and any arguments you want to use when running Execute.
</para>
- <note><para>
- If you are using the Build command to compile and link in one step, you will need
- to set both the compiler arguments and the linker arguments in the linker
- command setting.
- </para></note>
<para>
These settings are saved automatically when <application>Geany</application>
is shut down.
</para>
<para>
+ The following variables can be used:
+ </para>
+ <para>
+ <itemizedlist>
+ <listitem><para>
+ %f - complete filename without path
+ </para></listitem>
+ <listitem><para>
+ %e - filename without path and without extension
+ </para></listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ See <xref linkend="filetypes_build_settings"/> for details.
+ </para>
+ <para>
If you need complex settings for your build system, or several different
settings, then writing a Makefile and using the Make commands is recommended.
</para>
+ <note><title>One step compilation</title><para>
+ If you are using the Build command to compile and link in one step, you will need
+ to set both the compiler arguments and the linker arguments in the linker
+ command setting.
+ </para></note>
</section>
<section>
<title>Indicators</title>
@@ -2022,7 +2056,7 @@
<section>
<title>[build_settings] Section</title>
<para>
- <table frame="all">
+ <table frame="all" id="filetypes_build_settings">
<title>Build settings</title>
<tgroup cols="3">
<?dbhtml cellpadding="4" ?>
Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c 2007-05-25 11:39:10 UTC (rev 1569)
+++ trunk/src/build.c 2007-05-25 12:03:35 UTC (rev 1570)
@@ -526,7 +526,8 @@
/* Checks if the executable file corresponding to document idx exists.
* Returns the name part of the filename, without extension.
* Returns NULL if executable file doesn't exist. */
-static gchar *get_build_executable(gint idx, const gchar *locale_filename)
+static gchar *get_build_executable(const gchar *locale_filename, gboolean check_exists,
+ filetype_id ft_id)
{
gchar *long_executable = NULL;
struct stat st;
@@ -536,13 +537,12 @@
setptr(long_executable, g_strconcat(long_executable, ".exe", NULL));
#endif
- // only check for existing executable, if executable is required by %e
- if (strstr(doc_list[idx].file_type->programs->run_cmd, "%e") != NULL)
+ if (check_exists)
{
gchar *check_executable = NULL;
// add .class extension for JAVA source files (only for stat)
- if (doc_list[idx].file_type->id == GEANY_FILETYPES_JAVA)
+ if (ft_id == GEANY_FILETYPES_JAVA)
{
#ifdef G_OS_WIN32
gchar *tmp;
@@ -589,6 +589,10 @@
static gchar *prepare_run_script(gint idx)
{
gchar *locale_filename = NULL;
+ gboolean have_project;
+ GeanyProject *project = app->project;
+ filetype *ft = doc_list[idx].file_type;
+ gboolean check_exists;
gchar *cmd = NULL;
gchar *executable = NULL;
gchar *working_dir = NULL;
@@ -598,14 +602,24 @@
locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
- executable = get_build_executable(idx, locale_filename);
+ have_project = (project != NULL && NZV(project->run_cmd));
+ cmd = (have_project) ?
+ project->run_cmd :
+ ft->programs->run_cmd;
+
+ // only check for existing executable, if executable is required by %e
+ check_exists = (strstr(cmd, "%e") != NULL);
+ executable = get_build_executable(locale_filename, check_exists, FILETYPE_ID(ft));
if (executable == NULL)
{
g_free(locale_filename);
return NULL;
}
- working_dir = g_path_get_dirname(locale_filename);
+ working_dir = (have_project) ?
+ utils_get_locale_from_utf8(project->base_path) :
+ g_path_get_dirname(locale_filename);
+
if (chdir(working_dir) != 0)
{
gchar *utf8_working_dir =
@@ -620,7 +634,7 @@
}
// replace %f and %e in the run_cmd string
- cmd = g_strdup(doc_list[idx].file_type->programs->run_cmd);
+ cmd = g_strdup(cmd);
tmp = g_path_get_basename(locale_filename);
cmd = utils_str_replace(cmd, "%f", tmp);
g_free(tmp);
@@ -642,8 +656,8 @@
g_free(utf8_cmd);
}
- g_free(executable);
g_free(cmd);
+ g_free(executable);
g_free(locale_filename);
if (result)
@@ -654,57 +668,15 @@
}
-static gchar *prepare_project_run_script()
-{
- GeanyProject *project = app->project;
- gboolean autoclose = FALSE;
- gchar *working_dir;
- gchar *cmd;
-
- if (project == NULL || project->run_cmd == NULL) return NULL;
- g_return_val_if_fail(project->base_path != NULL, NULL);
-
- working_dir = utils_get_locale_from_utf8(project->base_path);
- if (chdir(working_dir) != 0)
- {
- msgwin_status_add(_("Failed to change the working directory to %s"), project->base_path);
- g_free(working_dir);
- return NULL;
- }
-
-#ifdef HAVE_VTE
- if (vte_info.load_vte && vc != NULL && vc->run_in_vte)
- autoclose = TRUE; // don't wait for user input at the end of script when we are running in VTE
-#endif
- cmd = utils_get_locale_from_utf8(project->run_cmd);
-
- // (RUN_SCRIPT_CMD should be ok in UTF8 without converting in locale because it contains no umlauts)
- if (! build_create_shellscript(RUN_SCRIPT_CMD, cmd, autoclose))
- {
- msgwin_status_add(_("Failed to execute \"%s\" (start-script could not be created)"),
- project->run_cmd);
- g_free(working_dir);
- g_free(cmd);
- return NULL;
- }
- g_free(cmd);
- return working_dir;
-}
-
-
static GPid build_run_cmd(gint idx)
{
- GeanyProject *project = app->project;
gchar *working_dir;
GError *error = NULL;
- if (! DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL) return (GPid) 1;
+ if (! DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL)
+ return (GPid) 1;
- if (project != NULL && project->run_cmd != NULL && *project->run_cmd != 0)
- working_dir = prepare_project_run_script();
- else
- working_dir = prepare_run_script(idx);
-
+ working_dir = prepare_run_script(idx);
if (working_dir == NULL)
{
return (GPid) 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1569
http://svn.sourceforge.net/geany/?rev=1569&view=rev
Author: ntrel
Date: 2007-05-25 04:39:10 -0700 (Fri, 25 May 2007)
Log Message:
-----------
Comment out stopping make process.
Remove note about editing build commands manually.
Modified Paths:
--------------
trunk/doc/geany.docbook
Modified: trunk/doc/geany.docbook
===================================================================
--- trunk/doc/geany.docbook 2007-05-24 16:12:12 UTC (rev 1568)
+++ trunk/doc/geany.docbook 2007-05-25 11:39:10 UTC (rev 1569)
@@ -1394,14 +1394,19 @@
<para>
Depending on the process you started it might occur that the process cannot be
stopped. This can happen when the process creates more than one child process.
+ <!-- Make shouldn't be run from the Run command.
Therefore stopping any make actions is not possible because make creates child
processes and these child processes creates again child process. There might be
- some other programs which cannot be stopped correctly. Xterm is known to work
+ some other programs which cannot be stopped correctly.
+ -->
+ </para>
+ <note><title>Terminal emulators</title><para>
+ Xterm is known to work
properly. If you are using "Terminal" (the terminal program of Xfce), you
should add the command line option "--disable-server" otherwise the started
process cannot be stopped. Just add this option in the preferences dialog on
the Tools tab in the terminal field.
- </para>
+ </para></note>
</section>
<section>
<title>Set Includes and Arguments</title>
@@ -1418,8 +1423,8 @@
command setting.
</para></note>
<para>
- These settings are not saved when <application>Geany</application> is shut
- down. See below for how to set permanent arguments.
+ These settings are saved automatically when <application>Geany</application>
+ is shut down.
</para>
<para>
If you need complex settings for your build system, or several different
@@ -1438,15 +1443,6 @@
If you do not like this feature, you can disable it in the preferences dialog.
</para>
</section>
- <section>
- <title>File type configuration settings</title>
- <para>
- You can set the commands to run for compiling, building or executing
- by opening the relevant <filename>filetypes.*</filename> configuration file,
- and checking the [build_settings] section. See <xref linkend="filetypes"/> for more
- information.
- </para>
- </section>
</section>
<section id="printing">
<title>Printing support</title>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.