unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* pretty highlighting and indenting own elisp macros
@ 2002-10-16 15:23 Klaus Berndl
  2002-10-16 16:03 ` Stefan Monnier <foo@acm.com>
  2002-10-16 17:01 ` Kevin Rodgers
  0 siblings, 2 replies; 7+ messages in thread
From: Klaus Berndl @ 2002-10-16 15:23 UTC (permalink / raw)



If i add a call to `with-temp-file' in my elisp-program it will be highlighted
with font-lock-keyword-face and indented like follows:

(with-temp-file "my-filename"
  (foo ...)
  (bar ...))

Fine. But suppose i have written my own macro `with-XYZ':

(defmacro with-XYZ (arg &rest body)
 ....)

If i add this macro to my elisp-program then it is not highlighted as keyword
and it is poorly indented:

(with-XYZ "my-first-arg"
          (first-form-of-body ..)
          ...)

What must i do so my own macros are highlighted and indented as build-in macros
like `with-temp-file'? The former one seems to be not so hard but for the
second one i have no glue.

Many thanks in advance,
Klaus

-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG				http://www.sdm.de
software design & management	
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220

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

* Re: pretty highlighting and indenting own elisp macros
  2002-10-16 15:23 pretty highlighting and indenting own elisp macros Klaus Berndl
@ 2002-10-16 16:03 ` Stefan Monnier <foo@acm.com>
  2002-10-16 17:01 ` Kevin Rodgers
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-10-16 16:03 UTC (permalink / raw)


>>>>> "Klaus" == Klaus Berndl <Klaus.Berndl@sdm.de> writes:
> What must i do so my own macros are highlighted and indented as build-in
> macros like `with-temp-file'? The former one seems to be not so hard but
> for the second one i have no glue.

You specify it via a symbol property.
Check out (symbol-plist 'with-temp-file) and you should see
something about indentation in the output.  Same thing for
edebugging.


        Stefan

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

* Re: pretty highlighting and indenting own elisp macros
  2002-10-16 15:23 pretty highlighting and indenting own elisp macros Klaus Berndl
  2002-10-16 16:03 ` Stefan Monnier <foo@acm.com>
@ 2002-10-16 17:01 ` Kevin Rodgers
  2002-10-16 17:08   ` Klaus Berndl
  1 sibling, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2002-10-16 17:01 UTC (permalink / raw)


Klaus Berndl wrote:

> If i add a call to `with-temp-file' in my elisp-program it will be highlighted
> with font-lock-keyword-face and indented like follows:
> 
> (with-temp-file "my-filename"
>   (foo ...)
>   (bar ...))
> 
> Fine. But suppose i have written my own macro `with-XYZ':
> 
> (defmacro with-XYZ (arg &rest body)
>  ....)
> 
> If i add this macro to my elisp-program then it is not highlighted as keyword
> and it is poorly indented:
> 
> (with-XYZ "my-first-arg"
>           (first-form-of-body ..)
>           ...)
> 
> What must i do so my own macros are highlighted and indented as build-in macros
> like `with-temp-file'? The former one seems to be not so hard but for the
> second one i have no glue.

;;; Local Variables:
;;; eval: (put 'with-XYZ 'lisp-indent-hook 1)
;;; End:

-- 
<a href="mailto:&lt;kevinr&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* Re: pretty highlighting and indenting own elisp macros
  2002-10-16 17:01 ` Kevin Rodgers
@ 2002-10-16 17:08   ` Klaus Berndl
  2002-10-16 17:54     ` Hannu Koivisto
  2002-10-16 18:09     ` Stefan Monnier <foo@acm.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Klaus Berndl @ 2002-10-16 17:08 UTC (permalink / raw)


On Wed, 16 Oct 2002, Kevin Rodgers wrote:



>  Klaus Berndl wrote:
>  
> > If i add a call to `with-temp-file' in my elisp-program it will be
> > highlighted with font-lock-keyword-face and indented like follows:
> > (with-temp-file "my-filename"
> >   (foo ...)
> >   (bar ...))
> > Fine. But suppose i have written my own macro `with-XYZ':
> > (defmacro with-XYZ (arg &rest body)
> >  ....)
> > If i add this macro to my elisp-program then it is not highlighted
> > as keyword
> > and it is poorly indented:
> > (with-XYZ "my-first-arg"
> >           (first-form-of-body ..)
> >           ...)
> > What must i do so my own macros are highlighted and indented as
> > build-in macros
> > like `with-temp-file'? The former one seems to be not so hard but for the
> > second one i have no glue.
>  
>  ;;; Local Variables:
>  ;;; eval: (put 'with-XYZ 'lisp-indent-hook 1)
>  ;;; End:

Ahh, nice...but where can i find such tricks in the documentation?
I have search all the elisp-info files and haven't found *lisp-indent-hook*.

Thanks a lot!
Klaus

-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG				http://www.sdm.de
software design & management	
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220

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

* Re: pretty highlighting and indenting own elisp macros
  2002-10-16 17:08   ` Klaus Berndl
@ 2002-10-16 17:54     ` Hannu Koivisto
  2002-10-16 18:09     ` Stefan Monnier <foo@acm.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Hannu Koivisto @ 2002-10-16 17:54 UTC (permalink / raw)


Klaus Berndl <Klaus.Berndl@sdm.de> writes:

> On Wed, 16 Oct 2002, Kevin Rodgers wrote:
...
>>  ;;; Local Variables:
>>  ;;; eval: (put 'with-XYZ 'lisp-indent-hook 1)

It should be lisp-indent-function, not -hook.

>>  ;;; End:
>
> Ahh, nice...but where can i find such tricks in the documentation?

See the node Lisp Indent in the Emacs manual.

-- 
Hannu

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

* Re: pretty highlighting and indenting own elisp macros
  2002-10-16 17:08   ` Klaus Berndl
  2002-10-16 17:54     ` Hannu Koivisto
@ 2002-10-16 18:09     ` Stefan Monnier <foo@acm.com>
  2002-10-17  7:29       ` Klaus Berndl
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-10-16 18:09 UTC (permalink / raw)


>> ;;; Local Variables:
>> ;;; eval: (put 'with-XYZ 'lisp-indent-hook 1)
>> ;;; End:
> Ahh, nice...but where can i find such tricks in the documentation?
> I have search all the elisp-info files and haven't found *lisp-indent-hook*.

Maybe a typo?

work/emacs-0% grep lisp-indent-function man/*.texi
man/programs.texi:@cindex @code{lisp-indent-function} property
man/programs.texi:functions, according to the @code{lisp-indent-function} property of the
work/emacs-0% 

I think it also appears in the elisp manual:

work/emacs-0% grep lisp-indent-function lispref/*.texi
lispref/hooks.texi:@item lisp-indent-function
lispref/symbols.texi:(lisp-indent-function 0 byte-compile byte-compile-progn)
lispref/symbols.texi:Here @code{lisp-indent-function} and @code{byte-compile} are property
work/emacs-0% 


        Stefan

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

* Re: pretty highlighting and indenting own elisp macros
  2002-10-16 18:09     ` Stefan Monnier <foo@acm.com>
@ 2002-10-17  7:29       ` Klaus Berndl
  0 siblings, 0 replies; 7+ messages in thread
From: Klaus Berndl @ 2002-10-17  7:29 UTC (permalink / raw)


On 16 Oct 2002, Stefan Monnier wrote:



> >> ;;; Local Variables:
> >> ;;; eval: (put 'with-XYZ 'lisp-indent-hook 1)
> >> ;;; End:
> > Ahh, nice...but where can i find such tricks in the documentation? I have
> > search all the elisp-info files and haven't found *lisp-indent-hook*.
>  
>  Maybe a typo?
>  
>  work/emacs-0% grep lisp-indent-function man/*.texi
>  man/programs.texi:@cindex @code{lisp-indent-function} property
>  man/programs.texi:functions, according to the @code{lisp-indent-function}
>  property of the work/emacs-0%
>  
>  I think it also appears in the elisp manual:

Yes, if i search for the right expression ;-) Thanks to all,
lisp-indent-function does the trick.

Klaus

-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG				http://www.sdm.de
software design & management	
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220

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

end of thread, other threads:[~2002-10-17  7:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-16 15:23 pretty highlighting and indenting own elisp macros Klaus Berndl
2002-10-16 16:03 ` Stefan Monnier <foo@acm.com>
2002-10-16 17:01 ` Kevin Rodgers
2002-10-16 17:08   ` Klaus Berndl
2002-10-16 17:54     ` Hannu Koivisto
2002-10-16 18:09     ` Stefan Monnier <foo@acm.com>
2002-10-17  7:29       ` Klaus Berndl

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).