* Now talking on #xfce * Topic for #xfce is: Xfce 4.10 released! Get it -> http://www.xfce.org/download | Translate? http://translations.xfce.org/ | Ask your question and then BE PATIENT AND IDLE FOR A WHILE * Topic for #xfce set by sarts at Thu Jul 26 20:52:13 2012 * #xfce :http://www.xfce.org <fchmmr> is this the official channel? * t_s_o has quit (Remote host closed the connection) <fchmmr> i fonud a bug in mousepad 0.3.0 <fchmmr> when syntax highlighting is enabled (im using kate theme), <fchmmr> if you do ctrl+n (make new doc) then save as anyname.php, <fchmmr> syntax highlighting dont show up <fchmmr> i had to close it first and then open it again (in mousepad) * freedomrun has quit (Quit: So long and thanks for all the fish) * bullgard4 has quit (Remote host closed the connection) * freedomrun (~freedomru@unaffiliated/freedomrun) has joined #xfce * eithel (~eithel@95.233.246.198) has joined #xfce <killermoehre> fchmmr: file this bug at bugzilla.xfce.org <fchmmr> thx <fchmmr> i will go there
cleaner description: open a PHP file with syntax colors turned on, it works ok. however, if you create a new document within mousepad then save it as a *.php (without closing) then start writing code, it doesn't show with syntax colours until you close the document and open it again.
Created attachment 5179 patch Misbehavior confirmed. The attached path solves the problem.
I think you need a more complicated patch, perhaps to first check whether you've manually set the filetype, and do nothing if you have. With the current patch, regardless of whether you are creating a new file or editing an existing one, if you have manually set the filetype (by clicking document->filetype->..., or from the status bar) to something different from what is autodetected, it overrides your choice every time you save the file. Note that there is a minor issue which is kind of related: 1. open Mousepad without opening an existing file 2. click File-new 3. in each tab, look at Document->filetype, and it will be "None" (the same as what is in the status bar) 4. open an existing file of some sort. 5. click File-new 6. repeat step 3: all the files will show up as whatever type of file you opened in step 4 (but the file type in the status bar will always be correct).
> perhaps to first check whether you've manually set the filetype, and do nothing if you have. But this approach would still cause a problem if you manually set the filetype to "None", unless it can tell that you did so.
Another issue which could possibly be considered a separate bug is that there is no syntax highlighting when you use "File>New from template". In this case the correct behaviour is obvious, so I guess the fix should be reasonably straightforward ;)
(In reply to alister.hood from comment #3) > I think you need a more complicated patch, perhaps to first check whether > you've manually set the filetype, and do nothing if you have. I agree with you, but it's just like Joel Spolsky says "500% effort to handle 1% of the cases". It's kind of weird if someone select Ruby syntax and write Python code. I've just tested Notepad++ and it's dumb just like my patch. Let's see what other folks think about it.
The problem will more commonly be when mousepad guesses a filetype "None". Try this with your patch: - Open a file in /usr/share/gtksourceview-2.0/language-specs - It isn't recognised as xml (at least on my machine), so tell mousepad that it is xml. - Every time you save the file the syntax highlighting disappears again.
(In reply to alister.hood from comment #7) > The problem will more commonly be when mousepad guesses a filetype "None". > Try this with your patch: > - Open a file in /usr/share/gtksourceview-2.0/language-specs > - It isn't recognised as xml (at least on my machine), so tell mousepad that > it is xml. > - Every time you save the file the syntax highlighting disappears again. Well, in this case if the file has no extension, then Mousepad shouldn't do anything. What do you think?
When you *open* an existing file and it doesn't detect the type then it will still need to set File: None So you would need some more code anyway, so that it just doesn't set File: None after *saving* a file. And I'm inclined to think the case you are trying to solve is part of Joel's 1%. i.e. someone starts coding but doesn't set the language, and then when they save the file they suddenly expect syntax highlighting. Wouldn't they normally set the language earlier if they need syntax highlighting? Personally I would make solving the issue I raised in comment 5 more of a priority :)
I fixed most of this stuff I think. The main bug was fixed in http://git.xfce.org/apps/mousepad/commit/?id=87ae5a08165461c01317719a3cea4c73a5f07dce, trying to take into consideration whether the user set the language themselves. The bug from Comment #4 about some of the language UI not updating when a language is set or tabs are switched was fixed in http://git.xfce.org/apps/mousepad/commit/?id=f113f6c88f191cbb7cd68493fa992cd111311b12. The bug from Comment #5 about the language not being set for template files was fixed in http://git.xfce.org/apps/mousepad/commit/?id=f113f6c88f191cbb7cd68493fa992cd111311b12, although it just uses the normal guessing mechanism as we don't really know/store the language of template files AFAICT. Please test to confirm the fixes if possible.
I guess this is fixed. Maybe Alister can test it thoroughly :)
I can't actually build at the moment: mousepad-window.c:1038:58: error: ‘mousepad_window_ui’ undeclared (first use in this function) gtk_ui_manager_add_ui_from_string (window->ui_manager, mousepad_window_ui, mousepad_window_ui_length, NULL); ^ mousepad-window.c:1038:58: note: each undeclared identifier is reported only once for each function it appears in mousepad-window.c:1038:78: error: ‘mousepad_window_ui_length’ undeclared (first use in this function) gtk_ui_manager_add_ui_from_string (window->ui_manager, mousepad_window_ui, mousepad_window_ui_length, NULL);
That stuff comes from the mousepad-window-ui.h file, despite being checked into Git, is also (re)generated from mousepad-window-ui.xml, but only when --enable-maintainer-mode is passed to configure script AFAIK.
OK, it is generally good, there is just the corner case: - File->New from Template - File->Save as - Neglect to add the appropriate file extension, and the syntax highlighting disappears.
I wonder if a successful guessing of a new template file's language should be treated the same as the user explicitly setting the filetype, so it's not re-guessed on Save As? This sounds simple to implement at least :) I think the file extension in save(as) dialog is a bit of a separate issue, but I'll look at it too.
> I wonder if a successful guessing of a new template file's language should be treated the same as the user explicitly setting the filetype, so it's not re-guessed on Save As? Yes, that's what I thought would make sense.