From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: "Paul W. Rankin" Newsgroups: gmane.emacs.help Subject: Use of where-is-internal Date: Sat, 25 Jan 2020 16:18:04 +1000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="396"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.2.0; emacs 27.0.60 To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 25 07:18:47 2020 Return-path: Envelope-to: geh-help-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 1ivEmM-000Y4z-Nx for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 25 Jan 2020 07:18:46 +0100 Original-Received: from localhost ([::1]:51146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ivEmL-0001B4-Pk for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 25 Jan 2020 01:18:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53174) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ivEm2-0001Ai-83 for help-gnu-emacs@gnu.org; Sat, 25 Jan 2020 01:18:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ivElz-0001iP-Hp for help-gnu-emacs@gnu.org; Sat, 25 Jan 2020 01:18:26 -0500 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:34725) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ivEly-0001fr-Ec for help-gnu-emacs@gnu.org; Sat, 25 Jan 2020 01:18:23 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 4718D21E1C for ; Sat, 25 Jan 2020 01:18:21 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 25 Jan 2020 01:18:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paulwrankin.com; h=from:to:subject:date:message-id:mime-version:content-type; s= fm1; bh=IuGWNrAe0yukg8FNlXFI0RI8PmnmIz4/RjiqZsuQjpA=; b=I6uohcwm bRa9wNsfGjv9r4S92B0r8THZzD8t6XoFP5Hbtufgw+OWRJK4AR/VM1016QsAtrvZ s/LlDhDerQy/fGyOJYK+/U23TDRH35UGD2/InTriqwYG7DVrmZugjnCO6U0ygR9p inRprpjjdwrpIRS5MKyfONeVa6unSw7919EpNoJLxg0k2+0qy7SecEiPlohbm+71 ZfzJib/lck5nm49hscRTfk5rQYSkw+rXIL0kwXk4cbBbc2PZ+65h1T/vCmXdSrXv 6iA0zktSv4Q//wigkrqT9iqgxjXLidflddh4bhJmS+pW8YXkz705EEG5uiKymBJr ZP2NkHTz50CwRQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=IuGWNrAe0yukg8FNlXFI0RI8PmnmI z4/RjiqZsuQjpA=; b=B8TkuK4MEqQSBocz7kMdLdlfs5y3AhaqIaitU3q1TnoA2 KxHGpnWOSh7EIN4eu0hbw2N/iFAjGc6wgZZgdzq1NN0LJca3nhADN7M1qP6Aini7 UVrq1ZdmP3c2utpyVn/lGGiU1YmSC9RzFNm5sFINjIf2xe2jaGjIm9GKlRkHdoOU 47G2JCs6fI2Hftdp14JXSkXtR4Lvy/BgnlMNlv84Th7IZm9l3wkwQhtnorSGX9T9 GbzdFnAXh/bxLsqbv61gUEJHWl08oSBaVZCh1VpwELz3Wk/V3XU62ITOa4GqklQo 07f21ZJaaKhgeIkIWzOlr6L8m9InqYUr2VNgHeplA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrvdeigdelvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfgfhvffufffkgggtsehttdertddtre dtnecuhfhrohhmpedfrfgruhhlucghrdcutfgrnhhkihhnfdcuoehhvghllhhosehprghu lhifrhgrnhhkihhnrdgtohhmqeenucffohhmrghinhepphgruhhlfihrrghnkhhinhdrtg homhenucfkphepudeggedrudeftddrudehiedruddvleenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehhvghllhhosehprghulhifrhgrnhhkih hnrdgtohhm X-ME-Proxy: Original-Received: from localhost (unknown [144.130.156.129]) by mail.messagingengine.com (Postfix) with ESMTPA id 70E723280059 for ; Sat, 25 Jan 2020 01:18:18 -0500 (EST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.25 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122294 Archived-At: Hello Emacs major modes, I'm considering of using where-is-internal in a program ~~outside of the help library~~. I've used the following in my init for a while to cycle windows and so far the world has persisted unscathed: (defun other-window-and-beyond (count &optional all-frames) "Select another window in cyclic ordering of windows. Successive pressing `o' calls `other-window'." (interactive "p") (let ((key-vector (where-is-internal this-command overriding-local-map t))) (set-transient-map (let ((map (make-sparse-keymap))) (define-key map (vector (aref key-vector (1- (length key-vector)))) 'other-window) map) t) (other-window count all-frames))) As the docstring implies, this function allows me to type C-x o o o o to keep on truckin through all frame windows (and only trips me up with I want to then immediately type "o"), with the idea being to allow the command to work with any key binding rather than hardcoding anything. I maintain a minor mode called olivetti that also uses a transient key map to allow changing a buffer-local variable with C-c { { { ... The key binding is currently hardcoded within the transient key map but I'd like to allow user customisation. So, should I throw caution to the wind and reimplement the transient key map in olivetti using where-is-internal, or is there a better way? Thanks, -- Paul W. Rankin https://www.paulwrankin.com