From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: Bind two commands to one key to toggle between them for the same local keymap. Date: Tue, 26 Oct 2021 09:49:40 +0800 Message-ID: References: <87y26lporl.fsf@zoho.eu> <87pmrxpky4.fsf@zoho.eu> <87lf2lpig4.fsf@zoho.eu> <87h7d9pg14.fsf@zoho.eu> <871r4dpesl.fsf@zoho.eu> <87sfwtnwwj.fsf@zoho.eu> <87a6izzkln.fsf@zoho.eu> <87mtmyre09.fsf@web.de> <87ee89at29.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3256"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 26 03:50:44 2021 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 1mfBbv-0000iB-UI for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 26 Oct 2021 03:50:43 +0200 Original-Received: from localhost ([::1]:56232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfBbu-0001i8-5s for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 25 Oct 2021 21:50:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfBb9-0001hm-1g for help-gnu-emacs@gnu.org; Mon, 25 Oct 2021 21:49:55 -0400 Original-Received: from mail-ua1-x932.google.com ([2607:f8b0:4864:20::932]:45625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfBb6-0008CP-Em for help-gnu-emacs@gnu.org; Mon, 25 Oct 2021 21:49:54 -0400 Original-Received: by mail-ua1-x932.google.com with SMTP id f24so6912827uav.12 for ; Mon, 25 Oct 2021 18:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=xUrLf5s0cjv7OkKMpXbmVqOuc/CZ1RLi4+Esc+jR55k=; b=gZ+mCI/8qXNG+A1BREHzMZfJjdCQ/kjTWi00ytyvcv37JauExx5+2FFsT1Mqt2xVA6 dLTQzThlcwNDDgpKe+zvG1cXZv0W2yhAQpMc7mqBG+U5d52Xb5ERpAUaWbQoQMK99bLm VJbjgvUsmdBtDbw48iQoH7ZHlQyBN+M6MVIfmktPO6mYZsjxM2kIhfb4nhUoB75D7GWO 5bO02VFUSCRjnSppJUbRDxPbk8qI2OiFDMrzTjb5w9wsoAy0mxO3Kqe6Rex39LSxaqe/ PGPmkbFYo19376RDdKPcqw1laNrfdx9zZ7skFQDoGwiP7K00HOucvdIlseIN1sm+u4rL I5cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=xUrLf5s0cjv7OkKMpXbmVqOuc/CZ1RLi4+Esc+jR55k=; b=i0C0+Y9brzKhgeAjObGAvkrO9e+30T9bO1j/6SoMdbA1mDT2IIJY61NF4iZvEk6Qg+ bdurangTwSh0wfRp5fF2kPfcU6v1Zk03e0VRa6r5gDbIfudInwr2RZkt5+XDqI5VS94f uYrm1nTEtHSJDCOHHNj4bOPoPLVyJDuH8vNWUG/oRTJDaZC3R3EeQQaJQau6j8u7MZqW sxz35SqU1ouOdafIXWwhxNiPcq6fDAe4iKJUnAGKW4g/b2uYFWBD7ByUrfb/d4f299jV SsmZXUmAhSm6Tqdk0GIJFE4hhfZvOLKcI6KKMQwtDl5IKrN0njyrdUonFgxdEEi3J+ZC 0Ajw== X-Gm-Message-State: AOAM531lrNhlKv584aqNMFiSp4poG9Kh+Xyv5j1cbp0t3QJzFycRmDvc 9y2KOGOn2361hBKuN/jQQSFQMHc4UcTLH2E49s9ouHdTtjxNENZU X-Google-Smtp-Source: ABdhPJwnvXKYWcCMe+/YpagnGC7Q/fxVvb3Nu5ZVe3mkddpJ7kXrpqVzcgG179C8Oj++Wa0OIrquV+uZnFWSb6fEJ5Y= X-Received: by 2002:a67:c29d:: with SMTP id k29mr19921611vsj.51.1635212991451; Mon, 25 Oct 2021 18:49:51 -0700 (PDT) In-Reply-To: <87ee89at29.fsf@zoho.eu> Received-SPF: pass client-ip=2607:f8b0:4864:20::932; envelope-from=hongyi.zhao@gmail.com; helo=mail-ua1-x932.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:134168 Archived-At: On Tue, Oct 26, 2021 at 2:03 AM Emanuel Berg via Users list for the GNU Emacs text editor wrote: > > Hongyi Zhao wrote: > > > (company-set-selection company--search-old-selection t) > > (setq company-selection-changed company--search-old-changed)) > > You have to do that manually? This is the code provided in the company-mode package: https://github.com/company-mode/company-mode/blob/811beeade86669e20da35efed5b00de6a5e305ab/company.el#L2343 > > :map company-search-map > > ("" . (lambda () > > (interactive) > > (if company-search-mode (company-search-abort) > > (company-search-candidates)))) > > Yeah, but that looks weird ... As I've told, it really represents the expected behavior. > the map is like 1/3 a mode. > You have to check for the major-mode now in its own map? I'm really puzzled by your comments and the following code snippet. > I wrote one major mode ... > > There it looks like this only. > > (defvar fpscalc-mode-map > (let ((the-map (make-keymap))) > (define-key the-map "\t" 'newline-and-indent) > the-map) > "`fpscalc-mode' keymap.") > > Okay not quite 1/3 ... > > https://dataswamp.org/~incal/fps/fpscalc.el > > https://dataswamp.org/~incal/fps/fpscalc.png <-- cool B) > > -- > underground experts united > https://dataswamp.org/~incal > >