Re: Org and Hyperbole

2022-06-23 Thread indieterminacy

On 24-06-2022 01:36, Samuel Wales wrote:

[p.s.  it also was not the topic i was talking about in my post.  :]
i was talking about specific features of links.]


I use (general) links functionality that hyperbole provides inside my 
emacs shell.


Apologies for not matching your specificity.

--
Jonathan McHugh
indieterminacy@libre.brussels



Re: Org and Hyperbole

2022-06-23 Thread Samuel Wales
hi robert, welcome to the org list and thanks for your offer.

for starters, does hyperbole have any concept of links that are:

- unbreakable [like org-id]

- bidirectional [link a goes to link b; link b goes to link a], or,
reversible via command to say "what links here?" [by any mechanism.
if desired, please see "id markers" concept on this list for
unbreakable bidirectional links and more stuff]

On 6/23/22, Robert Weiner  wrote:
> For reference:
>
> Hyperbole Videos are here:
>https://www.youtube.com/channel/UCNRwswKKpjOlOVfFTS73P9A/videos
>
> The Hyperbole Home Page is here:
>  https://www.gnu.org/software/hyperbole/
>
> Just to look at if you don't want to interact with it,
> the Hyperbole FAST-DEMO file is here:
>   https://www.gnu.org/software/hyperbole/FAST-DEMO
>
> The full web-version of the Hyperbole reference manual
> (somewhat technical) is here:
>https://www.gnu.org/software/hyperbole/man/hyperbole.html
>
> Enjoy.
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: Org and Hyperbole

2022-06-23 Thread Robert Weiner
Hi Eduardo:

I hope you'll take another look.

(hyperbole-mode 0)  disables the Hyperbole minor mode and all of its key
bindings.
The global binding {C-h h} is left in place so that you can quickly
re-enable Hyperbole's
minor mode and display its navigational minibuffer menu (where quick keys
let you
rapidly access a lot of Hyperbole capabilities.  You can unbind this global
key as you do
any other:

   (global-unset-key "\C-hh")


Re: Org and Hyperbole

2022-06-23 Thread Robert Weiner
Typically:
{M-x package-install RET hyperbole RET}
{M-x hyperbole-mode RET}

is enough to install the stable, V8 version of Hyperbole to try out.

If you are more advanced and want to try out the in-development version
that corresponds to the git tip of the Hyperbole master branch, this is
available
as a package from the elpa-devel archive.  To setup to install from there,
see
this article:

  https://protesilaos.com/codelog/2022-05-13-emacs-elpa-devel/

or just add:

(push '("elpa-devel" . "https://elpa.gnu.org/devel/;) package-archives)

to your Emacs init.

Built-in Org support for Hyperbole is documented here:


https://www.gnu.org/software/hyperbole/man/hyperbole.html#Smart-Key-_002d-Org-Mode


Re: Org and Hyperbole

2022-06-23 Thread Eduardo Ochs
On Thu, 23 Jun 2022 at 22:47, Robert Weiner  wrote:
>
> I am the author of Hyperbole and would be happy to answer questions
> concerning Hyperbole today (so you don't have to answer based on
> experience from the 1990s).  Hyperbole has been modernized for use
> with Org mode and Emacs 28 and continues to develop.  There are videos
> that demonstrate some of its features in simple, understandable ways.
> Hyperbole is a single Emacs package that can be installed and
> uninstalled quickly for testing.  It is largely a global minor mode,
> so you can also disable it quickly if you ever care to.  In 20 minutes
> you can get through the builtin, interactive demo and be on your way
> to basic yet powerful usage.  We have listened to much feedback in the
> last few years and made it much more approachable.


Hi Robert,

can you show us a sexp that will disable Hyperbole completely, and
that we can execute with our favorite variants of `C-x C-e'?
I know that this page

  (info "(hyperbole)Default Hyperbole Bindings")

has this paragraph,

  {C-h h}
  {C-h h X}
 Hyperbole Mini Menu: Enable Hyperbole minor mode and invoke the
 Hyperbole minibuffer menu, giving access to many Hyperbole
 commands.  This is bound globally.  Use {C-h h X} to close the
 Hyperbole minibuffer menu and disable Hyperbole minor mode.

and apparently these sexps toggle Hyperbole minor mode,

  (hyperbole-mode 1)
  (hyperbole-mode 0)

but even when I toggle it off the global binding for `C-h h' remains
active...

  Thanks in advance.
  My notes on Hyperbole are here,
http://angg.twu.net/hyperbole.html
  and there is some material on why I find Hyperbole too "magic"
  in these two links:
http://angg.twu.net/2021-org-for-non-users.html
http://angg.twu.net/eev-wconfig.html

  [[]],
Eduardo Ochs
http://angg.twu.net/#eev



Re: Org and Hyperbole

2022-06-23 Thread Robert Weiner
For reference:

Hyperbole Videos are here:
   https://www.youtube.com/channel/UCNRwswKKpjOlOVfFTS73P9A/videos

The Hyperbole Home Page is here:
 https://www.gnu.org/software/hyperbole/

Just to look at if you don't want to interact with it,
the Hyperbole FAST-DEMO file is here:
  https://www.gnu.org/software/hyperbole/FAST-DEMO

The full web-version of the Hyperbole reference manual
(somewhat technical) is here:
   https://www.gnu.org/software/hyperbole/man/hyperbole.html

Enjoy.


Re: Org and Hyperbole

2022-06-23 Thread Robert Weiner
Hi:

Thanks to Juan for starting this thread and the interesting
conversation it has started.  I just joined this mail list, so I don't
have the prior messages and can't reply to the thread, so I have
started this new one.

I am the author of Hyperbole and would be happy to answer questions
concerning Hyperbole today (so you don't have to answer based on
experience from the 1990s).  Hyperbole has been modernized for use
with Org mode and Emacs 28 and continues to develop.  There are videos
that demonstrate some of its features in simple, understandable ways.
Hyperbole is a single Emacs package that can be installed and
uninstalled quickly for testing.  It is largely a global minor mode,
so you can also disable it quickly if you ever care to.  In 20 minutes
you can get through the builtin, interactive demo and be on your way
to basic yet powerful usage.  We have listened to much feedback in the
last few years and made it much more approachable.

I find most of the confusion is people trying to understand how
Hyperbole works under the covers rather than just following the
tutorial and exploring it.  Hyperbole can be hacked on if you are a
moderate to advanced programmer but it is meant to be used, like Org
mode.  Hyperbole recognizes many, many common contexts in buffers that
could serve as hyperlinks (paths, URLs, multiple key sequences, mail
addresses, and on and on) and performs the typically desired action
when you press its Action Key {M-RET} on these 'implicit buttons'.
You get all this for free with no effort on your part.  Then if you
want to extend such behavior, as you have seen a bit of, you can
define your own implicit button and action types once and then
activate an infinite number of matching implicit buttons.  For
example, in an Emacs shell buffer, type:

   echo $PATH

then press the {M-RET} key or Shift-Middle mouse button on any path
there and jump right to it.  I find that very useful as a simple
example.  People are often surprised at how many things simply work
right out of the box because such broad context-sensitive behavior is
difficult to develop and rarely seen.  Just try it out and you should
find some contexts that you can leverage rapidly.  {C-h A} displays
what Hyperbole's Action Key will do in any context so you can always
check and learn before activating anything.  We say: Hyperbole brings
your text to life.  Like Org and Emacs, it provides an extensive
environment that you can grow into across time, getting ever more
productive rather than hitting a ceiling as with most point
packages/tools.

I am happy to answer questions and discuss ways we can make Hyperbole
and Org work even better together; one direct question per message
would typically work best.  Responses may take awhile as my schedule
makes it difficult to keep up with high volume mailing lists but if
you cc: r...@gnu.org, I'll likely see your message faster and respond.



Re: Using exec functions to simplify session code

2022-06-23 Thread Ivar Fredholm
Hi, Tim,
Let's say in your example that we are executing Python cells with the same 
session. When you execute block 1, the routines in org-babel-execute-src-block 
process the code into something that can be inserted into a file (say 
'tmp_code.py') and be run from the command line with python3 tmp_code.py.

At this point, Babel calls org-babel-execute:python, which decides, based on 
the 'session' header, whether or not to call python3 tmp_code.py or to feed 
each line in tmp_code.py into the session interpreter. What I am wondering is 
if we could replace the code for the latter option (in ob-comint.el) by just 
sending the interpreter the command 'exec(open("tmp_code.py").read())'.

Now you can still run block 2 or 3, or block 2 twice, or neither. I think this 
would simplify a lot of the comint code. All we would need to do is change how 
we implement the 'exec(open...' code in other languages, for instance, I 
believe in julia this could be done by an 'include'.

Best, Guacho





Sent with Proton Mail secure email.

--- Original Message ---
On Thursday, June 23rd, 2022 at 7:53 PM, Tim Cross  
wrote:


> Ivar Fredholm freddyho...@protonmail.com writes:
>
> > I have been browsing the orgmode code and it feels like we have to do a lot 
> > to implement sessions. At least for Python
> > or Julia, I am wondering if we could instantiate an interpreter, and send 
> > the code as a single 'exec' or 'include'
> > command. Other languages like R and groovy also have facilities to run code 
> > from a file. I believe this would reduce the
> > amount of code needing maintenance, as we would only need to manipulate the 
> > string to pass to the interpreter based
> > on the language. If this has been considered before, could someone explain 
> > why this approach was not used?
> > Best, Guacho
>
>
> I agree that supporting session can be complex, especially with some
> languages. The big limitation I can see with your suggestion (assuming I
> understand what your proposing) is that you may not necessarily want to
> execute all the blocks at once or only execute a block once.
>
> For example, I might have an org file with 4 code blocks which I want to
> all run in the same session. However, I might want to execute each block
> interactively, not run all four blocks sequentially all in one batch. I
> might execute block 1, then based on the result/output form that block,
> execute block 2 or 3, but maybe not both or perhaps I will execute block
> 2 twice before executing block 3 etc.
>
> If you adopt your approach, we would loose that flexibility. The session
> argument would essentially boil down to execute all code blocks in this
> file within the same batch rather than execute each one in a separate
> environment/instance. While this could be a valid interpretation of
> session, we would need to be sure it was one which all users found
> agreeable. It is possible, for stability and maintainability, a new
> definition of session would be acceptable, but it is a change with
> implications that would need to be managed carefully.



Re: Using exec functions to simplify session code

2022-06-23 Thread Tim Cross


Ivar Fredholm  writes:

> I have been browsing the orgmode code and it feels like we have to do a lot 
> to implement sessions. At least for Python
> or Julia, I am wondering if we could instantiate an interpreter, and send the 
> code as a single 'exec' or 'include'
> command. Other languages like R and groovy also have facilities to run code 
> from a file. I believe this would reduce the
> amount of code needing maintenance, as we would only need to manipulate the 
> string to pass to the interpreter based
> on the language. If this has been considered before, could someone explain 
> why this approach was not used?
> Best, Guacho
>

I agree that supporting session can be complex, especially with some
languages. The big limitation I can see with your suggestion (assuming I
understand what your proposing) is that you may not necessarily want to
execute all the blocks at once or only execute a block once. 

For example, I might have an org file with 4 code blocks which I want to
all run in the same session. However, I might want to execute each block
interactively, not run all four blocks sequentially all in one batch. I
might execute block 1, then based on the result/output form that block,
execute block 2 or 3, but maybe not both or perhaps I will execute block
2 twice before executing block 3 etc. 

If you adopt your approach, we would loose that flexibility. The session
argument would essentially boil down to execute all code blocks in this
file within the same batch rather than execute each one in a separate
environment/instance. While this could be a valid interpretation of
session, we would need to be sure it was one which all users found
agreeable. It is possible, for stability and maintainability, a new
definition of session would be acceptable, but it is a change with
implications that would need to be managed carefully. 



Using exec functions to simplify session code

2022-06-23 Thread Ivar Fredholm
I have been browsing the orgmode code and it feels like we have to do a lot to 
implement sessions. At least for Python or Julia, I am wondering if we could 
instantiate an interpreter, and send the code as a single 'exec' or 'include' 
command. Other languages like R and groovy also have facilities to run code 
from a file. I believe this would reduce the amount of code needing 
maintenance, as we would only need to manipulate the string to pass to the 
interpreter based on the language. If this has been considered before, could 
someone explain why this approach was not used?
Best, Guacho

Sent with [Proton Mail](https://proton.me/) secure email.

Re: Org and Hyperbole

2022-06-23 Thread Samuel Wales
[p.s.  it also was not the topic i was talking about in my post.  :]
i was talking about specific features of links.]



Re: Org and Hyperbole

2022-06-23 Thread Samuel Wales
i was indeed aware that one can dig into hyperbole's manual and load
it and keep using it for lots of buffers alongside org.  i first
learned about hyperbole in the 1990s or so and it seemed rather neat
and it seems intriguing still.

but that is not the model i was talking about in my post.  [there is
of course nothing wrong with that model.]

On 6/22/22, indieterminacy  wrote:
> On 23-06-2022 06:04, David Masterson wrote:
>> Samuel Wales  writes:
>>
>>> i am interested in whether hyperbole can inspire org.  or maybe spin
>>> off stuff that is useful for org.
>>
>> Hyperbole is loaded and activated in your .emacs file.  Therefore, it's
>> features are available in any file you work on (including Org
>> files). Many of the features may be useful to you as a replacement to a
>> feature in Org or something to work along side Org.  Dig into the
>> Hyperbole manual...
>
> any buffer!
>
> so it works inside emacs teminal emulators too!
> --
> Jonathan McHugh
> indieterminacy@libre.brussels
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: Org and Hyperbole

2022-06-23 Thread Eduardo Ochs
On Wed, 22 Jun 2022 at 11:36, Bill Burdick  wrote:
>
> 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


Hi Bill,

can I ask you for help on something that looks easy but that I'm not
being able to do (due to temporary braindeadness)?

How do we reimplement your  button as a sexp that can be run
with C-e C-x C-e? In eev all "buttons" are simply sexps that can
executed by variants of eval-last-sexp - as explained here:

  http://angg.twu.net/eev-intros/find-eev-quick-intro.html#3

I'm trying to translate your  to "eev style", but I'm
failing...

  Thanks in advance!
Eduardo Ochs
http://angg.twu.net/#eev



Re: [PATCH] Re: [BUG] Adding note to heading without newline at the end

2022-06-23 Thread Samuel Banya
Hey Ihor,

I can check it out on the weekend, sounds like fun.

Will step through the debugger to see what's up and get back to you on this, 
thanks for tagging me on this.

On Wed, Jun 22, 2022, at 10:28 AM, Tor Kringeland wrote:
> Ihor Radchenko  writes:
> 
> > Confirmed.
> >
> > Samuel, do you want to try fixing this?
> > It should be fairly easy to debug.
> 
> Nice.  But these are distinct bugs, it seems like.  The one you sent a
> patch for earlier fixes the former bug (which is also present in Org
> 9.5).  While my original problem is only present in Org 9.6.


Re: Org and Hyperbole

2022-06-23 Thread Samuel Banya
I'll be honest, every time I've ever seen Hyperbole attempted to be explained, 
it goes over my head in 2 seconds.

It seems like something akin to Acme where its mouse driven button events that 
trigger other things to occur.

Could never find a single solid video that dumbed down Hyperbole to make it 
useful for the average person though unfortunately. Seems neat though.

Sincerely,

Sam

On Thu, Jun 23, 2022, at 1:22 AM, indieterminacy wrote:
> On 23-06-2022 06:04, David Masterson wrote:
> > Samuel Wales  writes:
> > 
> >> i am interested in whether hyperbole can inspire org.  or maybe spin
> >> off stuff that is useful for org.
> > 
> > Hyperbole is loaded and activated in your .emacs file.  Therefore, it's
> > features are available in any file you work on (including Org
> > files). Many of the features may be useful to you as a replacement to a
> > feature in Org or something to work along side Org.  Dig into the
> > Hyperbole manual...
> 
> any buffer!
> 
> so it works inside emacs teminal emulators too!
> -- 
> Jonathan McHugh
> indieterminacy@libre.brussels
> 
> 


Re: Missing from Info

2022-06-23 Thread Colin Baxter
> Ihor Radchenko  writes:

> Colin Baxter  writes:
>> I think that this potentially confusing to someone unfamiliar in
>> the format of an info file. I had thought of suggesting the line
>> be changed to "The next sections have further details." That
>> suggestion however is no better that what is in place already.

> I do not see much improvement using your variant as well.  Also,
> note that, for example, Elisp manual is full of constructs like
> what we are discussing.

The line could be removed?

Best wishes,



Re: [BUG] random org-mode warning [9.5.4 (9.5.4-g7c61a3 @ /home/cro/.emacs.default/straight/build/org/)]

2022-06-23 Thread Cristi Constantin

Hi Ihor,

Than you for the response! I tried the fix you suggested, but I still 
see this:


Warning (org-element-cache): org-element--cache: Org parser error in 
2022-log.org::179869. Resetting.

 The error was: (error "Invalid search bound (wrong side of point)")
 Backtrace:
"  backtrace-to-string(nil)
  org-element-at-point(179869)
  org-element--cache-persist-before-write((elisp org-element--cache) 
(:hash \"63193836117540f39113c129b8de99c6\" :file 
\"/home/cro/org/log/2022-log.org\" :inode 23336608))
run-hook-with-args-until-success(org-element--cache-persist-before-write 
(elisp org-element--cache) (:hash \"63193836117540f39113c129b8de99c6\" 
:file \"/home/cro/org/log/2022-log.org\" :inode 23336608))
  #f(compiled-function (v) #)((elisp 
org-element--cache))
  #f(compiled-function (elt) #)((elisp 
org-element--cache))
  mapc(#f(compiled-function (elt) #) 
((elisp org-element--headline-cache) (elisp org-element--cache)))
  seq-do(#f(compiled-function (elt) #) 
((elisp org-element--headline-cache) (elisp org-element--cache)))
  seq-find(#f(compiled-function (v) #) 
((elisp org-element--headline-cache) (elisp org-element--cache)))
  org-persist-write(((elisp org-element--headline-cache) (elisp 
org-element--cache)) (:hash \"63193836117540f39113c129b8de99c6\" :file 
\"/home/cro/org/log/2022-log.org\" :inode 23336608) t)

  org-persist-write-all(#)
  org-persist-write-all-buffer()
  kill-buffer(#)
  kill-current-buffer()
  funcall-interactively(kill-current-buffer)
  call-interactively(kill-current-buffer nil nil)
  command-execute(kill-current-buffer)
"

Again other than the warning message, nothing seems to be broken, but 
it's annoying.


I also see something similar when I close the tab with 
centaur-tabs-buffer-close-tab.


~ Cristi

On 6/23/22 07:20, Ihor Radchenko wrote:

Cristi Constantin  writes:


I'm just editing my normal org log files and I started seeing the errors
above after I upgraded to latest org-mode.
I think I didn't upgrade for a month, so this bug is pretty new.
It doesn't seem to do anything weird, but I see this traceback a few
times a day.

This is the full error, so I'm reporting as requested:


Warning (org-element-cache): org-element--cache: Org parser error in
2022-log.org::178496. Resetting.
The error was: (error "Invalid search bound (wrong side of point)")
Backtrace:
" backtrace-to-string(nil)
org-element-at-point(178496)
org-element--cache-persist-before-write((elisp org-element--cache)

Thanks for reporting!

Will it help if you add the following to you config?

(defun org-persist-clear-caches ( _)
   "Clear read/write caches for org-persist."
   (clrhash org-persist--write-cache)
   (clrhash org-persist--read-cache)
   nil)
   
(add-hook 'org-persist-before-read-hook #'org-persist-clear-caches)

(add-hook 'org-persist-before-write-hook #'org-persist-clear-caches)

Best,
Ihor




Re: Missing from Info

2022-06-23 Thread Ihor Radchenko
Colin Baxter  writes:

> I think that this potentially confusing to someone unfamiliar in the
> format of an info file. I had thought of suggesting the line be changed
> to "The next sections have further details." That suggestion however is
> no better that what is in place already.

I do not see much improvement using your variant as well.
Also, note that, for example, Elisp manual is full of constructs like
what we are discussing.

Best,
Ihor



Re: Missing from Info

2022-06-23 Thread Ihor Radchenko
Colin Baxter  writes:

> M-: produces "/home//git/org-mode/doc/"
>
> Is it not that the org version has indeed further sections beneath, but
> these are not visible on the single info page?

I feel that I am confused.
Can you elaborate what exactly you expected and what you see instead?

Best,
Ihor



Re: [PATCH] org.el (org-read-date): Point to Info documentation

2022-06-23 Thread Ihor Radchenko
Robert Pluim  writes:

> I was just about to start implementing calendar navigation commands
> for org-read-date, except that they all already exist :-). Theyʼre
> just not documented in the docstring, only in the manual. Patch
> adding a cross-reference attached.

Thanks!
Applied onto main via 2b1b42891.

Best,
Ihor



Re: [PATCH] oc-basic.el: Stringify year from CSL-JSON date-parts

2022-06-23 Thread Ihor Radchenko
David Lukes  writes:

> * lisp/oc-basic.el (org-cite-basic--parse-json): Make sure year
> extracted from date-parts is returned as string.  Raise error if
> original type other than number or string.

Thanks!

Applied onto bugfix via 05626952b.

Note that the total LOC of your contributions is exceeding 20LOC
(depending how to count).

You may need to complete the copyright paperwork for future patches.
See https://orgmode.org/worg/org-contribute.html#copyright

Best,
Ihor



Re: [BUG] org-agenda-skip fails in batch mode because comment-start-skip is nil

2022-06-23 Thread Ihor Radchenko
Asilata Bapat  writes:

> Ihor Radchenko  writes:
>> Could you please provide a detailed reproducer?
>
> Sure. I have attached the files "mwe-data.org" and "mwe-export.org".
>
> To reproduce, save both files in the same directory. Then open 
> mwe-export.org, navigate to the "Export script" heading, and evaluate (Ctrl-C 
> Ctrl-C) the shell source block.

Thanks!

The offending commit is ec6d1df9bc.
The author of the commit claims that we never ever need to activate
major mode inside export:

https://list.orgmode.org/874kfmbc1l@gmail.com/

>> > I'm still unsure the patch is correct: what if people *need* major
>> > mode initialization before any contents is exported to a file?
>> 
>> I haven't responded to this concern, because I haven't been able to
>> conceive of a single situation where loading the normal-mode for the
>> exported file could be desirable.

So, we do have the situations where initialization of major mode is
required during export.

Timothy, do you have any comments?
I am inclined to revert ec6d1df9bc.

Best,
Ihor




Re: [BUG] ob-shell: cmdline and stdin broken when used with TRAMP

2022-06-23 Thread Ihor Radchenko
Bruno Barbier  writes:

> From what I understand, the function 'org-babel-sh-evaluate' relies on
> 'call-process'; and that function ignores file name handlers; as TRAMP
> relies on those file name handlers, it just cannot do the right thing.
>
> Using 'process-file' instead works for me.
>
> See the attached patch.

Thanks for the patch!

I am not very familiar with TRAMP, but since you supplied tests and they
are also passing on my side, everything looks good.

> I've also included a test, as the problem is reproducible with TRAMP
> "/mock::" connection. But, that test will only work on GNU/Linux
> systems.

Then you also need to guard the tests against system-type variable
value. If we cannot tests things on Windows, we should at least make the
tests not fail when they should not.

> Warning: that's my first attempt to write a patch, and I don't have
> (yet) signed the copyright papers.

You patch is >15LOC so we do need your copyright assignment before
merging. Let me know if you face any difficulties with the copyright
process. Note that FSF should reply within 5 working days.

> lib/ob-shell.el (org-babel-sh-evaluate): Use 'process-file' (instead
> of 'call-process-shell-command') so that 'org-babel-sh-evaluate' will
> invoke file name handlers based on 'default-directory', if needed,
> like when using a remote directory.

Note that we quote symbols like `symbols'.
See https://orgmode.org/worg/org-contribute.html#commit-messages
Also, please link to the bug report in the commit message for future
reference.

> + (apply #'process-file
> +(if shebang (file-local-name script-file)
> +  shell-file-name)
> + stdin-file
> +(current-buffer)
> +nil
> +(if shebang (when cmdline (list cmdline))
> +  (list shell-command-switch
> +(concat (file-local-name script-file)  " " 
> cmdline)))
> + ))

Probably you do not need concat here.
AFAIU, (list shell-command-switch (file-local-name script-file) cmdline)
should be good enough as ARGS argument of `process-file'.

> +   (:stdin   t :shebang t)
> +   (:cmdline t :stdin t :shebang t)
> +   ))

Please do not leave closing parenthesis at a separate line.  See D.1
Emacs Lisp Coding Conventions section of Elisp manual for details.

> +(defconst org-test-tramp-remote-dir "/mock::/tmp/"
> +  "Remote tramp directory.
> +We really should use 'tramp-test-temporary-file-directory', but that would 
> require TRAMP sources.")

Since TRAMP sources are not normally available, we can add this variable
as defined in tramp-tests.el somewhere into testing/org-test.el, for
example.

Best,
Ihor



Re: Org and Hyperbole

2022-06-23 Thread Bill Burdick
Note that recalc relies on lexical binding so if you use it, whatever file
it's in needs

;; -*- lexical-binding: t -*-

at the top.


-- Bill


Re: Org and Hyperbole

2022-06-23 Thread Bill Burdick
In case anyone's interested in writing hyperbole commands that can act on
regions but be located in other windows...

To write a hyperbole command that restores the previous window and
selection, just call bill/hyp-load-state at the start of your code and call
bill/hyp-restore at the end (see bill/recalc for an example).

This lets  recalculate org tables in any buffer with the button in
a different (or the same) window.

Here's some example text:



Here's a table. Click in it and then shift-middle-click recalc, above.
"aaa12" should change to "12" and your cursor should stay in the same place.
| a | aaa12 |
| a |  5 |
|   | 17 |
#+TBLFM: @1$2=3*4::@2$2=2+3::@3$2=vsum(@1..@2)

Here's my current definition for recalc

(defvar bill/hyp-state nil)

(defun bill/hyp-save-state ( args)
  (setq bill/hyp-state
(list (selected-window) (point-marker) (and (use-region-p)
(copy-marker (mark-marker))

(cl-defun bill/hyp-load-state ( (state bill/hyp-state))
  (let ((window (car state))
(point (cadr state))
(mark (caddr state)))
(when window
  (select-window window)
  (set-buffer (marker-buffer point))
  (and mark (set-mark (marker-position mark)))
  (goto-char point

(defun bill/hyp-restore ()
  (let ((state bill/hyp-state))
(run-at-time 0 nil (lambda () (bill/hyp-load-state state)

(advice-add 'action-key-depress :before 'bill/hyp-save-state)
;; evaluate this to remove the advice
;;(advice-remove 'action-key-depress 'bill/hyp-save-state)

(defun bill/recalc (end)
  (let ((act-point action-key-depress-prev-point))
(bill/hyp-load-state)
(when (org-at-table-p)
  (org-table-analyze)
  (org-table-maybe-eval-formula)
  (call-interactively 'org-table-recalculate)
  (org-table-align)))
  (bill/hyp-restore))

(defib recalc ()
  "recalculate the table at point"
  (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
  (and start end (string-match " ].*" (buffer-substring start
end))
   (hact 'bill/recalc end)


-- Bill


Re: [BUG] random org-mode warning [9.5.4 (9.5.4-g7c61a3 @ /home/cro/.emacs.default/straight/build/org/)]

2022-06-23 Thread Ihor Radchenko
Cristi Constantin  writes:

> I'm just editing my normal org log files and I started seeing the errors 
> above after I upgraded to latest org-mode.
> I think I didn't upgrade for a month, so this bug is pretty new.
> It doesn't seem to do anything weird, but I see this traceback a few 
> times a day.
>
> This is the full error, so I'm reporting as requested:
>
>
> Warning (org-element-cache): org-element--cache: Org parser error in 
> 2022-log.org::178496. Resetting.
> The error was: (error "Invalid search bound (wrong side of point)")
> Backtrace:
> " backtrace-to-string(nil)
> org-element-at-point(178496)
> org-element--cache-persist-before-write((elisp org-element--cache)

Thanks for reporting!

Will it help if you add the following to you config?

(defun org-persist-clear-caches ( _)
  "Clear read/write caches for org-persist."
  (clrhash org-persist--write-cache)
  (clrhash org-persist--read-cache)
  nil)
  
(add-hook 'org-persist-before-read-hook #'org-persist-clear-caches)
(add-hook 'org-persist-before-write-hook #'org-persist-clear-caches)

Best,
Ihor



Re: Org and Hyperbole

2022-06-23 Thread linux_hpc_akr
I use both Org and Hyperbole.

I'm a sysadmin so I do a lot with files and paths and URLs.  A lot of which
happens not in org files.

Being able to treat the files/paths/URLs as implicit buttons anywhere is
pretty valuable to me.

I just hit hkey-either on a filename/path and emacs opens it.  Or I hit
hkey-either on a URL and emacs sends to my web browser.  And I can do this in
any file or terminal or anywhere that I find myself in emacs.  I don't have to
think about it.  It just works.

Just my $0.02 in favor of using both Org and Hyperbole.

-- 
- Bill
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Bill Benedetto The Goodyear Tire & Rubber Co.
I don't speak for Goodyear and they don't speak for me.  We're both happy.



[BUG] random org-mode warning [9.5.4 (9.5.4-g7c61a3 @ /home/cro/.emacs.default/straight/build/org/)]

2022-06-23 Thread Cristi Constantin

Hi,

I'm just editing my normal org log files and I started seeing the errors 
above after I upgraded to latest org-mode.

I think I didn't upgrade for a month, so this bug is pretty new.
It doesn't seem to do anything weird, but I see this traceback a few 
times a day.


This is the full error, so I'm reporting as requested:


Warning (org-element-cache): org-element--cache: Org parser error in 
2022-log.org::178496. Resetting.

The error was: (error "Invalid search bound (wrong side of point)")
Backtrace:
" backtrace-to-string(nil)
org-element-at-point(178496)
org-element--cache-persist-before-write((elisp org-element--cache) 
(:hash \"aea4231abf77bb223420b9b8168a7da5\" :file 
\"/home/cro/org/log/2022-log.org\" :inode 23336608))
run-hook-with-args-until-success(org-element--cache-persist-before-write 
(elisp org-element--cache) (:hash \"aea4231abf77bb223420b9b8168a7da5\" 
:file \"/home/cro/org/log/2022-log.org\" :inode 23336608))
#f(compiled-function (v) #)((elisp 
org-element--cache))
#f(compiled-function (elt) #)((elisp 
org-element--cache))
mapc(#f(compiled-function (elt) #) ((elisp 
org-element--headline-cache) (elisp org-element--cache)))
seq-do(#f(compiled-function (elt) #) ((elisp 
org-element--headline-cache) (elisp org-element--cache)))
seq-find(#f(compiled-function (v) #) 
((elisp org-element--headline-cache) (elisp org-element--cache)))
org-persist-write(((elisp org-element--headline-cache) (elisp 
org-element--cache)) (:hash \"aea4231abf77bb223420b9b8168a7da5\" :file 
\"/home/cro/org/log/2022-log.org\" :inode 23336608) t)

org-persist-write-all(#)
org-persist-write-all-buffer()
kill-buffer(#)
kill-current-buffer()
funcall-interactively(kill-current-buffer)
call-interactively(kill-current-buffer nil nil)
command-execute(kill-current-buffer)
"
Please report this to Org mode mailing list (M-x org-submit-bug-report). 
Disable showing Disable logging



Emacs : GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.33, cairo version 1.17.6)

of 2022-04-27
Package: Org mode version 9.5.4 (9.5.4-g7c61a3 @ 
/home/cro/.emacs.default/straight/build/org/)


current state:
==
(setq
org-link-elisp-confirm-function 'yes-or-no-p
org-directory "~/org/"
org-hide-emphasis-markers t
org-log-done 'time
org-persist-after-read-hook '(org-element--cache-persist-after-read)
org-export-before-parsing-hook '(org-attach-expand-links)
org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)

org-archive-hook '(org-attach-archive-delete-maybe)
org-edit-src-content-indentation 0
org-cycle-hook '(org-cycle-hide-archived-subtrees 
org-cycle-show-empty-lines

org-cycle-optimize-window-after-visibility-change)
org-persist-before-read-hook '(org-element--cache-persist-before-read)
org-modules '(org-tempo)
org-mode-hook '(org-tempo-setup evil-org-mode er/add-org-mode-expansions
#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook 
org-fold-show-all append local] 5]

#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes
#[0 "\301\211\207" [imenu-create-index-function org-imenu-get-tree] 2])
org-babel-load-languages '((emacs-lisp . t) (shell . t) (python . t) 
(ruby . t))

org-link-file-path-type 'relative
org-confirm-shell-link-function 'yes-or-no-p
outline-isearch-open-invisible-function 'outline-isearch-open-invisible
org-use-sub-superscripts '{}
org-startup-indented t
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-tangle-lang-exts '(("ruby" . "rb") ("python" . "py") 
("emacs-lisp" . "el") ("elisp" . "el"))
org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer

doom-modeline-set-org-src-modeline)
org-confirm-elisp-link-function 'yes-or-no-p
org-cycle-separator-lines 1
org-support-shift-select t
org-structure-template-alist '(("sh" . "src shell") ("py" . "src 
python") ("js" . "src javascript")
("el" . "src emacs-lisp") ("a" . "export ascii") ("c" . "center") ("C" . 
"comment")
("e" . "example") ("E" . "export") ("h" . "export html") ("l" . "export 
latex")

("q" . "quote") ("s" . "src") ("v" . "verse"))
org-fontify-whole-heading-line t
org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)

org-confirm-babel-evaluate nil
org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal
org-persist-before-write-hook '(org-element--cache-persist-before-write)
org-indent-indentation-per-level 1
org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)

org-link-shell-confirm-function 'yes-or-no-p
org-babel-pre-tangle-hook '(save-buffer)
org-agenda-loop-over-headlines-in-active-region nil
org-occur-hook '(org-first-headline-recenter)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-link-parameters '(("attachment" :follow org-attach-follow :complete 
org-attach-complete-link)

("id" :follow org-id-open) ("file+sys") ("file+emacs")