I'm new to Emacs and Common Lisp. I'm wanting to use abbrev-mode
to replace standard Common Lisp function names with aliases that I have created. So for example, I would like to replace the following standard functions with my aliases:
equalp
alpha-char-p
char<
char/=
Following the example here, I defined my abbrev table in the global-abbrev-table
definition in the abbrev_defs.el
file in the folder ~\emacs.d\
.
However, I discovered that it does not replace connected multi-words or words that contains non-alphanumeric characters (all except the first in my examples). Reading various answers to questions here like this, things I need to do to fix this are:
- Create a regexp that will define abbrev boundaries.
I want the regex to match any sequences of characters except white spaces, parentheses and quotes, so I came up with this regexp
\\([^\n\t '()\"]*\\)
, which I tested usingM-x re-builder
inside Emacs. - Modify the syntax table with the new regexp by adding the function
abbrev-table-put
. I came up with this:(abbrev-table-put global-abbrev-table :regexp "\\([^\n\t '()\"]*\\)" )
After adding that sexp at the end of my init file, abbrev-mode
is now broken. It no longer replaces any word, but the default abbrev-mode
behavior comes back if I comment out that sexp. Adding the sexp to either file abbrev_defs.el
or the end of file abbrev.el
doesn't work.
Question: What's the right fix here? Is my regex wrong? Where should I put that sexp? Any other errors I'm doing?