[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Abbrev suggestions - feedback appreciated

From: Stefan Monnier
Subject: Re: Abbrev suggestions - feedback appreciated
Date: Sat, 16 Sep 2017 09:22:20 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> (defun absug-maybe-suggest ()
>   "Suggest an abbrev to the user based on the word before point."
>   (let* ((word (absug-word-before-point))
>          (expansions (absug-get-active-abbrev-expansions))
>          (abbrev (assoc word expansions)))
>     (if abbrev
>         (message "Abbrev suggestion: The word `%s' has the abbrev
> `%s' defined" (car abbrev) (cdr abbrev)))))

I like the feature.  Here are some comments:

- The expansion is not necessarily a "word".
- The `expansions` list is built only to then pass it to `assoc`.
  You could avoid constructing the list by passing `word` to
  absug-get-active-abbrev-expansions and have it check equality as it goes.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]