Thread overview
Emacs & D wiki update
Feb 24, 2007
Bill Baxter
Mar 02, 2007
Bill Baxter
Mar 02, 2007
Sean Kelly
Mar 02, 2007
Brad Anderson
Mar 02, 2007
Bill Baxter
Mar 02, 2007
Bill Baxter
Mar 02, 2007
Bill Baxter
Mar 02, 2007
Sean Kelly
February 24, 2007
I updated the info on emacs at Wiki4d, for any y'all using emacs for your D coding.

In particular I spent way too much time today figuring out how to get M-x compile to actually take to to the source given DMD compiler error messages.

Note to Walter:  *all* error messages should be prefixed with "Error" "Warning" or "Remark" if you want emacs to grok them out of the box. Currently it's hit-or-miss.  Some of them are, some of them aren't.

--bb
February 24, 2007
Bill Baxter wrote:

> Note to Walter:  *all* error messages should be prefixed with "Error" "Warning" or "Remark" if you want emacs to grok them out of the box. Currently it's hit-or-miss.  Some of them are, some of them aren't.

Another note: For GCC, all error messages should be printed on stderr (not stdout) since otherwise they get sent to the assembler instead of the log. This is fixed in GDC, but would be nice to have in DMD too ?

     va_start(ap, format);
-    printf("Error: ");
-    vprintf(format, ap);
+    fprintf(stderr, "Error: ");
+    vfprintf(stderr, format, ap);
     va_end( ap );
-    printf("\n");
-    fflush(stdout);
+    fprintf(stderr, "\n");
+    fflush(stderr);

I'm not sure if this was left as stdout because stderr doesn't *work* on
Win 9x or because stderr isn't used on Windows ? If it's just not used,
this should still be fixed since printing errors to stdout is wrong...

--anders
March 01, 2007
Bill Baxter wrote:
> I updated the info on emacs at Wiki4d, for any y'all using emacs for your D coding.
> 
> In particular I spent way too much time today figuring out how to get M-x compile to actually take to to the source given DMD compiler error messages.
> 
> Note to Walter:  *all* error messages should be prefixed with "Error" "Warning" or "Remark" if you want emacs to grok them out of the box. Currently it's hit-or-miss.  Some of them are, some of them aren't.

I think standardized compiler messages are a must to gain acceptance of D. Thanks Bill for the great work!

I am getting the following error with both emacs21 and a Xft-capable version that I built from a later branch:

File mode specification error: (void-variable c-symbol-key)

Any help would be appreciated.


Andrei
March 02, 2007
Andrei Alexandrescu (See Website For Email) wrote:
> Bill Baxter wrote:
>> I updated the info on emacs at Wiki4d, for any y'all using emacs for your D coding.
>>
>> In particular I spent way too much time today figuring out how to get M-x compile to actually take to to the source given DMD compiler error messages.
>>
>> Note to Walter:  *all* error messages should be prefixed with "Error" "Warning" or "Remark" if you want emacs to grok them out of the box. Currently it's hit-or-miss.  Some of them are, some of them aren't.
> 
> I think standardized compiler messages are a must to gain acceptance of D. Thanks Bill for the great work!
> 
> I am getting the following error with both emacs21 and a Xft-capable version that I built from a later branch:
> 
> File mode specification error: (void-variable c-symbol-key)
> 
> Any help would be appreciated.

Heh, I never looked closely at the code, but I just realized that other d-mode has absolutely nothing to do with the D Programming Language. It's like definition files for some compiled Lisp implementation. Here's an example of *that* D code:
  http://clisp.cvs.sourceforge.net/*checkout*/clisp/clisp/src/array.d

The bizarre thing is that I actually like the way it highlights D code *better* than Ben Hinkle's d-mode.  That's really bizarre.  I think it's just that's because it's based on emacs 22's cc-mode, so really all I'm seeing is the upgraded cc-mode at work.

So realizing this, I decided to try to update Ben Hinkle's mode.  It now works for me at least in both Emacs 21 and 22.    You can get it here:
   http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode

Hopefully that will work for you.   If not, maybe tell me what version of emacs you have (M-x version) and what version of cc-mode you have (M-x c-version).  But honestly I'm not really much of an elisp hacker. I know just enough to be dangerous.  :-)

--bb
March 02, 2007
Bill Baxter wrote:
> 
> The bizarre thing is that I actually like the way it highlights D code *better* than Ben Hinkle's d-mode.  That's really bizarre.  I think it's just that's because it's based on emacs 22's cc-mode, so really all I'm seeing is the upgraded cc-mode at work.
> 
> So realizing this, I decided to try to update Ben Hinkle's mode.  It now works for me at least in both Emacs 21 and 22.    You can get it here:
>    http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode
> 
> Hopefully that will work for you.   If not, maybe tell me what version of emacs you have (M-x version) and what version of cc-mode you have (M-x c-version).  But honestly I'm not really much of an elisp hacker. I know just enough to be dangerous.  :-)

I'll give it a try.  The problem I ran into with the old d-mode was that it didn't auto-indent some things properly, and Emacs tends to be pretty heavy-handed in how it does auto-indenting.  With any luck this one will work better.


Sean
March 02, 2007
Sean Kelly wrote:
> Bill Baxter wrote:
>>
>> The bizarre thing is that I actually like the way it highlights D code *better* than Ben Hinkle's d-mode.  That's really bizarre.  I think it's just that's because it's based on emacs 22's cc-mode, so really all I'm seeing is the upgraded cc-mode at work.
>>
>> So realizing this, I decided to try to update Ben Hinkle's mode.  It
>> now works for me at least in both Emacs 21 and 22.    You can get it
>> here:
>>    http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode
>>
>> Hopefully that will work for you.   If not, maybe tell me what version
>> of emacs you have (M-x version) and what version of cc-mode you have
>> (M-x c-version).  But honestly I'm not really much of an elisp hacker.
>> I know just enough to be dangerous.  :-)
> 
> I'll give it a try.  The problem I ran into with the old d-mode was that it didn't auto-indent some things properly, and Emacs tends to be pretty heavy-handed in how it does auto-indenting.  With any luck this one will work better.

Further, I'd be interested in how to get to some indent other than 2 spaces in d-mode...  Granted, I haven't looked very hard yet.  It's somewhere in c++-mode, I imagine.

BA
March 02, 2007
Brad Anderson wrote:
> Sean Kelly wrote:
>> Bill Baxter wrote:
>>> The bizarre thing is that I actually like the way it highlights D code
>>> *better* than Ben Hinkle's d-mode.  That's really bizarre.  I think
>>> it's just that's because it's based on emacs 22's cc-mode, so really
>>> all I'm seeing is the upgraded cc-mode at work.
>>>
>>> So realizing this, I decided to try to update Ben Hinkle's mode.  It
>>> now works for me at least in both Emacs 21 and 22.    You can get it
>>> here:
>>>    http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode
>>>
>>> Hopefully that will work for you.   If not, maybe tell me what version
>>> of emacs you have (M-x version) and what version of cc-mode you have
>>> (M-x c-version).  But honestly I'm not really much of an elisp hacker.
>>> I know just enough to be dangerous.  :-)
>> I'll give it a try.  The problem I ran into with the old d-mode was that
>> it didn't auto-indent some things properly, and Emacs tends to be pretty
>> heavy-handed in how it does auto-indenting.  With any luck this one will
>> work better.
> 
> Further, I'd be interested in how to get to some indent other than 2 spaces in
> d-mode...  Granted, I haven't looked very hard yet.  It's somewhere in
> c++-mode, I imagine.
> 
> BA

(setq c-basic-offset 4)

If you want to get fancy, put that in a mode-hook so it only gets set for some modes.  Check out the sample .emacs file in the cc-mode documentation:
http://cc-mode.sourceforge.net/html-manual/Sample-_002eemacs-File.html#Sample-_002eemacs-File

--bb
March 02, 2007
Sean Kelly wrote:
> Bill Baxter wrote:
>>
>> The bizarre thing is that I actually like the way it highlights D code *better* than Ben Hinkle's d-mode.  That's really bizarre.  I think it's just that's because it's based on emacs 22's cc-mode, so really all I'm seeing is the upgraded cc-mode at work.
>>
>> So realizing this, I decided to try to update Ben Hinkle's mode.  It now works for me at least in both Emacs 21 and 22.    You can get it here:
>>    http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode
>>
>> Hopefully that will work for you.   If not, maybe tell me what version of emacs you have (M-x version) and what version of cc-mode you have (M-x c-version).  But honestly I'm not really much of an elisp hacker. I know just enough to be dangerous.  :-)
> 
> I'll give it a try.  The problem I ran into with the old d-mode was that it didn't auto-indent some things properly, and Emacs tends to be pretty heavy-handed in how it does auto-indenting.  With any luck this one will work better.

My changes to the new D mode don't make any difference on emacs 21.  For instance methods inside a class template get formatted strangely still.   But those issues seem to be fixed by emacs 22's cc-mode support. So...if you're using emacs 21, I guess you could try upgrading your entire cc-mode.

What my changes enabled was for d-mode to work at all in emacs 22's cc-mode.  But the changes are kinda hacky.  In particular I check for the version by checking (boundp 'some-particular-new-function) three times in a row.

Cleanups and improvements would definitely be welcome if you have some time to work on it.  I posted an email to the cc-mode mailing list asking for advice/assistance but no response yet.  Seems to be more spam than signal on that list.

--bb

--bb
March 02, 2007
Sean Kelly wrote:
> Bill Baxter wrote:
>>
>> The bizarre thing is that I actually like the way it highlights D code *better* than Ben Hinkle's d-mode.  That's really bizarre.  I think it's just that's because it's based on emacs 22's cc-mode, so really all I'm seeing is the upgraded cc-mode at work.
>>
>> So realizing this, I decided to try to update Ben Hinkle's mode.  It now works for me at least in both Emacs 21 and 22.    You can get it here:
>>    http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode
>>
>> Hopefully that will work for you.   If not, maybe tell me what version of emacs you have (M-x version) and what version of cc-mode you have (M-x c-version).  But honestly I'm not really much of an elisp hacker. I know just enough to be dangerous.  :-)
> 
> I'll give it a try.  The problem I ran into with the old d-mode was that it didn't auto-indent some things properly, and Emacs tends to be pretty heavy-handed in how it does auto-indenting.  With any luck this one will work better.

I did get one response on the cc-mode list with a pointer to a "modern" csharp mode:
   http://mfgames.com/linux/csharp-mode

It looks good.  I recommend updating that.  If you don't do it I will.
Then we can just have 2 d-modes, one for cc-mode 5.30+, and leave the current one for old cc-mode.

--bb
March 02, 2007
Bill Baxter wrote:
> 
> I did get one response on the cc-mode list with a pointer to a "modern" csharp mode:
>    http://mfgames.com/linux/csharp-mode
> 
> It looks good.  I recommend updating that.  If you don't do it I will.
> Then we can just have 2 d-modes, one for cc-mode 5.30+, and leave the current one for old cc-mode.

Sounds good.  I'll give it a look, but no idea when I'll have time to really mess with it.  I don't use emacs much on the PC where I use D (it's not even installed there at the moment).


Sean