<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>All About Interop : emacs</title><link>http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx</link><description>Tags: emacs</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Enable .NET 3.5 goodies in IIS vdir</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/12/05/enable-net-3-5-goodies-in-asp-net-vdir.aspx</link><pubDate>Fri, 05 Dec 2008 20:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9156090</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/9156090.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=9156090</wfw:commentRss><description>&lt;P&gt;Some of you may be oddballs like me:&amp;nbsp; you like .NET, you program in .NET, but you don't always use Visual Studio.&amp;nbsp;&amp;nbsp; You hand-code everything for some applications.&amp;nbsp; You often open up a text editor and just start writing a source module, with no wizards, no project templates, etc.&amp;nbsp; You hand-code your MSbuild files.&amp;nbsp; You hand-code your web.config files. &lt;/P&gt;
&lt;P&gt;Oddballs like us cannot rely on the code-generation that comes with Visual Studio.&amp;nbsp; So when we write a new ASP.NET application, and we want to use the .NET 3.5 goodies in that app - things like var types, and LINQ - we need to explicitly specify that we want .NET 3.5 compilation.&amp;nbsp; Same is true if you are writing a WCF service and want to use REST or any of the var types or LINQ. &lt;/P&gt;
&lt;P&gt;I've done this twice now and had to search for the way to do it both times.&amp;nbsp; I'm putting here as a "note to self" and also as a reference for anyone else.&amp;nbsp; These are the custom magic incantations for web.config, if you want to enable .NET 3.5 in your ASP.NET app, or in your WCF Service - eg, the cool REST stuff from .NET 3.5.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; LINE-HEIGHT: 98%; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Consolas, Courier New"&gt;&lt;PRE&gt;&amp;lt;&lt;SPAN style="COLOR: #a020f0"&gt;?xml&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;version&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"1.0"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;encoding&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"utf-8"&lt;/SPAN&gt;?&amp;gt;
&amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;configuration&lt;/SPAN&gt;&amp;gt;

  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;system.web&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;compilation&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;debug&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"false"&lt;/SPAN&gt;&amp;gt;  
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;assemblies&lt;/SPAN&gt;&amp;gt;  
        &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;add&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;assembly&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"&lt;/SPAN&gt;/&amp;gt;  
        &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;add&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;assembly&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&lt;/SPAN&gt;/&amp;gt;  
        &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;add&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;assembly&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"&lt;/SPAN&gt;/&amp;gt;  
        &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;add&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;assembly&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"&lt;/SPAN&gt;/&amp;gt;  
      &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;assemblies&lt;/SPAN&gt;&amp;gt;  
    &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;compilation&lt;/SPAN&gt;&amp;gt;  
  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;system.web&lt;/SPAN&gt;&amp;gt;


  &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;system.codedom&lt;/SPAN&gt;&amp;gt;  
    &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;compilers&lt;/SPAN&gt;&amp;gt;  
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;compiler&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;language&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"c#;cs;csharp"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;extension&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;".cs"&lt;/SPAN&gt;   
                &lt;SPAN style="COLOR: #b8860b"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&lt;/SPAN&gt;   
                &lt;SPAN style="COLOR: #b8860b"&gt;warningLevel&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"4"&lt;/SPAN&gt;&amp;gt;  
        &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;providerOption&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"CompilerVersion"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;value&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"v3.5"&lt;/SPAN&gt;/&amp;gt;  
        &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;providerOption&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"WarnAsError"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;value&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"false"&lt;/SPAN&gt;/&amp;gt;  
      &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;compiler&lt;/SPAN&gt;&amp;gt;  
      &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;compiler&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;language&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"vb;vbs;visualbasic;vbscript"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;extension&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;".vb"&lt;/SPAN&gt;   
                &lt;SPAN style="COLOR: #b8860b"&gt;type&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&lt;/SPAN&gt;   
                &lt;SPAN style="COLOR: #b8860b"&gt;warningLevel&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"4"&lt;/SPAN&gt;&amp;gt;  
        &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;providerOption&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"CompilerVersion"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;value&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"v3.5"&lt;/SPAN&gt;/&amp;gt;  
        &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;providerOption&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"OptionInfer"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;value&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"true"&lt;/SPAN&gt;/&amp;gt;  
        &amp;lt;&lt;SPAN style="COLOR: #0000ff"&gt;providerOption&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;name&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"WarnAsError"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;value&lt;/SPAN&gt;=&lt;SPAN style="COLOR: #bc8f8f"&gt;"false"&lt;/SPAN&gt;/&amp;gt;  
      &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;compiler&lt;/SPAN&gt;&amp;gt;  
    &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;compilers&lt;/SPAN&gt;&amp;gt;  
  &amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;system.codedom&lt;/SPAN&gt;&amp;gt; 

&amp;lt;/&lt;SPAN style="COLOR: #0000ff"&gt;configuration&lt;/SPAN&gt;&amp;gt;
&lt;/PRE&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9156090" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Not+Really+Interop/default.aspx">Not Really Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/REST/default.aspx">REST</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Editing XAML in Emacs</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/08/21/editing-xaml-in-emacs.aspx</link><pubDate>Thu, 21 Aug 2008 19:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8885301</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8885301.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8885301</wfw:commentRss><description>&lt;P&gt;Luis Diego Fallas provides some hints.&amp;nbsp; He uses a RELAX NG based parser called nXML mode for emacs.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://langexplr.blogspot.com/2008/08/using-emacs-and-nxml-to-edit-xaml-files.html"&gt;http://langexplr.blogspot.com/2008/08/using-emacs-and-nxml-to-edit-xaml-files.html&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8885301" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/XAML/default.aspx">XAML</category></item><item><title>Emacs regex to grok csc compilation errors</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/05/22/emacs-regex-to-grok-csc-compilation-errors.aspx</link><pubDate>Thu, 22 May 2008 19:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8532396</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8532396.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8532396</wfw:commentRss><description>&lt;P&gt;People have asked about this.&amp;nbsp; This is the regular expression I use to allow emacs' next-error function to handle csc error messages.&amp;nbsp; It is included in the &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/14/dino-s-emacs-file.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/14/dino-s-emacs-file.aspx"&gt;emacs.el that I published previously&lt;/A&gt;.&amp;nbsp; Here it is excerpted for convenience. &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Courier New"&gt;&lt;PRE&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;to allow next-error to work with csc.exe: 
&lt;/SPAN&gt;(setq compilation-scroll-output t)
(setq-default compilation-error-regexp-alist
&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;       (append 
&lt;/SPAN&gt; '(
 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Microsoft VJC:
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;sample.java(6,1) : error J0020: Expected 'class' or 'interface'
&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #bc8f8f"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[a-zA-Z]:&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;?[&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;:(\t\n]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[,]&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;): &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;error&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;warning&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt; VJS[0-9]+:"&lt;/SPAN&gt; 1 3 4)

 &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;dinoch - Wed, 04 Aug 2004  09:29
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;handle whitespace at beginning of line (for nant output)
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;C# Compiler
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;t.cs(6,18): error SC1006: Name of constructor must match name of class
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #bc8f8f"&gt;"[ \t]*&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[_a-zA-Z:\]:&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;?[&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;:(\t\n]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[,]&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;): &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;error&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;warning&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt; CS[0-9]+:"&lt;/SPAN&gt; 1 3 4)

 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Microsoft C/C++:
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;keyboard.c(537) : warning C4005: 'min' : macro redefinition
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;d:\tmp\test.c(23) : error C2143: syntax error : missing ';' before 'if'
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;VC EEi
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;e:\projects\myce40\tok.h(85) : error C2236: unexpected 'class' '$S1'
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;myc.cpp(14) : error C3149: 'class System::String' : illegal use of managed type 'String'; did you forget a '*'?
&lt;/SPAN&gt;    (&lt;SPAN style="COLOR: #bc8f8f"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[a-zA-Z]:&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;?[&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;:(\t\n]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;) \
: &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;error&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;warning&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt; C[0-9]+:"&lt;/SPAN&gt; 1 3)
 )
&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;compilation-error-regexp-alist)
&lt;/SPAN&gt;)

&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8532396" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>C# Code Completion in emacs - CSDE now has a CsdeShell</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/22/c-code-completion-in-emacs-csde-now-has-a-csdeshell.aspx</link><pubDate>Tue, 22 Apr 2008 21:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8417010</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8417010.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8417010</wfw:commentRss><description>&lt;P&gt;I've been fiddling some more with C# code completion in emacs. I wrote a csde-shell.el that is the CSDE equivalent to &lt;A class="" href="http://jdee.sourceforge.net/" mce_href="http://jdee.sourceforge.net/"&gt;JDE&lt;/A&gt;'s beanshell.el . It runs as an inferior shell in emacs. The csde code-completion logic calls out to this shell to inquire about types by name. The shell then returns type information as lisp s-expressions, which can then be parsed and manipulated by csde-complete.el . Actually, the shell is &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/powershell-in-emacs-proof.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/powershell-in-emacs-proof.aspx"&gt;nothing more than Powershell&lt;/A&gt;, with a particular assembly of mine loaded into it. The assembly exposes a couple static methods that return information about .NET types. &lt;/P&gt;
&lt;P&gt;For example, if invoke this method within PowerShell: &lt;/P&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: maroon; FONT-FAMILY: Courier New"&gt;[Ionic.Csde.Utilities]::GetTypeInfo("System.IO.DriveInfo","mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); &lt;/SPAN&gt;
&lt;P&gt;Then I get back something like this: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Courier New"&gt;&lt;PRE&gt;(list &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.IO.DriveInfo"&lt;/SPAN&gt; 'type
            (list
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"Name"&lt;/SPAN&gt; 'property &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.String"&lt;/SPAN&gt; (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"readonly"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"DriveType"&lt;/SPAN&gt; 'property &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.IO.DriveType"&lt;/SPAN&gt; (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"readonly"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"DriveFormat"&lt;/SPAN&gt; 'property &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.String"&lt;/SPAN&gt; (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"readonly"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"IsReady"&lt;/SPAN&gt; 'property &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Boolean"&lt;/SPAN&gt; (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"readonly"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"AvailableFreeSpace"&lt;/SPAN&gt; 'property &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Int64"&lt;/SPAN&gt; (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"readonly"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"TotalFreeSpace"&lt;/SPAN&gt; 'property &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Int64"&lt;/SPAN&gt; (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"readonly"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"TotalSize"&lt;/SPAN&gt; 'property &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Int64"&lt;/SPAN&gt; (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"readonly"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"RootDirectory"&lt;/SPAN&gt; 'property &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.IO.DirectoryInfo"&lt;/SPAN&gt; (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"readonly"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"VolumeLabel"&lt;/SPAN&gt; 'property &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.String"&lt;/SPAN&gt; (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; ))))
            (list
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"Equals"&lt;/SPAN&gt; 'function &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Boolean"&lt;/SPAN&gt; (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Object"&lt;/SPAN&gt; )
                   (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"GetDrives"&lt;/SPAN&gt; 'function &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.IO.DriveInfo[]"&lt;/SPAN&gt; nil (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"static"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"GetHashCode"&lt;/SPAN&gt; 'function &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Int32"&lt;/SPAN&gt; nil (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"GetType"&lt;/SPAN&gt; 'function &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Type"&lt;/SPAN&gt; nil (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))
             (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"ToString"&lt;/SPAN&gt; 'function &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.String"&lt;/SPAN&gt; nil (cons 'typemodifiers (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"public"&lt;/SPAN&gt; )))))
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;This is basically the same way JDEE works. It wasn't too difficult to set up the shell, because I already had a shell (Powershell). The trickiest part was formatting and parsing the s-expressions, on both the C# side and the elisp side. &lt;/P&gt;
&lt;P&gt;With this, if you install into your emacs CSDE (remember CSDE is abandonware, stuck at version 0.1 since 2002), and then try a &lt;SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;csde-complete-at-point&lt;/SPAN&gt;, you will get context-sensitive code completion. &lt;SPAN style="FONT-SIZE: 16pt; COLOR: red"&gt;Yow!&lt;/SPAN&gt; The first time I saw it, I had to rub my eyes!&amp;nbsp;&amp;nbsp; Yes, I said C# code completion in emacs. And this is not dabbrev.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Ok, settle down.&amp;nbsp; This is really just a proof-of-concept at this point. There are tons of limitations, just oodles of them. The code completion is not very robust. It does not do Constructors, or public fields. It is not savvy to public/private/internal etc modifiers. It does not do parameter lists on methods - so once you select a method you have to key in all the parameters with no assistance. (Really in its current state it is nothing more than a smart property and method browser.)&amp;nbsp; The C# parser in Semantic apparently does not know about the var keyword (anonymous types) introduced in C# 3.0. So if you use var, then you don't get code completion. It only works, for now, on the classes in the .NET Framework base class library. It would have to be generalized to support other class libraries. Also, to be usable, all the pieces would have to be packaged together - CSDE, the CEDET and Semantic pieces, the Powershell piece. &lt;SPAN style="COLOR: red"&gt;[ Update:&amp;nbsp;I've attached to this post the elisp for csde&amp;nbsp; and the C# code for the CsdeShell.&amp;nbsp; But that is partial,&amp;nbsp;not enough to get you started.&amp;nbsp;more later on &lt;A href="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx"&gt;other posts&lt;/A&gt;. ]&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like I said, tons of limitations. But it is a start. Yinz guys should ring me up if you have an interest in developing this further. Or, better, vote if you want me to make this a codeplex project, sort of CSDE-limited redux. (Remember the goal here was just &lt;EM&gt;code completion&lt;/EM&gt;, much more limited that the broader goals of CSDE.) &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8417010" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/dotnetinterop/attachment/8417010.ashx" length="221898" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>C# Code Completion in emacs - getting beanshell equivalent in CSDE</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/21/c-code-completion-in-emacs-more-on-csde-and-beanshell.aspx</link><pubDate>Mon, 21 Apr 2008 19:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8414986</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8414986.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8414986</wfw:commentRss><description>&lt;P&gt;The beanshell is something that, I think, was specially engineered to support the JDE, and particularly the code completion stuff.&amp;nbsp; In JDEE, emacs starts up a Java VM and runs the beanshell class, in comint (command interpreter) mode.&amp;nbsp; Then emacs can send commands to this beanshell thing, commands like "Tell me what you know about the class named 'foo'". And the beanshell reflects on foo and returns the result, which would include public methods and properties, and so on. &lt;/P&gt;
&lt;P&gt;In my last post i said that the CSDE basically copied all this stuff over and did a search-and-replace (s/java/csharp).&amp;nbsp; That's obviously not gonna work in general, and in particular with the beanshell.&amp;nbsp; But we do have this &lt;A href="http://search.live.com/results.aspx?q=powershell+&amp;amp;form=QBRE"&gt;Powershell&lt;/A&gt; thing in .NET land, don't we?&amp;nbsp; Maybe you've heard of it.&amp;nbsp; And I already put together a working &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/run-powershell-as-a-shell-within-emacs.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/run-powershell-as-a-shell-within-emacs.aspx"&gt;powershell comint mode for emacs&lt;/A&gt;.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just now I wrote a little TypeInfo class that exposes a single public static method, GetTypeInfo(). It uses reflection to list the members of a named class.&amp;nbsp; I can load that TypeInfo() class into Powershell and interrogate types like this: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Courier New"&gt;&lt;PRE&gt;  [System.Reflection.Assembly]::LoadFrom(&lt;SPAN style="COLOR: #bc8f8f"&gt;"c:\\dinoch\\dev\\dotnet\\TypeInfo.dll"&lt;/SPAN&gt;);

  [Ionic.Reflection.Utilities.TypeInfo]::GetTypeInfo(&lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Data.SqlClient.SqlCommand"&lt;/SPAN&gt;,
                                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&lt;/SPAN&gt;);

  [Ionic.Reflection.Utilities.TypeInfo]::GetTypeInfo(&lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Xml.XmlReader"&lt;/SPAN&gt;,
                                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&lt;/SPAN&gt;);

  [Ionic.Reflection.Utilities.TypeInfo]::GetTypeInfo(&lt;SPAN style="COLOR: #bc8f8f"&gt;"System.DateTime"&lt;/SPAN&gt;,
                                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&lt;/SPAN&gt;);
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;This is pretty much what beanshell does for JDE.&amp;nbsp; Now to figure out how to return the information in the way that CSDE can use it. &lt;/P&gt;
&lt;P mce_keep="true"&gt;I know, I know.&amp;nbsp; I said I didn't want to write a code completion thing for C# in emacs.&amp;nbsp; But the various building blocks are all just sitting there, ready to be stitched together.&amp;nbsp; It's not far off.&amp;nbsp; &lt;/P&gt;
&lt;P style="COLOR: red"&gt;[ Update:&amp;nbsp; for the next installment in this drama, see the &lt;A href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/22/c-code-completion-in-emacs-csde-now-has-a-csdeshell.aspx"&gt;next post&lt;/A&gt;.]&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8414986" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>C# Code Completion in emacs - a look at Cedet, semantic, and CSDE</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/21/c-code-completion-in-emacs-a-look-at-cedet-semantic-and-csde.aspx</link><pubDate>Mon, 21 Apr 2008 18:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8414788</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8414788.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8414788</wfw:commentRss><description>&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;In &lt;A href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/15/i-have-a-dream-c-code-completion-in-emacs-csense-dabbrev-etc.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/15/i-have-a-dream-c-code-completion-in-emacs-csense-dabbrev-etc.aspx"&gt;my prior post&lt;/A&gt; I wrote that I have a dream of getting c# code completion in emacs. Jason Rumney wrote to me: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN-LEFT: 36pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;I think everything you want is here: &lt;A href="http://cedet.sourceforge.net/semantic.shtml" mce_href="http://cedet.sourceforge.net/semantic.shtml"&gt;&lt;SPAN style="COLOR: blue; TEXT-DECORATION: underline"&gt;http://cedet.sourceforge.net/semantic.shtml&lt;/SPAN&gt;&lt;/A&gt; &amp;nbsp;Semantic is what JDEE uses to provide code completion, and the page above claims grammars are already available for C# . &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Well, I checked it out. Did a little reconnoitering.&amp;nbsp; Here's what I found. &lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;Cedet (Semantic) &lt;/H2&gt;
&lt;P&gt;&lt;A href="http://cedet.sourceforge.net/" mce_href="http://cedet.sourceforge.net"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Cedet&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; is an interesting batch of tools, some of which are interesting to me, and some of which are not. Like, I don't want a Connected Graph Editor.&amp;nbsp; "Cogre".&amp;nbsp;&amp;nbsp; I don't even want to know what such a thing is.&amp;nbsp; But it's in Cedet.&amp;nbsp; Also, Cedet has something called eieio.&amp;nbsp; It's a very cute name, and&amp;nbsp;I'm sure a very clever reference to something.&amp;nbsp; But I don't get the joke, and don't care to.&amp;nbsp; Senator (After some stumbling around I discovered that "Senator" is a part of cedet that does the navigation, informed by the code analysis.&amp;nbsp;&amp;nbsp;(like, jump forward one class, one method, whatever))&amp;nbsp; Bovine, another oblique reference to yacc and bison I guess.&amp;nbsp; Whatthehell is "bovinate"?&amp;nbsp; Do I want to do that or not?&amp;nbsp; Will I be arrested if I try it? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Look, all&amp;nbsp;I want is code completion. I am vaguely aware that various impressive magic has to happen in order to get code completion.&amp;nbsp; There is some parsing magic, some context-analysis magic, and so on.&amp;nbsp; I don't want to &lt;EM&gt;write &lt;/EM&gt;a compiler and a parser though, although I am happy to use someone else's.&amp;nbsp; &amp;nbsp;I also don't want to &lt;EM&gt;admire the beauty &lt;/EM&gt;of someone else's compiler, parser, or analyzer.&amp;nbsp;Nor do I want to learn 8 new brand names for different magic technology (eieio, semantic, bovine, cogre, cedet, ede, speedbar, senator, etc etc etc) and how they all integrate and work together. I just want code completion.&amp;nbsp; I'm sure your compiler is beautiful.&amp;nbsp; I'm sure your parser is pure elegance.&amp;nbsp; Your branding is very clever. It's all very nice.&amp;nbsp; I just want code completion. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Ok, let me stop whining and start over. CEDET seems to have a whole bunch of infrastructure for doing analysis of source code in emacs, and then doing things with the analysis.&amp;nbsp; Like, navigation.&amp;nbsp;Code highlighting.&amp;nbsp; And, in theory, code completion. There is a csharp parser contribution to semantic, and this means that csharp source code is correctly parsed when you load it into an emacs buffer.&amp;nbsp; Installing it is pretty simple, you have to download cedet, then fiddle your emacs to add the cedet directories to your load-path, then load up semantic, and so on. Ok, it's not just a matter of running an msi file. It's a little more complicated than that. But you can handle it, you run emacs. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Once you get it installed, semantic gives you highlights on namespaces, classes, methods, and so on. It looks like this: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://blogs.msdn.com/blogfiles/dotnetinterop/042108_1514_CCodeComple1.png" mce_src="http://blogs.msdn.com/blogfiles/dotnetinterop/042108_1514_CCodeComple1.png"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;So this is hard evidence that semantic has successfully parsed the Csharp code. Keep in mind that there is another engine parsing the csharp code – it is called csharp-mode, and it has provided the pretty colors on the text (what emacs calls "font-lock"). But cedet seems to be a much deeper analysis of the code based on a formal parser. So, it's "better". Ok, we have blue lines calling my attention to the classes and methods. What else? In particular, DO WE GET CODE COMPLETION? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Hmm, well, see… (Reminds me of an episode of "The Office" where Michael asks about a potential dating partner. He asks, "Would this woman fit in a standard-sized rowboat, without causing the boat to capsize?" And there's no answer. And Michael says, "your delay in answering causes some concern…" Same thing here). Ah, so where were we? Code completion. Well, see, the code completion done by semantic depends on a tags database, I think, which does not exist for the .NET Framework class library. Semantic automagically generates suggested completions for classes in your source code. It looks like this: &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://blogs.msdn.com/blogfiles/dotnetinterop/042108_1514_CCodeComple2.png" mce_src="http://blogs.msdn.com/blogfiles/dotnetinterop/042108_1514_CCodeComple2.png"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;As you can see, Semantic has put some stuff in the minibuffer to tell us how much it knows about the current context. It knows my incomplete line of code is referencing the Secant type, and it is looking for static members on that type. That alone is pretty impressive. But not so impressive is the crappy popup. Half of the text is cut off and unreadable. If I then type an 'S' and then just a few seconds, Semantic suggests the SolveViaSecant() method, and if I TAB through, Semantic will autocomplete that method. Yeehaw! The delay is not up to Visual Studio snappiness standards, but it did work. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;(NB: the rose-colored highlighted lines come from flymake.el, which I &lt;A href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/14/getting-flymake-el-to-work-with-c-modules.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/14/getting-flymake-el-to-work-with-c-modules.aspx"&gt;wrote about previously&lt;/A&gt;). &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;As I said Semantic can do this with the classes defined in code in the buffer. And maybe even with classes defined in other source code in the same directory, although I could not get that to work. Also, sometimes the suggested completions were wrong. AND More importantly!! Semantic does not know about any of the 5000+ classes that are defined in the .NET Framework base class library. (that reminds me, I should count the classes in .NET 3.5 sometime soon). &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;In other words, if I declare a variable of type, let's say, System.Data.SqlClient and then try to get code completion, semantic knows I want to get a member on an instance of type SqlClient, but semantic doesn't know what SqlClient looks like.&amp;nbsp; It lacks the knowledge of SqlClient and it lacks the ability to go find out. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;In theory I could build a "system database" of tags that could be used by semantic to inform the code completion.&amp;nbsp; BUT, I could not find any tools that would enable me to build such a database, nor could I find examples of such a database. I couldn't figure out how to teach Semantic about libraries other than those defined in active source code. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;I imagine that Cedet and its semantic sub-technology works really well with C and C++. Not so much with C#, not yet anyway. And, I found it impenetrable. &lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;CSDE&amp;nbsp; &lt;/H2&gt;
&lt;P&gt;&lt;A href="http://csde.sourceforge.net/" mce_href="http://csde.sourceforge.net"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;CSDE&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt; is an abandonware clone of the JDEE. The JDEE is a bunch of add-ons to emacs that make developing in Java much easier. One of the things you get is… code completion! Zowie! Since C# is so similar to Java, the guy who started with CSDE figured the JDEE would be a great leg up. Basically he copied all the elisp and just did a global search-and-replace, swapping out "java" and inserting "csharp". &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The statement by Jason was that JDEE uses Semantic to power its code completion, but this is not exactly what I found.&amp;nbsp; I didn't do a teardown of JDEE, but the snapshot of JDEE that CSDE is based upon, uses the beanshell in order to get class information. Here's the thing, code completion magic all works mostly the same. Some analysis has to happen to figure out what you're doing in the code. Then there's got to be an information database about the type or identifier you are fiddling with – this is the source of context-sensitive suggestions. JDEE gets the class information by doing reflection on a named class, in the beanshell. The beanshell is a name foe a JVM that runs as an inferior process inside emacs, and just waits for commands to run. Emacs sends it a "tell me about class java.lang.Integer" command, and the beanshell returns what it knows about that class- all its members and so on. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The CSDE still has all the beanshell crapola in it, all the –classpath nonsense and jar files and so on. The same idea for getting class information could work in .NET, but certainly not with a JVM. We're gonna need more than that. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;So CSDE looks like a non-starter. &lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;Csense &lt;/H2&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;Finally there is &lt;A href="http://code.google.com/p/csense" mce_href="http://code.google.com/p/csense"&gt;CSense&lt;/A&gt;. As I commented elsewhere, it looks like the Csense project was thrown together in a couple afternoons by a passionate developer, then abandoned just as quickly. Csense actually has tools that go and build a database of information about classes from the various assemblies. This is really cool. But I could not get csense to apply that information to a code-completion request. &lt;/SPAN&gt;&lt;/P&gt;
&lt;H2&gt;The Bottom Line &lt;/H2&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;So the end result is that I cannot find code completion in emacs for C#. We have some tantalizing building blocks, but no real joy. The best results I have got so far is using dabbrev, which works on a text analysis of the buffer. Cedet looks good, but I cannot figure out how to build the database for system or third party assemblies. Csense builds a database for system assemblies, but I cannot figure out how to get it to use that data. CSDE seems to be a nice idea that was never really developed. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The right answer I think would require combining some magic from these various projects and developing them further. Combining the csense database-generation magic with the code-completion stuff in either CSDE or Semantic would do the trick. Or possibly just developing the CSDE a little further to have its own inferior process. Figuring out which of those paths to take? I will leave that for another day. &lt;/P&gt;
&lt;P style="COLOR: red"&gt;[ Update:&amp;nbsp; I have continued to explore this, and actually produced a CsdeShell.&amp;nbsp; For more on this, see my other posts on C# and emacs with &lt;A href="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx"&gt;this link&lt;/A&gt;. ]&amp;nbsp; &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8414788" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>I have a dream! C# Code Completion in Emacs (csense, dabbrev, etc)</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/15/i-have-a-dream-c-code-completion-in-emacs-csense-dabbrev-etc.aspx</link><pubDate>Tue, 15 Apr 2008 23:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8398199</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8398199.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8398199</wfw:commentRss><description>&lt;P&gt;No good options here. &lt;/P&gt;
&lt;P&gt;I know, dabbrev does some neat things. But it pales in comparison to real code completion as you get in Visual Studio, or, I think, even SharpDevelop. &lt;/P&gt;
&lt;P&gt;I checked out a module called &lt;A class="" href="http://code.google.com/p/csense/" mce_href="http://code.google.com/p/csense/"&gt;csense&lt;/A&gt; that a lone developer hacked together last year. The goal of the project&amp;nbsp;looked simple, focused, valuable: &lt;B&gt;real code completion in Emacs for C#&amp;nbsp;!!!&lt;/B&gt; &lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 18pt; COLOR: red"&gt;Whoohoo!!!!! &lt;/SPAN&gt;but &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The implementation looks incomplete&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;There are no docs&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;I couldn't even figure out how to initially install it&lt;/LI&gt;
&lt;LI&gt;&lt;EM&gt;nobody &lt;/EM&gt;is using it; there were 33 downloads and I think I was about 8 of them.&lt;/LI&gt;
&lt;LI&gt;I couldn't figure out how to configure it or what the various vars did, without wading in knee deep into elisp code.&lt;/LI&gt;
&lt;LI&gt;after bumping around in the dark, I did get a popup to show a class definnition when I hovered on XmlReader, for example&lt;/LI&gt;
&lt;LI&gt;But when I tried to get the code-completion to work, I consistently got the result that my editing buffer would just silently close. (I guess I didn't want to edit that file anyway.)&lt;/LI&gt;
&lt;LI&gt;It appears to be, as someone else said, "abandonware"&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;So the search continues.&amp;nbsp; Real code completion looks to be pretty hard to get, and not easy to implement. &lt;/P&gt;
&lt;P&gt;I think the next thing I may do is check out &lt;A class="" href="http://csde.sourceforge.net/" mce_href="http://csde.sourceforge.net/"&gt;CSDE&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;Jeez I hope I don't start considering implementing this meself. &lt;EM&gt;That &lt;/EM&gt;would be a disaster. Somebody stop me.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8398199" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>C# snippets for yasnippet.el (Emacs snippets)</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/15/c-snippets-for-yasnippet-el-emacs-snippets.aspx</link><pubDate>Tue, 15 Apr 2008 20:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8386326</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8386326.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8386326</wfw:commentRss><description>&lt;P&gt;Some nice person built &lt;A class="" href="http://code.google.com/p/yasnippet/" mce_href="http://code.google.com/p/yasnippet/"&gt;yasnippet.el&lt;/A&gt;, a snippet package for emacs.&amp;nbsp;You type 2 or 3 letters, then hit TAB, and&amp;nbsp;it expands into a snippet.&amp;nbsp; Like dabbrev, but with forms-based fill-in fields.&amp;nbsp; It's quickie code generation.&amp;nbsp;Sadly, no C# snippets are included.&lt;/P&gt;
&lt;P&gt;Here's my contribution (attached).&amp;nbsp; There's one for try..catch, foreach, for, using, while, class definition, property definition, singleton, and a couple others.&lt;/P&gt;
&lt;P&gt;yasnippet worked like a charm for me.&amp;nbsp; I did have to make a change in yasnippet.el:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Courier New"&gt;&lt;PRE&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defvar&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;yas/known-modes&lt;/SPAN&gt;
 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;added csharp so it will show up in the menu!! 
&lt;/SPAN&gt;  '(ruby-mode rst-mode csharp-mode)
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"A list of mode which is well known but not part of emacs."&lt;/SPAN&gt;)
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;Also I built a tool to generate the snippet bundle: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Courier New"&gt;&lt;PRE&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;CreateSnippetBundle.el
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Useful utility for creating / updating / maintaining snippets ..
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Complements the yasnippet package. 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Run this once, and it creates the bundle.el file. 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;do not delete this file!
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Time-stamp: &amp;lt;Friday, April 11, 2008  19:04:17  (by dinoch)&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;

(&lt;SPAN style="COLOR: #a020f0"&gt;require&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;yasnippet&lt;/SPAN&gt;)
(yas/compile-bundle 
 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;the starting point
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"c:/users/dinoch/elisp/yasnippet.el"&lt;/SPAN&gt;

 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;the bundle file to generate
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"c:/users/dinoch/elisp/yasnippet-bundle.el"&lt;/SPAN&gt; 

 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;the snippet dir from which to generate the bundle
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"c:/users/dinoch/elisp/snippets"&lt;/SPAN&gt;)

&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8386326" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/dotnetinterop/attachment/8386326.ashx" length="4725" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>Getting emacs flymake.el to work with C# modules</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/14/getting-flymake-el-to-work-with-c-modules.aspx</link><pubDate>Tue, 15 Apr 2008 00:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8391037</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8391037.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8391037</wfw:commentRss><description>&lt;P&gt;&lt;SPAN style="COLOR: red"&gt;&lt;EM&gt;[I'm going to try to keep this up to date, because I periodically change tweak and improve flymake setup... Latest is&amp;nbsp;23 April 2008] &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 18pt; COLOR: magenta"&gt;I Loooooooove Flymake.&lt;/SPAN&gt;&amp;nbsp; Emacs, since a while back, ships with a package called &lt;A class="" href="http://flymake.sourceforge.net/" mce_href="http://flymake.sourceforge.net/"&gt;flymake.el&lt;/A&gt;, that defines a minor mode.&amp;nbsp; When you enable this mode, flymake more-or-less continuously compiles the module you're working on, checking for syntax errors, and highlighting any that are found in your buffer. Pretty cool!&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Bad news: Out of the box, flymake does not work with C# compiles on Windows.&amp;nbsp;&amp;nbsp; But, it's possible to get it to work. Here's what I added to my .emacs file to make it work for me. &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Courier New"&gt;&lt;PRE&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;flymake minor mode - tweaks for csharp
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Flymake is built-in to emacs.  It  more-or-less continually compiles an
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;active buffer when the minor mode is enabled. It also flags broken lines
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;in the compile as you type.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This is a set of tweaks of flymake for C# on Windows.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;last saved Time-stamp: &amp;lt;Wednesday, April 23, 2008  13:44:26  (by dinoch)&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;require&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;flymake&lt;/SPAN&gt;) 

(setq flymake-log-level 0)  &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;insure flymake errors get plopped into the *Messages* buffer
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;There are 2 common ways to build C# files: nmake or msbuild.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Here are examples for either. 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;For makefile, use nmake.  Configure this stanza to specify where your
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;nmake is.  Usually it is in the .NET 2.0 SDK directory, or the platform SDK
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;directory.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;If you use nmake, then you need a make target like this in your makefile:
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;check-syntax:
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;      &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;$(_CSC) /t:module $(CHK_SOURCES)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(You could also put this in an alternatively named makefile,
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;like makefile.flymake. In this case you would also need to modify
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;the nmake command line (See below))
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;If you use msbuild, and you are compiling projects that consist of a single
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;source file, you can use a standard (boilerplate) build project
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;file.  Call it msbuild.flymake.xml, and define it like this:
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;         &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;DefaultTargets="CompileAll"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;         &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;ToolsVersion="3.5"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- specify reference assemblies for all builds in this project --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;ItemGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="mscorlib" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="System" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="System.Core" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="System.Data" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="System.Data.Linq" /&amp;gt;                   &amp;lt;!-- LINQ --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!--Reference Include="System.ServiceModel" /--&amp;gt;           &amp;lt;!-- WCF --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!--Reference Include="System.ServiceModel.Web" /--&amp;gt;       &amp;lt;!-- WCF --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!--Reference Include="System.Runtime.Serialization" /--&amp;gt;  &amp;lt;!-- WCF --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;/ItemGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Target Name="CheckSyntax"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;          &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;DependsOnTargets="ResolveAssemblyReferences"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;CSC 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Sources="$(SourceFileToCheck)"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;References="@(ReferencePath)"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;TargetType="module"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Toolpath="$(MSBuildToolsPath)"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Nologo="true"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;/&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;/Target&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;/Project&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;-ends-
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(This msbuild file works only with .NET 3.5.)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;If your projects consist of multiple source files, then you need to get fancier.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;You need to compile all files, *except* for the original source file, the one
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;being edited currently. In this case, your msbuild.flymake.xml file should look
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;something like this: 
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;          &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;DefaultTargets="CompileAll"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;          &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;ToolsVersion="3.5"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;          &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;PropertyGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Optimize&amp;gt;false&amp;lt;/Optimize&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;DebugSymbols&amp;gt;true&amp;lt;/DebugSymbols&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- &amp;lt;OutputPath&amp;gt;.\bin\&amp;lt;/OutputPath&amp;gt;  --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;OutputPath&amp;gt;.\&amp;lt;/OutputPath&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;OutDir&amp;gt;.\&amp;lt;/OutDir&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;IntermediateOutputPath&amp;gt;.\obj\&amp;lt;/IntermediateOutputPath&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;/PropertyGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- specify reference assemblies for all builds in this project --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;ItemGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="mscorlib" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="System" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="System.Core" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="System.Data" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Reference Include="System.Data.Linq" /&amp;gt;                   &amp;lt;!-- LINQ --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!--Reference Include="System.ServiceModel" /--&amp;gt;           &amp;lt;!-- WCF --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!--Reference Include="System.ServiceModel.Web" /--&amp;gt;       &amp;lt;!-- WCF --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!--Reference Include="System.Runtime.Serialization" /--&amp;gt;  &amp;lt;!-- WCF --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;/ItemGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- This ItemGroup includes every .cs source file in the directory,           --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- except for the one indicated by OriginalSourceFile.  In flymake, that     --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- property indicates the currently edited file. So the result is that the   --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- ItemGroup CSFile will include all files, including the _flymake.cs clone, --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- but not including the original file.  Which is what we want.              --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;ItemGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;CSFile Include="*.cs" Exclude="$(OriginalSourceFile)" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;/ItemGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- Stuff the OriginalSourceFile property into an ItemGroup.                  --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- We do this so we can get at the metadata, which I Think is available only --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- through an item within an ItemGroup.  We want the root filename, which    --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- we use to name the output netmodule.                                      --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;ItemGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;ExcludedCSFile Include="$(OriginalSourceFile)" /&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;/ItemGroup&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;Target Name="CheckSyntax"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;           &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;DependsOnTargets="ResolveAssemblyReferences"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;           &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;!-- Run the Visual C# compilation on the specified set of .cs files. --&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;     &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;CSC 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Sources="@(CSFile)"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;References="@(ReferencePath)"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;TargetType="module"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Toolpath="$(MSBuildToolsPath)"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;OutputAssembly="%(ExcludedCSFile.Filename)_flymake.netmodule"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Nologo="true"
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;/&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;   &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;/Target&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;&amp;lt;/Project&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;

&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;These variables are ones I made up for help with C#:
&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defvar&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;dino-flymake-netsdk-location&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"c:\\netsdk2.0"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Location of .NET SDK, for finding nmake.exe.  The nmake is found in the bin subdir.&amp;nbsp; Example value is: c:\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0 ."&lt;/SPAN&gt;)

(&lt;SPAN style="COLOR: #a020f0"&gt;defvar&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;dino-flymake-msbuild-location&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"c:\\.net3.5"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Directory containing MSBuild.exe.  Typically, c:\\windows\\Microsoft.NET\\Framework\\v3.5 ."&lt;/SPAN&gt;)

(&lt;SPAN style="COLOR: #a020f0"&gt;defvar&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;dino-flymake-csharp-msbuild-buildfile&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"msbuild.flymake.xml"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Build file if using MSBuild.exe."&lt;/SPAN&gt;)

(&lt;SPAN style="COLOR: #a020f0"&gt;defvar&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;dino-flymake-csharp-nmake-buildfile&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"makefile"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Build file if using nmake.exe."&lt;/SPAN&gt;)

(&lt;SPAN style="COLOR: #a020f0"&gt;defvar&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;dino-flymake-csharp-use-msbuild&lt;/SPAN&gt; t
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"If t, then flymake uses msbuild.exe and the msbuild.flymake.xml
file.  If nil, then flymake uses nmake and the makefile with a
check-status target. Keep in mind the buildfile for either msbuild or nmake
is customizable.  See the vars dino-flymake-csharp-{nmake,msbuild}-buildfile ."&lt;/SPAN&gt;)

&lt;SPAN style="TEXT-DECORATION: overline"&gt;(defun dino-flymake-csharp-cleanup ()
&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Delete the temporary .netmodule file created in syntax checking,
then call through to flymake-simple-cleanup."&lt;/SPAN&gt;
  (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; flymake-temp-source-file-name
  (&lt;SPAN style="COLOR: #a020f0"&gt;let*&lt;/SPAN&gt; ((netmodule-name
          (concat (file-name-sans-extension flymake-temp-source-file-name)
                              &lt;SPAN style="COLOR: #bc8f8f"&gt;".netmodule"&lt;/SPAN&gt;))
         (expanded-netmodule-name (expand-file-name netmodule-name &lt;SPAN style="COLOR: #bc8f8f"&gt;"."&lt;/SPAN&gt;))
         )
    (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (file-exists-p expanded-netmodule-name)
        (flymake-safe-delete-file expanded-netmodule-name)
      )
    )
  )
    (flymake-simple-cleanup)
    
  )



&lt;SPAN style="TEXT-DECORATION: overline"&gt;(defun dino-flymake-csharp-buildfile ()
&lt;/SPAN&gt;  (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; dino-flymake-csharp-use-msbuild
      dino-flymake-csharp-msbuild-buildfile
    dino-flymake-csharp-nmake-buildfile
    )
  )


&lt;SPAN style="TEXT-DECORATION: overline"&gt;(defun dino-flymake-find-csharp-buildfile (source-file-name)
&lt;/SPAN&gt;  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; ((actual-build-file-name (dino-flymake-csharp-buildfile)))
    (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (file-exists-p (expand-file-name actual-build-file-name &lt;SPAN style="COLOR: #bc8f8f"&gt;"."&lt;/SPAN&gt;))
        &lt;SPAN style="COLOR: #bc8f8f"&gt;"."&lt;/SPAN&gt;
      (flymake-log 1 &lt;SPAN style="COLOR: #bc8f8f"&gt;"no buildfile (%s) for %s"&lt;/SPAN&gt; actual-build-file-name source-file-name)
      (flymake-report-fatal-status
       &lt;SPAN style="COLOR: #bc8f8f"&gt;"NOMK"&lt;/SPAN&gt; (format &lt;SPAN style="COLOR: #bc8f8f"&gt;"No buildfile (%s) found for %s"&lt;/SPAN&gt;
                      actual-build-file-name source-file-name))
      nil
      )

  )
  )


&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(debug-on-entry 'flymake-create-temp-inplace)
&lt;/SPAN&gt;
&lt;SPAN style="TEXT-DECORATION: overline"&gt;(defun dino-flymake-csharp-init ()
&lt;/SPAN&gt;  (dino-flymake-csharp-init-impl 'flymake-create-temp-inplace t t  'flymake-get-make-cmdline))


&lt;SPAN style="TEXT-DECORATION: overline"&gt;(defun dino-flymake-csharp-init-impl (create-temp-f use-relative-base-dir use-relative-source get-cmdline-f)
&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Create syntax check command line for a directly checked source file.
Use CREATE-TEMP-F for creating temp copy."&lt;/SPAN&gt;
  (&lt;SPAN style="COLOR: #a020f0"&gt;let*&lt;/SPAN&gt; ((args nil)
         (source-file-name   buffer-file-name)
         (buildfile-dir      (dino-flymake-find-csharp-buildfile source-file-name)))
    (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; buildfile-dir
        (&lt;SPAN style="COLOR: #a020f0"&gt;let*&lt;/SPAN&gt; ((temp-source-file-name  (flymake-init-create-temp-buffer-copy create-temp-f)))
          (setq args (flymake-get-syntax-check-program-args temp-source-file-name buildfile-dir
                                                            use-relative-base-dir use-relative-source
                                                            get-cmdline-f))))
    args))

&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(debug-on-entry 'dino-flymake-csharp-init)
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This fixup sets flymake to use a different cleanup routine for c# compiles
&lt;/SPAN&gt;&lt;SPAN style="TEXT-DECORATION: overline"&gt;(defun dino-fixup-flymake-for-csharp ()
&lt;/SPAN&gt;  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; (elt 
        (csharp-entry nil)
        (masks flymake-allowed-file-name-masks)
        )

    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;The "flymake-allowed-file-name-masks" variable stores a filename pattern as
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;well as the make-init function, and a cleanup function.  In the case of csharp,
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;the setting in flymake.el has the cleanup fn as nil, which means it gets the
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;standard cleanup : the *_flymake.cs cloned source file gets deleted.  But the
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;way I have done the syntax checking, I compile the .cs file into a module,
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;which needs to be deleted afterwards.
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;    
    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Here, we remove the C# entry in the "flymake-allowed-file-name-masks"
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;variable, and replace it with an entry that includes a custom csharp cleanup
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;routine.  In that cleanup routine, I delete the .netmodule file.
&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;I could just setq the "flymake-allowed-file-name-masks" var to the C# thing I
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;want, but that would obliterate all the masks for all other languages, which
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;would be bad manners.
&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;You know, come to think of it, I could just delete the generated .netmodule
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;file in the msbuild or makefile.  That might be simpler.
&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;But the main point is this ought to be more easily configurable or customizable
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;in flymake.el.  And also, flymake ought to do something reasonable for csharp builds,
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;rather than completely punt.
&lt;/SPAN&gt;    
    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This fixup is really hacky, relying on the string that is used for csharp in
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;flymake.el.  But it will do for now...
&lt;/SPAN&gt;
    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Find the entry
&lt;/SPAN&gt;    (&lt;SPAN style="COLOR: #a020f0"&gt;while&lt;/SPAN&gt; (consp masks)
      (setq elt (car masks))
      (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (string= &lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.cs\\'"&lt;/SPAN&gt; (car elt))
          (setq csharp-entry elt)
        )
      (setq masks (cdr masks))
      )
    
    &lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;remove the original one ...
&lt;/SPAN&gt;    (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; csharp-entry
        (setq flymake-allowed-file-name-masks
              (delete csharp-entry flymake-allowed-file-name-masks)))

    &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Now add a new one, with the custom cleanup method.
&lt;/SPAN&gt;    (setq flymake-allowed-file-name-masks
          (cons 
           '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.cs\\'"&lt;/SPAN&gt; dino-flymake-csharp-init dino-flymake-csharp-cleanup)
           flymake-allowed-file-name-masks))
    )
  )

&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;need to do this only once, not every time csharp-mode is invoked
&lt;/SPAN&gt;(dino-fixup-flymake-for-csharp) 


&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This method re-defines the defun shipped in flymake, for csharp.  Re-defining
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;this function *will* definitely break flymake for all other languages.  One
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;way to fix that problem is to make the "get-make-cmdline" function a
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;configurable hook within flymake!  
&lt;/SPAN&gt;
&lt;SPAN style="TEXT-DECORATION: overline"&gt;(defun flymake-get-make-cmdline (source base-dir)
&lt;/SPAN&gt;  (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; dino-flymake-csharp-use-msbuild
      (list (concat  dino-flymake-msbuild-location &lt;SPAN style="COLOR: #bc8f8f"&gt;"\\msbuild.exe"&lt;/SPAN&gt;)
            (list (concat base-dir &lt;SPAN style="COLOR: #bc8f8f"&gt;"/"&lt;/SPAN&gt; (dino-flymake-csharp-buildfile))
                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"/nologo"&lt;/SPAN&gt;
                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"/t:CheckSyntax"&lt;/SPAN&gt;
                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"/v:quiet"&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;normal
&lt;/SPAN&gt;                  &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;use file-relative-name to remove the fully-qualified directory name 
&lt;/SPAN&gt;                  (concat &lt;SPAN style="COLOR: #bc8f8f"&gt;"/property:SourceFileToCheck="&lt;/SPAN&gt; (file-relative-name source))
                  (concat &lt;SPAN style="COLOR: #bc8f8f"&gt;"/property:OriginalSourceFile="&lt;/SPAN&gt; (file-relative-name buffer-file-name))
                  ))
    
    (list (concat  dino-flymake-netsdk-location &lt;SPAN style="COLOR: #bc8f8f"&gt;"\\bin\\nmake.exe"&lt;/SPAN&gt;)
        (list &lt;SPAN style="COLOR: #bc8f8f"&gt;"/f"&lt;/SPAN&gt;
              (concat base-dir &lt;SPAN style="COLOR: #bc8f8f"&gt;"/"&lt;/SPAN&gt; (dino-flymake-csharp-buildfile))
              (concat &lt;SPAN style="COLOR: #bc8f8f"&gt;"CHK_SOURCES="&lt;/SPAN&gt; source)
              &lt;SPAN style="COLOR: #bc8f8f"&gt;"SYNTAX_CHECK_MODE=1"&lt;/SPAN&gt;
              &lt;SPAN style="COLOR: #bc8f8f"&gt;"check-syntax"&lt;/SPAN&gt;))

    )
  )

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;provide&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;flymake-for-csharp&lt;/SPAN&gt;)

&lt;SPAN style="COLOR: #b22222"&gt;;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;end of flymake-for-csharp.el
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;I think there are probably still some problems with this. For example, there's no direct support for projects, so for a module that refers to a class in another source file, you're gonna have to fiddle with the msbuild file to get the references right. But as a first attempt, it's basically working.&lt;/P&gt;
&lt;P&gt;I do love flymake, it is very handy.&amp;nbsp; But just to repeat my &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/12/emacs-is-better-than-visual-studio-as-a-c-development-tool.aspx#8390629" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/12/emacs-is-better-than-visual-studio-as-a-c-development-tool.aspx#8390629"&gt;previous statement&lt;/A&gt; about it: &lt;/P&gt;
&lt;BLOCKQUOTE&gt;Flymake is at least 5 years old, but it still seems to be a bit rough. There's no doc in the el file. It doesn't respect the "compile-command" variable of compile.el, instead hard-coding make. There are a bunch of other missed opportunities for customization in flymake, too. There's no doc for how to specify a different check-syntax build. There's no doc for how to do a better cleanup - so I have temporary output files hanging around. Why isn't flymake-allowed-file-name-masks an alist? Basically flymake is bad manners all around. But it's mostly working now, and it seems very handy. &lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8391037" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/dotnetinterop/attachment/8391037.ashx" length="13049" type="text/plain" /><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/MSBuild/default.aspx">MSBuild</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>Dino's .emacs file</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/14/dino-s-emacs-file.aspx</link><pubDate>Mon, 14 Apr 2008 21:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8386434</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8386434.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8386434</wfw:commentRss><description>&lt;P&gt;&lt;SPAN style="COLOR: red"&gt;&lt;EM&gt;[I'm going to try to keep this up to date, because I periodically change tweak and improve flymake setup... Latest is 15 April 2008] &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;This includes all my setup for C# development, including yasnippet, hideshow, flymake, htmlize, defaultcontent, timestamp, csharp-mode, and so on. The flymake is pulled out, you can find it &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/14/getting-flymake-el-to-work-with-c-modules.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/14/getting-flymake-el-to-work-with-c-modules.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Courier New"&gt;&lt;PRE&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Dino's .emacs setup file.  
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Time-stamp: &amp;lt;Tuesday, April 15, 2008  17:59:13  (by dinoch)&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Works with v22.2 of emacs. 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;total re-organization April 2008.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;use byte-compile-file to compile this file into emacs.elc.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;

&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;(message &lt;SPAN style="COLOR: #bc8f8f"&gt;"Running emacs.el..."&lt;/SPAN&gt;)

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;directory to load additional libraries from :
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This dir contains:
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;yasnippet.el defaultcontent.el, csharp-mode.el,
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;powershell-mode.el, powershell.el, htmlize.el
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;javascript.el 
&lt;/SPAN&gt;
(setq load-path
      (append '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"c:/users/dinoch/elisp"&lt;/SPAN&gt;)  load-path ))

&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;csense is junk
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(setq load-path
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;      &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(append '("c:/users/dinoch/elisp/csense")  load-path ))
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Global settings
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-xw"&lt;/SPAN&gt; 'dino-fixup-linefeeds)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c1"&lt;/SPAN&gt; 'just-one-space)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-cw"&lt;/SPAN&gt; 'where-is)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-\C-^"&lt;/SPAN&gt;   'describe-variable)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-^"&lt;/SPAN&gt;      'describe-key-briefly)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-xd"&lt;/SPAN&gt;     'delete-window)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-x\C-d"&lt;/SPAN&gt;  'delete-window)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-x\C-r"&lt;/SPAN&gt;  'dino-resize-big)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-xx"&lt;/SPAN&gt;     'copy-to-register)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-xg"&lt;/SPAN&gt;     'insert-register)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-xp"&lt;/SPAN&gt;     'previous-window)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-x\C-p"&lt;/SPAN&gt;  'previous-window)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-xn"&lt;/SPAN&gt;     'other-window)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-x\C-e"&lt;/SPAN&gt;  'compile)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-x\C-g"&lt;/SPAN&gt;  'auto-fill-mode)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-x\C-n"&lt;/SPAN&gt;  'next-error)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-xt"&lt;/SPAN&gt;     'toggle-truncation)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-\C-y"&lt;/SPAN&gt;   'yank-pop)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-g"&lt;/SPAN&gt;      'goto-line)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M- "&lt;/SPAN&gt;      'set-mark-command)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-\C-h"&lt;/SPAN&gt;   'backward-kill-word)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c\C-c"&lt;/SPAN&gt;  'center-paragraph)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;good for text mode
&lt;/SPAN&gt;(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-ck"&lt;/SPAN&gt;     'global-set-key)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-cs"&lt;/SPAN&gt;     'search-forward-regexp)

(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-cq"&lt;/SPAN&gt;     'query-replace)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-cc"&lt;/SPAN&gt;     'goto-char)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-cr"&lt;/SPAN&gt;     'replace-regexp)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-ct"&lt;/SPAN&gt;     'dino-insert-timeofday)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c\C-t"&lt;/SPAN&gt;  'dino-insert-timestamp)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-cw"&lt;/SPAN&gt;     'where-is)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c\C-w"&lt;/SPAN&gt;  'compare-windows)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c!"&lt;/SPAN&gt;     'revert-buffer-unconditionally)


&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;the help key is assigned to Ctrl-\, or Esc-Ctrl-\
&lt;/SPAN&gt;(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-\C-\\"&lt;/SPAN&gt;   'help-for-help)
(global-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-\\"&lt;/SPAN&gt;      'help-for-help)


&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;handle text end-of-line conventions the way it oughta be: 
&lt;/SPAN&gt;(setq inhibit-eol-conversion nil)

&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;turn on font-lock globally
&lt;/SPAN&gt;(global-font-lock-mode 1  'ON)

(setq-default fill-column 72)
(setq auto-save-interval 500)
(setq case-fold-search nil)

&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;helpful for debugging lisp code:
&lt;/SPAN&gt;(setq messages-buffer-max-lines 2500)

&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;for fontification in emacs progmodes:
&lt;/SPAN&gt;(load &lt;SPAN style="COLOR: #bc8f8f"&gt;"font-lock"&lt;/SPAN&gt;)
(setq font-lock-maximum-decoration t)

(setq completion-auto-help nil)

(put 'eval-expression 'disabled nil)

&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;set truncation on side-by-side windows to nil.
&lt;/SPAN&gt;(setq truncate-partial-width-windows nil)

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
                

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Frames preferences: initial and default frames
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;see http://www.gnu.org/software/emacs/windows/big.html#windows-frames
&lt;/SPAN&gt;(setq default-frame-alist
      '(
        (top . 10) (left . 860)
        (width . 100) (height . 28)
        (cursor-color . &lt;SPAN style="COLOR: #bc8f8f"&gt;"Blue"&lt;/SPAN&gt;)
        (cursor-type . box)
                (foreground-color . &lt;SPAN style="COLOR: #bc8f8f"&gt;"Black"&lt;/SPAN&gt;)
        (background-color . &lt;SPAN style="COLOR: #bc8f8f"&gt;"White"&lt;/SPAN&gt;)
                (mouse-color . &lt;SPAN style="COLOR: #bc8f8f"&gt;"sienna3"&lt;/SPAN&gt;)
        (font . &lt;SPAN style="COLOR: #bc8f8f"&gt;"-*-Lucida Console-normal-r-*-*-11-82-96-96-c-*-iso8859-1"&lt;/SPAN&gt;)
        )
      )

&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;initial frame is 128 wide x 72 high
&lt;/SPAN&gt;(setq initial-frame-alist '(
                            (top . 40) (left . 10)
                            (width . 128) (height . 68)
                            )
      )



&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;what should a frame look like
&lt;/SPAN&gt;(setq frame-title-format '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"%f [mode: %m]"&lt;/SPAN&gt; )    &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;"filename [mode]" in title bar
&lt;/SPAN&gt;      icon-title-format '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"emacs: %b"&lt;/SPAN&gt;))   &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;"emacs: buffername" in icon
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;adjustment to mode mappings
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;In the regexp's, the trailing \\' represents "end of string".
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;The $ represents the zero-width place before newline.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;They are equivalent unless there is a filename with a new line in it.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;(setq auto-mode-alist
      (append '(
                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;war&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;ear&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;WAR&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;EAR&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;\\'"&lt;/SPAN&gt; . archive-mode)        &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;java archives
&lt;/SPAN&gt;                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.s?html?\\'"&lt;/SPAN&gt;                     . html-helper-mode)
                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.asp$"&lt;/SPAN&gt;                           . html-helper-mode)
                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.aspx$"&lt;/SPAN&gt;                          . html-helper-mode)
                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.html$"&lt;/SPAN&gt;                          . html-helper-mode)
                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.htm$"&lt;/SPAN&gt;                           . html-helper-mode)
                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.md$"&lt;/SPAN&gt;                            . emacs-lisp-mode)     &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;what the hell is an .md file?
&lt;/SPAN&gt;                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.el$"&lt;/SPAN&gt;                            . emacs-lisp-mode)
                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.js\\'"&lt;/SPAN&gt;                          . javascript-mode)
                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.txt$"&lt;/SPAN&gt;                           . text-mode)
                (&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.asmx$"&lt;/SPAN&gt;                          . csharp-mode)          &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;maybe, could be any language tho
&lt;/SPAN&gt;                ) auto-mode-alist ))

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;htmlize
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;require&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;htmlize&lt;/SPAN&gt;)
(setq htmlize-output-type 'inline-css)

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;yasnippet
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;grabbed 2008 april 11
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;see http://code.google.com/p/yasnippet/downloads/list
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;you need to create a new yasnippet-bundle.el each time you add
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;new snippets! see yasnippet-CreateBundle.el for the tool.
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;require&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;yasnippet-bundle&lt;/SPAN&gt;)

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;defaultcontent
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This package inserts "default content" into a new  file of a given
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;type, when it is first edited in emacs.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;See the elisp/defaultcontent directory for templates.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;require&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;defaultcontent&lt;/SPAN&gt;)

&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;specify the directory to look in for templates
&lt;/SPAN&gt;(setq dc-auto-insert-directory &lt;SPAN style="COLOR: #bc8f8f"&gt;"c:/users/dinoch/elisp/defaultcontent/"&lt;/SPAN&gt;)
(setq dc-fast-variable-handling t)

&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;specify the template to use for .cs files:
&lt;/SPAN&gt;(add-to-list 'dc-auto-insert-alist '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.cs$"&lt;/SPAN&gt; . &lt;SPAN style="COLOR: #bc8f8f"&gt;"template.cs"&lt;/SPAN&gt; ))


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;configure external utilities
&lt;/SPAN&gt;
(setq archive-zip-use-pkzip nil)   &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;i.e. use unzip instead
&lt;/SPAN&gt;(setq archive-zip-extract '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"unzip"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"-"&lt;/SPAN&gt;))

(setq-default compile-command &lt;SPAN style="COLOR: #bc8f8f"&gt;"nmake"&lt;/SPAN&gt;)

(setq-default grep-command &lt;SPAN style="COLOR: #bc8f8f"&gt;"grep -i "&lt;/SPAN&gt;)
&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;timestamp 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;put this in a file in the first N lines to get an auto-updated timestamp: 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Time-stamp: &amp;lt;&amp;gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
(setq 
  time-stamp-active t          &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;do enable time-stamps
&lt;/SPAN&gt;  time-stamp-line-limit 24     &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;check first N buffer lines for Time-stamp: &amp;lt;&amp;gt;
&lt;/SPAN&gt;  time-stamp-format &lt;SPAN style="COLOR: #bc8f8f"&gt;"%:a, %:b %02d, %04y  %02H:%02M:%02S %Z (by %u)"&lt;/SPAN&gt;) &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;date format
&lt;/SPAN&gt;
(add-hook 'before-save-hook 'time-stamp)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;update time stamps when saving
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;



&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Text mode
&lt;/SPAN&gt;
(add-hook 'text-mode-hook '(&lt;SPAN style="COLOR: #a020f0"&gt;lambda&lt;/SPAN&gt; () (auto-fill-mode 1)))

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;flymake-for-csharp
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;tweaks to flymake.el for csharp.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;require&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;flymake-for-csharp&lt;/SPAN&gt;)
&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;

&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(require 'csense-cs-frontend)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(setq csense-cs-source-files (csense-get-files-recursive "." ".+\\.cs$"))
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(setq csense-cs-assembly-parser-program "c:\\users\\dinoch\\elisp\\csense\\netsense.exe")
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(setq csense-cs-assemblies '("c:\\.net2.0\\System.dll" "c:\\.net2.0\\System.XML.dll" "c:\\.net2.0\\System.Data.dll"))
&lt;/SPAN&gt;

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;csharp mode 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;csharp mode was originally from Brad Merrill, bmerrill@microsoft.com
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;but then Dennis Haney (I think) &amp;lt;&lt;A href="mailto:davh@davh.dk" mce_href="mailto:davh@davh.dk"&gt;davh@davh.dk&lt;/A&gt;&amp;gt; updated it. 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;http://davh.dk/script/ 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;I then found what I think is a later version? better integrated with cc-modes.?
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;maintained by Dylan Moonfire. Most recently updated September 2007.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;http://mfgames.com/linux/csharp-mode
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;require&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;csharp-mode&lt;/SPAN&gt;)

(&lt;SPAN style="COLOR: #a020f0"&gt;require&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;hideshow&lt;/SPAN&gt;)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;builtin to emacs
&lt;/SPAN&gt;

&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
&lt;/SPAN&gt;(c-add-style &lt;SPAN style="COLOR: #bc8f8f"&gt;"C#"&lt;/SPAN&gt;
 '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"Java"&lt;/SPAN&gt;
   (c-basic-offset . 2)
   (c-comment-only-line-offset . (0 . 0))
   (c-offsets-alist 
    . (
       (access-label . -)
       (arglist-close . c-lineup-arglist)
       (arglist-cont . 0)
       (arglist-cont-nonempty . c-lineup-arglist)
       (arglist-intro . c-lineup-arglist-intro-after-paren)
       (block-close . 0)
       (block-open . 0)
       (brace-entry-open . 0)
       (brace-list-close . 0)
       (brace-list-entry . 0)
       (brace-list-intro . +)
       (brace-list-open . +)
       (c . c-lineup-C-comments)
       (case-label . 0)
       (catch-clause . 0)
       (class-close . 0)
       (class-open . 0)
       (comment-intro . c-lineup-comment)
       (cpp-macro . 0)
       (cpp-macro-cont . c-lineup-dont-change)
       (defun-block-intro . +)
       (defun-close . 0)
       (defun-open . 0)
       (do-while-closure . 0)
       (else-clause . 0)
       (extern-lang-close . 0)
       (extern-lang-open . 0)
       (friend . 0)
       (func-decl-cont . +)
       (inclass . +)
       (inexpr-class . +)
       (inexpr-statement . 0)
       (inextern-lang . +)
       (inher-cont . c-lineup-multi-inher)
       (inher-intro . +)
       (inlambda . c-lineup-inexpr-block)
       (inline-close . 0)
       (inline-open . 0)
       (innamespace . +)
       (knr-argdecl . 0)
       (knr-argdecl-intro . 5)
       (label . 0)
       (lambda-intro-cont . +)
       (member-init-cont . c-lineup-multi-inher)
       (member-init-intro . +)
       (namespace-close . 0)
       (namespace-open . 0)
       (objc-method-args-cont . c-lineup-ObjC-method-args)
       (objc-method-call-cont . c-lineup-ObjC-method-call)
       (objc-method-intro . [0])
       (statement . 0)
       (statement-block-intro . +)
       (statement-case-intro . +)
       (statement-case-open . +)
       (statement-cont . +)
       (stream-op . c-lineup-streamop)
       (string . c-lineup-dont-change)
       (substatement . +)
       (substatement-open . 0)
       (template-args-cont c-lineup-template-args +)
       (topmost-intro . 0)
       (topmost-intro-cont . 0)
       ))
   ))


(c-add-style &lt;SPAN style="COLOR: #bc8f8f"&gt;"myC#Style"&lt;/SPAN&gt;
  '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"C#"&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;this must be defined elsewhere 
&lt;/SPAN&gt;  (c-basic-offset . 2)
  (c-echo-syntactic-information-p . t)
  (c-comment-only-line-offset . (0 . 0))
  (c-offsets-alist . (
    (c                     . c-lineup-C-comments)
    (namespace-open        . 0)
    (namespace-close       . 0)
    (innamespace           . +)
    (class-open            . 0)
    (class-close           . 0)
    (inclass               . +)
    (block-open            . -)    &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;eg, open a block under a function name or if stmt;
&lt;/SPAN&gt;                                   &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;want this to be flush with prev line. 
&lt;/SPAN&gt;    (arglist-cont          . +)
    (substatement-open     . 0)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;I think this is for a try {} or if{} or etc. why this is not block open, I don't know!
&lt;/SPAN&gt;    (defun-open            . 0)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;method defn? (but no!)
&lt;/SPAN&gt;    (defun-block-intro     . +)  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;0 ; block within a function????
&lt;/SPAN&gt;    (inline-open           . 0)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;eg, opening a function? ??
&lt;/SPAN&gt;    (statement-block-intro . +)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;unknown what this is
&lt;/SPAN&gt;    (brace-list-open       . 0)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;list open (like an enum, array initializer)
&lt;/SPAN&gt;    (brace-list-intro      . +)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;first item in the list 
&lt;/SPAN&gt;    (brace-list-entry      . 0)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;subsequent items in the list 
&lt;/SPAN&gt;    (brace-list-close      . 0)  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;list close
&lt;/SPAN&gt;    (statement-cont        . (dinoch-csharp-lineup-string-cont +))  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;align long strings
&lt;/SPAN&gt;    ))
  ))



&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;this aligns long strings broken across multiple lines.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;need   (statement-cont . (dinoch-csharp-lineup-string-cont +)) in the styles list
&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dinoch-csharp-lineup-string-cont&lt;/SPAN&gt; (langelem)
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Like `&lt;/SPAN&gt;&lt;SPAN style="COLOR: #5f9ea0"&gt;c-lineup-string-cont&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;' but works with csharp string continuations."&lt;/SPAN&gt;
  (&lt;SPAN style="COLOR: #a020f0"&gt;save-excursion&lt;/SPAN&gt;
    (back-to-indentation)
    (and (looking-at &lt;SPAN style="COLOR: #bc8f8f"&gt;"@?\\s\""&lt;/SPAN&gt;)
         (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; ((quote (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (equal (char-after) ?@)
                          (char-after (1+ (point)))
                        (char-after)))
               pos)
           (&lt;SPAN style="COLOR: #a020f0"&gt;while&lt;/SPAN&gt; (and (&lt;SPAN style="COLOR: #a020f0"&gt;progn&lt;/SPAN&gt; (c-backward-syntactic-ws)
                              (&lt;SPAN style="COLOR: #a020f0"&gt;when&lt;/SPAN&gt; (eq (char-before) ?+)
                                (backward-char)
                                (c-backward-syntactic-ws))
                              (eq (char-before) quote))
                       (c-safe (c-backward-sexp) t)
                       &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;uncomment this to lineup under the @
&lt;/SPAN&gt;                       &lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(progn (if (eq (char-before) ?@) (backward-char)) t)
&lt;/SPAN&gt;                       (/= (setq pos (point)) (c-point 'boi))))
           (&lt;SPAN style="COLOR: #a020f0"&gt;when&lt;/SPAN&gt; pos
             (goto-char pos)
             (vector (current-column)))))))



&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(debug-on-entry 'hs-hide-level-recursive)
&lt;/SPAN&gt;

&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;for hideshow.el
&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;csharp-hs-forward-sexp&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #228b22"&gt;&amp;amp;optional&lt;/SPAN&gt; arg)

&lt;SPAN style="COLOR: #bc8f8f"&gt;"I set hs-forward-sexp-func to this function.

I found this customization necessary to do the hide/show magic in C#
code, when dealing with region/endregion. This routine
goes forward one s-expression, whether it is defined by curly braces
or region/endregion. It handles nesting, too.

The forward-sexp method takes an arg which can be negative, which
indicates the move should be backward.  Therefore, to be fully
correct this function should also handle a negative arg. However,
the hideshow.el package never uses negative args to its
hs-forward-sexp-func, so it doesn't matter that this function does not
do negative numbers.

The arg can also be greater than 1, which means go forward
multiple times. This function doesn't handle that EITHER.  But
again, I haven't see that as a problem."&lt;/SPAN&gt;

  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; ((nestlevel 0)
        (mark1 (point))
        (done nil)
        )

    &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(show-match-data)
&lt;/SPAN&gt;    
    (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (and arg (&amp;lt; arg 0))
        &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;a negative argument; we want to back up!
&lt;/SPAN&gt;        (message &lt;SPAN style="COLOR: #bc8f8f"&gt;"negative arg (%d) is not supported..."&lt;/SPAN&gt; arg)

      &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;else, we have a positive argument, hence move forward.
&lt;/SPAN&gt;      &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;simple case is just move forward one brace
&lt;/SPAN&gt;      (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (looking-at &lt;SPAN style="COLOR: #bc8f8f"&gt;"{"&lt;/SPAN&gt;)
          (and
           (forward-sexp arg)
           )
        
        &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;The more complex case is dealing with a "region/endregion" block.
&lt;/SPAN&gt;        &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;We have to deal with nested regions!
&lt;/SPAN&gt;        (and
         (&lt;SPAN style="COLOR: #a020f0"&gt;while&lt;/SPAN&gt; (not done)
           (re-search-forward &lt;SPAN style="COLOR: #bc8f8f"&gt;"^[ \\t]*#[ \\t]*&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;region&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;endregion&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;\\b"&lt;/SPAN&gt;
                              (point-max) 'move)
           (&lt;SPAN style="COLOR: #a020f0"&gt;cond&lt;/SPAN&gt;
            
            ((eobp))                            &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;do nothing if at end of buffer
&lt;/SPAN&gt;            
            ((and
              (match-beginning 1)

              &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;if the match is longer than 6 chars, we know it is "endregion"
&lt;/SPAN&gt;              (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (&amp;gt; (- (match-end 1) (match-beginning 1)) 6)
                   (setq nestlevel (1- nestlevel))
                 (setq nestlevel (1+ nestlevel))
                )
              )))

           (setq done (not (and (&amp;gt; nestlevel 0) (not (eobp)))))
           
           ) &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;while
&lt;/SPAN&gt;                        
         (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (= nest 0)
             (goto-char (match-end 2)))

         )
        )
      )
    )
  )

&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;more for hideshow.el
&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;unless&lt;/SPAN&gt; (assoc 'csharp-mode hs-special-modes-alist)
          (push '(csharp-mode
                  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;"\\(^\\s*#\\s*region\\b\\)\\|{"      ; regexp for start block
&lt;/SPAN&gt;                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^[ \\t]*#[ \\t]*region\\b&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;{"&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;regexp for start block
&lt;/SPAN&gt;                  
                  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;"\\(^\\s*#\\s*endregion\\b\\)\\|}"   ; regexp for end block
&lt;/SPAN&gt;                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^[ \\t]*#[ \\t]*endregion\\b&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;}"&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;regexp for end block
&lt;/SPAN&gt;                  
                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"/[*/]"&lt;/SPAN&gt;                                &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;regexp for comment start
&lt;/SPAN&gt;                  
                  csharp-hs-forward-sexp                 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;hs-forward-sexp-func
&lt;/SPAN&gt;                  hs-c-like-adjust-block-beginning       &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;c-like adjust (1 char)
&lt;/SPAN&gt;                  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;csharp-hs-adjust-block-beginning      ;csharp adjust ?
&lt;/SPAN&gt;                  )
                hs-special-modes-alist))



(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-csharp-mode-fn&lt;/SPAN&gt; ()
  (&lt;SPAN style="COLOR: #a020f0"&gt;cond&lt;/SPAN&gt; (window-system
         (turn-on-font-lock)
         (c-set-style &lt;SPAN style="COLOR: #bc8f8f"&gt;"myC#Style"&lt;/SPAN&gt;)
         (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-\C-R"&lt;/SPAN&gt;  'indent-region)
         (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-#"&lt;/SPAN&gt;     'dino-indent-buffer)
         (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-s"&lt;/SPAN&gt;     'dino-insert-csharp-gettersetter)
         (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-cp"&lt;/SPAN&gt;    'dino-convert-csharp-field-to-property)
         (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c\C-p"&lt;/SPAN&gt; 'dino-convert-csharp-field-to-property)

         &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;for skeleton stuff?  do I need this now?
&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(make-local-variable skeleton-pair)
&lt;/SPAN&gt;         (setq skeleton-pair t)
         (local-set-key (kbd &lt;SPAN style="COLOR: #bc8f8f"&gt;"("&lt;/SPAN&gt;) 'skeleton-pair-insert-maybe)
         (local-set-key (kbd &lt;SPAN style="COLOR: #bc8f8f"&gt;"["&lt;/SPAN&gt;) 'skeleton-pair-insert-maybe)
         (local-set-key (kbd &lt;SPAN style="COLOR: #bc8f8f"&gt;"{"&lt;/SPAN&gt;) 'skeleton-pair-insert-maybe)
         (local-set-key (kbd &lt;SPAN style="COLOR: #bc8f8f"&gt;"\""&lt;/SPAN&gt;) 'skeleton-pair-insert-maybe)
         
         &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;for snippets support:
&lt;/SPAN&gt;         (yas/minor-mode-on)
         
         &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;for flymake support:
&lt;/SPAN&gt;         (flymake-mode)
         
         &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;for hide/show support
&lt;/SPAN&gt;         (hs-minor-mode 1)
         (setq hs-isearch-open t)

         &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;with point inside the block, use these keys to hide/show
&lt;/SPAN&gt;         (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c&amp;gt;"&lt;/SPAN&gt;  'hs-hide-block)
         (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c&amp;lt;"&lt;/SPAN&gt;  'hs-show-block)

         &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;autorevert.el is built-in to emacs; if files
&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;are changed outside of emacs, the buffer auto-reverts.
&lt;/SPAN&gt;         (turn-on-auto-revert-mode)
         
         )))

(add-hook 'csharp-mode-hook 'dino-csharp-mode-fn)


&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;to allow next-error to work with csc.exe: 
&lt;/SPAN&gt;(setq compilation-scroll-output t)
(setq-default compilation-error-regexp-alist
&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;       (append 
&lt;/SPAN&gt; '(
 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Microsoft VJC??:
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;sample.java(6,1) : error J0020: Expected 'class' or 'interface'
&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #bc8f8f"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[a-zA-Z]:&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;?[&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;:(\t\n]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[,]&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;): &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;error&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;warning&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt; VJS[0-9]+:"&lt;/SPAN&gt; 1 3 4)

 &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;dinoch - Wed, 04 Aug 2004  09:29
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;handle whitespace at beginning of line (for nant output)
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;C# Compiler
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;t.cs(6,18): error SC1006: Name of constructor must match name of class
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #bc8f8f"&gt;"[ \t]*&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[_a-zA-Z:\]:&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;?[&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;:(\t\n]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[,]&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;): &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;error&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;warning&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt; CS[0-9]+:"&lt;/SPAN&gt; 1 3 4)

 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Microsoft C/C++:
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;keyboard.c(537) : warning C4005: 'min' : macro redefinition
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;d:\tmp\test.c(23) : error C2143: syntax error : missing ';' before 'if'
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;VC EEi
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;e:\projects\myce40\tok.h(85) : error C2236: unexpected 'class' '$S1'
&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;myc.cpp(14) : error C3149: 'class System::String' : illegal use of managed type 'String'; did you forget a '*'?
&lt;/SPAN&gt;    (&lt;SPAN style="COLOR: #bc8f8f"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[a-zA-Z]:&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;?[&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;:(\t\n]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[0-9]+&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;) \
: &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;error&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;warning&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt; C[0-9]+:"&lt;/SPAN&gt; 1 3)
 )
&lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;compilation-error-regexp-alist)
&lt;/SPAN&gt;)


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;XML mode
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
(add-hook 'sgml-mode-hook (&lt;SPAN style="COLOR: #a020f0"&gt;lambda&lt;/SPAN&gt; () (turn-on-auto-revert-mode)))

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;



&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;elisp mode
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-elisp-mode-fn&lt;/SPAN&gt; ()
  (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\r"&lt;/SPAN&gt;        'newline-and-indent)
  (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c\C-c"&lt;/SPAN&gt;  'comment-region)
  (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-\C-R"&lt;/SPAN&gt;   'indent-region)
  (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-ce"&lt;/SPAN&gt;     'eval-buffer)
  (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-c\C-e"&lt;/SPAN&gt;  'eval-region)
  (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\C-x\C-e"&lt;/SPAN&gt;  'byte-compile-file)
  )
(add-hook 'emacs-lisp-mode-hook 'dino-elisp-mode-fn)

&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This is for scratch buffer
&lt;/SPAN&gt;(add-hook 'lisp-interaction-mode-hook 'dino-elisp-mode-fn)

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;JavaScript
&lt;/SPAN&gt;
(autoload 'javascript-mode &lt;SPAN style="COLOR: #bc8f8f"&gt;"javascript"&lt;/SPAN&gt; nil t)
&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;

   


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Java
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-java-mode-hook&lt;/SPAN&gt; ()
  (c-set-style &lt;SPAN style="COLOR: #bc8f8f"&gt;"myJavaStyle"&lt;/SPAN&gt;)
  (font-lock-mode)
  (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-\C-R"&lt;/SPAN&gt; 'indent-region)
)
(setq java-mode-hook 'dino-java-mode-hook)


(c-add-style &lt;SPAN style="COLOR: #bc8f8f"&gt;"myJavaStyle"&lt;/SPAN&gt;
  '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"Java"&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;this must be defined elsewhere - it is in cc-modes.el
&lt;/SPAN&gt;  (c-basic-offset . 2)
  (c-echo-syntactic-information-p . t)
  (c-comment-only-line-offset . (0 . 0))
  (c-offsets-alist . (
    (c                     . c-lineup-C-comments)
    (statement-case-open   . 0)
    (case-label            . +)
    (substatement-open     . 0)  
    ))
  ))

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;C Programming language
&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-c-mode-hook&lt;/SPAN&gt; ()
  (c-set-style &lt;SPAN style="COLOR: #bc8f8f"&gt;"myCStyle"&lt;/SPAN&gt;)
  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;for re-tabbing an entire region of code: 
&lt;/SPAN&gt;  (local-set-key &lt;SPAN style="COLOR: #bc8f8f"&gt;"\M-\C-R"&lt;/SPAN&gt; 'indent-region)

  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;don't think I still need this!
&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(set-backspace-keys-conditionally)
&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;turn off the c-indent-region thing; I don't like the indents it gives me! 
&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;by using nil here, I get indent-according-to-mode, which is what works for me. 
&lt;/SPAN&gt;  (setq indent-region-function nil)

  (setq c-auto-newline nil)

  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;two comment procedures (see above)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(local-set-key "\M-/" 'dino-start-c-comment)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(local-set-key "\M-?" 'dino-end-c-comment)  
&lt;/SPAN&gt;)
(setq c-mode-hook 'dino-c-mode-hook)


(c-add-style &lt;SPAN style="COLOR: #bc8f8f"&gt;"myCStyle"&lt;/SPAN&gt;
  '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"bsd"&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;this must be defined elsewhere - it is in cc-modes.el
&lt;/SPAN&gt;  (c-basic-offset . 2)
  (c-echo-syntactic-information-p . t)
  (c-comment-only-line-offset . (0 . 0))
  (c-offsets-alist . (
    (c                     . c-lineup-C-comments)
    (statement-case-open   . 0)
    (case-label            . +)
    (substatement-open     . 0)  
    ))
  ))


(fset 'dino-start-c-comment   &lt;SPAN style="COLOR: #bc8f8f"&gt;"/* "&lt;/SPAN&gt;)

(fset 'dino-end-c-comment   &lt;SPAN style="COLOR: #bc8f8f"&gt;" */"&lt;/SPAN&gt;)

(fset 'dino-end-block-comment
   [escape ?\C-b escape ?  ?\C-a ?\C-w ?\C-y escape ?\C-f ?  ?/ ?/ ?  ?\C-y ?\C-x ?\C-x ?\C-c ?1])

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;



&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;perl mode
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defalias&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #0000ff"&gt;perl-mode&lt;/SPAN&gt; 'cperl-mode)
(autoload 'perl-mode &lt;SPAN style="COLOR: #bc8f8f"&gt;"c:/emacs/lisp/progmodes/cperl-mode"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;""&lt;/SPAN&gt; t)
&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(autoload 'perl-mode "c:/emacs/lisp/progmodes/perl-mode" "" t)
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(setq                                       
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;cperl-comment-column   44)                 ; must these be set globally?
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;defconst&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;my-cperl-style&lt;/SPAN&gt;
  '( (&lt;SPAN style="COLOR: #bc8f8f"&gt;"MyPerl"&lt;/SPAN&gt;
     (cperl-indent-level               .  0)
     (cperl-brace-offset               .  2)
     (cperl-continued-statement-offset .  2)
     (cperl-continued-brace-offset     . -2)
     (cperl-label-offset               . -2)
     (cperl-close-paren-offset         . -1))))



(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;cperl-mode-hook-fn&lt;/SPAN&gt; ()
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"My hook for perl"&lt;/SPAN&gt;
  (set-variable 'c-indent-level 0)      &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;required for c-outline
&lt;/SPAN&gt;  (turn-on-font-lock)
  )

(add-hook 'cperl-mode-hook 'cperl-mode-hook-fn) 

(make-local-variable 'cperl-style-alist)
(setq cperl-style-alist 'my-cperl-style)

(add-to-list 'auto-mode-alist '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;[pP][Llm]&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;al&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;\\'"&lt;/SPAN&gt; . cperl-mode))
(add-to-list 'interpreter-mode-alist '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"perl"&lt;/SPAN&gt; . cperl-mode))
(add-to-list 'interpreter-mode-alist '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"perl5"&lt;/SPAN&gt; . cperl-mode))
(add-to-list 'interpreter-mode-alist '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"miniperl"&lt;/SPAN&gt; . cperl-mode))

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Powershell
&lt;/SPAN&gt;
(autoload 'powershell-mode &lt;SPAN style="COLOR: #bc8f8f"&gt;"powershell-mode"&lt;/SPAN&gt;   
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Major mode for editing powershell code."&lt;/SPAN&gt; t)
(setq auto-mode-alist (cons '( &lt;SPAN style="COLOR: #bc8f8f"&gt;"\\.ps1\\'"&lt;/SPAN&gt; . powershell-mode ) auto-mode-alist ))

(autoload 'powershell &lt;SPAN style="COLOR: #bc8f8f"&gt;"powershell"&lt;/SPAN&gt;   
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Run powershell as a shell within emacs."&lt;/SPAN&gt; t)


&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;







&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;handy utility functions for various purposes
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;when copying binary files into a clipboard buffer
&lt;/SPAN&gt;(fset 'dinoch-b64-copy
   [escape ?  escape ?&amp;gt; escape ?x ?b ?a ?s ?e ?6 ?4 ?- ?e ?n ?c tab return ?\C-w ?\C-y])

&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;when pasting the base64 stuff from binary files 
&lt;/SPAN&gt;(fset 'dinoch-b64-paste
   [escape ?x ?r backspace ?e ?r ?a ?s ?e ?- ?b ?u tab return ?\C-y escape ?x ?b ?a ?s ?e ?6 ?4 ?- ?d ?e ?c ?o tab return ?\C-x ?\C-s])


(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-fixup-linefeeds&lt;/SPAN&gt; ()
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Dino's function to replace the CR-LF of a DOS ASCII file to a LF for Unix."&lt;/SPAN&gt; 
  (interactive)
  (&lt;SPAN style="COLOR: #a020f0"&gt;save-excursion&lt;/SPAN&gt;
  (&lt;SPAN style="COLOR: #a020f0"&gt;while&lt;/SPAN&gt; (search-forward &lt;SPAN style="COLOR: #bc8f8f"&gt;"

"&lt;/SPAN&gt; nil t)
    (replace-match &lt;SPAN style="COLOR: #bc8f8f"&gt;"
"&lt;/SPAN&gt; nil t))
  )
)


(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-indent-buffer&lt;/SPAN&gt; ()
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Dino's function to re-indent an entire buffer; helpful in progmodes like XML mode or csharp mode."&lt;/SPAN&gt;
  (interactive)
  (indent-region (point-min) (point-max))
)


&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;put an href around the url at point. 
&lt;/SPAN&gt;(fset 'dino-href-url
   [?&amp;lt; ?  backspace ?a ?  ?h ?r ?e ?f ?= ?\" ?\C-s ?  ?\C-b ?\" ?&amp;gt; ?\C-r ?/ ?\C-f escape ?  ?\C-s ?\" ?\C-b ?\C-w ?\C-y ?\C-f ?\C-f ?\C-y ?&amp;lt; ?/ ?a ?&amp;gt; ?&amp;lt; ?b ?r ?&amp;gt; return])


(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;revert-buffer-unconditionally&lt;/SPAN&gt; ()
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"revert the current buffer unconditionally,"&lt;/SPAN&gt;
  (interactive)
  (revert-buffer t t)
  )

(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-resize-big&lt;/SPAN&gt; ()
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"quick resize to 128x72"&lt;/SPAN&gt;
  (interactive)
  (set-frame-height (selected-frame) 72)
  (set-frame-width (selected-frame) 128)
)

(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-toggle-truncation&lt;/SPAN&gt; ()
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Joe's function to toggle the state of the truncate-lines variable"&lt;/SPAN&gt;
  (interactive)
  (setq truncate-lines (not truncate-lines))
  (redraw-display)
  )

(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-remove-trailing-whitespace&lt;/SPAN&gt; () 
&lt;SPAN style="COLOR: #bc8f8f"&gt;"For each line in region, Convert multiple spaces at end of line to just one."&lt;/SPAN&gt; 
  (interactive)
  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; ((beg (point-min))
        (end (point-max)))
  (&lt;SPAN style="COLOR: #a020f0"&gt;save-excursion&lt;/SPAN&gt;
    (goto-char beg)
    (&lt;SPAN style="COLOR: #a020f0"&gt;while&lt;/SPAN&gt; (and (&amp;lt; (point) end)
                (re-search-forward &lt;SPAN style="COLOR: #bc8f8f"&gt;" +$"&lt;/SPAN&gt; end t))
      (just-one-space)
      (backward-delete-char-untabify 1)
      )
)))


(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-insert-timestamp&lt;/SPAN&gt; ()
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"function to insert timestamp at point. format: DayOfWeek, Date Month Year   24hrTime"&lt;/SPAN&gt;
  (interactive)
  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; (localstring mytime)
    (setq localstring (current-time-string))
    (setq mytime (concat &lt;SPAN style="COLOR: #bc8f8f"&gt;"....dinoch...."&lt;/SPAN&gt;
                         (substring localstring 0 3)  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;day-of-week
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;", "&lt;/SPAN&gt; 
                         (substring localstring 8 10) &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;day number
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;" "&lt;/SPAN&gt;
                         (substring localstring 4 7)  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;month 
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;" "&lt;/SPAN&gt;
                         (substring localstring 20 24 ) &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;4-digit year
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;"...."&lt;/SPAN&gt;
                         (substring localstring 11 16 ) &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;24-hr time
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;"....\n"&lt;/SPAN&gt;
                         ))
    (insert mytime))
) 



(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-insert-timeofday&lt;/SPAN&gt; ()
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"function to insert time of day at point . format: DayOfWeek, Date Month Year   24hrTime"&lt;/SPAN&gt;
  (interactive)
  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; (localstring mytime)
    (setq localstring (current-time-string))
&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;example:
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Mon, 17 Jun 96  12:52
&lt;/SPAN&gt;    (setq mytime (concat (substring localstring 0 3)  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;day-of-week
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;", "&lt;/SPAN&gt; 
                         (substring localstring 8 10) &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;day number
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;" "&lt;/SPAN&gt;
                         (substring localstring 4 7)  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;month 
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;" "&lt;/SPAN&gt;
                         (substring localstring 20 24 ) &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;4-digit year
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;"  "&lt;/SPAN&gt;
                         (substring localstring 11 16 ) &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;24-hr time
&lt;/SPAN&gt;                         &lt;SPAN style="COLOR: #bc8f8f"&gt;"\n"&lt;/SPAN&gt;
                         ))
    (insert mytime))
) 


&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;The following function (scarfed off an emacs bboard) will allow you to
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;see what emacs is seeing when you press any key.  
&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;dino-see-chars&lt;/SPAN&gt; ()
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Displays characters typed, terminated by a 3-second timeout."&lt;/SPAN&gt;
  (interactive)
  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; ((chars &lt;SPAN style="COLOR: #bc8f8f"&gt;""&lt;/SPAN&gt;)
        (inhibit-quit t))
    (message &lt;SPAN style="COLOR: #bc8f8f"&gt;"Enter characters, terminated by 3-second timeout."&lt;/SPAN&gt;)
    (&lt;SPAN style="COLOR: #a020f0"&gt;while&lt;/SPAN&gt; (not (sit-for 3))
      (setq chars (concat chars (list (read-char)))
            quit-flag nil))         &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;quit-flag maybe set by C-g
&lt;/SPAN&gt;    (message &lt;SPAN style="COLOR: #bc8f8f"&gt;"Characters entered: %s"&lt;/SPAN&gt; (key-description chars))))

&lt;SPAN style="COLOR: #b22222"&gt;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;

(message &lt;SPAN style="COLOR: #bc8f8f"&gt;"Done with emacs.el..."&lt;/SPAN&gt;)
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8386434" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/dotnetinterop/attachment/8386434.ashx" length="27149" type="text/plain" /><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>Making Hideshow.el work with Csharp-mode.el and region/endregion</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/14/making-hideshow-el-work-with-csharp-mode-el-and-region-endregion.aspx</link><pubDate>Mon, 14 Apr 2008 20:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8386298</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8386298.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8386298</wfw:commentRss><description>&lt;P&gt;The default hideshow.el stuff in emacs doesn't "do" region/endregion, which is commonly seen in C# modules.&amp;nbsp; Thankfully, the hideshow people thought of this, and made available a customization hook, where you can specify how to navigate blocks within the buffer.&amp;nbsp; It is &lt;STRONG&gt;hs-forward-sexp-func&lt;/STRONG&gt;, and you can customize it for any mode.&amp;nbsp; I wrote one to deal with C#. &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 10pt; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Courier New"&gt;&lt;PRE&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;csharp-hs-forward-sexp&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #228b22"&gt;&amp;amp;optional&lt;/SPAN&gt; arg)

  &lt;SPAN style="COLOR: #bc8f8f"&gt;"I set hs-forward-sexp-func to this function.

I found this customization necessary to do the hide/show magic in C#
code, when dealing with region/endregion. This routine
goes forward one s-expression, whether it is defined by curly braces
or region/endregion. It handles nesting, too.

The forward-sexp method takes an arg which can be negative, which
indicates the move should be backward.  Therefore, to be fully
correct this function should also handle a negative arg. However,
the hideshow.el package never uses negative args to its
hs-forward-sexp-func, so it doesn't matter that this function does not
do negative numbers.

The arg can also be greater than 1, which means go forward
multiple times. This function doesn't handle that EITHER.  But
again, I haven't see that as a problem."&lt;/SPAN&gt;

  (message &lt;SPAN style="COLOR: #bc8f8f"&gt;"csharp-hs-forward-sexp, (arg %d) (point %d)..."&lt;/SPAN&gt;
           (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (numberp arg) arg -1)
           (point))
  
  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; ((nestlevel 0)
        (mark1 (point))
        (done nil)
        )
    
    (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (and arg (&amp;lt; arg 0))
        (message &lt;SPAN style="COLOR: #bc8f8f"&gt;"negative arg (%d) is not supported..."&lt;/SPAN&gt; arg)

      &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;else, we have a positive argument, hence move forward.
&lt;/SPAN&gt;      &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;simple case is just move forward one brace
&lt;/SPAN&gt;      (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (looking-at &lt;SPAN style="COLOR: #bc8f8f"&gt;"{"&lt;/SPAN&gt;)
          (forward-sexp arg)
        
        &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;The more complex case is dealing with a "region/endregion" block.
&lt;/SPAN&gt;        &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;We have to deal with nested regions!
&lt;/SPAN&gt;        (and
         (&lt;SPAN style="COLOR: #a020f0"&gt;while&lt;/SPAN&gt; (not done)
           (re-search-forward &lt;SPAN style="COLOR: #bc8f8f"&gt;"^[ \\t]*#[ \\t]*&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;region&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;endregion&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;\\b"&lt;/SPAN&gt;
                              (point-max) 'move)
           (&lt;SPAN style="COLOR: #a020f0"&gt;cond&lt;/SPAN&gt;
            
            ((eobp))                    &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;do nothing if at end of buffer
&lt;/SPAN&gt;            
            ((and
              (match-beginning 1)
              &lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;if the match is longer than 6 chars, we know it is "endregion"
&lt;/SPAN&gt;              (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (&amp;gt; (- (match-end 1) (match-beginning 1)) 6)
                  (setq nestlevel (1- nestlevel))
                (setq nestlevel (1+ nestlevel))
                )
              )))

           (setq done (not (and (&amp;gt; nestlevel 0) (not (eobp)))))
           
           )                            &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;while
&lt;/SPAN&gt;                        
         (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; (= nest 0)
             (goto-char (match-end 2)))

         )
        )
      )
    )
  )


(&lt;SPAN style="COLOR: #a020f0"&gt;unless&lt;/SPAN&gt; (assoc 'csharp-mode hs-special-modes-alist)
          (push '(csharp-mode
                  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;"\\(^\\s*#\\s*region\\b\\)\\|{"      ; regexp for start block DID NOT WORK
&lt;/SPAN&gt;                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^[ \\t]*#[ \\t]*region\\b&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;{"&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;regexp for start block
&lt;/SPAN&gt;                  
                  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;"\\(^\\s*#\\s*endregion\\b\\)\\|}"   ; regexp for end block NO WORKY!
&lt;/SPAN&gt;                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^[ \\t]*#[ \\t]*endregion\\b&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;)&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;\\&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #bc8f8f"&gt;|&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;}"&lt;/SPAN&gt;   &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;regexp for end block
&lt;/SPAN&gt;                  
                  &lt;SPAN style="COLOR: #bc8f8f"&gt;"/[*/]"&lt;/SPAN&gt;                                &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;regexp for comment start
&lt;/SPAN&gt;                  
                  csharp-hs-forward-sexp                 &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;hs-forward-sexp-func
&lt;/SPAN&gt;                  hs-c-like-adjust-block-beginning       &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;c-like adjust (1 char)
&lt;/SPAN&gt;                  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;csharp-hs-adjust-block-beginning      ;csharp adjust ?
&lt;/SPAN&gt;                  )
                hs-special-modes-alist))


&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;To use this, put this into your csharp-mode-hook:
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; for hide/show support
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(hs-minor-mode 1)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(setq hs-isearch-open t)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;; with point inside the block, use these keys to hide/show
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(local-set-key "\C-c&amp;gt;"  'hs-hide-block)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;       &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(local-set-key "\C-c&amp;lt;"  'hs-show-block)
&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;If you use emacs to code C#, maybe this is useful to you. It is attached here, too. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8386298" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/dotnetinterop/attachment/8386298.ashx" length="3749" type="text/plain" /><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>Emacs is better than Visual Studio as a C# Development Tool?!!</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/12/emacs-is-better-than-visual-studio-as-a-c-development-tool.aspx</link><pubDate>Sun, 13 Apr 2008 07:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8386272</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>29</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8386272.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8386272</wfw:commentRss><description>&lt;P&gt;I recently spent some time fiddling with my setup of emacs on Windows. I use emacs for lots of stuff; just now I optimized my setup for development of C# apps. &lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://blogs.msdn.com/blogfiles/dotnetinterop/041308_0415_Emacsisbett1.png" mce_src="http://blogs.msdn.com/blogfiles/dotnetinterop/041308_0415_Emacsisbett1.png"&gt; &lt;/P&gt;
&lt;P&gt;I knew of the &lt;A href="http://jdee.sourceforge.net/" mce_href="http://jdee.sourceforge.net/"&gt;JDEE&lt;/A&gt;, which has been around for a long time. JDEE is the Java Development Environment for Emacs; it used to go by the moniker of JDE. It has code completion (aka "intellisense"), compiling tools (ant I think), syntax highlighting, an "immediate window" (BeanShell) for evaluating Java expressions &lt;EM&gt;right now&lt;/EM&gt;, that kind of thing. There was a copycat project launched in 2001 called &lt;A href="http://sourceforge.net/projects/csde/" mce_href="http://sourceforge.net/projects/csde/"&gt;CSDE&lt;/A&gt; (C# Dev Env for Emacs). It sounded like a great idea, but it is now stale as 3-day old doughnuts, not having been updated since early 2005. With just one contributor, it never reached critical mass. And no update since &lt;EM&gt;before&lt;/EM&gt; the launch of .NET 2.0 means no support for generics, I suppose, no support for msbuild, nothing for the yield keyword, and other goodies like that. Certainly nothing for LINQ syntax or anonymous methods. I didn't even have the courage to take it for a test drive. &lt;/P&gt;
&lt;P&gt;So lacking an integrated set of add-ons, what would be the best Emacs setup, for C# development? Here's what I put together. &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;First, &lt;A href="ftp://ftp.gnu.org/gnu/emacs/windows/" mce_href="ftp://ftp.gnu.org/gnu/emacs/windows/"&gt;emacs v22.2&lt;/A&gt;. This was released last week. I upgraded from v21.3. It was painless. &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://mfgames.com/linux/csharp-mode" mce_href="http://mfgames.com/linux/csharp-mode"&gt;csharp-mode.el&lt;/A&gt; from Dylan Moonfire of Moonfire games. Latest is v0.7.0, Sept 2007.&lt;BR&gt;The main thing in this "mode" is C# syntax highlighting (using emacs' "font locking" capability) and auto-indenting. &lt;/LI&gt;
&lt;LI&gt;A template library – I used &lt;A href="http://code.google.com/p/yasnippet/" mce_href="http://code.google.com/p/yasnippet/"&gt;yasnippet.el&lt;/A&gt;. This allows me to type "fore&amp;lt;TAB&amp;gt; and get a template of a foreach loop. Or I could type try&amp;lt;TAB&amp;gt; and get the boilerplate for a try…catch…finally. Yasnippet ships with templates for C, C++, Java, Ruby, Python, HTML, CSS, and even Fortran (??). But no csharp. I created a set: new class, foreach, arg parsing in a console app, xml serialization, if-then-else, while, using, and singleton among others. &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://www.emacswiki.org/cgi-bin/wiki/HideShow" mce_href="http://www.emacswiki.org/cgi-bin/wiki/HideShow"&gt;hideshow.el&lt;/A&gt;, which is included in emacs v22.2. Hideshow can collapse or expand regions of text bounded by three-curly-braces . I almost never do that in my C# code&lt;SPAN style="FONT-FAMILY: Wingdings"&gt;J&lt;/SPAN&gt; , so I had to write an extension to hideshow.el to allow it to recognize the region/endregion syntax supported in C#. There were some suggestions on the &lt;A href="http://forum.mfgames.com/index.php/board,14.0.html" mce_href="http://forum.mfgames.com/index.php/board,14.0.html"&gt;csharp page on the emacs wiki&lt;/A&gt;, that I only needed to set a regular expression up. But, 2 things: the regexp didn't work, and when I modified it to work, hideshow.el still did not behave as I wanted it to. So I had to write the extension. (I'll post that separately) &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://forum.mfgames.com/index.php/board,14.0.html" mce_href="http://forum.mfgames.com/index.php/board,14.0.html"&gt;defaultcontent.el&lt;/A&gt; – fills empty (new) files with some default content. Every time I create a new .cs file from within emacs, I can fill it with a header, some copyright info, and even some boilerplate code, like using statements and a class skeleton. This is not part of emacs, it is a separate add-on. Setting up the new-file template was pretty easy. &lt;/LI&gt;
&lt;LI&gt;skeleton.el – this does auto-insert of matching characters, so for example when I type an open-curly I get a close-curly automatically. This is included in emacs, all I needed to do was set it up. &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el" mce_href="http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el"&gt;htmlize.el&lt;/A&gt; – which is a bit of magic that generates html for the syntax-highlighted c# code. I &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/copysourceashtml-in-emacs-htmlize-el.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/copysourceashtml-in-emacs-htmlize-el.aspx"&gt;wrote about this&lt;/A&gt; a few days ago.&amp;nbsp; This is the moral equivalent of &lt;A href="http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/" mce_href="http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/"&gt;CopySourceAsHtml&lt;/A&gt;, from Steven Coller. &lt;/LI&gt;
&lt;LI&gt;
&lt;DIV&gt;Customization of the existing, built-in emacs stuff – like &lt;/DIV&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://www.emacswiki.org/cgi-bin/wiki/TimeStamp" mce_href="http://www.emacswiki.org/cgi-bin/wiki/TimeStamp"&gt;timestamp&lt;/A&gt;. Timestamp is I can insert a field into the source file that emacs automagically updates every time I save the file. The default is that emacs looks only in the first 8 lines for the timestamp. But for C# code, that was not sufficient, so I needed to bump it out a bit. I can even stuff the timestamp into a const string within the class. Nice. &lt;/LI&gt;
&lt;LI&gt;Properly configuring the &lt;A href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Compilation-Mode.html" mce_href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Compilation-Mode.html"&gt;next-error&lt;/A&gt; function in emacs to be able to see the error messages generated by csc.exe. &lt;/LI&gt;
&lt;LI&gt;To properly use csharp-mode, I needed to define a C# Style, which defines my indentation preferences and so on. This is about 20 lines of elisp. &lt;/LI&gt;
&lt;LI&gt;I wrote some elisp functions to do common refactoring tasks, like convert a field to a property with a getter and setter, stuff like that. &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;Setting up a default msbuild file. For quick little projects I'd like to build a single .cs file into an exe. But I don't want to change the msbuild file every time I create a new .cs file.&amp;nbsp; So it's gotta be general. &lt;/LI&gt;
&lt;LI&gt;Stitching together all the pieces in my .emacs file. I need to load htmlize, hideshow, yasnippet, defaultcontent, and csharp-mode. Also need to set a bunch of key bindings and a style for csharp-mode and set up some hooks for hideshow. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;There were some places where I came up short. Intellisense is something I really wanted, and I know it has been done within Emacs for Java. The CSDE though, was just too stale. I found a smaller package, dedicated more narrowly to just .NET intellisense, called &lt;A href="http://code.google.com/p/csense/" mce_href="http://code.google.com/p/csense/"&gt;csense&lt;/A&gt;. Bummer though; this thing did not work for me at all. It was a non-starter. I invested quite a bit of time but no joy. Couldn't find any doc. It seems like it was one of those things that someone built, and it worked for him, and that was it. I think it had something like 13 downloads. &lt;/P&gt;
&lt;P&gt;I also checked out a package called &lt;A href="http://www.emacswiki.org/cgi-bin/wiki/FoldingMode" mce_href="http://www.emacswiki.org/cgi-bin/wiki/FoldingMode"&gt;folding.el&lt;/A&gt;. But it seemed heavier than hideshow.el, and unnecessarily so. Also, not sure if folding.el is still being maintained. I can't even find the URL now, where I downloaded it from, though I know I downloaded it. The emacs wiki says that the author appears to have vaporized. Anyway, I punted on folding.el. &lt;/P&gt;
&lt;P&gt;I don't have integrated debugging, but I can separately start up the clrdbg.exe which is included in the .NET SDK. &lt;/P&gt;
&lt;P&gt;I didn't bother with setting up unit testing. I can run nunit, from outside of emacs. So it's really independent. &lt;/P&gt;
&lt;P&gt;The upshot is, I have a pretty good development environment for C# now, in Emacs. And, it's free. (no license charge) It uses emacs and a bunch of free add-ons, and the .NET SDK, which is a no-cost addition to Windows. &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 16pt"&gt;How does Emacs compare to Visual Studio? &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Comparing Emacs to Visual Studio… hmmm…. Let me start by asking you a question: what is your time worth? I like what I have set up here, but I have to say, I don't think what I have done is accessible to, or feasible for, most people. I have used emacs for 20 years, the keybindings are in my nerve cells, it would be like major surgery for me to stop using it. But for most people, I imagine emacs itself would be hard to approach. Beyond that is the C# support, which is all add-on. The sheer number of pieces I had to seek out and install, configure, understand – that alone is daunting for most people I would guess. Couple that with the fact that I had to wade through and even write elisp code, which is yes, something I can do, though not very well. (I took a couple lisp courses in college 22 yrs ago) The other black magic is regular expressions, which are tricky and for some people, a complete puzzle. I had to use a ton of regexp's in the setup, for everything from hideshow (to find region/endregion) and the compile error messages. I have regexp knowledge from way back, too. All of this took lots of time to do, as well as some esoteric skills. &lt;/P&gt;
&lt;P&gt;So for me, the emacs setup will continue to be useful. But for most devs, I'd guess it would be a tough sell. &lt;/P&gt;
&lt;P&gt;In contrast, Visual Studio is just an install. Most things I want are set up already – I don't have to write a regular expression, for example, to find the compiler error message. I don't have to write an msbuild file to compile. The refactoring tasks are already built-in – you don't have to write code to describe what refactoring you want. Debugging is built in. Intellisense. Unit testing. Snippets. Collapsing regions of code. All of it is just soooo much more accessible for mere mortals, or for anyone, really who values their time realistically. And that doesn't even mention the graphical designers, the database designers (eg linq support), or the team-development capabilities of Visual Studio. &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 16pt"&gt;The Bottom Line &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;My effort at setting up emacs was a labor of love – it is not the kind of thing I would recommend to anyone who wants to actually make money at writing code. I did it because I wanted to see if it could be done. If time is money, I spent myself into the poorhouse setting up emacs for C# work. I spent a bunch of time evaluating options, exploring dead-ends. (I was just thinking – g*d help me if I lose my laptop, because my setup is totally unique and not reproducible.) &lt;/P&gt;
&lt;P&gt;The bottom line is that it is possible to set up emacs as a dev environment for C#. What I got for myself – I will actually use it extensively, for quick jobs and small projects, as well as larger single-person efforts. For me, it will be better than VS, for those kinds of projects. But in the end, Visual Studio is still sooo much better in terms of overall cost/benefit. &lt;/P&gt;
&lt;P&gt;On the other hand, all of the emacs stuff I did works on any platform. I benefited from emacs packages that were developed for and by devs using mono on non-Windows platforms. So I can see that for some people, emacs could make sense. The way I got into emacs, by the way, was in school. There was a critical mass of people using emacs as an editor, and so I was able to pick it up easily. Then I worked at a company where emacs was standard issue, and that is when emacs became part of my DNA. I had no choice in the matter. The emacs setup was all prearranged, set up and shaken down for me. I can see that continuing as a common scenario for new developers picking up emacs – when they join a team of experts who have done all the setup for them, and who can transfer the lore to them. The body of experts can make emacs accessible to the new guy. But without that, IDE's like Visual Studio just seem sooo much more broadly applicable. &lt;/P&gt;
&lt;P&gt;Hey, last thing - If I've missed any gems for working with c# within emacs, &lt;EM&gt;please let me know! Especially intellisense!&lt;/EM&gt; &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8386272" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>CopySourceAsHTML in Emacs?    Htmlize.el</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/copysourceashtml-in-emacs-htmlize-el.aspx</link><pubDate>Fri, 11 Apr 2008 09:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8378739</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8378739.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8378739</wfw:commentRss><description>&lt;P&gt;There's a nice add-in for Visual Studio called CopySourceAsHTML (for &lt;A href="http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/" mce_href="http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/"&gt;VS2005&lt;/A&gt;, &lt;A href="http://developers.de/blogs/andreas_erben/archive/2007/08/01/using-copysourceashtml-with-visual-studio-2008-beta-2.aspx" mce_href="http://developers.de/blogs/andreas_erben/archive/2007/08/01/using-copysourceashtml-with-visual-studio-2008-beta-2.aspx"&gt;VS2008&lt;/A&gt;), which I have been using for a while now. Turns out there was an earlier progenitor in &lt;A href="http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el" mce_href="http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el"&gt;htmlize.el&lt;/A&gt; for emacs. &lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://blogs.msdn.com/blogfiles/dotnetinterop/041108_0626_CopySourceA1.png" mce_src="http://blogs.msdn.com/blogfiles/dotnetinterop/041108_0626_CopySourceA1.png"&gt; &lt;/P&gt;
&lt;P&gt;Here's the result: &lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://blogs.msdn.com/blogfiles/dotnetinterop/041108_0626_CopySourceA2.png" mce_src="http://blogs.msdn.com/blogfiles/dotnetinterop/041108_0626_CopySourceA2.png"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8378739" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>PowerShell in Emacs, proof!</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/powershell-in-emacs-proof.aspx</link><pubDate>Fri, 11 Apr 2008 07:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8378376</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8378376.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8378376</wfw:commentRss><description>&lt;P&gt;Here's the proof that &lt;EM&gt;you&lt;/EM&gt; &lt;EM&gt;can &lt;A class="" href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/run-powershell-as-a-shell-within-emacs.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/run-powershell-as-a-shell-within-emacs.aspx"&gt;run powershell as a shell in Emacs&lt;/A&gt;&lt;/EM&gt;. &lt;/P&gt;
&lt;P&gt;&lt;IMG alt="" src="http://blogs.msdn.com/blogfiles/dotnetinterop/041108_0450_PowerShelli1.png" mce_src="http://blogs.msdn.com/blogfiles/dotnetinterop/041108_0450_PowerShelli1.png"&gt; &lt;/P&gt;
&lt;P&gt;Grab the download from &lt;A href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/run-powershell-as-a-shell-within-emacs.aspx" mce_href="http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/run-powershell-as-a-shell-within-emacs.aspx"&gt;yesterday&lt;/A&gt; to get this awesome power yourself! &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8378376" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item><item><title>Run PowerShell as a shell within Emacs</title><link>http://blogs.msdn.com/dotnetinterop/archive/2008/04/10/run-powershell-as-a-shell-within-emacs.aspx</link><pubDate>Thu, 10 Apr 2008 22:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8376018</guid><dc:creator>DotNetInterop</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/dotnetinterop/comments/8376018.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dotnetinterop/commentrss.aspx?PostID=8376018</wfw:commentRss><description>&lt;P&gt;I saw a couple people asking about running powershell as an inferior shell within emacs.&amp;nbsp; Here's what I do. &lt;/P&gt;
&lt;P&gt;For the tragically unhip, some background:&amp;nbsp;&lt;A class="" href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" mce_href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx"&gt;PowerShell&lt;/A&gt; is a nifty shell, it ships as an add-on to Windows.&amp;nbsp; Currently at v1.0, but the &lt;A class="" href="http://www.microsoft.com/downloads/results.aspx?pocId=&amp;amp;freetext=powershell&amp;amp;DisplayLang=en#" mce_href="http://www.microsoft.com/downloads/results.aspx?pocId=&amp;amp;freetext=powershell&amp;amp;DisplayLang=en#"&gt;v2.0 is available as a CTP&lt;/A&gt;.&amp;nbsp; Emacs is the venerable supereditor that does 1001 things - one of those things is the ability to &lt;A class="" href="http://moxie.oswego.edu/doc/emacs/Shell.html#Shell" mce_href="http://moxie.oswego.edu/doc/emacs/Shell.html#Shell"&gt;run a shell&lt;/A&gt; within a buffer.&amp;nbsp; Emacs runs on Unix and Windows, and the shell stuff is configurable across a wide variety of shells and operating systems.&amp;nbsp; As I was saying, some people have expressed interest in running PowerShell as an inferior shell within Emacs. &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;We're not talking about a powershell script editing mode.&lt;/EM&gt; &lt;A class="" href="http://www.viveksharma.com/techlog/attache/powershell-mode.el.txt" mce_href="http://www.viveksharma.com/techlog/attache/powershell-mode.el.txt"&gt;That problem has been solved&lt;/A&gt;. Instead, we're talking about running a powershell interactively within emacs.&lt;/P&gt;
&lt;P&gt;There are a couple challenges with doing this.&amp;nbsp; First, emacs is complex, and it is hard for people to figure out to do what they want.&amp;nbsp;&amp;nbsp;Even the doc is impenetrable.&amp;nbsp; Basically you just have to KNOW how to do something, or someone else shows you.&amp;nbsp; Getting back to our situation, to explicitly specify the shell to run, in emacs you set a variable called &lt;STRONG&gt;explicit-shell-file-name&lt;/STRONG&gt;.&amp;nbsp;Great, so we set this to c:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe. There's an example for starting shells that says "to set the arguments to the shell, set the &lt;STRONG&gt;explicit-sh-args &lt;/STRONG&gt;variable. People were setting this variable and trying to run PowerShell but &lt;A class="" href="http://search.msn.com/results.aspx?q=explicit-sh-args+powershell&amp;amp;FORM=QBHP" mce_href="http://search.msn.com/results.aspx?q=explicit-sh-args+powershell&amp;amp;FORM=QBHP"&gt;getting an error&lt;/A&gt;.&amp;nbsp;That's because the variable name for arguments is different for each shell.&amp;nbsp; For bash, sh is the image and the variable is explicit-sh-args.&amp;nbsp; For powershell, the variable to set is &lt;STRONG&gt;explicit-powershell.exe-args &lt;/STRONG&gt;.&amp;nbsp;Of course!&amp;nbsp; This isn't explicitly documented anywhere (that I could see), but if you read the source code for shell.el you will see it. And, to further complicate things, if you don't explicitly set anything in that args variable, shell.el &lt;EM&gt;implicitly &lt;/EM&gt;includes -i as an argument, which makes powershell barf.&amp;nbsp; -i is a valid powershell argument, but it needs another param.&amp;nbsp; Hence the barf.&amp;nbsp; Anyway, to avoid all this, set &lt;STRONG&gt;explicit-powershell.exe-args .&amp;nbsp; &lt;/STRONG&gt;Example:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: 1px; BORDER-TOP: 1px; BORDER-LEFT: 1px; BORDER-BOTTOM: 1px"&gt;&lt;PRE&gt;  (setq explicit-shell-file-name "c:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe")
  (setq explicit-powershell.exe-args '("-Command" "-" )) ; interactive, but no command prompt &lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;After setting these variables, to launch powershell from within emacs, just use &lt;STRONG&gt;M-x shell&lt;/STRONG&gt;.&amp;nbsp;This gets you to the second problem: powershell goes into "noninteractive mode".&amp;nbsp; It emits no prompts, although it reads from the stdin and puts output on stdout.&amp;nbsp; So you can see the input and output, but no prompts at all.&amp;nbsp; Needless to say, it's a bit unfriendly to do this. &lt;/P&gt;
&lt;P&gt;To fix this up we have to ask powershell to give us prompts.&amp;nbsp; A simple thing to do would be to launch powershell in interactive mode, despite the fact that stdin and stdout have been redirected.&amp;nbsp; There's an option on powershell.exe to launch it in "noninteractive mode" which means no prompts, and which is already what we have.&amp;nbsp; We want the converse.&amp;nbsp; I couldn't figure a way to do the "force interactive mode", so I used some emacs lisp to sort of fake it. &lt;/P&gt;
&lt;P&gt;Within shell mode, there are "hooks" that emacs will call, on certain events, and overrides that you can set. (Sort of like the channel stack in WCF.)&amp;nbsp; One possible override is the "send command to shell" method.&amp;nbsp;You can write some custom code that runs, every time the user types in a command to the shell, in order to&amp;nbsp;send the command to the shell.&amp;nbsp;You can filter it, modify it, log it, suppress it, whatever.&amp;nbsp; I wrote a simple wrapper in elisp that sends the original command, and then ALSO sends the "prompt" command.&amp;nbsp; This causes powershell to emit the prompt, after the first, explicit command is run.&amp;nbsp; Cool.&amp;nbsp; That's what we want. &lt;/P&gt;
&lt;P&gt;Then there are some rough edges. For example, powershell assumes an 80-character width for a terminal in non-interactive mode.&amp;nbsp; You can set this by tickling the &lt;A class="" href="http://www.microsoft.com/technet/scriptcenter/topics/winpsh/manual/console.mspx" mce_href="http://www.microsoft.com/technet/scriptcenter/topics/winpsh/manual/console.mspx"&gt;RawUI&lt;/A&gt; object within powershell itself.&amp;nbsp; This is made possible with another hook.&amp;nbsp; Also, I need to resize the powershell terminal whenever the emacs window changes.&amp;nbsp; So I need to hook the window-size-change event within emacs. &lt;/P&gt;
&lt;P&gt;One last thing is that the powershell prompt comes out with a trailing newline.&amp;nbsp; So I need to trim that off as well, so that the next command you type in the powershell inferior shell, is just to the right of the powershell prompt. &lt;/P&gt;
&lt;P&gt;Anyway, the result is the brief bit of elisp attached here. It's pretty bare-bones, but it's a start.&amp;nbsp; And it lets you do what you want - run powershell as an inferior shell within emacs.&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 2pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 2pt; FONT-SIZE: 9pt; BACKGROUND: white; PADDING-BOTTOM: 2pt; BORDER-LEFT: windowtext 1pt solid; COLOR: black; PADDING-TOP: 2pt; BORDER-BOTTOM: windowtext 1pt solid; FONT-FAMILY: Courier New"&gt;&lt;PRE&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;powershell.el, version 0.1
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Author: Dino Chiesa
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Thu, 10 Apr 2008  11:10
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;Run Windows PowerShell v1.0 as an inferior shell within emacs. Tested with emacs v22.2.
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;TODO:
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;test what happens when you expand the window size beyond the maxWindowWidth for the RawUI
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;make everything configurable (Powershell exe, initial args, powershell prompt regexp)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;implement powershell launch hooks
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;  &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;prevent backspace from deleting the powershell prompt? (do other shells do this?)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;
(&lt;SPAN style="COLOR: #a020f0"&gt;require&lt;/SPAN&gt; '&lt;SPAN style="COLOR: #5f9ea0"&gt;shell&lt;/SPAN&gt;)


(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;powershell-gen-window-width-string&lt;/SPAN&gt; ()
  (concat  &lt;SPAN style="COLOR: #bc8f8f"&gt;"$a = (Get-Host).UI.RawUI\n"&lt;/SPAN&gt; 
            &lt;SPAN style="COLOR: #bc8f8f"&gt;"$b = $a.WindowSize\n"&lt;/SPAN&gt;
            &lt;SPAN style="COLOR: #bc8f8f"&gt;"$b.Width = "&lt;/SPAN&gt; (number-to-string  (window-width)) &lt;SPAN style="COLOR: #bc8f8f"&gt;"\n"&lt;/SPAN&gt;
            &lt;SPAN style="COLOR: #bc8f8f"&gt;"$a.BufferSize = $b\n"&lt;/SPAN&gt;
            &lt;SPAN style="COLOR: #bc8f8f"&gt;"$a.WindowSize = $b"&lt;/SPAN&gt;)
  )
  

(&lt;SPAN style="COLOR: #a020f0"&gt;defvar&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;powershell-prompt-pattern&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #bc8f8f"&gt;"PS [&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;#$%&amp;gt;]+&amp;gt;"&lt;/SPAN&gt; 
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Regexp for powershell prompt.  This isn't really used, because I couldn't figure out how to get it to work."&lt;/SPAN&gt;
  )

(&lt;SPAN style="COLOR: #a020f0"&gt;defgroup&lt;/SPAN&gt; &lt;SPAN style="COLOR: #228b22"&gt;powershell&lt;/SPAN&gt; nil
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Running shell from within Emacs buffers."&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #da70d6"&gt;:group&lt;/SPAN&gt; 'processes
  )


(&lt;SPAN style="COLOR: #a020f0"&gt;defcustom&lt;/SPAN&gt; &lt;SPAN style="COLOR: #b8860b"&gt;powershell-need-rawui-resize&lt;/SPAN&gt; t
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"set when powershell needs to be resized"&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #da70d6"&gt;:group&lt;/SPAN&gt; 'powershell
)

&lt;SPAN style="COLOR: #b22222"&gt;;;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;###&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: bold; COLOR: #ff0000"&gt;autoload&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;
&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;powershell&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #228b22"&gt;&amp;amp;optional&lt;/SPAN&gt; buffer)
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Run an inferior powershell, by invoking the shell function. See the help for shell for more details.
\(Type \\[&lt;/SPAN&gt;&lt;SPAN style="COLOR: #5f9ea0"&gt;describe-mode&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;] in the shell buffer for a list of commands.)"&lt;/SPAN&gt;
  (interactive
   (list
    (and current-prefix-arg
         (read-buffer &lt;SPAN style="COLOR: #bc8f8f"&gt;"Shell buffer: "&lt;/SPAN&gt;
                      (generate-new-buffer-name &lt;SPAN style="COLOR: #bc8f8f"&gt;"*PowerShell*"&lt;/SPAN&gt;)))))
  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;get a name for the buffer
&lt;/SPAN&gt;  (setq buffer (get-buffer-create (or buffer &lt;SPAN style="COLOR: #bc8f8f"&gt;"*PowerShell*"&lt;/SPAN&gt;)))

  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; (
        (tmp-shellfile explicit-shell-file-name)
        )
                                        &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;set arguments for the powershell exe.
&lt;/SPAN&gt;                                        &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This needs to be tunable.
&lt;/SPAN&gt;    (setq explicit-shell-file-name &lt;SPAN style="COLOR: #bc8f8f"&gt;"c:\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"&lt;/SPAN&gt;)  
    (setq explicit-powershell.exe-args '(&lt;SPAN style="COLOR: #bc8f8f"&gt;"-Command"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #bc8f8f"&gt;"-"&lt;/SPAN&gt; )) &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;interactive, but no command prompt
&lt;/SPAN&gt;  
                                        &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;launch the shell
&lt;/SPAN&gt;    (shell buffer)

    &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;restore the original shell
&lt;/SPAN&gt;    (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; explicit-shell-file-name
        (setq explicit-shell-file-name tmp-shellfile)
      )
    )
  
  (&lt;SPAN style="COLOR: #a020f0"&gt;let&lt;/SPAN&gt; (
        (proc (get-buffer-process buffer))
        )
    
    &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This sets up the powershell RawUI screen width. By default,
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;the powershell v1.0 assumes terminal width of 80 chars.
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This means input gets wrapped at the 80th column.  We reset the
&lt;/SPAN&gt;    &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;width of the PS terminal to the window width. 
&lt;/SPAN&gt;    (add-hook 'window-size-change-functions 'powershell-window-size-changed)

    (powershell-window-size-changed)
    
    &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;ask for initial prompt
&lt;/SPAN&gt;    (comint-simple-send proc &lt;SPAN style="COLOR: #bc8f8f"&gt;"prompt"&lt;/SPAN&gt;)
    )

  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;hook the kill-buffer action so we can kill the inferior process?
&lt;/SPAN&gt;  (add-hook 'kill-buffer-hook 'powershell-delete-process)

  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;wrap the comint-input-sender with a PS version
&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;must do this after launching the shell! 
&lt;/SPAN&gt;  (make-local-variable 'comint-input-sender)
  (setq comint-input-sender 'powershell-simple-send)

  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;set a preoutput filter for powershell.  This will trim newlines after the prompt.
&lt;/SPAN&gt;  (add-hook 'comint-preoutput-filter-functions 'powershell-preoutput-filter-for-prompt)

  &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(run-hooks 'powershell-launch-hook)
&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;return the buffer created
&lt;/SPAN&gt;  buffer
)


(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;powershell-window-size-changed&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #228b22"&gt;&amp;amp;optional&lt;/SPAN&gt; frame)
  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;do not actually resize here. instead just set a flag.
&lt;/SPAN&gt;  (setq powershell-need-rawui-resize t)
)



(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;powershell-delete-process&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #228b22"&gt;&amp;amp;optional&lt;/SPAN&gt; proc)
  (or proc
      (setq proc (get-buffer-process (current-buffer))))
  (and (processp proc)
       (delete-process proc))
  )



&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;This function trims the newline from the prompt that we
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;get back from powershell.  It is set into the preoutput
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;filters, so the newline is trimmed before being put into
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;the output buffer.
&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;powershell-preoutput-filter-for-prompt&lt;/SPAN&gt; (string)
   (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt;
       &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;not sure why, but I have not succeeded in using a variable here???  
&lt;/SPAN&gt;       &lt;SPAN style="COLOR: #b22222"&gt;;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;(string-match  powershell-prompt-pattern  string)
&lt;/SPAN&gt;
       (string-match  &lt;SPAN style="COLOR: #bc8f8f"&gt;"PS [&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;^&lt;/SPAN&gt;&lt;SPAN style="COLOR: #bc8f8f"&gt;#$%&amp;gt;]+&amp;gt;"&lt;/SPAN&gt; string)
       (substring string 0 -1)
     
     string

     )
   )



(&lt;SPAN style="COLOR: #a020f0"&gt;defun&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;powershell-simple-send&lt;/SPAN&gt; (proc string)
  &lt;SPAN style="COLOR: #bc8f8f"&gt;"Override of the comint-simple-send function, specific for powershell.
This just sends STRING, plus the prompt command. Normally powershell is in
noninteractive model when run as an inferior shell with stdin/stdout
redirected, which is the case when running as a shell within emacs.
This function insures we get and display the prompt. "&lt;/SPAN&gt;
  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;resize if necessary. We do this by sending a resize string to the shell,
&lt;/SPAN&gt;  &lt;SPAN style="COLOR: #b22222"&gt;; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #b22222"&gt;before sending the actual command to the shell. 
&lt;/SPAN&gt;  (&lt;SPAN style="COLOR: #a020f0"&gt;if&lt;/SPAN&gt; powershell-need-rawui-resize
      (and
       (comint-simple-send proc (powershell-gen-window-width-string))
       (setq powershell-need-rawui-resize nil)
       )
    )
  (comint-simple-send proc string)
  (comint-simple-send proc &lt;SPAN style="COLOR: #bc8f8f"&gt;"prompt"&lt;/SPAN&gt;)
)
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;To use it, you need to add in this text in your .emacs file: &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: 1px; BORDER-TOP: 1px; BORDER-LEFT: 1px; BORDER-BOTTOM: 1px"&gt;&lt;PRE&gt;(autoload 'powershell "powershell" "Run powershell as a shell within emacs." t) &lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;Start&amp;nbsp;powershell within emacs with &lt;B&gt;M-x powershell&lt;/B&gt;. You can continue to use the regular Windows shell within emacs via &lt;B&gt;M-x shell&lt;/B&gt;. &lt;/P&gt;
&lt;P&gt;Cheers!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8376018" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/dotnetinterop/attachment/8376018.ashx" length="5001" type="text/plain" /><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Interop/default.aspx">Interop</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://blogs.msdn.com/dotnetinterop/archive/tags/emacs/default.aspx">emacs</category></item></channel></rss>