From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pillule Newsgroups: gmane.emacs.bugs Subject: bug#48917: 28.0.50; allow user to choose what function is used when windmove create a window Date: Tue, 08 Jun 2021 16:12:56 +0200 Message-ID: <87tum8xx0z.fsf@riseup.net> References: <875yyozkpj.fsf@riseup.net> <83a6o0fue0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21123"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pillule , 48917@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 08 16:16:32 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqcWt-0005FF-QZ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Jun 2021 16:16:32 +0200 Original-Received: from localhost ([::1]:40374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqcWs-0002l2-1r for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Jun 2021 10:16:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqcWS-0002j9-Ee for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 10:16:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lqcWQ-00065n-Ct for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 10:16:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lqcWQ-0000JD-8s for bug-gnu-emacs@gnu.org; Tue, 08 Jun 2021 10:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: pillule Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Jun 2021 14:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48917 X-GNU-PR-Package: emacs Original-Received: via spool by 48917-submit@debbugs.gnu.org id=B48917.16231617551173 (code B ref 48917); Tue, 08 Jun 2021 14:16:02 +0000 Original-Received: (at 48917) by debbugs.gnu.org; 8 Jun 2021 14:15:55 +0000 Original-Received: from localhost ([127.0.0.1]:59414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqcWI-0000Ir-KY for submit@debbugs.gnu.org; Tue, 08 Jun 2021 10:15:54 -0400 Original-Received: from mx1.riseup.net ([198.252.153.129]:51664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lqcWG-0000Ic-R6 for 48917@debbugs.gnu.org; Tue, 08 Jun 2021 10:15:53 -0400 Original-Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4Fzshz3Y2FzDv6W; Tue, 8 Jun 2021 07:15:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1623161747; bh=dPSbv4rqgBJup7+y3WCxNFIl+8hq+69TUt00TNaHYps=; h=References:From:To:Cc:Subject:Date:In-reply-to:From; b=PczJjNayoSNvd0qT3Y76qS228v3PXBJVxeFCz3gOMWzH2ugZE0ySxIG1o9wX/Q+79 ntRVm65SLa6dhoB6VKGtwZqfTblS6MsyUo7CZ5lNjOwMpHuVAARaizsvj+VEBX92ms BP8nBxbuAZHM7baQSdq3s3WQ3qKX4HSihQSmWQwI= X-Riseup-User-ID: 9928475AF052E345BC3DB32161351BD02E932C83B71CFFDBB837D291F36C3699 Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4Fzshy108dz5vSN; Tue, 8 Jun 2021 07:15:45 -0700 (PDT) In-reply-to: <83a6o0fue0.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208244 Archived-At: --=-=-= Content-Type: text/plain; format=flowed Eli Zaretskii writes: >> From: pillule >> Date: Tue, 08 Jun 2021 12:31:58 +0200 >> >> (defcustom windmove-create-window nil >> - "Whether movement off the edge of the frame creates a new >> window. >> + "Whether movement off the edge of the frame creates a new >> window or >> +trigger a custom function. > > The first line of a doc string should be a single complete > sentence. > (The reason for this is that some Emacs commands, like "M-x > apropos", > show only the first line of the doc string.) > >> If this variable is set to t, moving left from the leftmost >> window in >> a frame will create a new window on the left, and similarly >> for the other >> directions." >> - :type 'boolean >> + :type '(choice (const :tag "Don't create new windows" nil) >> + (const :tag "Create new windows" t) >> + (function :tag "Provide a function")) >> :group 'windmove >> :version "27.1") > > The :version tag should be updated, because the defcustom was > changed. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-User-option-to-choose-a-function-triggered-by-windmo.patch Content-Description: allow user to choose what function is used when windmove create a window >From 6438107565875ff69f533c244a9601192218e7c9 Mon Sep 17 00:00:00 2001 From: Trust me I am a doctor Date: Tue, 8 Jun 2021 11:44:54 +0200 Subject: [PATCH] User option to choose a function triggered by windmove-create * lisp/windmove.el (windmove-create-window): Add a defcustom choice. (windmove-do-window-select): Trigger custom functions. --- lisp/windmove.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/windmove.el b/lisp/windmove.el index f558903681..d410e387d4 100644 --- a/lisp/windmove.el +++ b/lisp/windmove.el @@ -142,13 +142,16 @@ windmove-wrap-around :group 'windmove) (defcustom windmove-create-window nil - "Whether movement off the edge of the frame creates a new window. + "Whether movement off the edge of the frame create a window. If this variable is set to t, moving left from the leftmost window in a frame will create a new window on the left, and similarly for the other -directions." - :type 'boolean - :group 'windmove - :version "27.1") +directions. +The variable may also be a function to be called in this circumstance, +the function should accept as agument a DIRECTION, and the selected WINDOW." + :type '(choice (const :tag "Don't create new windows" nil) + (const :tag "Create new windows" t) + (function :tag "Provide a function")) + :version "28.0.50") ;; If your Emacs sometimes places an empty column between two adjacent ;; windows, you may wish to set this delta to 2. @@ -357,7 +360,9 @@ windmove-do-window-select (or (null other-window) (and (window-minibuffer-p other-window) (not (minibuffer-window-active-p other-window))))) - (setq other-window (split-window window nil dir))) + (setq other-window (if (functionp windmove-create-window) + (funcall windmove-create-window dir window) + (split-window window nil dir)))) (cond ((null other-window) (user-error "No window %s from selected window" dir)) ((and (window-minibuffer-p other-window) -- 2.20.1 --=-=-= Content-Type: text/plain; format=flowed -- --=-=-=--