Can I configure Emacs AC mode (auto-complete) to ignore numbers?

I often include numerical data, phone numbers, etc. when entering text files, and this is annoying in AC mode. Now, when I type β€œ2,” I get an autocomplete option with every number or numeric code I have ever entered, starting with β€œ2”. Not very useful to say.

I went in and cleaned up my ac-comphist.dat , but it ac-comphist.dat dirty again with numbers. Is there a way to prevent these entries from being added in the first place, perhaps using a regular expression filter? I tried setting the ac-ignores with a list of integers, but it didn't seem to fix the problem.

+4
source share
1 answer

I think I never noticed decimal digits, but for hexadecimal it was really annoying. I fixed it by overriding ac-prefix-default as follows:

 (eval-after-load "auto-complete" '(progn (defun ac-prefix-default () "Same as `ac-prefix-symbol' but ignore a number prefix." (let ((start (ac-prefix-symbol))) (when (and start (not (string-match "^\\(?:0[xX][0-9A-Fa-f]+\\|[0-9]+\\)$" (buffer-substring-no-properties start (point))))) start))) )) 
+3
source

All Articles