From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: dieter@duenenhof-wilhelm.de (H. Dieter Wilhelm) Newsgroups: gmane.emacs.help Subject: Re: (other-window) with negative argument Date: Fri, 21 Dec 2018 18:50:38 +0100 Organization: The Church of Emacs Message-ID: <878t0iahw1.fsf@duenenhof-wilhelm.de> References: <87d0puakg4.fsf@duenenhof-wilhelm.de> <87d0pulqy7.fsf@rub.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1545414565 13898 195.159.176.226 (21 Dec 2018 17:49:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 21 Dec 2018 17:49:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 21 18:49:21 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gaOvG-0003TB-8G for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Dec 2018 18:49:18 +0100 Original-Received: from localhost ([::1]:47094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaOxN-0001yq-4e for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Dec 2018 12:51:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gaOwq-0001yU-4Q for help-gnu-emacs@gnu.org; Fri, 21 Dec 2018 12:50:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gaOwm-0004gL-Tx for help-gnu-emacs@gnu.org; Fri, 21 Dec 2018 12:50:56 -0500 Original-Received: from [195.159.176.226] (port=48732 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gaOwm-0004fw-Mo for help-gnu-emacs@gnu.org; Fri, 21 Dec 2018 12:50:52 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1gaOud-0002cA-6V for help-gnu-emacs@gnu.org; Fri, 21 Dec 2018 18:48:39 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 47 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:lFSkhTvJz7PLamfq3dTEHJx6x3E= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:119018 Archived-At: Stephen Berman 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