emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Charles Choi <kickingvegas@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>, Emacs-orgmode@gnu.org
Subject: Re: [RFC] Insert reference to Org table cell or cell range from region selection (w/without mouse)
Date: Mon, 21 Oct 2024 09:24:28 -0700	[thread overview]
Message-ID: <FE824DDA-C981-411C-9BC9-3AAEABC1485C@gmail.com> (raw)
In-Reply-To: <87zfmzqezp.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]

Ihor - 

Thanks for replying. Some initial reply thoughts.

> On Oct 20, 2024, at 2:51 AM, Ihor Radchenko <yantar92@posteo.net> wrote:
> 
> It would be nice if you summarized the feature request in a few
> sentences in the email. The link may or may not be available for future
> readers in 10+ years from now.


Understood. I’ll prepare a more formal RFC in a forthcoming email.

> As we briefly discussed during the meetup, I believe that we can
> integrate mouse support into M-x org-table-edit-formulas:
> - when in fedit buffer, clicking/dragging on the original table should
>  insert reference into the formula buffer
> 


In trying to understand better what mouse support means, I’ve tried to formalize this with a state machine as described below. Is this proposed behavior along the lines of what you were thinking?


* Proposed Mouse Region to Org Table Reference Behavior

Described below is a proposed state machine description of mapping a region or rectangle defined by a mouse to an Org table reference.


[-- Attachment #2: org-table-reference-table-mouse-sm.svg --]
[-- Type: image/svg+xml, Size: 4632 bytes --]

[-- Attachment #3: Type: text/plain, Size: 1589 bytes --]



* States
*** s1: point in org table
Initial state where the point in inside an Org table.

Dev note: this is existing behavior.

*** s2: point in ✳︎Edit Formulas✳︎ buffer
After calling ~org-table-edit-formulas~, point is moved into a new buffer named ✳︎Edit Formulas✳︎.

Dev note: this is existing behavior.

*** s3: dynamically calculate reference
Upon transition *t2* (a down-mouse event) an Org table field reference is generated and inserted into the ✳︎Edit Formulas✳︎ buffer.

As the mouse is dragged (transition *t3*), the Org table reference is dynamically regenerated and inserted into the ✳︎Edit Formulas✳︎ buffer.

Note that the current point is in the buffer where the text region (or rectangle) is defined.

Dev note: this is new behavior. I do not know enough about Emacs event handling 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 ✳︎Edit Formulas✳︎.

Dev note: this is new behavior. I do not know enough about Emacs event handling to implement the above.

** Transitions
*** t1: org-table-edit-formulas
The command ~org-table-edit-formulas~ is called.

*** t2: down-mouse-1 on table cell
Either the ~down-mouse-1~ or ~C-M down-mouse-1~ event is made.

*** t3: drag-mouse-1 to define region
The mouse is dragged immediately after a *t2* event.

*** t4: move point back
An up mouse event immediately after a *t3* event.



Thanks and best regards - 

Charles


      reply	other threads:[~2024-10-21 16:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-20  0:28 Request for comment: Adding feature to calculate Org table reference from selected text region Charles Choi
2024-10-20  9:51 ` [RFC] Insert reference to Org table cell or cell range from region selection (w/without mouse) Ihor Radchenko
2024-10-21 16:24   ` Charles Choi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FE824DDA-C981-411C-9BC9-3AAEABC1485C@gmail.com \
    --to=kickingvegas@gmail.com \
    --cc=Emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).