SwingUtilities.invokeLater(new SafeAppender(msg));
SwingUtilities.invokeLater(new SafeAppend(msg));
	private synchronized void addOutput(String msg)	{		SwingUtilities.invokeLater(new SafeAppender(msg));		// Empty errors are of no use to us or the user		if(msg.length() == 0)		{			errorMode = GENERIC;			return;		}		// Do the funky error state machine (and hope that the		// other thread doesn't sent irrelevant crap our way)		switch(errorMode)		{		case GENERIC:			// Check for TeX-style error			if(msg.charAt(0) == '!')			{				errorMode = TEX;				error = msg.substring(1);				break;			}			// Otherwise, check for standard filename:lineno:error			// We have to start at offset 3, otherwise DOS drive			// letters will be caught (E:\file:12:error)			int fileIndex = msg.indexOf(':',2);			if(fileIndex == -1)				break; /* Oops */			file = msg.substring(0,fileIndex);			int lineNoIndex = msg.indexOf(':',fileIndex + 1);			if(lineNoIndex == -1)				break; /* Oops */			try			{				lineNo = Integer.parseInt(msg.substring(					fileIndex + 1,lineNoIndex));			}			catch(NumberFormatException nf)			{				break; /* Oops */			}			// Emacs style errors have			// filename:line:column:endline:endcolumn:			int emacsIndex = msg.indexOf(':',lineNoIndex + 1);			if(emacsIndex != -1)			{				if(msg.charAt(msg.length() - 1) == ':' &&					msg.length() - emacsIndex != 1)				{					errorMode = EMACS;					break;				}			}						// If not, set the error message variable			error = msg.substring(lineNoIndex + 1);			addError(file,lineNo,error);			break;		case TEX:			// Check for l.<line number>			if(msg.startsWith("l."))			{				lineNoIndex = msg.indexOf(' ');				if(lineNoIndex == -1)				{					errorMode = GENERIC;					break; /* Oops */				}				try				{					lineNo = Integer.parseInt(msg						.substring(2,lineNoIndex));				}				catch(NumberFormatException nf)				{					errorMode = GENERIC;					break; /* Oops */				}				error = error.concat(msg.substring(lineNoIndex));				errorMode = GENERIC;				addError(view.getBuffer().getPath(),					lineNo,error);			}			break;		case EMACS:			// Easy peasy			error = msg.trim();			errorMode = GENERIC;			addError(file,lineNo,error);			break;		}	}