From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SL3sHNZzs2L+QwEAbAwnHQ (envelope-from ) for ; Wed, 22 Jun 2022 21:56:06 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id ULbmHNZzs2LpBQAA9RJhRA (envelope-from ) for ; Wed, 22 Jun 2022 21:56:06 +0200 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 18DDF80CA for ; Wed, 22 Jun 2022 21:56:06 +0200 (CEST) Received: from localhost ([::1]:58394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o46SK-0007C8-Sg for larch@yhetil.org; Wed, 22 Jun 2022 15:56:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o46Rj-0007Br-SR for emacs-orgmode@gnu.org; Wed, 22 Jun 2022 15:55:27 -0400 Received: from mail-yw1-x112d.google.com ([2607:f8b0:4864:20::112d]:41675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o46Rh-0005Gw-AQ for emacs-orgmode@gnu.org; Wed, 22 Jun 2022 15:55:27 -0400 Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-31780ad7535so147438287b3.8 for ; Wed, 22 Jun 2022 12:55:24 -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 :cc; bh=Q2We4UT3dvTOQngb+fLjJtXkyYPhvVqc5UDm3kASNco=; b=jCcqAgmUvByC5zOc2R7Qpvij5pvaHCTSqkrqEOOq+ziJRxydAYg04KCpqIAAqRujab 1gdRXUaxb3YJlJxo1ActS6/Q2o+J3GScTCkjv1Rj8b9UnhvPeCulk5x8+cisgw5vTYWC QKGhpzawc/3/gtQ4nH4xZdUB9Yk4wZ7tWbwe3/JTe3SzfYyFOYKPDGtiJG+N2Zb134Vb uKI5QrhHHVKZpbtWD4FdnsoDQo+q15vFiRMxEINwkWgNmWRlIC8SaQwnF9ERjHBt4ADY Kdqk8kGXmTE4dcdmJnYfeRtzNxGQHLD/lQ4b2jEWEzwqsJmXM4xMgRPJK1HKVtMzH/P6 O6kg== 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:cc; bh=Q2We4UT3dvTOQngb+fLjJtXkyYPhvVqc5UDm3kASNco=; b=tbAuLKOeZSDVXnCN1o8bwo5eEat64aCfLp9XoL520J9ERigYls+h2UStOAtzPTOqXS OZi0jPdyFKuya+D2eYf+OuXelkqsvUAxyUyaiyfZiUE0tGXhbrt6B7Z8oWNJrDUtxZLZ hhxlh85YrxJXdD4qLj5nfsbnjtPwvHYuTGs2tpaMNyJLnkzVqy9WpDeXuz6982wAG10M nByCgHwFCkc6uEwKZu0qfyzbMPFsUK3VX61w3PvcixjPC9dbw5t/T5XkGy8PEaqL1d0l PAC+GnbgOelsExuj9ZmWdDs6F/AcvbItLJgki7HRnY2jLjWZpJycF2dqbtBNP5XLHVF7 Yy+A== X-Gm-Message-State: AJIora/ZTukOpZze/Ut5jybYNtJy+pFTHZ4Aeb5qpX5pZ5mh5IJXkUvg HeoLjJ1b0Ze21uYmxx2sBiRQAK8MGrHKeUG0TIY= X-Google-Smtp-Source: AGRyM1sLho4i5p4MEDvrWZtp8IpSrQufhYoAQDnYr3PmHHOgkcSYz9/tBZnsGtvd+JAG3tE3KBWl9gbGgJNg5O2vfrs= X-Received: by 2002:a81:90e:0:b0:317:a269:a629 with SMTP id 14-20020a81090e000000b00317a269a629mr6274608ywj.214.1655927724168; Wed, 22 Jun 2022 12:55:24 -0700 (PDT) MIME-Version: 1.0 References: <875ykvbffg.fsf@posteo.net> <87a6a5gf1p.fsf@posteo.net> In-Reply-To: From: Bill Burdick Date: Wed, 22 Jun 2022 22:55:13 +0300 Message-ID: Subject: Re: Org and Hyperbole To: David Masterson Cc: =?UTF-8?Q?Juan_Manuel_Mac=C3=ADas?= , orgmode Content-Type: multipart/alternative; boundary="000000000000c5dab305e20eb7f9" Received-SPF: pass client-ip=2607:f8b0:4864:20::112d; envelope-from=bill.burdick@gmail.com; helo=mail-yw1-x112d.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1655927766; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Q2We4UT3dvTOQngb+fLjJtXkyYPhvVqc5UDm3kASNco=; b=toBPLy1b+zMtawgEaLyUZ0kgi6ZByYB7sR9Ieg0bsRCsFfYCX8QVMTi3cF5O3WDM+DAtw1 3OW4w1cPSP0vNA33YT5cpAYd9rBZCJ53E7FIXDii69rhFMo3OdE9VKowlktgPPIsvThB5x plaICZhIYdzjJ8Sgy1/VuUqzdFb0ZWBmJzz8BCG/AW/jrgAX3ueDPO/mWo2UBEaqTHzMSr LK7iB/s1+ZRw0CkYf570156J2zv+aozAJY5myXnR1LPDORWI4aUpjqiuqxEvK7R17u1Llg N01C6542J1DJdz5y7oFz9yT6C0urrywNU9xn3DLsiqCpNV2f1/td/d2gFNIZvw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1655927766; a=rsa-sha256; cv=none; b=NiFqvk6Li0QODSa+p23KLWoTQIOPA129a7LsmymHJep805FyTK8isIqQ8zRy/m598kbS0O TA82aXIDdAwlo/pJYND3ODaT0BH8XHSd+XuGolQ92K8gOCDrw+xM6vTfJJPSKaGBzHCgjd iSmiEYFboqVZmVrgqtxkBaZQOrBl9ecGNWwV48MDmvQMTRUm5CAVs9JxBBUetunKQ3gCSj HhdQWhNQE4HtDu9PZpAnX/BsmRRwDbqLa00z1dSt9HlE29xHPtg9kZtSzPo2mtB17J8zZ/ FipK9BsFxHXyXs7QPwLHr2LJ0IDrh946vnMq6rOP7EJmC6Mg84dLrfJzUaPDWA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jCcqAgmU; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Spam-Score: -5.26 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jCcqAgmU; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: 18DDF80CA X-Spam-Score: -5.26 X-Migadu-Scanner: scn0.migadu.com X-TUID: uNJFX+ps4WRN --000000000000c5dab305e20eb7f9 Content-Type: text/plain; charset="UTF-8" I just wrote recalc today as a demo so people can extrapolate what they might do with Hyperbole (calc was handy in my head since I wrote it for Ober, the Java version of the Oberon environment). WIth buttons that restore the point to where it was when you clicked, you can make them operate on the current selection (it looks like Hyperbole might not save the region though so maybe more function advice is needed for that). This makes reusable "menu bars" possible: (changing recalc to find the table at point instead of using the location of the button). Highlight a region and shift-middle-click on cut/copy/paste to do that action on your selection. This also lets you use button bars in other frames (acting even more like a real menu bar). Buttons could also parse contextual information in the button buffer (and/or the active buffer), something like org-mode properties, that could influence how the buttons behave. Other buttons could edit this information to give you document-based behavior. For instance, a button-buffer (like the menubar) could have behavioral information like this: : 4 : left Clicking "left" could toggle it between the different types of justification (left, right, center, full) and clicking on could justify the current paragraph. Clicking could change the indentation of the current file (if it's a program, it could analyze for the current indentation and then change it to the desired indentation). Just thinking out loud here -- this is the sort of thing Ober did and Hyperbole looks like a framework that makes it not too hard to do that for Emacs. -- Bill On Wed, Jun 22, 2022 at 10:26 PM Bill Burdick wrote: > No idea. > > > -- Bill > > > On Wed, Jun 22, 2022 at 10:23 PM David Masterson > wrote: > >> Bill Burdick writes: >> >> > Here's a hyperbole-org integration that lets you use org-mode tables >> > outside of org-mode files. Shift-middle-click a "recalc" button and it >> > will recalculate the table right under it (this idea is from an old >> > version of the Oberon environment I wrote in Java, by the way). >> > >> > Here's the code: >> > >> > (defun bill/calc (end) >> > (goto-char end) >> > (re-search-forward "\n") >> > (when (org-at-table-p) >> > (org-table-analyze) >> > (let* ((table-start (point)) >> > (rows (1- (length org-table-dlines))) >> > (table-end (re-search-forward "\n" nil t rows)) >> > (inside (<= table-start action-key-depress-prev-point >> table-end))) >> > (when inside >> > (goto-char action-key-depress-prev-point) >> > (org-table-maybe-eval-formula)) >> > (goto-char table-start) >> > (call-interactively 'org-table-recalculate) >> > (org-table-align)))) >> > >> > (defib recalc () >> > "recalculate a table" >> > (save-excursion >> > (let* ((pos (point)) >> > (eol (progn (re-search-forward "\n") (point))) >> > (bol (progn (re-search-backward "\n" nil t 2) (1+ (point)))) >> > (start (progn (goto-char pos) (re-search-backward "<" bol >> t))) >> > (end (progn (goto-char pos) (re-search-forward ">" eol t)))) >> > ;;(message "pos: %s, prev: %s" (point) >> action-key-depress-prev-point) >> > (and start end (string-match " ].*" (buffer-substring >> start end)) >> > (hact 'bill/calc end))))) >> > >> > Here's an example table you can put anywhere. Just shift-middle-click >> > on it to recalculate the org-mode table. Also, if you type a formula >> > (and keep the cursor on the same line) and then shift-click recalc, >> > it'll handle the formula: >> > >> > >> > | a | 12 | >> > | a | 5 | >> > #+TBLFM: @1$2=3*4::@2$2=2+3 >> >> Isn't this the minor mode orgtbl-mode ? >> >> -- >> David Masterson >> > --000000000000c5dab305e20eb7f9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I just wrote recalc toda= y as a demo so people can extrapolate what they might do with Hyperbole (ca= lc was handy in my head since I wrote it for Ober, the Java version of the = Oberon=C2=A0environment).

= WIth buttons that restore the point to where it was when you clicked, you c= an make them operate on the current selection (it looks like Hyperbole migh= t not save the region though so maybe more function advice is needed for th= at). This makes reusable "menu bars" possible:

<recalc> <cut> <copy> <paste>
<= br>
(changing recalc to find the table=C2=A0at point instea= d of using the location of the button).
Highlight a region and sh= ift-middle-click on cut/copy/paste to do that action on your selection.

This also lets you use button bars in other frames (a= cting even more like a real menu bar).

Buttons cou= ld also parse contextual information in the button buffer (and/or the activ= e buffer),=C2=A0something like org-mode properties, that could influence ho= w the buttons behave. Other buttons could edit this information to give you= document-based behavior. For instance, a button-buffer (like the menubar) = could have behavioral information like this:

<i= ndent>: 4
<justify>: left

Click= ing "left" could toggle it between the different types of justifi= cation (left, right, center, full) and clicking on <justify> could ju= stify the current paragraph. Clicking <indent> could change the inden= tation of the current file (if it's a program, it could analyze for the= current indentation and then change it to the desired indentation).
<= div>
Just thinking out loud here -- this is the sort of thing= Ober did and Hyperbole looks like a framework that makes it not too hard t= o do that for Emacs.


-- Bill


On Wed, Jun 22, 2022 at 10:26 PM B= ill Burdick <bill.burdick@gmai= l.com> wrote:
No idea.


-- Bill

On Wed, = Jun 22, 2022 at 10:23 PM David Masterson <dsmasterson@gmail.com> wrote:
=
Bill Burdick <bill.burdick@gmail.com= > writes:

> Here's a hyperbole-org integration that lets you use org-mode tabl= es
> outside of org-mode files. Shift-middle-click a "recalc" but= ton and it
> will recalculate the table right under it (this idea is from an old > version of the Oberon environment I wrote in Java, by the way).
>
> Here's the code:
>
> (defun bill/calc (end)
>=C2=A0 =C2=A0(goto-char end)
>=C2=A0 =C2=A0(re-search-forward "\n")
>=C2=A0 =C2=A0(when (org-at-table-p)
>=C2=A0 =C2=A0 =C2=A0(org-table-analyze)
>=C2=A0 =C2=A0 =C2=A0(let* ((table-start (point))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (rows (1- (length org-table-d= lines)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (table-end (re-search-forward= "\n" nil t rows))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (inside (<=3D table-start = action-key-depress-prev-point table-end)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(when inside
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char action-key-depress-prev-po= int)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-table-maybe-eval-formula))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char table-start)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(call-interactively 'org-table-recalcula= te)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(org-table-align))))
>
> (defib recalc ()
>=C2=A0 =C2=A0"recalculate a table"
>=C2=A0 =C2=A0(save-excursion
>=C2=A0 =C2=A0 =C2=A0(let* ((pos (point))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (eol (progn (re-search-forwar= d "\n") (point)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (bol (progn (re-search-backwa= rd "\n" nil t 2) (1+ (point))))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (start (progn (goto-char pos)= (re-search-backward "<" bol t)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (end (progn (goto-char pos) (= re-search-forward ">" eol t))))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0;;(message "pos: %s, prev: %s" (po= int) action-key-depress-prev-point)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(and start end (string-match "<recal= c[> ].*" (buffer-substring start end))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (hact 'bill/calc end)))))=
>
> Here's an example table you can put anywhere. Just shift-middle-cl= ick
> on it to recalculate the org-mode table. Also, if you type a formula > (and keep the cursor on the same line) and then shift-click recalc, > it'll handle the formula:
>
> <recalc>
> | a | 12 |
> | a |=C2=A0 5 |
> #+TBLFM: @1$2=3D3*4::@2$2=3D2+3

Isn't this the minor mode orgtbl-mode ?

--
David Masterson
--000000000000c5dab305e20eb7f9--