[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (other-window) with negative argument
From: |
H. Dieter Wilhelm |
Subject: |
Re: (other-window) with negative argument |
Date: |
Fri, 21 Dec 2018 18:50:38 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Stephen Berman <stephen.berman@gmx.net> writes:
Hi Stephen
thank you very much for your prompt explanation. :-)
Dieter
> On Fri, 21 Dec 2018 17:55:23 +0100 dieter@duenenhof-wilhelm.de (H. Dieter
> Wilhelm) wrote:
>
>> Hello ()
>>
>> I can't get a function to work with a negative argument of
>> (other-window). When I'm using (other-window -1) in the *scratch*
>> buffer it is working as expected, as soon as I put it into a function
>> like the following
>>
>> (defun previous-window ()
>> (other-window -1))
>>
>> or
>>
>> (defun previous-window ()
>> "blabla"
>> (interactive)
>> (other-window -1))
>>
>> and activate the function any call to (other-window -1) is opening the
>> debugger!
>>
>> What am I doing wrong?
>
> Redefining a function, previous-window, which is a primitive Emacs
> function defined in C. When other-window has a negative argument, it
> calls the built-in previous-window with three arguments, which are
> optional in the built-in version, and since your redefinition takes no
> arguments, this raises the error. If you name your function
> e.g. my-previous-window, it will work as you expect.
>
> Steve Berman
>
>
--
Best wishes
H. Dieter Wilhelm
Seeheim-Jugenheim, Germany