From: Tamas Papp
Subject: defining a macro in all packages
Date: 
Message-ID: <87lkcf7ral.fsf@pu100877.student.princeton.edu>
Since I use defparameter quite a bit when testing functions
interactively, I put the following in my .sbclrc:

(defmacro defp (&rest rest)
  `(defparameter ,@rest))

to get a shorter alias for defparameter.  But this only defines the
macro in cl-user.  Is there a way to have this macro set up
automagically in all packages I load?  I am usign SLIME.

Thanks,

Tamas

From: Pascal Costanza
Subject: Re: defining a macro in all packages
Date: 
Message-ID: <5ial94F3oatf6U1@mid.individual.net>
Tamas Papp wrote:
> Since I use defparameter quite a bit when testing functions
> interactively, I put the following in my .sbclrc:
> 
> (defmacro defp (&rest rest)
>   `(defparameter ,@rest))
> 
> to get a shorter alias for defparameter.  But this only defines the
> macro in cl-user.  Is there a way to have this macro set up
> automagically in all packages I load?  I am usign SLIME.

No, for the very simple reason that you don't want your own definitions 
in the packages of third-party libraries. They might have defined a 
macro with the same name, but with different functionality.

A good way to define your own language is to define a 'my-common-lisp 
package which exports almost all common-lisp symobls, but adds and maybe 
even replaces some with new symbols. It's then just a matter of saying 
(:use my-common-lisp) instead of (:use common-lisp) in defpackage forms.

[It's a good idea to always mention the (:use ...) form in defpackage 
anyway, even if you only use the default packages of your implementation.)


Pascal

-- 
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Tim Bradshaw
Subject: Re: defining a macro in all packages
Date: 
Message-ID: <1187029300.581095.112010@w3g2000hsg.googlegroups.com>
On Aug 13, 10:06 am, Pascal Costanza <····@p-cos.net> wrote:

> A good way to define your own language is to define a 'my-common-lisp
> package which exports almost all common-lisp symobls, but adds and maybe
> even replaces some with new symbols. It's then just a matter of saying
> (:use my-common-lisp) instead of (:use common-lisp) in defpackage forms.

conduits.

(defpackage :org.tfeb.souped-up-cl
  (:use)
  (:extends :common-lisp)
  (:extends :org.tfeb.souped-up-cl.impl))

(defpackage :org.tfeb.souped-up-cl.impl
  (:use :common-lisp)
  (:export #:defp))

You don't need the conduit package to e "pure" like that, of course.
From: Rainer Joswig
Subject: Re: defining a macro in all packages
Date: 
Message-ID: <joswig-4AB385.12010413082007@news-europe.giganews.com>
In article <··············@pu100877.student.princeton.edu>,
 Tamas Papp <······@gmail.com> wrote:

> Since I use defparameter quite a bit when testing functions
> interactively, I put the following in my .sbclrc:
> 
> (defmacro defp (&rest rest)
>   `(defparameter ,@rest))
> 
> to get a shorter alias for defparameter.  But this only defines the
> macro in cl-user.  Is there a way to have this macro set up
> automagically in all packages I load?  I am usign SLIME.
> 
> Thanks,
> 
> Tamas

You could use completion...

-- 
http://lispm.dyndns.org
From: Tobias C. Rittweiler
Subject: Re: defining a macro in all packages
Date: 
Message-ID: <87vebjd3r1.fsf@freebits.de>
Tamas Papp <······@gmail.com> writes:

> Since I use defparameter quite a bit when testing functions
> interactively, I put the following in my .sbclrc:
>
> (defmacro defp (&rest rest)
>   `(defparameter ,@rest))

Use the `!' REPL shortcut in Slime, i.e. type at the REPL `,!RET'.

  -T.
From: Pascal Bourguignon
Subject: Re: defining a macro in all packages
Date: 
Message-ID: <87y7gfehwk.fsf@informatimago.com>
Tamas Papp <······@gmail.com> writes:

> Since I use defparameter quite a bit when testing functions
> interactively, I put the following in my .sbclrc:
>
> (defmacro defp (&rest rest)
>   `(defparameter ,@rest))
>
> to get a shorter alias for defparameter.  But this only defines the
> macro in cl-user.  Is there a way to have this macro set up
> automagically in all packages I load?  I am usign SLIME.

In the same order as the Slime shortcut, you can just write and use
your own REPL, where you could define your own "repl-macros" for such
shortcuts.

See for example the (quit) or (exit) stuff in the various REPLs I
often posted here.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.