Page 1 of 1

New Macro Tag Request

Posted: Mon Jul 02, 2012 4:40 pm
by pwdiener
Would it be possible to add a new macro tag to reflect the language (document type) of the current file? This isn't that hard to detect from the file extension, I realize, but since Zeus has already done that classification, it might make language-dependent macros a little bit more robust, with less code redundancy. Some languages also use multiple file extensions for a document type (depends on shop conventions, I guess), so specifying this in one place rather than Zeus config + one or more language-dependent macros would be a nice convenience.

Bill Diener

Posted: Mon Jul 02, 2012 11:37 pm
by jussij
Hi Bill,
Would it be possible to add a new macro tag to reflect the language (document type) of the current file?
Sure. I create a new macro tag described as follows:

Code: Select all

$DTD   i.e the DocumentTypeDescription
So for example given a COBOL active document this new tag would return the following string:

Code: Select all

Cobol Document Type
Even though it the Zeus configuration is wrong since it should have been configured as COBOL Document Type ;)

That should work don't you think :?:

PS: I could also parse the string to remove the Document Type portion but I am not sure that is a good idea.

Cheers Jussi

Posted: Tue Jul 03, 2012 3:34 pm
by pwdiener
That would work perfectly!

To me, this is one of the key things that sets Zeus apart from some of the other editors I've used - your willingness to consider suggestions and the responsiveness with which they get implemented are excellent!

Bill Diener

Posted: Wed Jul 04, 2012 4:54 am
by jussij
Hi Bill,

This latest patch include the new $DTD macro tag: http://www.zeusedit.com/z300/zeus-beta-patch.zip

Here's an example:

Code: Select all

function key_macro()
    document_type = macro_tag("$DTD")
    message(document_type)
end

key_macro() -- run the macro
your willingness to consider suggestions and the responsiveness with which they get implemented are excellent!
Thanks :)

Generally I am always very happy when people offer suggestion on how to make Zeus better.

Cheers Jussi