all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* question about macro `minibuffer-with-setup-hook', byte-compilation
@ 2012-10-05 18:35 Drew Adams
  2012-10-05 19:03 ` Stefan Monnier
  2012-10-06  7:12 ` Stephen J. Turnbull
  0 siblings, 2 replies; 8+ messages in thread
From: Drew Adams @ 2012-10-05 18:35 UTC (permalink / raw)
  To: emacs-devel

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)




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-10-06  7:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-05 18:35 question about macro `minibuffer-with-setup-hook', byte-compilation Drew Adams
2012-10-05 19:03 ` Stefan Monnier
2012-10-05 20:02   ` Drew Adams
2012-10-05 20:21     ` Stefan Monnier
2012-10-05 20:33       ` Drew Adams
2012-10-05 20:49         ` Andreas Schwab
2012-10-05 21:02           ` Drew Adams
2012-10-06  7:12 ` Stephen J. Turnbull

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.