Loading ...
Sorry, an error occurred while loading the content.

Comment Region Macro

Expand Messages
  • Jeremy Cowgar
    This macro will comment between the point and mark. However, I believe it suffers from a flaw in comment-line which I previously described and will describe
    Message 1 of 1 , Nov 29, 2006
    • 0 Attachment
      This macro will comment between the point and mark. However, I
      believe it suffers from a flaw in comment-line which I previously
      described and will describe again here for context sake:

      if (1==1) {
      if (2==2) {
      @@printf("Looks like it's working!");
      }
      }

      If my cursor is at @@ and I press C-c C-c, then I will get:

      if (1==1) {
      if (2==2) {
      /* @@printf("Looks like it's working!"); */
      }
      }

      It seems to me that it should be:

      if (1==1) {
      if (2==2) {
      /* @@printf("Looks like it's working!"); */
      }
      }

      Now, for the macro:

      ====================================================

      define-macro comment-region
      !if &great $window-line $window-mark-line
      exchange-point-and-mark
      !endif

      set-variable .to-line $window-mark-line

      !while &or &less $window-line .to-line &equal $window-line .to-line
      comment-line
      !done
      !emacro

      ====================================================

      Jeremy Cowgar
    Your message has been successfully submitted and would be delivered to recipients shortly.