Option to restrict macro to a single document type

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
SamuelReynolds
Posts: 9
Joined: Tue Dec 28, 2004 10:55 pm
Location: Colorado
Contact:

Option to restrict macro to a single document type

Post by SamuelReynolds »

I would love to be able to, for example, set up document-type-specific macros for "Comment" and "Uncomment", and use the same shortcut key combo for any (programming) document type.
  • Example: Comment/Uncomment

    In a Python file, ctrl-\ would invoke the CommentPython macro to insert a '#' at the beginning of the line, but in a Javascript or C/C++ file it would invoke an alternate macro to insert '//' and in a DOS/Windows .bat file it would invoke yet another macro to insert 'REM'.

    Similarly, ctrl-shift-\ would invoke the appropriate Uncomment macro to remove the appropriate comment character or sequence of characters.

    FWIW, I'm forever inserting '#' in Javascript files by hitting the Comment Lines shortcut key. (My Comment Lines macro is set up for Python.)
This option (in the macro Properties dialog) could be either:
  • 1. Checkbox to restrict plus selection list to select a single document type. A macro could be either unrestricted or restricted to a single document type.

    This would mean that separate macros would be needed for different document types even if they use the same comment sequence (for example, C++ and Javascript files).
or
  • 2. Checkbox to restrict plus selection list to select one or more document types. A macro could be either unrestricted or restricted to one or more document type(s).
A macro that is Restricted to one (or several) document type(s) would only appear on the Macros menu for that (or those) document type(s).

The default behavior (if the Restrict checkbox is not checked) would be the current behavior: make the macro available for all document types.

- Sam[/list]
drefty
Posts: 35
Joined: Mon Dec 22, 2003 3:53 pm

There is a workaround for this functionality

Post by drefty »

There is a workaround that gives you this functionality. It is posted in the TIPS section.

Using one keystroke to comment out any type of code
http://www.textpad.info/forum/viewtopic.php?t=5791
Post Reply