From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ramesh Nedunchezian Newsgroups: gmane.emacs.devel Subject: Re: Getting magic numbers 134217734 etc in a repetable keymap Date: Sat, 3 Apr 2021 17:28:12 +0530 Message-ID: References: <83tuonesck.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33395"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 03 13:59:10 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lSevl-0008ZY-Tx for ged-emacs-devel@m.gmane-mx.org; Sat, 03 Apr 2021 13:59:10 +0200 Original-Received: from localhost ([::1]:58462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lSevk-0002MW-VU for ged-emacs-devel@m.gmane-mx.org; Sat, 03 Apr 2021 07:59:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSev8-0001sB-Ma for emacs-devel@gnu.org; Sat, 03 Apr 2021 07:58:31 -0400 Original-Received: from mail-oln040092254018.outbound.protection.outlook.com ([40.92.254.18]:19503 helo=APC01-PU1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSev6-0004Mo-8Y for emacs-devel@gnu.org; Sat, 03 Apr 2021 07:58:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dDUJ2M/ZgwAaanmy7NULo4GEQaywXvb7qCPyZ+aTNQ1GSMStseBTovqA6NRSq3Q2i0mjWvCbbynuDVvsZ7NcIt3XyLFnBLVRR+LWGbUBgZx3OpZS4cenKD2Tt60rT8JykCTspjr8zokfY1j/+AkD33J64JE1gccMMmCTBAaqklWkiN1JTrtrIEbV+LrBjk5b0xB1VQHN3UaY6FMFUQ5RkPm+f/vjMhyCuo5XV/O/cqykvq746pt/UGWIL9BvnAoa+KUydbZ8TSojjFWx3oT1xbV02CBjSoLObkTuiMRV+/57iqKyu68qGMvEHpbeQ3D2p/bRmnCdkFMx+lM4Kf03yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R52rNfkcjKPK2f7ugw5uTAhREP05+JknKPtSafW722o=; b=LUPhZsJb52j1zLR3UUuQAfATTKZCZIra2WZkOLVHGjahPog3tDwGkkGY1qQEIFJdxgbEiR74E7AHv71WykM+K49KoLG8xGCxoi8/HxeWQxVhvg+Vd0GoFEZwlqFqwfADeJ+nRq9uTIctMDq4KpVCPzkohmTsG5i8ANqeEwXFLw6jxws+GKgaVM9HfmmRgbAPeDRd9ki+xGTDX6DP5VnqKZBfgUpsV3b7UeCEBKgGqpsNm7jnrQw3Y1w8b4FLA0682DSWdtVQx/V7QXrvABZiwta4pMtwRl/fBfORuxOM1ie5oztJjjAkbofK8xeCYPg1FD+0Q8vt4RA/IOMeAQe0lQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R52rNfkcjKPK2f7ugw5uTAhREP05+JknKPtSafW722o=; b=uJhFDWP2tiPJMRkIdSYV9jFJA7ekIZOki3lSQf5mVtwBKgDzUmss4edMmIiTALcgGGvrF8Jw1dm3Pdb5aP3UNElqyvI4CP/s8KyuCd+s5KWtFIS+qiG1TqEnRHgZXB9rFLjbigqh3ZWuywrjUtwuXZ0yHIQLBkiisUuaBfugr9bzs6IIkl+J8HTIUJAG/j1uZSWdsKa+nNbQPG0E2aPSVvW9tGIYLUfrzZTPUXUSpdag1DIOJCi8Rca9Lq34zE+5TSQrH4NdObKwbs78KYAHnL3AkNh3DRdoIsOluPhqcP8Bt1U4HJU/QSya2BVzk6cbde6AEdNazfFRcKJO15j+Zg== Original-Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) by TY2PR0101MB2944.apcprd01.prod.exchangelabs.com (2603:1096:404:aa::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.26; Sat, 3 Apr 2021 11:58:20 +0000 Original-Received: from TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::4980:4d7f:474b:de2c]) by TY2PR0101MB3693.apcprd01.prod.exchangelabs.com ([fe80::4980:4d7f:474b:de2c%3]) with mapi id 15.20.3999.032; Sat, 3 Apr 2021 11:58:20 +0000 In-Reply-To: <83tuonesck.fsf@gnu.org> Content-Language: en-US X-TMN: [Ns5XHRUWeLgL5hjqcFczWdXL2cZaZ0SI2LZ91u47Ses=] X-ClientProxiedBy: MA1PR01CA0115.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::31) To TY2PR0101MB3693.apcprd01.prod.exchangelabs.com (2603:1096:404:800f::16) X-Microsoft-Original-Message-ID: <85830e61-520e-8f8a-1e37-0a140398c792@outlook.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from [192.168.43.244] (117.230.168.115) by MA1PR01CA0115.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28 via Frontend Transport; Sat, 3 Apr 2021 11:58:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb2223f8-4724-48d5-6a4c-08d8f697c695 X-MS-TrafficTypeDiagnostic: TY2PR0101MB2944: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZDZ3QG+C98K6/uS9ZnAW4HId/D4aMyvLhln3FV20eGp2C3tsKtrCKmmDmnH/x1264ni8HyOdxYFxdWzHCa5rhYV0hMTAmUXxh4NTP9PlxGSjFZhmXLhSmxS9Fblq42AymhR1NFOEzh1qfKw4IGn68YtK0TkXLA492ucRfitxFHS2DK9Q1NhM5MaazeYj8PsV7Gxsuwm4C8VvY2csarU90fbrnw2PqPPla5AW32Wt/N5ty9XeUFbIudxV20QvJjHPCF6XbriSeVw+27xhk0nuiV9UE5XjL9072gUD9JhN/hahSTMqOGn77rz0J9c4N4T/qvWMGAPkW6OhiUoGdKUuZ33qob51Sc5A0VnNszExP5t57vLkD/bFz1AuP2WDGRh0M5js6X81FsG7lblUQvlbFQ== X-MS-Exchange-AntiSpam-MessageData: wijH+N5+XxYrHS7TnSOhBY4/eFSARRyKe4j+CRTzvP+b2c9YsPjHxMQCqmbRCjCvmLAht/rG7IU0laOKSpVjVn2mBhkL0xCR4cToQY9GQcMsBaahXGdQ1n30cUySxEecSOKrH7JGCRTbzM+N0KvkLw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb2223f8-4724-48d5-6a4c-08d8f697c695 X-MS-Exchange-CrossTenant-AuthSource: TY2PR0101MB3693.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Apr 2021 11:58:20.8754 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR0101MB2944 Received-SPF: pass client-ip=40.92.254.18; envelope-from=rameshnedunchezian@outlook.com; helo=APC01-PU1-obe.outbound.protection.outlook.com X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 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, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:267340 Archived-At: On 03/04/21 1:02 pm, Eli Zaretskii wrote: >> From: Ramesh Nedunchezian >> Date: Sat, 3 Apr 2021 11:50:50 +0530 >> >> I would like to create a repeatable keymap which has magic number >> 134217734 etc in it using either `define-key' or any other API. >> >> I have tried the following, and it desn't work >> >> (define-key sexp--repeat-map >> (vector >> (car >> (listify-key-sequence >> (kbd "C-M-f")))) >> 'forward-sexp) >> >> Getting numbers like 134217734 etc in to the repeatable keymap are >> important for successful setting up of repetition. That is, for >> repetition to succeed, the condition below in `repeat-post-hook' need >> to succeed. >> >> (or (memq last-command-event keys) >> (memq this-original-command '(universal-argument >> universal-argument-more >> digit-argument >> negative-argument))) >> >> ... and when I invoke C-M-f `last-command-event' comes out as 134217734. >> >> ---------------- >> >> For now I have hard-coded `sexp--repeat-map' as below, and this works >> as expected. But I want a cleaner and less-hackish recipe for achieving the same. > > Display the "magic" numbers in hex, and I think you will see the way > clearly. > I am dumb. I unable to take your hint. Can I have a full recipe. Getting the magic value of C-M-f is not an issue. But, getting the magic number _verbatim_ in to the _repeat-map__ is the issue. Note the emphasis on words "verbatim" and "repeat-map". i.e., I want a recipe which will create this keymap '(keymap (134217734 . forward-sexp) ;; (102 . forward-sexp) ) instead of the (keymap (27 keymap (6 . forward-sexp))) i.e. The problem with `define-key' is that it is converting C-M-f in to ESC C-f and this 2-level keymap I DO NOT want. The two level keymap gets in the way of setting up a repeatable keymap which will help me do C-M-f f f f f etc. To summarize, I want the "not ok" to be fixed. (progn (defvar test-repeat-map (let ((map (make-sparse-keymap))) map) "Keymap used to repeatedly invoke `forward-sexp' with C-M-f f f f .....") (cl-loop for (cmd . key) in '((forward-sexp . [134217734]) ;; Not ok (forward-sexp . "f")) do (define-key test-repeat-map key cmd) (put cmd 'repeat-map 'test-repeat-map)) test-repeat-map) ---------------- This is the crux of my problem, and it appears in the context of newly introduced `repeat-mode' feature. Getting numbers like 134217734 etc in to the repeatable keymap are important for successful setting up of repetition. That is, for repetition to succeed, the condition below in `repeat-post-hook' need to succeed. (or (memq last-command-event keys) (memq this-original-command '(universal-argument universal-argument-more digit-argument negative-argument))) ... and when I invoke C-M-f `last-command-event' comes out as 134217734.