I want to type "--> " and have it automatically converted into "→ ". Is there a way to do this using Abbrev?
From emacs manual:
More precisely, any character that is not a word constituent expands an abbrev, and any word-constituent character can be part of an abbrev.
So the answer is no because characters '-' and '>' are not word characters.
Instead, do come up a with naming schema that is easy to remember. I am using the convention from Xah Lee to start Unicode abbrevs with character 8 and use a short mnemonic string. For example, add this into your global-abbrev-table:
("8ar" "→" nil 0)
Using abbrev, not really. You can do it yourself though:
(defun my-insert-gt () "Substitute in arrow maybe." (interactive) (if (looking-back "--" (- (point) 2)) (progn (backward-delete-char 2) (insert "→")) (insert ">"))) (global-set-key ">" #'my-insert-gt)