[PATCH] PHP syntax highlighting broken
Hello mc-devel, the php.syntax file is broken due to bad highlighting definition of LOG_LOCAL[0-7] symbols. To reproduce: F4 on any .php file. Results: Error in file /usr/share/mc//syntax/php.syntax on line 4367 and file is edited without any highlighting. Patch is attached. Jindrich -- Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/ (o_ _o) //\ The worst evil in the world is refusal to think. //\ V_/_ _\_V --- mc-4.6.1a/syntax/php.syntax.phpfix 2005-11-20 15:42:01.0 +0100 +++ mc-4.6.1a/syntax/php.syntax 2005-12-02 11:01:48.0 +0100 @@ -1,5 +1,8 @@ # PHP syntax file +# 2005-12-02 Jindrich Novy [EMAIL PROTECTED] +# * fix highlighting of LOG_LOCALn symbols to make the syntax file work + # 2005-11-20 Leonard den Ottolander leonard den ottolander nl # * regenerated from the docs at http://www.php.net @@ -4364,7 +4367,14 @@ keyword whole LOG_ERR white keyword whole LOG_INFO white keyword whole LOG_KERN white -keyword whole LOG_LOCAL0 ... LOG_LOCAL7 white +keyword whole LOG_LOCAL0 white +keyword whole LOG_LOCAL1 white +keyword whole LOG_LOCAL2 white +keyword whole LOG_LOCAL3 white +keyword whole LOG_LOCAL4 white +keyword whole LOG_LOCAL5 white +keyword whole LOG_LOCAL6 white +keyword whole LOG_LOCAL7 white keyword whole LOG_LPR white keyword whole LOG_MAIL white keyword whole LOG_NDELAY white ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] PHP syntax highlighting broken
Jindrich Novy wrote: Hello mc-devel, the php.syntax file is broken due to bad highlighting definition of LOG_LOCAL[0-7] symbols. To reproduce: F4 on any .php file. Results: Error in file /usr/share/mc//syntax/php.syntax on line 4367 and file is edited without any highlighting. Patch is attached. Committed, Thanks. I have removed the ChangeLog from the syntax file, and left only a list of authors. We don't really need _three_ different ChangeLogs. Roland ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] concat_dir_and_file() needs fixes
Jindrich Novy wrote: --- mc-4.6.1a/src/util.c.jn 2005-12-02 11:08:26.0 +0100 +++ mc-4.6.1a/src/util.c2005-12-02 13:11:19.0 +0100 @@ -1515,9 +1515,16 @@ /* If filename is NULL, then we just append PATH_SEP to the dir */ char * -concat_dir_and_file (const char *dir, const char *file) +concat_dir_and_file (const char *dir, const char *filename) { int i = strlen (dir); +const char *file = filename; + It's obvious that you used mcedit here. :) (Hint: trailing white-space.) +/* Return filename when dir is empty */ +if (!i) return g_strdup (filename); This looks almost good, except that i is not a boolean variable. You should use if (i == 0) instead. + +if (file != NULL *file == PATH_SEP) + file++; Maybe we should rather make sure that this function is never called with non-empty dir and file starting with a slash. Otherwise we might hide bugs. How often do you want to concatenate two absolute paths? Roland ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] PHP syntax highlighting broken
Hello Roland, Jindrich, On Fri, 2005-12-02 at 15:38 +0100, Roland Illig wrote: Error in file /usr/share/mc//syntax/php.syntax on line 4367 and file is edited without any highlighting. Patch is attached. Committed, Thanks. Thanks for committing. I should actually have tested that file before committing ;) . I have removed the ChangeLog from the syntax file, and left only a list of authors. We don't really need _three_ different ChangeLogs. Don't we? The change log might be useful to see why certain (ad hoc) fixes have been applied. You should have at least discussed this. Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] concat_dir_and_file() needs fixes
Hello Roland, On Fri, 2005-12-02 at 15:58 +0100, Roland Illig wrote: Jindrich Novy wrote: --- mc-4.6.1a/src/util.c.jn 2005-12-02 11:08:26.0 +0100 +++ mc-4.6.1a/src/util.c2005-12-02 13:11:19.0 +0100 @@ -1515,9 +1515,16 @@ /* If filename is NULL, then we just append PATH_SEP to the dir */ char * -concat_dir_and_file (const char *dir, const char *file) +concat_dir_and_file (const char *dir, const char *filename) { int i = strlen (dir); +const char *file = filename; + It's obvious that you used mcedit here. :) (Hint: trailing white-space.) Yes ;) +/* Return filename when dir is empty */ +if (!i) return g_strdup (filename); This looks almost good, except that i is not a boolean variable. You should use if (i == 0) instead. It's a question of style, !i and i==0 are equivalent, but feel free to change it. + +if (file != NULL *file == PATH_SEP) + file++; Maybe we should rather make sure that this function is never called with non-empty dir and file starting with a slash. Otherwise we might hide bugs. How often do you want to concatenate two absolute paths? The problem isn't to concatenate two absolute paths actually. The patch enhances the functionality of concat_dir_and_file() in the way that it will correctly add say dir=/home/jnovy and file=/.mc/bindings to /home/jnovy/.mc/bindings as the unfixed concat_dir_and_file checks only whether the dir ends with PATH_SEP and adds it even if file begins with PATH_SEP already - the result is /home/jnovy//.mc/bindings what's not too good. Fortunately the path works even if it's so ugly. I thought that it would be less PITA to make concat_dir_and_file less stupid than fixing the strings in edit.h: /* File names */ #define EDIT_DIR PATH_SEP_STR .mc PATH_SEP_STR cedit #define SYNTAX_FILEEDIT_DIR PATH_SEP_STR Syntax #define CLIP_FILE EDIT_DIR PATH_SEP_STR cooledit.clip #define MACRO_FILE EDIT_DIR PATH_SEP_STR cooledit.macros #define BLOCK_FILE EDIT_DIR PATH_SEP_STR cooledit.block #define TEMP_FILE EDIT_DIR PATH_SEP_STR cooledit.temp used for concatenation, all of them beginning with PATH_SEP. Please note that if you remove the leading PATH_SEP from these strings, you need to rewrite almost all calls to catstrs(), edit_save_block() and friends by at least adding the PATH_SEP_STR there. Regards, Jindrich -- Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/ (o_ _o) //\ The worst evil in the world is refusal to think. //\ V_/_ _\_V ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] concat_dir_and_file() needs fixes
Hi Jindrich, On Fri, 2005-12-02 at 19:11 +0100, Jindrich Novy wrote: I thought that it would be less PITA to make concat_dir_and_file less stupid than fixing the strings in edit.h: As Roland points out one should not concatenate 2 absolute paths. /* File names */ #define EDIT_DIR PATH_SEP_STR .mc PATH_SEP_STR cedit So indeed the correct fix is to remove PATH_SEP_STR from the front of this string. EDIT_DIR is a relative path, not absolute. Leonard. -- mount -t life -o ro /dev/dna /genetic/research ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel