Mathematica: Unevaluated vs Defer vs Hold vs HoldForm vs HoldAllComplete vs etc etc

These are pretty tricky constructs, and it’s tough to give clear explanations; they aren’t as straightforward as Lisp macros (or, for that matter, the relationship between Lisp’s QUOTE and EVAL). However, there’s a good, lengthy discussion available in the form of notes from Robby Villegas’s 1999 talk “Unevaluated Expressions” on Wolfram’s website. Defer is omitted … Read more

How to auto execute a macro when opening a Powerpoint presentation?

While Auto_Open doesn’t run in a PowerPoint presentation, you can fake it. Add a CustomUI part to the presentation, then use the CustomUI OnLoad callback to run code when the presentation opens. The CustomUI part needs no more than just the CustomUI tags. Get the Custom UI Editor from here: http://openxmldeveloper.org/articles/customuieditor.aspx Open the presentation in … Read more

How to write macro for Notepad++?

Macros in Notepad++ are just a bunch of encoded operations: you start recording, operate on the buffer, perhaps activating menus, stop recording then play the macro. After investigation, I found out they are saved in the file shortcuts.xml in the Macros section. For example, I have there: <Macro name=”Trim Trailing and save” Ctrl=”no” Alt=”yes” Shift=”yes” … Read more

How to allow optional trailing commas in macros?

Make the comma optional As DK. points out, the trailing comma can be made optional. Rust 1.32 You can use the ? macro repeater to write this and disallow multiple trailing commas: ($Name:ident { $($Variant:ident),* $(,)? }) => { // ^^^^^ Previous versions This allows multiple trailing commas: ($Name:ident { $($Variant:ident),* $(,)* }) => { … Read more