From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id UB+cMEDjF2eu9wAAe85BDQ:P1 (envelope-from ) for ; Tue, 22 Oct 2024 17:39:13 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id UB+cMEDjF2eu9wAAe85BDQ (envelope-from ) for ; Tue, 22 Oct 2024 19:39:12 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=OylsQ25T; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1729618752; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=i/mlYO/VQhwBLfIEUJ70PM+rh0cJe0YfuRW0BuSjA0o=; b=iC7g3VysGxxUOHNbRAVnh2RowIYiG+zIykp0vPY/LoIolXqCTrKwxgclTemmnOymVxilHh LZifazxbDEOGdplW+TxntaWTJu7uoO+Wwh/r9uy5OcwYju41q/xHcEdsFQKCu3ddXsumK9 PI8aZfEHRfhGIt6kaVWxWDmNl2V0R+1QPqTXMupuz02M62ohSaLKAlBEBcDA4gnoMrgDWl PZkQyyHJeTfo5DoIFdcYJMXfmTPLx1/jU1QxrwoNbFuDI2JMgykRWvw+UkrUWsWGZf8yrj u59+9dwrjSzCnamTCLyottHh9lNjndM89XJQ+HRIEy0qECZd0ngxkQ0aTUyjZg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=OylsQ25T; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729618752; a=rsa-sha256; cv=none; b=Eb2o8PqTfsSMcyKmghzhS/eqZCIAPOhYD7KnNcoEL8a4LE7c9M4/4ZgbaLvGW99ubXNKCE 3UOjc7Qq6mwBRVq3I8GC8Q5vX2PpiJfSbJA1qlUycSoThiqKAgnTkPnPpfNf8gge7KnURJ cPH+aTe3AeEuOwsTTFOX2ktEXAev0fGo+Klae7OwGrHZJU5x240xnUgwtarMRfXctMCokE 1DKAvPMImk2j8jHNZc8KAAi1fDHFCpf4meU/XFq08aowPinPpVfffTnCZ8lHI1Pe5isaw1 Kql2Iqb4JBvfuGZDcSpEnfOUGIiBujgpw9FtMOorNnvs9tjAR5yN+zLXzy0g8A== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 126188CAC9 for ; Tue, 22 Oct 2024 19:39:12 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3Ipy-00050n-5V; Tue, 22 Oct 2024 13:38:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3IpO-0004w6-61 for Emacs-orgmode@gnu.org; Tue, 22 Oct 2024 13:37:55 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3IpH-0004IL-OT for Emacs-orgmode@gnu.org; Tue, 22 Oct 2024 13:37:52 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 23153240027 for ; Tue, 22 Oct 2024 19:37:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1729618658; bh=aGln9MbZ1LTsgxS0u6eCFUmUc0ZXBYfAQMUrys73d1w=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=OylsQ25TqU3vi2ak3kF55HfKYZ56uHB+PABWCkOlfl4SJctZiq3uvNgpLgIZM+JVs P+gYEdRKPsJiix2Ie6YsfxqxBf5nX3EhioIrWAn/Yk08x6zec2oXM/rOZ0WZ5xP5mX aX34b04z22oOK7MwWnjutoaj4udrgE2S/kqET+EVRO5SMbMv6/2MbvtS8/tQkJCqQy 1QmPS5o8x290Wem80PpC6X8ErO7u/NirR5gffVYQ+1423bGk2N8ADU75sdQXYyZG6o vJ8sJZQaKqiNRHTlBK3SOuM/zkq6yvKFEsbEHIAy4Ym6W8Lk6nIYsZHTRvmkM7bPq6 h2oARklQZQacw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4XXzsF5L0Xz6txq; Tue, 22 Oct 2024 19:37:37 +0200 (CEST) From: Ihor Radchenko To: Charles Choi Cc: Emacs-orgmode@gnu.org Subject: Re: [RFC] Insert reference to Org table cell or cell range from region selection (w/without mouse) In-Reply-To: References: <95CE1447-FC08-431A-9CA1-83B4C3F77BA7@gmail.com> <87zfmzqezp.fsf@localhost> Date: Tue, 22 Oct 2024 17:39:24 +0000 Message-ID: <875xpk11gz.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -1.15 X-Spam-Score: -1.15 X-Migadu-Queue-Id: 126188CAC9 X-TUID: ZLX5Wu5Jgo6o Charles Choi writes: > In trying to understand better what mouse support means, I=E2=80=99ve tri= ed to > formalize this with a state machine as described below. Is this > proposed behavior along the lines of what you were thinking? > > *** s2: point in =E2=9C=B3=EF=B8=8EEdit Formulas=E2=9C=B3=EF=B8=8E buffer > After calling ~org-table-edit-formulas~, point is moved into a new buffer= named =E2=9C=B3=EF=B8=8EEdit Formulas=E2=9C=B3=EF=B8=8E. > > Dev note: this is existing behavior. Here, you may add an overlay with custom keymap to the original table - just while *Edit formulas* buffer is active. > *** s3: dynamically calculate reference > Upon transition *t2* (a down-mouse event) an Org table field reference is= generated and inserted into the =E2=9C=B3=EF=B8=8EEdit Formulas=E2=9C=B3= =EF=B8=8E buffer. > > As the mouse is dragged (transition *t3*), the Org table reference is dyn= amically regenerated and inserted into the =E2=9C=B3=EF=B8=8EEdit Formulas= =E2=9C=B3=EF=B8=8E buffer. > > Note that the current point is in the buffer where the text region (or re= ctangle) is defined. > > Dev note: this is new behavior. I do not know enough about Emacs event ha= ndling to implement the above. > *** s4: move point back > Upon completion of a defined text region or rectangle, the point is moved= back to the end of the inserted table reference in =E2=9C=B3=EF=B8=8EEdit = Formulas=E2=9C=B3=EF=B8=8E. > > Dev note: this is new behavior. I do not know enough about Emacs event ha= ndling to implement the above. I think that you can do it simpler. Instead of trying to handle partial evens like "mouse down", you can use the usual mouse click event (22.7.4 Click Events in Elisp manual). Then, you (1) record cell reference; (2) switch to table edit buffer upon clicking. Evens in Emacs are the same as key sequences. So, just as you can bind a command to C-c C-x C-c, you can also bind it to [mouse-click] or [mouse-dra= g]. You can access the information about mouse click/drag boundaries using interactive specification: =E2=80=98e=E2=80=99 The first or next non-keyboard event in the key sequence that invoked the command. More precisely, =E2=80=98e=E2=80=99 gets events = that are lists, so you can look at the data in the lists. *Note Input Events::. No I/O. You use =E2=80=98e=E2=80=99 for mouse events and for special system ev= ents (*note Misc Events::). The event list that the command receives depends on the event. *Note Input Events::, which describes the forms of the list for each event in the corresponding subsections. You can use =E2=80=98e=E2=80=99 more than once in a single command's i= nteractive specification. If the key sequence that invoked the command has N events that are lists, the Nth =E2=80=98e=E2=80=99 provides the Nth su= ch event. Events that are not lists, such as function keys and ASCII characters, do not count where =E2=80=98e=E2=80=99 is concerned. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at