emacs: implement intelligent C-f/C-b