For: (defun my-w3m-view-url () (interactive) (browse-url (w3m-anchor))) (eval-after-load 'w3m (define-key w3m-minor-mode-map (kbd "RET") #'my-w3m-view-url)) when byte-compiled I get error on key binding `RET` usage: my-w3m-view-url: Invalid function: w3m-anchor This because `w3m-anchor` isn't a function but become macro. I try to add: (eval-when-compile (require 'w3m-util nil :no-error)) before lines that uses `w3m-anchor`. But this doesn't help me. I load `.emacs-my.elc` file made by: emacs -Q --batch --eval='(byte-compile-file "~/.emacs.d/.emacs-my")' **UPDATE** As suggest @Iqbal Ansari I further debug issue. For some reason byte compiled file have function call instead of expanded macro: $ strings .emacs-my.elc | grep w3m-anchor 840:(defalias 'my-w3m-view-url #[nil "\300\301 !\207" [browse-url w3m-anchor] 2 nil nil]) Full `.emacs-my` file source code available at https://sourceforge.net/u/gavenkoa/dot-emacs/ci/default/tree/.emacs-my