[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (other-window) with negative argument

From: Stephen Berman
Subject: Re: (other-window) with negative argument
Date: Fri, 21 Dec 2018 18:39:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Fri, 21 Dec 2018 17:55:23 +0100 (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]