0

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 is available at https://sourceforge.net/u/gavenkoa/dot-emacs/ci/default/tree/.emacs-my Corresponding installation steps are available at https://sourceforge.net/u/gavenkoa/dot-emacs/ci/default/tree/Makefile

2
  • Did you try recompiling after adding missing require? Commented Oct 13, 2015 at 9:23
  • @IqbalAnsari Of course I recompile again )) Added further info.
    – gavenkoa
    Commented Oct 13, 2015 at 9:32

1 Answer 1

0

Hm..., my error come from many parts after adaptation of install architecture.

I introduce byte-compilation for speed reason, that effect macro expansion.

Note that I used -Q option (to make compilation faster), which prevents built normal load-path value.

My (require 'w3m-util nil :no-error) style allow byte-compilation ever some packages doesn't preset at compile time. Changing code to (require 'w3m-util) has shown me where I am wrong.

So as solution I strip -Q from Emacs invocation during byte-compilation.

3
  • 1
    An alternative would be using -L with the path to the library needed.
    – wasamasa
    Commented Oct 13, 2015 at 11:20
  • If you feel your answer is correct, and if you are not looking for other answers, consider accepting your answer. that removes it from the list of unanswered questions.
    – Drew
    Commented Oct 13, 2015 at 15:33
  • It's been more than 2 days by now...
    – npostavs
    Commented Nov 12, 2015 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.