Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

jasspa · JASSPA's MicroEmacs

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 127
  • Category: Cyberculture
  • Founded: Jul 7, 1999
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Messages 2128 - 2157 of 2695   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#2128 From: "cp200205" <jeremy@...>
Date: Mon Nov 27, 2006 9:42 am
Subject: Indent Mode Question
cp200205
Send Email Send Email
 
I am creating a mode for the programming language Icon. In it, you can do:

if 1 = 1 then write("Good") else write("Bad")
write("All done with if")

or

if 1 =1 then {
   write("Good")
} else {
   write("bad")
}
write("All done with if")

Now, those two I can handle just fine. The following is what I don't know how to
handle:

if 1 =1 then
   write("Good")
else
   write("Bad")
write("All done with if")

See on the last how only the next line is indented? Nothing more after that?

Any help would be appriciated,

Jeremy

#2129 From: jon@...
Date: Mon Nov 27, 2006 12:12 pm
Subject: Re: Indent Mode Question
bigfatmrmoose
Send Email Send Email
 
> I am creating a mode for the programming language Icon. In it, you can do:
>
> if 1 = 1 then write("Good") else write("Bad")
> write("All done with if")
>
> or
>
> if 1 =1 then {
>   write("Good")
> } else {
>   write("bad")
> }
> write("All done with if")
>
> Now, those two I can handle just fine. The following is what I don't know
> how to handle:
>
> if 1 =1 then
>   write("Good")
> else
>   write("Bad")
> write("All done with if")
>
> See on the last how only the next line is indented? Nothing more after
> that?
>
> Any help would be appriciated,
>
> Jeremy
>

This is exactly what the problem is with the current indent mechanism.
Unfortunately there is not a known work around when a language does not
include a closing token (this is actually why 'c' mode is burnt into the
editor and is not implemented with indent tokens).

You could take a look at the hkjava.emf. Bryan created a 'indent' only
indentation scheme rather than basing it on c-mode. I do not think that it
handles the case you cite above.

To handle the if/then stuff then you could try using multiple indent
schemes, but you would have to use \n as a closing token (i.e. end of
line).

To be honest I do not think you will be able to do it - specifically
because of dangling else's which are difficult to handle.

We have been looking at the indent mechanism with a view to fixing this
very problem. I think you will have to use a regular indent. If the syntax
of the language allowed terminating ';' then you could have probably used
cmode with some tweaks.

Sorry.
Jon.

#2130 From: "Bryan Schofield" <schofield.bryan@...>
Date: Mon Nov 27, 2006 3:12 pm
Subject: Corrupted notes file
schofield.bryan@...
Send Email Send Email
 
Twice now I've had my notes enf file become corrupted. Both times,
I've had something I pasted into a note at the top of the enf file. I
haven't quite nailed it down what causes the problem just yet,  just
thought I'd give a heads up.



junk
junk
junk

-!- enf -!-
"000050" = "bschofie" {
    ...

#2131 From: "Bryan Schofield" <schofield.bryan@...>
Date: Mon Nov 27, 2006 2:46 pm
Subject: Re: Indent Mode Question
schofield.bryan@...
Send Email Send Email
 
I don't know Icon syntax, but could have indent look for "if" and
"else" on a line by itself as a "continue" rule as well as "{}" brace
rule?

indent .hilight.icon n "{" t
indent .hilight.icon o "}" -t
indent .hilight.icon c "^\\s*else\\s*$" t
indent .hilight.icon c "^\\s*if\\s*$" t

Just a thought...
-- bryan

On 11/27/06, jon@... <jon@...> wrote:
> > I am creating a mode for the programming language Icon. In it, you can do:
> >
> > if 1 = 1 then write("Good") else write("Bad")
> > write("All done with if")
> >
> > or
> >
> > if 1 =1 then {
> >   write("Good")
> > } else {
> >   write("bad")
> > }
> > write("All done with if")
> >
> > Now, those two I can handle just fine. The following is what I don't know
> > how to handle:
> >
> > if 1 =1 then
> >   write("Good")
> > else
> >   write("Bad")
> > write("All done with if")
> >
> > See on the last how only the next line is indented? Nothing more after
> > that?
> >
> > Any help would be appriciated,
> >
> > Jeremy
> >
>
> This is exactly what the problem is with the current indent mechanism.
> Unfortunately there is not a known work around when a language does not
> include a closing token (this is actually why 'c' mode is burnt into the
> editor and is not implemented with indent tokens).
>
> You could take a look at the hkjava.emf. Bryan created a 'indent' only
> indentation scheme rather than basing it on c-mode. I do not think that it
> handles the case you cite above.
>
> To handle the if/then stuff then you could try using multiple indent
> schemes, but you would have to use \n as a closing token (i.e. end of
> line).
>
> To be honest I do not think you will be able to do it - specifically
> because of dangling else's which are difficult to handle.
>
> We have been looking at the indent mechanism with a view to fixing this
> very problem. I think you will have to use a regular indent. If the syntax
> of the language allowed terminating ';' then you could have probably used
> cmode with some tweaks.
>
> Sorry.
> Jon.
>
>
>
>
>
>
>
>
>
> __________________________________________________________________________
>
> This is an unmoderated list. JASSPA is not responsible for the content of
> any material posted to this list.
>
> To unsubscribe, send a mail message to
>
>     mailto:jasspa-unsubscribe@yahoogroups.com
>
> or visit http://groups.yahoo.com/group/jasspa and
> modify your account settings manually.
>
>
>
> Yahoo! Groups Links
>
>
>
>

#2132 From: "Phillips, Steven" <sphillips@...>
Date: Mon Nov 27, 2006 4:42 pm
Subject: RE: Corrupted notes file
sphillips@...
Send Email Send Email
 
I have seen this myself, I think it might be caused by using insert-file, are there other ways of corrupting it?
 
Steve


From: jasspa@yahoogroups.com [mailto:jasspa@yahoogroups.com] On Behalf Of Bryan Schofield
Sent: Monday, November 27, 2006 3:12 PM
To: Jasspa
Subject: [jasspa] Corrupted notes file

Twice now I've had my notes enf file become corrupted. Both times,
I've had something I pasted into a note at the top of the enf file. I
haven't quite nailed it down what causes the problem just yet, just
thought I'd give a heads up.

junk
junk
junk

-!- enf -!-
"000050" = "bschofie" {
...


#2133 From: Jeremy Cowgar <jeremy@...>
Date: Mon Nov 27, 2006 4:09 pm
Subject: Re: Indent Mode Question
cp200205
Send Email Send Email
 
That works great. Thanks!

Jeremy

On Nov 27, 2006, at 9:46 AM, Bryan Schofield wrote:

> I don't know Icon syntax, but could have indent look for "if" and
> "else" on a line by itself as a "continue" rule as well as "{}" brace
> rule?
>
> indent .hilight.icon n "{" t
> indent .hilight.icon o "}" -t
> indent .hilight.icon c "^\\s*else\\s*$" t
> indent .hilight.icon c "^\\s*if\\s*$" t
>
> Just a thought...
> -- bryan
>
> On 11/27/06, jon@... <jon@...> wrote:
>>> I am creating a mode for the programming language Icon. In it,
>>> you can do:
>>>
>>> if 1 = 1 then write("Good") else write("Bad")
>>> write("All done with if")
>>>
>>> or
>>>
>>> if 1 =1 then {
>>>   write("Good")
>>> } else {
>>>   write("bad")
>>> }
>>> write("All done with if")
>>>
>>> Now, those two I can handle just fine. The following is what I
>>> don't know
>>> how to handle:
>>>
>>> if 1 =1 then
>>>   write("Good")
>>> else
>>>   write("Bad")
>>> write("All done with if")
>>>
>>> See on the last how only the next line is indented? Nothing more
>>> after
>>> that?
>>>
>>> Any help would be appriciated,
>>>
>>> Jeremy
>>>
>>
>> This is exactly what the problem is with the current indent
>> mechanism.
>> Unfortunately there is not a known work around when a language
>> does not
>> include a closing token (this is actually why 'c' mode is burnt
>> into the
>> editor and is not implemented with indent tokens).
>>
>> You could take a look at the hkjava.emf. Bryan created a 'indent'
>> only
>> indentation scheme rather than basing it on c-mode. I do not think
>> that it
>> handles the case you cite above.
>>
>> To handle the if/then stuff then you could try using multiple indent
>> schemes, but you would have to use \n as a closing token (i.e. end of
>> line).
>>
>> To be honest I do not think you will be able to do it - specifically
>> because of dangling else's which are difficult to handle.
>>
>> We have been looking at the indent mechanism with a view to fixing
>> this
>> very problem. I think you will have to use a regular indent. If
>> the syntax
>> of the language allowed terminating ';' then you could have
>> probably used
>> cmode with some tweaks.
>>
>> Sorry.
>> Jon.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _____________________________________________________________________
>> _____
>>
>> This is an unmoderated list. JASSPA is not responsible for the
>> content of
>> any material posted to this list.
>>
>> To unsubscribe, send a mail message to
>>
>>     mailto:jasspa-unsubscribe@yahoogroups.com
>>
>> or visit http://groups.yahoo.com/group/jasspa and
>> modify your account settings manually.
>>
>>
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>
>
> ______________________________________________________________________
> ____
>
> This is an unmoderated list. JASSPA is not responsible for the
> content of
> any material posted to this list.
>
> To unsubscribe, send a mail message to
>
>     mailto:jasspa-unsubscribe@yahoogroups.com
>
> or visit http://groups.yahoo.com/group/jasspa and
> modify your account settings manually.
>
>
>
> Yahoo! Groups Links
>
>
>

#2134 From: "Bryan Schofield" <schofield.bryan@...>
Date: Mon Nov 27, 2006 6:06 pm
Subject: Re: Corrupted notes file
schofield.bryan@...
Send Email Send Email
 
Come to think about it... I was using insert-file around that that time...

On 11/27/06, Phillips, Steven <sphillips@...> wrote:
>
> I have seen this myself, I think it might be caused by  using insert-file, are
there other ways of corrupting it?
>
> Steve
>

#2135 From: Jeremy Cowgar <jeremy@...>
Date: Mon Nov 27, 2006 4:34 pm
Subject: Re: Indent Mode Question
cp200205
Send Email Send Email
 
One more question and I think I then have a basic working mode for
Icon! Yippie!

In Icon, you can extend a string onto multiple lines by making the
last character a _

i.e.

"John Doe had a dog"

is the *exact* same as:

"John Doe_
          had a dog"

_ says skip everything until the next non-whitespace.

So, my problem lies in the fact that I am ignoring comments inside of
quotes:

indent .hilight.icon e "\"" "\"" "\\"

Any thoughts on a workaround for this? I'd like _ to cause a
continuation indent.

Jeremy

On Nov 27, 2006, at 9:46 AM, Bryan Schofield wrote:

> I don't know Icon syntax, but could have indent look for "if" and
> "else" on a line by itself as a "continue" rule as well as "{}" brace
> rule?
>
> indent .hilight.icon n "{" t
> indent .hilight.icon o "}" -t
> indent .hilight.icon c "^\\s*else\\s*$" t
> indent .hilight.icon c "^\\s*if\\s*$" t
>
> Just a thought...
> -- bryan
>
> On 11/27/06, jon@... <jon@...> wrote:
>>> I am creating a mode for the programming language Icon. In it,
>>> you can do:
>>>
>>> if 1 = 1 then write("Good") else write("Bad")
>>> write("All done with if")
>>>
>>> or
>>>
>>> if 1 =1 then {
>>>   write("Good")
>>> } else {
>>>   write("bad")
>>> }
>>> write("All done with if")
>>>
>>> Now, those two I can handle just fine. The following is what I
>>> don't know
>>> how to handle:
>>>
>>> if 1 =1 then
>>>   write("Good")
>>> else
>>>   write("Bad")
>>> write("All done with if")
>>>
>>> See on the last how only the next line is indented? Nothing more
>>> after
>>> that?
>>>
>>> Any help would be appriciated,
>>>
>>> Jeremy
>>>
>>
>> This is exactly what the problem is with the current indent
>> mechanism.
>> Unfortunately there is not a known work around when a language
>> does not
>> include a closing token (this is actually why 'c' mode is burnt
>> into the
>> editor and is not implemented with indent tokens).
>>
>> You could take a look at the hkjava.emf. Bryan created a 'indent'
>> only
>> indentation scheme rather than basing it on c-mode. I do not think
>> that it
>> handles the case you cite above.
>>
>> To handle the if/then stuff then you could try using multiple indent
>> schemes, but you would have to use \n as a closing token (i.e. end of
>> line).
>>
>> To be honest I do not think you will be able to do it - specifically
>> because of dangling else's which are difficult to handle.
>>
>> We have been looking at the indent mechanism with a view to fixing
>> this
>> very problem. I think you will have to use a regular indent. If
>> the syntax
>> of the language allowed terminating ';' then you could have
>> probably used
>> cmode with some tweaks.
>>
>> Sorry.
>> Jon.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _____________________________________________________________________
>> _____
>>
>> This is an unmoderated list. JASSPA is not responsible for the
>> content of
>> any material posted to this list.
>>
>> To unsubscribe, send a mail message to
>>
>>     mailto:jasspa-unsubscribe@yahoogroups.com
>>
>> or visit http://groups.yahoo.com/group/jasspa and
>> modify your account settings manually.
>>
>>
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>
>
> ______________________________________________________________________
> ____
>
> This is an unmoderated list. JASSPA is not responsible for the
> content of
> any material posted to this list.
>
> To unsubscribe, send a mail message to
>
>     mailto:jasspa-unsubscribe@yahoogroups.com
>
> or visit http://groups.yahoo.com/group/jasspa and
> modify your account settings manually.
>
>
>
> Yahoo! Groups Links
>
>
>

#2136 From: "Bryan Schofield" <schofield.bryan@...>
Date: Mon Nov 27, 2006 8:02 pm
Subject: Re: Indent Mode Question
schofield.bryan@...
Send Email Send Email
 
hmmm... you may have to use 2 indent schemes and switch when you encounter a "

Off the top of my head something like this may work...

; define a new indent scheme for quoted strings
set-variable .indent.icon-q &pinc .hilight.next 1
0 indent .indent.icon-q 1 20

; have the indent scheme change to quoted scheme
; when a " is encountered and change back when a
; another non-escaped " is encountered
indent .indent.icon t "\"" .indent.icon-q
indent .indent.icon-q t "[^\\]\"" .indent.icon

; continue a line if a trailing _ is found
indent .indent.icon-q c "_\s*$" t


On 11/27/06, Jeremy Cowgar <jeremy@...> wrote:
>
> One more question and I think I then have a basic working mode for
>  Icon! Yippie!
>
>  In Icon, you can extend a string onto multiple lines by making the
>  last character a _
>
>  i.e.
>
>  "John Doe had a dog"
>
>  is the *exact* same as:
>
>  "John Doe_
>           had a dog"
>
>  _ says skip everything until the next non-whitespace.
>
>  So, my problem lies in the fact that I am ignoring comments inside of
>  quotes:
>
>  indent .hilight.icon e "\"" "\"" "\\"
>
>  Any thoughts on a workaround for this? I'd like _ to cause a
>  continuation indent.
>
>  Jeremy

#2137 From: "Gadrin" <gadrin@...>
Date: Mon Nov 27, 2006 9:17 pm
Subject: Highlighting Question
gadrin77
Send Email Send Email
 
I just downloaded and installed the latest version of emacs and I
changed the highlight scheme to blue background with white lettering.

I noticed that when I go to the end of the buffer, set the mark then
go to the top of the buffer, everything is highlighted except the
first line.

Is this a known bug/issue ?

#2138 From: Jon Green <jon@...>
Date: Mon Nov 27, 2006 9:37 pm
Subject: Re: Highlighting Question
bigfatmrmoose
Send Email Send Email
 
Gadrin wrote:
> I just downloaded and installed the latest version of emacs and I
> changed the highlight scheme to blue background with white lettering.
>
> I noticed that when I go to the end of the buffer, set the mark then
> go to the top of the buffer, everything is highlighted except the
> first line.
>
> Is this a known bug/issue ?

Not seen it - OK on my machine (SunOS UNIX).

Can you post your modified scheme file and we can try it and see what it
does.

Thanks
Jon.

#2139 From: Steven Phillips <bill@...>
Date: Mon Nov 27, 2006 11:38 pm
Subject: Re: Highlighting Question
bill@...
Send Email Send Email
 
Did you update the 'Sel-Cur' scheme? The 'Select scheme sets the
selection scheme for all lines except the current line, 'Sel-Cur'
(short for Select-Current-Line) sets the scheme for the selection on
the current line.

> Subject: [jasspa] Highlighting Question
> From: Gadrin <gadrin@...>
> Date: Monday, November 27, 2006, 9:17:44 PM
> To: jasspa@yahoogroups.com
>
>
>
>
>
> I just downloaded and installed the latest version of emacs and I
>  changed the highlight scheme to blue background with white lettering.
>
>  I noticed that when I go to the end of the buffer, set the mark then
>  go to the top of the buffer, everything is highlighted except the
>  first line.
>
>  Is this a known bug/issue ?
>
>
>
>
>

#2140 From: "Gadrin" <gadrin@...>
Date: Tue Nov 28, 2006 6:57 am
Subject: Re: Highlighting Question
gadrin77
Send Email Send Email
 
that's it. 30 minutes after I posted I remembered about emacs
highlighting the selected line.

is there a way to get more colors ?

I had thought one of the older versions had much more of a selection.

--- In jasspa@yahoogroups.com, Steven Phillips <bill@...> wrote:
>
> Did you update the 'Sel-Cur' scheme? The 'Select scheme sets the
> selection scheme for all lines except the current line, 'Sel-Cur'
> (short for Select-Current-Line) sets the scheme for the selection on
> the current line.

#2141 From: "Phillips, Steven" <sphillips@...>
Date: Tue Nov 28, 2006 7:52 am
Subject: RE: Re: Highlighting Question
sphillips@...
Send Email Send Email
 
Use the scheme-editor -> Color table -> Add button to create as many colors as you want (schemej uses 33 colors)
 
Steve


From: jasspa@yahoogroups.com [mailto:jasspa@yahoogroups.com] On Behalf Of Gadrin
Sent: Tuesday, November 28, 2006 6:57 AM
To: jasspa@yahoogroups.com
Subject: [jasspa] Re: Highlighting Question

that's it. 30 minutes after I posted I remembered about emacs
highlighting the selected line.

is there a way to get more colors ?

I had thought one of the older versions had much more of a selection.

--- In jasspa@yahoogroups.com, Steven Phillips <bill@...> wrote:
>
> Did you update the 'Sel-Cur' scheme? The 'Select scheme sets the
> selection scheme for all lines except the current line, 'Sel-Cur'
> (short for Select-Current-Line) sets the scheme for the selection on
> the current line.


#2142 From: Jeremy Cowgar <jeremy@...>
Date: Wed Nov 29, 2006 12:22 am
Subject: C-x # on a region?
cp200205
Send Email Send Email
 
Can I C-x # on a region?

Jeremy

#2143 From: Jeremy Cowgar <jeremy@...>
Date: Wed Nov 29, 2006 12:13 am
Subject: Aligning text?
cp200205
Send Email Send Email
 
Can I align text based on a character? i.e.

name = "John"
age = 10
d = 3

and turn that into

name = "John"
age  = 10
d    = 3

Thanks,

Jeremy

#2144 From: Jeremy Cowgar <jeremy@...>
Date: Wed Nov 29, 2006 12:12 am
Subject: Commenting out a region?
cp200205
Send Email Send Email
 
Can I comment out a region?

Jeremy

#2145 From: Jon Green <jon@...>
Date: Wed Nov 29, 2006 9:03 am
Subject: Re: Commenting out a region?
bigfatmrmoose
Send Email Send Email
 
Jeremy Cowgar wrote:
> Can I comment out a region?
No - out of the box.
Yes - if you wrote a macro to do it.

#2146 From: Jon Green <jon@...>
Date: Wed Nov 29, 2006 9:02 am
Subject: Re: Aligning text?
bigfatmrmoose
Send Email Send Email
 
Jeremy Cowgar wrote:
> Can I align text based on a character? i.e.
>
> name = "John"
> age = 10
> d = 3
>
> and turn that into
>
> name = "John"
> age  = 10
> d    = 3
>
> Thanks,
>
> Jeremy

No - not out of the box.
Yes - if you wrote a macro command to do it.

#2147 From: Jon Green <jon@...>
Date: Wed Nov 29, 2006 9:01 am
Subject: Re: C-x # on a region?
bigfatmrmoose
Send Email Send Email
 
Jeremy Cowgar wrote:
> Can I C-x # on a region?
No.

#2148 From: "Phillips, Steven" <sphillips@...>
Date: Wed Nov 29, 2006 9:23 am
Subject: RE: Commenting out a region?
sphillips@...
Send Email Send Email
 
In many languages (i.e. C) this is dangerous because the presence of any comment within the block will break the file, i.e.
 
/* start region comment here...
some code
/* original comment */
some more code
end region comment */
 
Therefore in C I would do the following instead:
 
#if 0
some code
/* original comment */
some more code
#endif
 
And perhaps this capability should be added to ME. but in the interim giving a numeric argument to comment-line will comment out the next 'n' lines, writing a macro based on that may be a good start depending on the target file format.
 
Steve


From: jasspa@yahoogroups.com [mailto:jasspa@yahoogroups.com] On Behalf Of Jeremy Cowgar
Sent: Wednesday, November 29, 2006 12:13 AM
To: jasspa@yahoogroups.com
Subject: [jasspa] Commenting out a region?

Can I comment out a region?

Jeremy


#2149 From: Jeremy Cowgar <jeremy@...>
Date: Wed Nov 29, 2006 9:48 pm
Subject: Commenting Problem w/Icon mode
cp200205
Send Email Send Email
 
I have been using my Icon mode for a few days now and it's working
very well, indenting properly all around. I have one last thing I
would like to implement and along with that a problem.

I would like the continuation of comments like in the C mode, but I
cannot seem to make it work. There are no block comments in Icon.
Only line comments, they are the # character. So, when I type:

##

I would like it to begin a comment block for me and continue to
comment with "# " like the C comments continue with " * ".

Now, the current problem I am having with comments (aside from the
above) is when I use C-c C-c to comment out a line, the comment
always begins on Column 1. i.e.

if 1 then {
    write("Hello") | {
      @@write("Hello did not work
    }
}

If at the @@ I press C-c C-c I will get:

if 1 then {
    write("Hello") | {
#    write("Hello did not work
    }
}

I would like to have:

if 1 then {
    write("Hello") | {
      # write("Hello did not work
    }
}

Any help on these two issues would be greatly appriciated. I have
placed my hkicon.emf file on the net so others can view and tell me
maybe what I am doing wrong.

http://jeremy.cowgar.com/files/hkicon.emf

Jeremy

#2150 From: Jeremy Cowgar <jeremy@...>
Date: Wed Nov 29, 2006 11:41 pm
Subject: Align Character's macro
cp200205
Send Email Send Email
 
Attached below is my align-character macro. It's function is:

int rad = 10;
int speed = 20;
int drag = 3;

Set the mark at int rad, move to int drag, Esc-x, align-character,
it'll prompt for a character, enter =... The result will be:

int rad   = 10;
int speed = 20;
int drag  = 3;

It aligned the = signs.

Now, the macro has a few flaws:

#1 If the character you want to align starts on the 1 column, it'll
be over looked.
#2 If you move too far down, say after int drag, and there is no =
sign, it'll abort with a end of buffer error.
#3 If you have:

int rad              = 10;
int speed = 20;
int drag  = 3;

and align, it'll align to the furthest = sign, so the result would be:

int rad              = 10;
int speed            = 20;
int drag             = 3;

If anyone has any fixes for those items or can make the macro better
in any way, I'd appriciate it! Oh! One more thing, I'd like to be
able to wrap it in other macros and call it with a parameter but am
unsure how to do that yet. i.e.

define-macro align-equals
    align-character "="
!emacro

Jeremy Cowgar

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

define-macro align-character
	 set-variable .align-char @ml "Align character"

	 !if &great $window-line $window-mark-line
		 exchange-point-and-mark
	 !endif

	 set-variable .start-line $window-line
	 set-variable .to-line $window-mark-line
	 set-variable .max 1

	 !while &or &less $window-line .to-line &equal $window-line .to-line
		 beginning-of-line

		 !repeat
			 forward-char
		 !until &sequal @wc .align-char

		 !if &great $window-col .max
			 set-variable .max $window-col
		 !endif

		 forward-line
	 !done

	 goto-line .start-line

	 !while &or &less $window-line .to-line &equal $window-line .to-line
		 beginning-of-line

		 !repeat
			 forward-char
		 !until &sequal @wc .align-char

		 !if &less $window-col .max
			 !repeat
				 insert-string " "
			 !until &equal $window-col .max
		 !endif

		 forward-line
	 !done

	 goto-line .start-line

	 ml-write "Aligned!"
!emacro

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

#2151 From: Jeremy Cowgar <jeremy@...>
Date: Wed Nov 29, 2006 10:36 pm
Subject: Comment Region Macro
cp200205
Send Email Send Email
 
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

#2152 From: "Bryan Schofield" <schofield.bryan@...>
Date: Thu Nov 30, 2006 2:03 pm
Subject: Re: Align Character's macro
schofield.bryan@...
Send Email Send Email
 
You can pass arguments just as described:

define-macro align-equals
   align-character "="
!emacro


The following snippet changes the first portion of you macro to look for an argument passed in, if not found, then prompt the user.

define-macro align-character
    !force set-variable .align-char @1
    !if &not $status
        s set-variable .align-char @ml "Align character"
    !endif
    ...



On 11/29/06, Jeremy Cowgar < jeremy@...> wrote:

Attached below is my align-character macro. It's function is:

int rad = 10;
int speed = 20;
int drag = 3;

Set the mark at int rad, move to int drag, Esc-x, align-character,
it'll prompt for a character, enter =... The result will be:

int rad = 10;
int speed = 20;
int drag = 3;

It aligned the = signs.

Now, the macro has a few flaws:

#1 If the character you want to align starts on the 1 column, it'll
be over looked.
#2 If you move too far down, say after int drag, and there is no =
sign, it'll abort with a end of buffer error.
#3 If you have:

int rad = 10;
int speed = 20;
int drag = 3;

and align, it'll align to the furthest = sign, so the result would be:

int rad = 10;
int speed = 20;
int drag = 3;

If anyone has any fixes for those items or can make the macro better
in any way, I'd appriciate it! Oh! One more thing, I'd like to be
able to wrap it in other macros and call it with a parameter but am
unsure how to do that yet. i.e.

define-macro align-equals
align-character "="
!emacro

Jeremy Cowgar

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

define-macro align-character
set-variable .align-char @ml "Align character"

!if &great $window-line $window-mark-line
exchange-point-and-mark
!endif

set-variable .start-line $window-line
set-variable .to-line $window-mark-line
set-variable .max 1

!while &or &less $window-line .to-line &equal $window-line .to-line
beginning-of-line

!repeat
forward-char
!until &sequal @wc .align-char

!if &great $window-col .max
set-variable .max $window-col
!endif

forward-line
!done

goto-line .start-line

!while &or &less $window-line .to-line &equal $window-line .to-line
beginning-of-line

!repeat
forward-char
!until &sequal @wc .align-char

!if &less $window-col .max
!repeat
insert-string " "
!until &equal $window-col .max
!endif

forward-line
!done

goto-line .start-line

ml-write "Aligned!"
!emacro

,___


#2153 From: "Bryan Schofield" <schofield.bryan@...>
Date: Thu Nov 30, 2006 2:04 pm
Subject: Re: Align Character's macro
schofield.bryan@...
Send Email Send Email
 
oops, I see I have an extra "s" on one line... doh.

On 11/30/06, Bryan Schofield <schofield.bryan@...> wrote:
> You can pass arguments just as described:
>
> define-macro align-equals
>    align-character "="
> !emacro
>
>
> The following snippet changes the first portion of you macro to look for an
> argument passed in, if not found, then prompt the user.
>
> define-macro align-character
>     !force set-variable .align-char @1
>     !if ¬ $status
>         s set-variable .align-char @ml "Align character"
>     !endif
>     ...
>
>
>
>
> On 11/29/06, Jeremy Cowgar < jeremy@...> wrote:
> >
> >
> >
> >
> >
> >
> >
> > Attached below is my align-character macro. It's function is:
> >
> > int rad = 10;
> > int speed = 20;
> > int drag = 3;
> >
> > Set the mark at int rad, move to int drag, Esc-x, align-character,
> > it'll prompt for a character, enter =... The result will be:
> >
> > int rad = 10;
> > int speed = 20;
> > int drag = 3;
> >
> > It aligned the = signs.
> >
> > Now, the macro has a few flaws:
> >
> > #1 If the character you want to align starts on the 1 column, it'll
> > be over looked.
> > #2 If you move too far down, say after int drag, and there is no =
> > sign, it'll abort with a end of buffer error.
> > #3 If you have:
> >
> > int rad = 10;
> > int speed = 20;
> > int drag = 3;
> >
> > and align, it'll align to the furthest = sign, so the result would be:
> >
> > int rad = 10;
> > int speed = 20;
> > int drag = 3;
> >
> > If anyone has any fixes for those items or can make the macro better
> > in any way, I'd appriciate it! Oh! One more thing, I'd like to be
> > able to wrap it in other macros and call it with a parameter but am
> > unsure how to do that yet. i.e.
> >
> > define-macro align-equals
> > align-character "="
> > !emacro
> >
> > Jeremy Cowgar
> >
> > =====================================================
> >
> > define-macro align-character
> > set-variable .align-char @ml "Align character"
> >
> > !if &great $window-line $window-mark-line
> > exchange-point-and-mark
> > !endif
> >
> > set-variable .start-line $window-line
> > set-variable .to-line $window-mark-line
> > set-variable .max 1
> >
> > !while &or &less $window-line .to-line &equal $window-line .to-line
> > beginning-of-line
> >
> > !repeat
> > forward-char
> > !until &sequal @wc .align-char
> >
> > !if &great $window-col .max
> > set-variable .max $window-col
> > !endif
> >
> > forward-line
> > !done
> >
> > goto-line .start-line
> >
> > !while &or &less $window-line .to-line &equal $window-line .to-line
> > beginning-of-line
> >
> > !repeat
> > forward-char
> > !until &sequal @wc .align-char
> >
> > !if &less $window-col .max
> > !repeat
> > insert-string " "
> > !until &equal $window-col .max
> > !endif
> >
> > forward-line
> > !done
> >
> > goto-line .start-line
> >
> > ml-write "Aligned!"
> > !emacro
> > ,___
>
>

#2154 From: Jeremy Cowgar <jeremy@...>
Date: Thu Nov 30, 2006 5:49 pm
Subject: JST Mode, any docs?
cp200205
Send Email Send Email
 
Is there a doc somewhere on how to use this mode? Or an example?

Jeremy

#2155 From: "Bryan Schofield" <schofield.bryan@...>
Date: Thu Nov 30, 2006 8:52 pm
Subject: Re: JST Mode, any docs?
schofield.bryan@...
Send Email Send Email
 
Esc x
help-item
jst


Are you asking in references to Notes? If so this is my cheat sheet note on using Notes and jst formatting...

**Bold**
//Italic//
__Underline__
@@Monospace@@
,,Subscript,,
``Superscript``
""Verbatim Text""

!* Styled block of text
Can use combinations of style characters: */_@,`"
Continues until a blank line


= Heading 1
== Heading 2
=== Heading 3
==c Centered Heading 2


*. Bullet list
1. Numbered list
A. Alpha list
a. Alpha list
I. Roman numeral list
i. Roman numeral list
 . A single . indicates continuation of the list
   A. Lists can be nested

:. Term
   Definition list


Nested highlight modes:
>java>
public String getName() {
    return this.name;
}
>end>

Supported Modes:
emf    - JASSPA MicroEmacs Macro file.
pseudo - Pseudo code block.
bnf    - BNF block.
c      - ANSI C code block.
cpp    - C++ code block.
perl   - Perl code block.
tcl    - TCL code block.
shell  - UNIX shell block.
java   - Java code block.
ini    - MS-DOS/Windows .ini code block.
php    - PHP code block.
make   - Makefile fragment.



Justification:
> No justification will occur for this paragraph
>c Center justified paragraph
>r Right justified paragraph





On 11/30/06, Jeremy Cowgar < jeremy@...> wrote:

Is there a doc somewhere on how to use this mode? Or an example?

Jeremy



#2156 From: Jon Green <jon@...>
Date: Thu Nov 30, 2006 10:33 pm
Subject: Re: Commenting Problem w/Icon mode
bigfatmrmoose
Send Email Send Email
 
Jeremy Cowgar wrote:
> I have been using my Icon mode for a few days now and it's working
> very well, indenting properly all around. I have one last thing I
> would like to implement and along with that a problem.
>
> I would like the continuation of comments like in the C mode, but I
> cannot seem to make it work. There are no block comments in Icon.
> Only line comments, they are the # character. So, when I type:
>
> ##
>
> I would like it to begin a comment block for me and continue to
> comment with "# " like the C comments continue with " * ".
>

For single line comments it does not work like this i.e. when you do //
on C++ (or even C). What I normally do is to carry on typing and when it
wants to wrap (i.e. starts to scroll horizontally) then do a quick esc-o
to reformat the comment and then carry on typing,


> Now, the current problem I am having with comments (aside from the
> above) is when I use C-c C-c to comment out a line, the comment
> always begins on Column 1. i.e.
>
> if 1 then {
>    write("Hello") | {
>      @@write("Hello did not work
>    }
> }
>
> If at the @@ I press C-c C-c I will get:
>
> if 1 then {
>    write("Hello") | {
> #    write("Hello did not work
>    }
> }
>
> I would like to have:
>
> if 1 then {
>    write("Hello") | {
>      # write("Hello did not work
>    }
> }
>
> Any help on these two issues would be greatly appriciated. I have
> placed my hkicon.emf file on the net so others can view and tell me
> maybe what I am doing wrong.

For your icon template then define your own comment-line macro  and then
you need to over-ride the default comment handling i.e

First you need to make sure that the standard comment template is loaded.

; Make sure that the comment definitions are loaded before we define our own
; comment line handling because we want to use the standard comment
; definitions set up by buffer-init.
!if ¬ &exi "comment-get-def"
      !force exec-file "comment"
!endif


Then set up you buffer command over-rides i.e. in the following example
I have added the key binding C-c C-c at command-3 to execute our own
icon macro to handle the line commenting. If you have no special
commands then you will only define a command-0 entry with the comment
line entry.

set-variable .fhook-hkt.command-0
"|th||expand-abbrev-handle|A-q|Complete co\Hmmand|"
set-variable .fhook-hkt.command-1 "|thbo||hkt-quote-command|A-q|Complete
co\Hmmand|"
set-variable .fhook-hkt.command-2 "|b||hkt-quote-command|C-c C-q|\HQuote
command|"
set-variable .fhook-hkt.command-3 "|b||icon-comment-line|C-c C-c|Comment
\HLine|"


Then take the standard comment-line macro and modify it a bit for
insertion at the first valid character. Call it something different
specific to the template.

; comment line ie xxx -> <comment start>xxx
;              or xxx -> <comment start>xxx<comment end>
; Redefined so the comment is placed at the correct indent.
define-macro icon-comment-line
      0 comment-get-def
      set-variable #l1 &lget #l9 1
      set-variable #l2 &trl &lget #l9 2
      beginning-of-line
      !while &gre &pdec @# 1 0
          ; Find the first non-white space of the line.
          !if &sin @wc " \t\n"  ; NEW
              forward-char      ; NEW
              !jump -2          ; NEW
          !endif                ; NEW
          insert-string #l1
          !if ¬ &seq #l2 ""
              end-of-line
              insert-string #l2
          !endif
          beginning-of-line
          forward-line
      !done
!emacro

I have used !jump here because I cannot use a nested !while. !jump is a
dirty relative !goto and -2 is backward 2 lines.

If you wanted to over-ride the behaviour of the comment-line macro for
all files then you would do the following in your user.emf:

First you need to make sure that the standard comment template is loaded.

; Make sure that the comment definitions are loaded before we define our own
; comment line handling because we want to use the standard comment
; definitions set up by buffer-init.
!if ¬ &exi "comment-get-def"
      !force exec-file "comment"
!endif

This would force line-comment to be defined, you would now redefine the
macro globally and it would be used in preference to the system one.
This is the same as above except we have called it by the same name as
the system wide one.

; comment line ie xxx -> <comment start>xxx
;              or xxx -> <comment start>xxx<comment end>
; Redefined so the comment is placed at the correct indent.
define-macro comment-line
      0 comment-get-def
      set-variable #l1 &lget #l9 1
      set-variable #l2 &trl &lget #l9 2
      beginning-of-line
      !while &gre &pdec @# 1 0
          ; Find the first non-white space of the line.
          !if &sin @wc " \t\n"  ; NEW
              forward-char      ; NEW
              !jump -2          ; NEW
          !endif                ; NEW
          insert-string #l1
          !if ¬ &seq #l2 ""
              end-of-line
              insert-string #l2
          !endif
          beginning-of-line
          forward-line
      !done
!emacro

The other way of doing this is to copy comment.emf to your user area and
then modify it - either way will work.

Hope that helps
Jon,


>
> http://jeremy.cowgar.com/files/hkicon.emf
>
> Jeremy
>
>
>
> __________________________________________________________________________
>
> This is an unmoderated list. JASSPA is not responsible for the content of
> any material posted to this list.
>
> To unsubscribe, send a mail message to
>
>     mailto:jasspa-unsubscribe@yahoogroups.com
>
> or visit http://groups.yahoo.com/group/jasspa and
> modify your account settings manually.
>
>
>
> Yahoo! Groups Links
>
>
>
>

#2157 From: Jeremy Cowgar <jeremy@...>
Date: Thu Nov 30, 2006 10:52 pm
Subject: Re: Commenting Problem w/Icon mode
cp200205
Send Email Send Email
 
> For your icon template then define your own comment-line macro  and
> then
> you need to over-ride the default comment handling i.e

Jon,

The problem I see with this solution is that the problem is not
specific to my Icon mode I have found. It does it in C also. i.e.

if (1=1) {
      if (2=2) {
          @@printf("HELLO");
      }
}

When at the @@ line, I do C-c C-c, I get:

if (1=1) {
      if (2=2) {
/*        printf("HELLO"); */
      }
}

Then, when I restyle the buffer:

if (1=1) {
      if (2=2) {
          /*        printf("HELLO"); */
      }
}

Jeremy

Messages 2128 - 2157 of 2695   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help