You can continue to use
The following elisp snippet allows you to specify additional characters as word-consistent when abbreviation takes place.
After running the snippet customize the option
abbrev-additional-chars with an alist that maps major-mode symbols to the lists of characters that should be interpreted as word-consistent during abbreviation.
The special mode symbol
t corresponds to additional characters active in all modes.
The default value of
'((t ?-)) which covers your use-case.
You can install the snippet in your init file if you like.
"Alist that maps major mode symbols to lists of characters that may appear in abbreviations.
The chars of the special major mode symbol `t' are active in all modes."
:type '(repeat :tag "List of modes"
(cons :tag "Map major mode symbols to lists of additional chars in abbrevs"
(symbol :tag "Mode symbol (`t' stands for all modes)")
(repeat :tag "List of additional word-consistent characters" character))))
(defvar-local T-abbrev-syntax-table nil
"List of additional characters in abbreviations.")
(defun T-abbrev-mode-hook-fun ()
"Populate T-abbrev-syntax-table with the local syntax table modfied by
the characters in `abbrev-additional-chars'."
(let ((char-list (append (cdr (assoc major-mode abbrev-additional-chars))
(cdr (assoc 't abbrev-additional-chars)))))
(setq T-abbrev-syntax-table (make-syntax-table (syntax-table)))
(mapcar (lambda (char)
(modify-syntax-entry char "w" T-abbrev-syntax-table))
;; Wrapping functions of the `abbrev` package with the local syntax table.
;; I'm not sure I captured all fun's that need to run with the local syntax-table.
;; Adding further functions is easy.
;; Just add them to the list at the end of the next form.
(let ((newfun (intern (concat "T-ad-" (symbol-name fun)))))
(defun ,newfun (oldfun &rest args)
,(concat "This function evaluates `" (symbol-name fun) "' with `T-abbrev-syntax-table' as active syntax table.
It is used for the advicing `" (symbol-name fun) "'.")
(apply oldfun args)
(advice-add (quote ,fun) :around (quote ,newfun))))))
(add-hook 'abbrev-mode-hook #'T-abbrev-mode-hook-fun)