> > True. I thought about that and concluded that it would be a lot harder > to look for more than one words, matching a certain expansion. It will > be especially tricky, I think, if the words the user types and which > match an extension, spans more than one line. Of course not impossible but > I thought I would start with the easy and probably quite common use > case. > Okay, so... Turns out it was not that hard... :) With two helper functions I could rewrite the suggest function quite nicely: (defun asug-count-words (expansion) (length (split-string expansion " " t))) (defun asug-get-previous-words (n) (let ((end (point)) words) (save-excursion (backward-word n) (replace-regexp-in-string "[\n\r]" " " (buffer-substring-no-properties (point) end))))) (defun absug-maybe-suggest () "Suggest an abbrev to the user based on the word(s) before point." (let ((expansions (absug-get-active-abbrev-expansions)) words found expansion word-count) (while (and expansions (not found)) (setq expansion (pop expansions)) (when expansion (setq word-count (asug-count-words (car expansion)) words (asug-get-previous-words word-count)) (when (and (> word-count 0) (string= words (car expansion))) (setq found t) (message "You can write `%s' using the abbrev `%s'." (car expansion) (cdr expansion))))))) It works for abbrevs that has an expansion with multiple words and it also works across lines. Now I will clean this up a bit and checkdoc it...