emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

question about macro `minibuffer-with-setup-hook', byte-compilation


From: Drew Adams
Subject: question about macro `minibuffer-with-setup-hook', byte-compilation
Date: Fri, 5 Oct 2012 11:35:50 -0700

In a file foo.el I define function foo, wrapping the defun in
(when (> emacs-major-version 22)...)

Function foo uses `minibuffer-with-setup-hook' which is a macro defined in
files.el.  (The code for foo is similar to that for `read-file-name-default',
and it is used similarly.)

I byte-compile foo.el in an Emacs version that does not have macro
`minibuffer-with-setup-hook', so the byte code contains a call to
`minibuffer-with-setup-hook' instead of the macro expansion.

In Emacs versions that define `minibuffer-with-setup-hook', the byte-compiled
code does not work.

File files.elc is preloaded, and it contains a defalias for
`minibuffer-with-setup-hook'.  And (symbol-function 'minibuffer-setup-hook)
shows its usual, byte-compiled definition.

But when foo is invoked an error is raised saying that `minibuffer-setup-hook'
is an invalid function.

If I load source file foo.el instead of foo.elc, there is of course no problem.
Likewise if I load source file files.el.

How to handle this?  What am I missing?  Thx.

---
Debugger entered--Lisp error: (invalid-function minibuffer-with-setup-hook)
  minibuffer-with-setup-hook(#[nil "..." [dir default-directory insdef
    minibuffer-default minibuffer-local-filename-syntax make-local-variable
    minibuffer-default-add-function #[nil "..." [dir initial window-buffer
    minibuffer-selected-window read-file-name--defaults] 3] boundp
    set-syntax-table] 2] "c:/dir/fooooo.el")
  icicle-foo("File or directory: " nil "c:/dir/toto"
    confirm-after-completion nil nil)
  read-file-name("File or directory: " nil "c:/dir/toto"
    confirm-after-completion nil nil)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]