diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2022-01-05 21:49:58 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2022-01-05 22:27:08 +0100 |
| commit | c6290431566e5e6f30518fc925183907820a1edf (patch) | |
| tree | 6affaefdca1bdb64eb2eb3a799b65af41f5b8823 | |
| parent | be2014538af37fdb3cf38b2129c06314644f745f (diff) | |
cape-abbrev: Take all abbrev tables into account (Fix #19)
Thanks, @tpeacock19!
| -rw-r--r-- | cape.el | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -681,18 +681,27 @@ is nil the function acts like a capf." method method) ;;;;; cape-abbrev +(defun cape--abbrev-tables () + "Return list of all active abbrev tables, including parents." + ;; Emacs 28: See abbrev--suggest-get-active-tables-including-parents. + (let ((tables (abbrev--active-tables))) + (append tables (cl-loop for table in tables + append (abbrev-table-get table :parents))))) + (defun cape--abbrev-list () "Abbreviation list." - (delete "" (nconc (all-completions "" global-abbrev-table) - (all-completions "" local-abbrev-table)))) + (delete "" (cl-loop for table in (cape--abbrev-tables) + nconc (all-completions "" table)))) (defun cape--abbrev-annotation (abbrev) "Annotate ABBREV with expansion." (concat " " (truncate-string-to-width - (symbol-value - (or (abbrev--symbol abbrev local-abbrev-table) - (abbrev--symbol abbrev global-abbrev-table))) + (format + "%s" + (symbol-value + (cl-loop for table in (cape--abbrev-tables) + thereis (abbrev--symbol abbrev table)))) 30 0 nil t))) (defun cape--abbrev-exit (_str status) |
