Next: , Previous: Block Boundary Check, Up: Actions

4.9.2 Padding Operators

Some operators can be automatically surrounded by spaces. This can happen when the operator is typed, or later when the line is indented. IDLWAVE can pad the operators ‘<’, ‘>’, ‘,’, ‘=’, and ‘->’, as well as the modified assignment operators (‘AND=’, ‘OR=’, etc.). This feature is turned off by default. If you want to turn it on, customize the variables idlwave-surround-by-blank and idlwave-do-actions and turn both on. You can also define similar actions for other operators by using the function idlwave-action-and-binding in the mode hook. For example, to enforce space padding of the ‘+’ and ‘*’ operators (outside of strings and comments, of course), try this in .emacs

     (add-hook 'idlwave-mode-hook
       (lambda ()
          (setq idlwave-surround-by-blank t)  ; Turn this type of actions on
          (idlwave-action-and-binding "*" '(idlwave-surround 1 1))
          (idlwave-action-and-binding "+" '(idlwave-surround 1 1))))

Note that the modified assignment operators which begin with a word (‘AND=’, ‘OR=’, ‘NOT=’, etc.) require a leading space to be recognized (e.g., vAND=4 would be interpreted as a variable vAND). Also note that since, e.g., > and >= are both valid operators, it is impossible to surround both by blanks while they are being typed. Similarly with & and &&. For these, a compromise is made: the padding is placed on the left, and if the longer operator is keyed in, on the right as well (otherwise you must insert spaces to pad right yourself, or press simply press Tab to repad everything if idlwave-do-actions is on).

— User Option: idlwave-surround-by-blank (nil)

Non-nil means enable idlwave-surround. If non-nil, ‘=’, ‘<’, ‘>’, ‘&’, ‘,’, ‘->’, and the modified assignment operators (‘AND=’, ‘OR=’, etc.) are surrounded with spaces by idlwave-surround.

— User Option: idlwave-pad-keyword (t)

Non-nil means space-pad the ‘=’ in keyword assignments.