From: Tamas K Papp
Subject: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <6iivf5FqtmiaU1@mid.individual.net>
Suppose I type

(foo :a a :b b
:c c :d :e e
:f f :g g)

into a Lisp buffer (keyword names are deliberately short, but imagine 
they would not fit on a line).  C-M-q gives

(foo :a a :b b
	  :c c :d d :e e
	  :f f :g g)

Pressing Tab gives

(foo :a a :b b
	  :c c :d d :e e
		    :f f :g g)

What I would prefer is something like

(foo :a a :b b
     :c c :d d :e e
     :f f :g g)

Is there any way to do this in emacs (version 23.0.0.1)?

Thanks,

Tamas

From: Paul Donnelly
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <87od2z1p8m.fsf@plap.localdomain>
Tamas K Papp <······@gmail.com> writes:

> Suppose I type
>
> (foo :a a :b b
> :c c :d :e e
> :f f :g g)
>
> into a Lisp buffer (keyword names are deliberately short, but imagine 
> they would not fit on a line).  C-M-q gives
>
> (foo :a a :b b
> 	  :c c :d d :e e
> 	  :f f :g g)
>
> Pressing Tab gives
>
> (foo :a a :b b
> 	  :c c :d d :e e
> 		    :f f :g g)
>
> What I would prefer is something like
>
> (foo :a a :b b
>      :c c :d d :e e
>      :f f :g g)
>
> Is there any way to do this in emacs (version 23.0.0.1)?
>
> Thanks,
>
> Tamas

Could those keys be bound to the wrong commands?
From: Tamas K Papp
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <6ijajpFqtmiaU2@mid.individual.net>
On Sun, 07 Sep 2008 18:59:53 -0500, Paul Donnelly wrote:

> Tamas K Papp <······@gmail.com> writes:
> 
>> Suppose I type
>>
>> (foo :a a :b b
>> :c c :d :e e
>> :f f :g g)
>>
>> into a Lisp buffer (keyword names are deliberately short, but imagine
>> they would not fit on a line).  C-M-q gives
>>
>> (foo :a a :b b
>> 	  :c c :d d :e e
>> 	  :f f :g g)
>>
>> Pressing Tab gives
>>
>> (foo :a a :b b
>> 	  :c c :d d :e e
>> 		    :f f :g g)
>>
>> What I would prefer is something like
>>
>> (foo :a a :b b
>>      :c c :d d :e e
>>      :f f :g g)
>>
>> Is there any way to do this in emacs (version 23.0.0.1)?
>>
>> Thanks,
>>
>> Tamas
> 
> Could those keys be bound to the wrong commands?

Don't know.  This is what C-h k tells me:

C-M-q runs the command indent-sexp
  which is an interactive compiled Lisp function in `lisp-mode.el'.

TAB (translated from <tab>) runs the command lisp-indent-line
  which is an interactive compiled Lisp function in `lisp-mode.el'.

Are these the right commands?

Thanks,

Tamas
From: Stephen Compall
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <m2od2zwiga.fsf@nocandy.dyndns.org>
Tamas K Papp <······@gmail.com> writes:
> C-M-q runs the command indent-sexp
>   which is an interactive compiled Lisp function in `lisp-mode.el'.
>
> TAB (translated from <tab>) runs the command lisp-indent-line
>   which is an interactive compiled Lisp function in `lisp-mode.el'.
>
> Are these the right commands?

However, the core of these is whatever function is set as the value of
the variable `lisp-indent-function'.  For me, this is the symbol
`common-lisp-indent-function' in lisp-mode buffers, and
`lisp-indent-function' in others.

-- 
But you know how reluctant paranormal phenomena are to reveal
themselves when skeptics are present. --Robert Sheaffer, SkI 9/2003
From: Tamas K Papp
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <6ijff4FqtmiaU3@mid.individual.net>
On Sun, 07 Sep 2008 20:10:45 -0500, Stephen Compall wrote:

> Tamas K Papp <······@gmail.com> writes:
>> C-M-q runs the command indent-sexp
>>   which is an interactive compiled Lisp function in `lisp-mode.el'.
>>
>> TAB (translated from <tab>) runs the command lisp-indent-line
>>   which is an interactive compiled Lisp function in `lisp-mode.el'.
>>
>> Are these the right commands?
> 
> However, the core of these is whatever function is set as the value of
> the variable `lisp-indent-function'.  For me, this is the symbol
> `common-lisp-indent-function' in lisp-mode buffers, and
> `lisp-indent-function' in others.

lisp-indent-function is a variable defined in `lisp-mode.el'.
Its value is 
common-lisp-indent-function
Local in buffer foo.lisp; global value is 
lisp-indent-function

I am baffled.  What else could affect its behaviour?

Thanks,

Tamas
From: Didier Verna
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <muxvdx7vzr8.fsf@uzeb.lrde.epita.fr>
Tamas K Papp <······@gmail.com> wrote:

> lisp-indent-function is a variable defined in `lisp-mode.el'.
> Its value is 
> common-lisp-indent-function
> Local in buffer foo.lisp; global value is 
> lisp-indent-function
>
> I am baffled.  What else could affect its behaviour?

  Not sure this applies to GNU Emacs, but in XEmacs, the indentation
process also takes into account the value of the
'[common-]lisp-indent-function property on the symbol. This allows you
to customize the indentation for particular constructs.

-- 
Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com

EPITA/LRDE, 14-16 rue Voltaire, 94276 Le Kremlin-Bic�tre, France
Tel. +33 (0)1 44 08 01 85       Fax. +33 (0)1 53 14 59 22
From: Tamas K Papp
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <6ikfddFr4hnfU1@mid.individual.net>
On Mon, 08 Sep 2008 09:54:35 +0200, Didier Verna wrote:

> Tamas K Papp <······@gmail.com> wrote:
> 
>> lisp-indent-function is a variable defined in `lisp-mode.el'. Its value
>> is
>> common-lisp-indent-function
>> Local in buffer foo.lisp; global value is lisp-indent-function
>>
>> I am baffled.  What else could affect its behaviour?
> 
>   Not sure this applies to GNU Emacs, but in XEmacs, the indentation
> process also takes into account the value of the
> '[common-]lisp-indent-function property on the symbol. This allows you
> to customize the indentation for particular constructs.

(symbol-plist 'common-lisp-indent-function) gives

(autoload ("cl-indent" 1040521 nil nil))

(symbol-plist 'lisp-indent-function) returns nil.

What do they give on your system?

Thanks,

Tamas



nil
From: ·············@gmail.com
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <7906d7b8-daee-44c0-80f7-c470a37211f0@y38g2000hsy.googlegroups.com>
On Sep 8, 7:08 am, Tamas K Papp <······@gmail.com> wrote:
> On Mon, 08 Sep 2008 09:54:35 +0200, Didier Verna wrote:
> > Tamas K Papp <······@gmail.com> wrote:
>
> >> lisp-indent-function is a variable defined in `lisp-mode.el'. Its value
> >> is
> >> common-lisp-indent-function
> >> Local in buffer foo.lisp; global value is lisp-indent-function
>
> >> I am baffled.  What else could affect its behaviour?
>
> >   Not sure this applies to GNU Emacs, but in XEmacs, the indentation
> > process also takes into account the value of the
> > '[common-]lisp-indent-function property on the symbol. This allows you
> > to customize the indentation for particular constructs.
>
> (symbol-plist 'common-lisp-indent-function) gives
>
> (autoload ("cl-indent" 1040521 nil nil))
>
> (symbol-plist 'lisp-indent-function) returns nil.
>
> What do they give on your system?
>
> Thanks,
>
> Tamas
>
> nil

As another data point, I am in the same boat as Tamas on both clisp on
cygwin+windows and sbcl on rh running emacs 22.1.1 and identical
recent version of slime.  Same keybindings, same common-lisp-indent-
function setting, as him.

Mirko
From: Didier Verna
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <muxy722u9fj.fsf@uzeb.lrde.epita.fr>
Tamas K Papp <······@gmail.com> wrote:

> On Mon, 08 Sep 2008 09:54:35 +0200, Didier Verna wrote:
>
>> Tamas K Papp <······@gmail.com> wrote:
>> 
>>> lisp-indent-function is a variable defined in `lisp-mode.el'. Its value
>>> is
>>> common-lisp-indent-function
>>> Local in buffer foo.lisp; global value is lisp-indent-function
>>>
>>> I am baffled.  What else could affect its behaviour?
>> 
>>   Not sure this applies to GNU Emacs, but in XEmacs, the indentation
>> process also takes into account the value of the
>> '[common-]lisp-indent-function property on the symbol. This allows you
>> to customize the indentation for particular constructs.
>
> (symbol-plist 'common-lisp-indent-function) gives
>
> (autoload ("cl-indent" 1040521 nil nil))
>
> (symbol-plist 'lisp-indent-function) returns nil.
>
> What do they give on your system?

  Sorry; I didn't make myself clear. Let's take an example. Here's the
default indentation given by a vanilla XEmacs:

(concatenate 'string
	     "foo" "bar")

that's the default indentation for function calls, in which the
arguments are aligned. But I want to treat the first argument to
CONCATENATE as a special one, so I say:

(put 'concatenate 'common-lisp-indent-function 1) [1]

and then, hitting TAB will give me the following indentation:

(concatenate 'string
  "foo" "bar")


So, I don't know how "shortened to minimal" your example was, but if
you're not satisfied with a particular indentation of some form, you
should also have a look at this property because it might get in the way
(it's honored in priority to everything else).




Footnotes: 
[1]  this might be just (put 'concatenate 'lisp-indent-function 1)
depending on the actual indent-function in use in your configuration

-- 
Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com

EPITA/LRDE, 14-16 rue Voltaire, 94276 Le Kremlin-Bic�tre, France
Tel. +33 (0)1 44 08 01 85       Fax. +33 (0)1 53 14 59 22
From: Madhu
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <m3tzcq7kad.fsf@moon.robolove.meer.net>
* Tamas K Papp in  <6ikfddFr4hnfU1 @ mid.individual.net> :
Wrote on 8 Sep 2008 11:08:29 GMT:

| On Mon, 08 Sep 2008 09:54:35 +0200, Didier Verna wrote:
|> Tamas K Papp <tkpapp @gmail.com> wrote:
|
|>> lisp-indent-function is a variable defined in `lisp-mode.el'. Its value
|>> is
|>> common-lisp-indent-function
|>> Local in buffer foo.lisp; global value is lisp-indent-function
|>>
|>> I am baffled.  What else could affect its behaviour?
|> 
|>   Not sure this applies to GNU Emacs, but in XEmacs, the indentation
|> process also takes into account the value of the
|> '[common-]lisp-indent-function property on the symbol. This allows you
|> to customize the indentation for particular constructs.
|
| (symbol-plist 'common-lisp-indent-function) gives
|
| (autoload ("cl-indent" 1040521 nil nil))
|
| (symbol-plist 'lisp-indent-function) returns nil.

You should be checking for a property named
`common-lisp-indent-function' in (symbol-plist 'foo) on your system.


| What do they give on your system?

[They give the same values. Emacs 23.0.60 from a few months ago. The
 emacs version number you quoted is suspect --- there was a time before
 23.0.X was regularized]

--
Madhu
From: Paul Donnelly
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <874p4rpbwa.fsf@plap.localdomain>
Tamas K Papp <······@gmail.com> writes:

> On Sun, 07 Sep 2008 18:59:53 -0500, Paul Donnelly wrote:
>
>> Tamas K Papp <······@gmail.com> writes:
>> 
>>> Suppose I type
>>>
>>> (foo :a a :b b
>>> :c c :d :e e
>>> :f f :g g)
>>>
>>> into a Lisp buffer (keyword names are deliberately short, but imagine
>>> they would not fit on a line).  C-M-q gives
>>>
>>> (foo :a a :b b
>>> 	  :c c :d d :e e
>>> 	  :f f :g g)
>>>
>>> Pressing Tab gives
>>>
>>> (foo :a a :b b
>>> 	  :c c :d d :e e
>>> 		    :f f :g g)
>>>
>>> What I would prefer is something like
>>>
>>> (foo :a a :b b
>>>      :c c :d d :e e
>>>      :f f :g g)
>>>
>>> Is there any way to do this in emacs (version 23.0.0.1)?
>>>
>>> Thanks,
>>>
>>> Tamas
>> 
>> Could those keys be bound to the wrong commands?
>
> Don't know.  This is what C-h k tells me:
>
> C-M-q runs the command indent-sexp
>   which is an interactive compiled Lisp function in `lisp-mode.el'.
>
> TAB (translated from <tab>) runs the command lisp-indent-line
>   which is an interactive compiled Lisp function in `lisp-mode.el'.
>
> Are these the right commands?
>
> Thanks,
>
> Tamas

Those do look correct.
From: Joost Kremers
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <slrngc8iao.30r.joostkremers@j.kremers4.news.arnhem.chello.nl>
Tamas K Papp wrote:
> What I would prefer is something like
>
> (foo :a a :b b
>      :c c :d d :e e
>      :f f :g g)
>
> Is there any way to do this in emacs (version 23.0.0.1)?

it's exactly what i get (emacs 23.0.60.1) in lisp mode, both with tab and
with C-M-q. even with emacs -Q...


-- 
Joost Kremers                                      ············@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
From: David Hansen
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <87r67uvy88.fsf@localhorst.mine.nu>
On 7 Sep 2008 21:30:13 GMT Tamas K. Papp wrote:

> Is there any way to do this in emacs (version 23.0.0.1)?

What version is this?  Did it even ever existed?  The current CVS HEAD
is GNU Emacs 23.0.60 and is exactly doing what you want.

Update, run emacs -Q and try again.  If this doesn't help:
M-x report-emacs-bug.

If the problem does not exist with "emacs -Q" but if you start it with
no arguments, something in your site-lisp or .emacs breaks it (grep for
`lisp-indent-function').

David
From: Tamas K Papp
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <6indg7FratlpU2@mid.individual.net>
On Tue, 09 Sep 2008 04:39:51 +0200, David Hansen wrote:

> On 7 Sep 2008 21:30:13 GMT Tamas K. Papp wrote:
> 
>> Is there any way to do this in emacs (version 23.0.0.1)?
> 
> What version is this?  Did it even ever existed?  The current CVS HEAD
> is GNU Emacs 23.0.60 and is exactly doing what you want.
> 
> Update, run emacs -Q and try again.  If this doesn't help: M-x
> report-emacs-bug.
> 
> If the problem does not exist with "emacs -Q" but if you start it with
> no arguments, something in your site-lisp or .emacs breaks it (grep for
> `lisp-indent-function').

Hi David,

Apparently my version was the last emacs-snapshot from Debian, which no 
longer has this package.  But I found that http://emacs.orebokech.com/ 
has packaged them for debian, so I installed the latest 23.0.60.1 version 
and everything works fine.  Thanks.

BTW, what is the syntax of indentation specifiers I can put in common-
lisp-indent-function?  When I google for examples, sometimes I see a 
number put there, sometimes an S-expression.  Is it documented anywhere?

Thanks,

Tamas
From: David Hansen
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <871vztwb3k.fsf@localhorst.mine.nu>
On 9 Sep 2008 13:54:15 GMT Tamas K. Papp wrote:

> Apparently my version was the last emacs-snapshot from Debian, which no 
> longer has this package.  But I found that http://emacs.orebokech.com/ 
> has packaged them for debian, so I installed the latest 23.0.60.1 version 
> and everything works fine.  Thanks.

I suspect you were running an very old *experimental* branch.  I hope
I'm wrong, it would be pretty irresponsible from Debian to package such
a beast.

If you want to run a development version, please build it yourself,
update regularly and M-x report-emacs-bug a lot.

David
From: Madhu
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <m3ej3tqrrd.fsf@moon.robolove.meer.net>
* Tamas K Papp <··············@mid.individual.net> :
Wrote on 9 Sep 2008 13:54:15 GMT:

| BTW, what is the syntax of indentation specifiers I can put in common-
| lisp-indent-function?  When I google for examples, sometimes I see a 
| number put there, sometimes an S-expression.  Is it documented anywhere?

Just to remind you, you had started a thread on this topic exactly a
year ago, regarding the BIND macro, to which I had last responded in
···················································@robolove.meer.net

--
Madhu
From: Tamas K Papp
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <6iniocFrfrqmU1@mid.individual.net>
On Tue, 09 Sep 2008 20:40:46 +0530, Madhu wrote:

> * Tamas K Papp <··············@mid.individual.net> : Wrote on 9 Sep 2008
> 13:54:15 GMT:
> 
> | BTW, what is the syntax of indentation specifiers I can put in common-
> | lisp-indent-function?  When I google for examples, sometimes I see a |
> number put there, sometimes an S-expression.  Is it documented anywhere?
> 
> Just to remind you, you had started a thread on this topic exactly a
> year ago, regarding the BIND macro, to which I had last responded in
> ···················································@robolove.meer.net

Yes, I reread that thread recently.  But I still don't know what 
'((&whole 4 1 &body)) means in

(put 'bind 'common-lisp-indent-function '((&whole 4 1 &body)))

Is this documented somewhere?

Thanks,

Tamas
From: David Hansen
Subject: Re: Emacs lisp-mode indentation for keyword arguments
Date: 
Message-ID: <8763p5wbgr.fsf@localhorst.mine.nu>
On 9 Sep 2008 15:23:56 GMT Tamas K. Papp wrote:

> On Tue, 09 Sep 2008 20:40:46 +0530, Madhu wrote:
>
>> Just to remind you, you had started a thread on this topic exactly a
>> year ago, regarding the BIND macro, to which I had last responded in
>> ···················································@robolove.meer.net
>
> Yes, I reread that thread recently.  But I still don't know what 
> '((&whole 4 1 &body)) means in
>
> (put 'bind 'common-lisp-indent-function '((&whole 4 1 &body)))
>
> Is this documented somewhere?

I doubt it.  M-f find-function RET common-lisp-indent-function will
bring you to the right source file and Emacs code is usually pretty well
commented.  At least you will find a lot of examples.

David