unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* wrong-type-argument when ~/.emacs is byte compiled
@ 2005-05-12  0:56 Esben Stien
  2005-05-12 15:24 ` Kevin Rodgers
  0 siblings, 1 reply; 6+ messages in thread
From: Esben Stien @ 2005-05-12  0:56 UTC (permalink / raw)


I have this code in my ~/.emacs to automatically byte compile when I
save the file.

(defun autocompile nil
  "compile itself if ~/.emacs"
  (interactive)
  (require 'bytecomp)
  (if (string= (buffer-file-name) (expand-file-name (concat default-directory ".emacs")))
(byte-compile-file (buffer-file-name))))
  (add-hook 'after-save-hook 'autocompile)
(defconst animate-n-steps 3)

Now, when I try to start my function irc, defined: 

(defmacro de-erc-connect (command server port nick)
  "Create interactive command `command', for connecting to an IRC server. The command uses interactive mode if passed an argument."
  (fset command
	`(lambda (arg)
	   (interactive "p")
	   (if (not (= 1 arg))
	       (erc-select ,server ,port ,nick)
	     (erc ,server ,port ,nick ,erc-user-full-name t)))))

(autoload 'erc "erc" "" t)
(autoload 'erc-select "erc" "" t)
(de-erc-connect erc-fn "irc.gnu.org" 6667 "b0ef")

(defun erc-autojoin-channels (server nick)
  (dolist (l erc-autojoin-channels-alist)
    (when (string-match (car l) server)
      (dolist (chan (cdr l))
        (erc-send-command (concat "join " chan))))))
(add-hook 'erc-after-connect 'erc-autojoin-channels)

 (defun irc ()
   "Start to waste time on IRC with ERC."
   (interactive)
   (call-interactively 'erc-fn))

I get, when trying to M-x irc:

Debugger entered--Lisp error: (wrong-type-argument commandp erc-fn)
  call-interactively(erc-fn)
  irc()
  call-interactively(irc)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

Now, everything works if I just take out the auto compile function or
rm the ~/.emacs.elc file.

Anyone have any pointers on what to look at?

-- 
Esben Stien is b0ef@e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
          [sip|iax]:   e     e 
           jid:b0ef@    n     n

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

* Re: wrong-type-argument when ~/.emacs is byte compiled
       [not found] <mailman.4745.1115860035.2819.help-gnu-emacs@gnu.org>
@ 2005-05-12  4:03 ` Stefan Monnier
  2005-05-12 13:15   ` Esben Stien
  2005-05-12 10:13 ` Thien-Thi Nguyen
  2005-05-12 14:40 ` Johan Bockgård
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2005-05-12  4:03 UTC (permalink / raw)


> I have this code in my ~/.emacs to automatically byte compile when I
> save the file.

This is a bad idea.  If your .emacs contains something worth byte-compiling,
it should be moved outside .emacs into its own file.  I.e. you're just
wasting your time with such a hack.


        Stefan

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

* Re: wrong-type-argument when ~/.emacs is byte compiled
       [not found] <mailman.4745.1115860035.2819.help-gnu-emacs@gnu.org>
  2005-05-12  4:03 ` wrong-type-argument when ~/.emacs is byte compiled Stefan Monnier
@ 2005-05-12 10:13 ` Thien-Thi Nguyen
  2005-05-12 14:40 ` Johan Bockgård
  2 siblings, 0 replies; 6+ messages in thread
From: Thien-Thi Nguyen @ 2005-05-12 10:13 UTC (permalink / raw)


Esben Stien <b0ef@esben-stien.name> writes:

>    (call-interactively 'erc-fn)

that is a strange approach.

unless you are "manually" supplying a prefix arg, you
might as well just use a straightforward function call.

thi

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

* Re: wrong-type-argument when ~/.emacs is byte compiled
  2005-05-12  4:03 ` wrong-type-argument when ~/.emacs is byte compiled Stefan Monnier
@ 2005-05-12 13:15   ` Esben Stien
  0 siblings, 0 replies; 6+ messages in thread
From: Esben Stien @ 2005-05-12 13:15 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:

> If your .emacs contains something worth byte-compiling, it should be
> moved outside .emacs into its own file.

Aiight, I'll do that. 

-- 
Esben Stien is b0ef@e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
          [sip|iax]:   e     e 
           jid:b0ef@    n     n

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

* Re: wrong-type-argument when ~/.emacs is byte compiled
       [not found] <mailman.4745.1115860035.2819.help-gnu-emacs@gnu.org>
  2005-05-12  4:03 ` wrong-type-argument when ~/.emacs is byte compiled Stefan Monnier
  2005-05-12 10:13 ` Thien-Thi Nguyen
@ 2005-05-12 14:40 ` Johan Bockgård
  2 siblings, 0 replies; 6+ messages in thread
From: Johan Bockgård @ 2005-05-12 14:40 UTC (permalink / raw)


Esben Stien <b0ef@esben-stien.name> writes:

> (defmacro de-erc-connect (command server port nick)
>   "Create interactive command `command', for connecting to an IRC
>   server. The command uses interactive mode if passed an argument."
>   (fset command
>       `(lambda (arg) [...]

This macro is broken.

-- 
Johan Bockgård

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

* Re: wrong-type-argument when ~/.emacs is byte compiled
  2005-05-12  0:56 Esben Stien
@ 2005-05-12 15:24 ` Kevin Rodgers
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2005-05-12 15:24 UTC (permalink / raw)


Esben Stien wrote:
 > I have this code in my ~/.emacs to automatically byte compile when I
 > save the file.
 >
 > (defun autocompile nil
 >   "compile itself if ~/.emacs"
 >   (interactive)
 >   (require 'bytecomp)
 >   (if (string= (buffer-file-name) (expand-file-name (concat 
default-directory ".emacs")))
 > (byte-compile-file (buffer-file-name))))
 >   (add-hook 'after-save-hook 'autocompile)

That will automatically byte compile .emacs files in any directory.

-- 
Kevin Rodgers

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

end of thread, other threads:[~2005-05-12 15:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.4745.1115860035.2819.help-gnu-emacs@gnu.org>
2005-05-12  4:03 ` wrong-type-argument when ~/.emacs is byte compiled Stefan Monnier
2005-05-12 13:15   ` Esben Stien
2005-05-12 10:13 ` Thien-Thi Nguyen
2005-05-12 14:40 ` Johan Bockgård
2005-05-12  0:56 Esben Stien
2005-05-12 15:24 ` Kevin Rodgers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).