Re: Re: A dream?

2023-04-17 Thread Pedro Andres Aranda Gutierrez
> Jean Louis :
>> Eduardo Ochs  [2023-04-16 01:45]:
>> do you have a page in https://gnu.support/ explaining in detail how
>> you teach Emacs to beginners? It would be nice to have something like
>> that...
>
>I just tell them to do Emacs Tutorial. There is no need for page when
>it is built-in.
>
>I tell them, open Emacs and do the tutorial, then let me know. Later
>we do not talk much, we just do the work.

In addition to that, I have also collected a set of slides with suggestions
and
quick answers to some of the configuration hurdles. That helps a lot (they
say)
In addition, I have an article on org-mode.
I submitted to the (wrong) journal and never got published on paper ,-(
That was a couple of years ago and I have continued to update it for my
personal
reference. When people have specific interest in org-mode I pass
the lastest version in PDF and org for them to play around. The teaser for
this
is any of my lecture handouts.

Best, /PA

-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet


Re: [ANN] org-jami-bot

2023-04-17 Thread Marcin Borkowski


On 2023-04-17, at 21:22, Hanno Perrey  wrote:

> Dear fellow org-users,
>
> I have just released two new packages that scratch an old itch of mine:
> capturing thoughts, quick notes and URLs while "on the road" with only
> my mobile phone around. Messaging myself feels most natural, so that is
> what I went with: triggering a capture via GNU Jami, the distributed
> private messenger.

Hi,

I've never heard about Jami before -- I'll definitely check it out!  And
your package looks _very_ cool.  Thanks!

Best,

-- 
Marcin Borkowski
http://mbork.pl



Re: [BUG] ob-js "SyntaxError: Unexpected end of input" when code block ends with comment

2023-04-17 Thread General discussions about Org-mode.
Happy to help and thanks for fixing it so quickly:)
Best regards,
--
Salah 



Apr 17, 2023 at 12:10 by yanta...@posteo.net:

> sgherdao--- via "General discussions about Org-mode."
>  writes:
>
>> The following code snippet fails to execute
>>
>> #+begin_src js
>> console.log("Hello Friends!");
>> // -> logs "Hello Friends"
>> #+end_src
>>
>> I encounter the following error message:
>>
>> #+begin_src text
>> /tmp/js-script-dn2Wrp:2
>> // -> logs "Hello Friends"}()));
>>
>> SyntaxError: Unexpected end of input
>> ...
>> As a simple fix, I have added a \n after %s
>>
>> #+begin_src emacs-lisp
>> (defvar org-babel-js-function-wrapper
>>   
>> "require('process').stdout.write(require('util').inspect(function(){%s\n}()));"
>>   "Javascript code to print value of body.")
>> #+end_src
>>
>
> Thanks for reporting and providing a fix!
> Fixed, on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7d8a9324f
>
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>



[ANN] org-jami-bot

2023-04-17 Thread Hanno Perrey


Dear fellow org-users,

I have just released two new packages that scratch an old itch of mine:
capturing thoughts, quick notes and URLs while "on the road" with only
my mobile phone around. Messaging myself feels most natural, so that is
what I went with: triggering a capture via GNU Jami, the distributed
private messenger.

The first package, =jami-bot= provides something of a framework to
handle incoming text and file messages. =org-jami-bot= provides hooks
and functions that extend this to Org mode captures. Any text or file is
being captured, but even simple commands (prefixed with '!') are
possible, for example:

#+begin_example
!schedule monday
buy oat milk
#+end_example

Schedules a todo entry for next monday.

#+begin_example
!url blog emacs news
https://sachachua.com/blog/2023/04/2023-04-17-emacs-news/
#+end_example

Uses =org-capture-ref= to capture the URL and tags it with
:blog:emacs:news:.

This last command is technically not part of =org-jami-bot= as it
requires =org-capture-ref= to be installed and configured -- but it only
takes relatively little code to realize and I have documented it in a
blog post: https://www.hoowl.se/org-capture-ref-jami-bot.html

Further extensions are quite easily possible, I believe.

More examples and detailed documentation can be found here:
https://www.hoowl.se/org-jami-bot.html


The code to both packages will eventually be on Melpa, but for now it
can be found here:
https://gitlab.com/hperrey/jami-bot
https://gitlab.com/hperrey/org-jami-bot


Feedback, comments and ideas for further development are welcome!


Thanks and cheers,

Hanno

--
Hanno Perrey
https://hoowl.se



Re: [PATCH] Async evaluation in ob-shell

2023-04-17 Thread Ihor Radchenko
Matt  writes:

>  > Thanks, but I am not seeing 6c9104f59.
>
> I'm sorry, I was unclear about which repo these commits were in.  ORG-NEWS 
> was updated here: 
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6c9104f59ca8085abe477a81857548461bf88f23

Now, see. I was again confused by savannah interface...
Thanks for the clarification!

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Async evaluation in ob-shell

2023-04-17 Thread Matt


  On Mon, 17 Apr 2023 14:53:18 -0400  Ihor Radchenko  wrote --- 
 > Matt m...@excalamus.com> writes:
 > 
 > >  > A small note on the WORG page: it may be more natural to use :async yes
 > >  > rather than :async t. Both are viable - in fact, anything other than
 > >  > :async no and :async none will be treated as "t".
 > >
 > > Updated WORG with commits 9d153ea4, 754c72cb, and 18333299.  Updated 
 > > ORG-NEWS with 6c9104f59.
 > 
 > Thanks, but I am not seeing 6c9104f59.

I'm sorry, I was unclear about which repo these commits were in.  ORG-NEWS was 
updated here: 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6c9104f59ca8085abe477a81857548461bf88f23



Re: [PATCH] Async evaluation in ob-shell

2023-04-17 Thread Ihor Radchenko
Matt  writes:

>  > A small note on the WORG page: it may be more natural to use :async yes
>  > rather than :async t. Both are viable - in fact, anything other than
>  > :async no and :async none will be treated as "t".
>
> Updated WORG with commits 9d153ea4, 754c72cb, and 18333299.  Updated ORG-NEWS 
> with 6c9104f59.

Thanks, but I am not seeing 6c9104f59.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[BUG] ob-R tests fail on Emacs 27 since ESS commit 536b5b914a7 [9.7-pre (release_9.6.4-318-gcfe5e0.dirty @ /home/yantar92/.emacs.d/straight/build/org/)]

2023-04-17 Thread Ihor Radchenko


Steps to reproduce:

1. cd /path/to/org/git/repo
2. make test EMACS=emacs-27 BTEST_POST="-L /path/to/ESS/lisp -l ob-R -l ess -l 
ess-r-mode" BTEST_RE="async"

3 unexpected results:
   FAILED  ob-session-async-R-named-output
   FAILED  ob-session-async-R-output-drawer
   FAILED  ob-session-async-R-simple-session-async-output

The tests started failing since 2023/04/04.
https://builds.sr.ht/~bzg/job/968099

I bisected the failure down to the following ESS commit:

536b5b914a75afa37ee05aa8ba0aecd0f9c9eb33
Author: Lionel Henry 
AuthorDate: Mon Apr 3 13:01:11 2023 +0200
Commit: Lionel Henry 
CommitDate: Mon Apr 3 13:01:11 2023 +0200

Parent: fef059c3 Wait for process after `ess-r-post-run-hook`
Contained:  master
Follows:ESSRv1.8 (21)

Move `ess-r` startup commands out of `ess-r-post-run-hook`

They are blocking commands and the user might have added streaming
commands to the hook.

Also document why users should be careful when mixing blocking and
streaming commands.

--

I am not sure what is going on as ob-R does not really use the changed
hooks. The suspects are

(ess-execute-screen-options t)
(ess-set-working-directory default-directory)))

In particular, I think that `ess-execute-screen-options' is doing
something funny because one of the tests fails with

"1:5" outputting

 1 2 3
 4 5

split into two lines, which looks like some text filling problem.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[test] org-colview/org-columns

2023-04-17 Thread Sławomir Grochowski
Dear All,

I'm trying to better understand 'org-colview/org-columns'.
So I wrote some tests. File in attachment.
I hope the commit message is correct.

I will be very grateful for your comments & feedback on what can be done
better.

Regards,
Sławomir Grochowski
From 2768ecfd896d2dd950b23f0134a3779523479d35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Mon, 17 Apr 2023 19:18:16 +0200
Subject: [PATCH] testing/lisp/test-org-colview.el: Add tests

* test-org-colview.el (test-org-colview/uncompile-format,
test-org-colview/compile-format): Add tests for functions:
org-columns-uncompile-format & org-columns-compile-format
---
 testing/lisp/test-org-colview.el | 66 
 1 file changed, 66 insertions(+)

diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index 9daec18e2..a80763622 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -26,6 +26,72 @@
 (require 'org-duration)
 (require 'org-inlinetask)
 
+(ert-deftest test-org-colview/uncompile-format ()
+  "Test `org-columns-uncompile-format' specifications."
+  ;; With minimum data, one element
+  (should
+   (equal "%ITEM"
+  (org-columns-uncompile-format '(("ITEM" "ITEM" nil nil nil)
+  ;; With minimum data, two element
+  (should
+   (equal "%ITEM %TODO"
+  (org-columns-uncompile-format
+   `(("ITEM" "ITEM" nil nil nil) ("TODO" "TODO" nil nil nil)
+  ;; Read width
+  (should
+   (equal "%10ITEM"
+  (org-columns-uncompile-format `(("ITEM" "ITEM" 10 nil nil)
+  ;; Read title
+  (should
+   (equal "%ITEM(some title)"
+  (org-columns-uncompile-format `(("ITEM" "some title" nil nil nil)
+  ;; Read operator
+  (should
+   (equal "%ITEM{+}"
+  (org-columns-uncompile-format `(("ITEM" "ITEM" nil "+" nil)
+  ;; Read operator printf
+  (should
+   (equal "%ITEM{+;%.1f}"
+  (org-columns-uncompile-format  `(("ITEM" "ITEM" nil "+" "%.1f"))
+
+(ert-deftest test-org-colview/compile-format ()
+  "Test `org-columns-compile-format' specifications."
+  ;; With minimum data, one element
+  (should
+   (equal `(("ITEM" "ITEM" nil nil nil))
+  (org-columns-compile-format
+   "%ITEM")))
+  ;; With minimum data, two element
+  (should
+   (equal `(("ITEM" "ITEM" nil nil nil) ("TODO" "TODO" nil nil nil))
+  (org-columns-compile-format
+   "%ITEM %TODO")))
+  ;; Read width
+  (should
+   (equal `(("ITEM" "ITEM" 10 nil nil))
+  (org-columns-compile-format
+   "%10ITEM")))
+  ;; Upcase property name
+  (should
+   (equal `(("ITEM" "item" nil nil nil))
+  (org-columns-compile-format
+   "%item")))
+  ;; Read title
+  (should
+   (equal `(("ITEM" "some title" nil nil nil))
+  (org-columns-compile-format
+   "%ITEM(some title)")))
+  ;; Read operator
+  (should
+   (equal `(("ITEM" "ITEM" nil "+" nil))
+  (org-columns-compile-format
+   "%ITEM{+}")))
+  ;; Read operator printf
+  (should
+   (equal `(("ITEM" "ITEM" nil "+" "%.1f"))
+  (org-columns-compile-format
+   "%ITEM{+;%.1f}"
+
 (ert-deftest test-org-colview/get-format ()
   "Test `org-columns-get-format' specifications."
   ;; Without any clue, use `org-columns-default-format'.
-- 
2.30.2



Re: [PATCH v2] Add compat.el support to Org (was: [POLL] Use compat.el in Org? (was: Useful package? Compat.el))

2023-04-17 Thread Max Nikulin

On 13/04/2023 19:42, Ihor Radchenko wrote:

Max Nikulin writes:
My expectation 
is that make does not attempt to manage dependencies. For me it is OK to 
type an additional command to install them and to fail otherwise.


Sure. And you will have such option (EFLAGS).
However, I decided to enable auto-downloading by default to not break
the previous working compilation instructions.


For me adding external dependencies is strong enough reason to change 
compiling instructions. My vote is for clear separation of dependency 
management (even if performed through make targets) and 
compiling/testing/etc.


Last years I rarely use make directly to build software besides the 
cases when I am involved in development. I strongly prefer .deb 
packages. Earlier it was usual practice that "make" or "make all" failed 
if dependencies were not provided. Actually often it was configure that 
reported unavailable libraries. So network requests may be more 
surprising for users than failures due to missed dependencies. It is OK 
for e.g. gradle, but not for make to fetch packages. I expect that 
maintainers of packages from Linux distributions would prefer to avoid 
mixing of compiling and loading dependencies as well.


In my opinion, ideally there should be 3 options for dependency management:
1. Completely disabled. If load from default paths failed than it is a 
fatal error.
2. Use specified directory outside of Org tree (~/.emacs.d/elpa by 
default) or any other directory that you named pkgdir. Only dedicated 
target may clean this directory.

3. Install packages to Org source/build directory.

You decided to make 3 the default variant. I believe, it should be 
activated by a variable, e.g. AUTODEP = 1 in local.mk or from command 
line "make compile AUTODEP=1


I think, it is better to require an additional command

make autoloads
make fetch-dependencies
make compile


+package-install = --eval '(unless (require '"'"'$(package) nil t) (message "%s" 
load-path) (package-install '"'"'$(package)))'


I do not like that versions of dependencies are ignored. I have noticed 
`package-install-from-buffer'. Perhaps it can be used to generate a stub 
package (e.g. org-build-deps) with Package-Requires line obtained from 
org.el. The only purpose of this package is to pull dependencies. It is 
just an idea, I have not tried such approach.



$(FIND) $(pkgdir) -name \*.elc -delete


Looks fine, except that now we have part of the targets using $RM
variable and part of the targets ignoring it. I am not sure if it is a
problem. I am slightly in favour of keeping the existing approach with
$RM.


I have realized that -delete action is not a part of POSIX 
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html
Anyway you removed this line and I like it since I suspected some issues 
when "make compile" is invoked twice.



Is there a way to express (or (compat "29.1.4.1") (emacs "28.1")) to
avoid installing compat in the case of sufficiently new emacs? E.g.
dpkg/apt allows such alternatives.


No, AFAIK:


It is sour. Another deficiency of Emacs package management is that 
errors during compiling of dependencies do not cause immediate failure 
of make.



+EMACS_VERSION := $(shell $(EMACS) -Q --batch --eval '(message "%s" emacs-version)' 
2>&1)


Ideally $(BATCH) should be used, but it is defined below. (princ 
emacs-version) is an alternative, but I have not idea which variant is 
better.



-;; Package-Requires: ((emacs "26.1") (compat "29.1.4.1"))
+;; Package-Requires: ((emacs "26.1") (compat "29.1.3.2"))


thanks


Subject: [PATCH 3/7] Use compat.el library instead of ad-hoc compatibility
 function set

* mk/default.mk (EPACKAGES): Demand compat library during compile time.


when I asked for more granular commits I expected this change in


Subject: [PATCH 2/7] org-compat: Enable compat.el


To separate adding dependency and replacing org-compat functions to compat.

Earlier I used the following procedure: git rebase -i, mark some commit 
for edit, git gui, unstage lines from commit, create new commit, reorder 
and squash/fixup commits on next iteration of rebase -i. Perhaps magit 
can do the same tricks as "git gui". If all changes of some file should 
be moved to another commit it should be easier to use git checkout 
COMMIT FILE.





Re: [PATCH] Async evaluation in ob-shell

2023-04-17 Thread Matt


  On Fri, 24 Mar 2023 05:11:38 -0400  Ihor Radchenko  wrote --- 
 > Matt m...@excalamus.com> writes:
 > 
 > >   On Thu, 23 Mar 2023 07:48:44 -0400  Ihor Radchenko  wrote --- 
 > >  > May you also document this new feature in ORG-NEWS and in
 > >  > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-shell.html ?
 > >
 > > Done.
 > 
 > A small note on the WORG page: it may be more natural to use :async yes
 > rather than :async t. Both are viable - in fact, anything other than
 > :async no and :async none will be treated as "t".

Updated WORG with commits 9d153ea4, 754c72cb, and 18333299.  Updated ORG-NEWS 
with 6c9104f59.



Re: Hyphen after LaTeX fragments

2023-04-17 Thread Dominik Schrempf
Great, thank you so much!

Ihor Radchenko  writes:

> Ihor Radchenko  writes:
>
>> Yuchen Guo  writes:
>>
>>> If it is deprecated in Org mode, maybe we can print a warning message in
>>> echo area?
>>
>> Not in echo area, but we can add a linter.
>
> Applied, onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cfe5e01e1



Re: [BUG] No font lock in src blocks for shells in org-babel-shell-names (was Re: Font lock for org-babel shell scripts?)

2023-04-17 Thread Ihor Radchenko
Matt  writes:

> I was able to resolve it by simply requiring `sh-script' in `org-src'.  
> Committed and pushed.

Note that it will break Emacs 26.
Which will fix itself once we merge compat.el support.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] No font lock in src blocks for shells in org-babel-shell-names (was Re: Font lock for org-babel shell scripts?)

2023-04-17 Thread Matt


  On Fri, 07 Apr 2023 11:29:59 -0400  Matt  wrote --- 
 > 
 >   On Tue, 04 Apr 2023 08:30:34 -0400  Ihor Radchenko  wrote --- 
 > 
 >  > See the attached tentative patch.
 > 
 > After applying the patch, I get the following error when trying to load 
 > Emacs:
 > 
 > Warning (comp): /home/ahab/Projects/org-mode/lisp/org.el: Error: Symbol's 
 > value as variable is void sh-ancestor-alist
 > 
 > I wasn't able to resolve it.  I suspect the issue is on my end, such as a 
 > mixed install or the need to  re-byte-compile  `sh-script.el'.  

I was able to resolve it by simply requiring `sh-script' in `org-src'.  
Committed and pushed.



Re: Hyphen after LaTeX fragments

2023-04-17 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Yuchen Guo  writes:
>
>> If it is deprecated in Org mode, maybe we can print a warning message in
>> echo area?
>
> Not in echo area, but we can add a linter.

Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cfe5e01e1

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Feature request: Allow export to convert broken links to plain text

2023-04-17 Thread Ihor Radchenko
Janek Fischer  writes:

> I am looking for exactly the feature in 
> https://lists.gnu.org/r/emacs-orgmode/2019-01/msg00203.html:
> I have a note with many links, but would like to export that note as landing 
> page as text stripped of links.
>
> Has there been any progress in the last 4 years on this,
> or any hint on how to get this now?

For example, you can make all the code throwing 'org-link-broken return
a list of (PATH LINK) instead of just PATH. Then, `org-export-data' and
`org-export-with-broken-links' may be modified to optionally do
something with the LINK object itself.

Patches welcome!

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Allow customizing commands affected by `org-fold-catch-invisible-edits' (was: Should we extend org-catch-invisible-edits to more interactive commands? (was: Catching invisible edits: probl

2023-04-17 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Subject: [PATCH] org-fold: Allow customizing commands where invisible edits
>  are checked

Applied, onto main.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Allow customizing commands affected by `org-fold-catch-invisible-edits' (was: Should we extend org-catch-invisible-edits to more interactive commands? (was: Catching invisible edits: probl

2023-04-17 Thread Ihor Radchenko
alain.coch...@unistra.fr writes:

> However, I could not have it work for my case so far.  I tried to add
> "(undo . insert)", "(undo . delete-backward)" and "(undo . delete)" to
> 'org-fold-catch-invisible-edits-commands', one by one and together,
> and all values of 'org-fold-catch-invisible-edits'.  Any clue of what
> I am doing wrong?  Thanks.

What can be reasonably done here is revealing edits, when they are done
inside folded text. Do you think that adding such an option to Org would
be useful?

Note that we cannot easily prevent edits inside invisible region because
some edits may start in visible text and then continue inside invisible
- aborting only invisible part of the edit will cause partial edited
state, which is terrible idea.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] lisp/org-id.el: Add new relative timestamp feature for `ts' `org-id-method'

2023-04-17 Thread Ihor Radchenko
ferns...@fernseed.me writes:

> * etc/ORG-NEWS (New relative timestamp feature now available for the
> ~ts~ ~org-id-method~): Document the new feature.
> ---
> This patch introduces a new feature for the `ts` method specified by
> `org-id-method' that allows for the creation IDs with relative
> timestamps. This is my first patch for Emacs/Org mode. I have just
> started the FSF copyright assignment process.

Thanks for the patch!

Several high-level comments:
1. Instead of manually searching for keywords, please use `org-collect-keywords'
2. It will make sense to allow properties, not just keywords, to be the
   source of time.
3. Currently, `org-id-new' can be called outside Org mode buffers.
   With your new ID method, `org-id-new' may fail with error in non-Org
   buffers.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] ob-js "SyntaxError: Unexpected end of input" when code block ends with comment

2023-04-17 Thread Ihor Radchenko
sgherdao--- via "General discussions about Org-mode."
 writes:

> The following code snippet fails to execute
>
> #+begin_src js
> console.log("Hello Friends!");
> // -> logs "Hello Friends"
> #+end_src
>
> I encounter the following error message:
>
> #+begin_src text
> /tmp/js-script-dn2Wrp:2
> // -> logs "Hello Friends"}()));
>
> SyntaxError: Unexpected end of input
> ...
> As a simple fix, I have added a \n after %s
>
> #+begin_src emacs-lisp
> (defvar org-babel-js-function-wrapper
>   
> "require('process').stdout.write(require('util').inspect(function(){%s\n}()));"
>   "Javascript code to print value of body.")
> #+end_src

Thanks for reporting and providing a fix!
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7d8a9324f

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] Org publish makeindex doesn't work on symlinked path [9.6.4 ( @ /home/bence/src/org-mode/lisp/)]

2023-04-17 Thread Ihor Radchenko
Bence Fábián  writes:

> When performing an `org-publish' if the `:base-directory' property
> contians a symlink in its path, then the `theindex.inc' file is not
> populated.
>
> I created a repo to help reproduce the bug:
> https://github.com/bencef/org-publish-symlink-repro

I tried to reproduce starting from emacs -Q, and I am unable to.

I did
1. cd /tmp
2. git clone https://github.com/bencef/org-publish-symlink-repro
3. cd org-publish-symlink-repro
4. ln -sf /tmp/org-publish-symlink-repro/long/path/to ./shortcut 
5. emacs -Q /path/to/README.org
6. Open the second relative file link
7. C-c C-e C-f P x  

All the files are published correctly, including the index.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] org-cite-activate causes org-fontify-like-in-org-mode to fail for a citation [9.6.4]

2023-04-17 Thread Ihor Radchenko
Lin Jian  writes:

> font-lock-default-fontify-region: End of buffer
>
> 6. I think the message in step 5 is a bug.  If this bug is fixed, we
> should see this in the *Message* buffer instead:
> ...
> At the end of [2], (match-beginning 0) is 1.  At the end of [3],
> (match-beginning 0) is changed to 35 by split-string.  So, [4] is nil.
> As a result, [5] runs, which causes an end-of-buffer error.
>
> I propose wrapping the whole let[6] in save-match-data to fix this bug.

Thanks fore reporting and debugging!
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c827341df

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] Org-9.6.x org templates hang on 'clipboard pasted as level 2 subtree'...

2023-04-17 Thread Carlo Tambuatco
I've decided to delete the org-9.6 folder entirely and go with the
built-in org-9.5.5 that comes with my emacs distribution, emacs-28.2 (9.0).

Maybe for some reason newer versions of org are just incompatible with
my version of emacs 28.2. Maybe the version of emacs you're using is
newer or somehow more compatible with these bleeding edge development
versions of org-mode, but I suppose when I upgrade my emacs the version
of org that comes with it (9.6, I suppose) will just work out of the box.

At any rate, I can't spend any more time and energy on this. I'll stick to
what works. Thanks for the help.

On Sun, Apr 16, 2023 at 8:09 AM Ihor Radchenko  wrote:

> Carlo Tambuatco  writes:
>
> > I restarted emacs with org 9.6.3 and reloaded it uncompiled and
> > did M-x toggle-debug-on-error to turn on backtrace on error.
> >
> > I have also attached a copy of what my org-capture-templates
> > variable looks like.
> >
> > Comparing these backtraces to my org-capture-templates,
> > you can see that only some of them fail (the ones corresponding to
> > 'd', 'e', 'r', 'Rr', 'Rg', and 'Cc')
> >
> > They all worked up until Org 9.6. They still work under Org 9.5.5, so
> > I don't know what changed.
>
> I tried your templates locally and I am not seeing any problem.
>
> May you try to reproduce starting from emacs -Q?
> Or, alternatively, try to use the following version of Org capture, use
> C-g to exit, and report the (hopefully) more detailed backtrace.
>
> (defun org-capture ( goto keys)
>   "Capture something.
> \\
> This will let you select a template from `org-capture-templates', and
> then file the newly captured information.  The text is immediately
> inserted at the target location, and an indirect buffer is shown where
> you can edit it.  Pressing `\\[org-capture-finalize]' brings you back to
> the \
> previous
> state of Emacs, so that you can continue your work.
>
> When called interactively with a `\\[universal-argument]' prefix argument \
> GOTO, don't
> capture anything, just go to the file/headline where the selected
> template stores its notes.
>
> With a `\\[universal-argument] \\[universal-argument]' prefix argument, go
> to \
> the last note stored.
>
> When called with a `C-0' (zero) prefix, insert a template at point.
>
> When called with a `C-1' (one) prefix, force prompting for a date when
> a datetree entry is made.
>
> ELisp programs can set KEYS to a string associated with a template
> in `org-capture-templates'.  In this case, interactive selection
> will be bypassed.
>
> If `org-capture-use-agenda-date' is non-nil, capturing from the
> agenda will use the date at point as the default date.  Then, a
> `C-1' prefix will tell the capture process to use the HH:MM time
> of the day at point (if any) or the current HH:MM time."
>   (interactive "P")
>   (when (and org-capture-use-agenda-date
>  (eq major-mode 'org-agenda-mode))
> (setq org-overriding-default-time
>   (org-get-cursor-date (equal goto 1
>   (cond
>((equal goto '(4))  (org-capture-goto-target keys))
>((equal goto '(16)) (org-capture-goto-last-stored))
>(t
> (let* ((orig-buf (current-buffer))
>(annotation (if (and (boundp
> 'org-capture-link-is-already-stored)
> org-capture-link-is-already-stored)
>(plist-get org-store-link-plist :annotation)
>  (ignore-errors (org-store-link nil
>(entry (or org-capture-entry (org-capture-select-template
> keys)))
>initial)
>   (setq initial (or org-capture-initial
> (and (org-region-active-p)
>  (buffer-substring (point) (mark)
>   (when (stringp initial)
> (remove-text-properties 0 (length initial) '(read-only t) initial))
>   (when (stringp annotation)
> (remove-text-properties 0 (length annotation)
> '(read-only t) annotation))
>   (cond
>((equal entry "C")
> (customize-variable 'org-capture-templates))
>((equal entry "q")
> (user-error "Abort"))
>(t
> (org-capture-set-plist entry)
> (org-capture-get-template)
> (org-capture-put :original-buffer orig-buf
>  :original-file (or (buffer-file-name orig-buf)
> (and (featurep 'dired)
>  (car (rassq orig-buf
>
>  dired-buffers
>  :original-file-nondirectory
>  (and (buffer-file-name orig-buf)
>   (file-name-nondirectory
>(buffer-file-name orig-buf)))
>  :annotation annotation
>  :initial initial
>  :return-to-wconf (current-window-configuration)
>  :default-time (or 

Re: Command not found when using Org + Guix + envrc.el

2023-04-17 Thread Ihor Radchenko
Fabio Natali  writes:

> - Emacs and Org
> - Guix, to install the dependencies and create a development environment
> - direnv, to automatically load the Guix environment
> - envrc.el, to use direnv from Emacs
> ...
> However, things don't work as expected when using emacsclient with an
> existing Emacs server. Thanks to envrc.el the Guix environment gets
> apparently activated in the buffer, as confirmed by the envrc flag in
> the modeline and by the output of =(getenv "PATH")=. However, evaluating
> the block results in the following error:
>
> #+begin_quote
> /bin/bash: line 1: python: command not found
> [ Babel evaluation exited with code 127 ]
> #+end_quote

An ugly workaround could be using :python header argument to explicitly
set the python path.

Org babel uses a temporary buffer + `process-file' to evaluate code
blocks with no session. The current directory is being set by
let-binding `default-directory'. You can look into
`org-babel-execute-src-block' (sets `default-directory') ->
"(funcall cmd body params)" -> `org-babel-execute:python' ->
`org-babel-python-evaluate' ->
`org-babel-python-evaluate-external-process' -> `org-babel-eval' ->
`org-babel--shell-command-on-region' -> `process-file' call chain and
check where the envrc settings get lost.

I am unsure how and why the Org's approach is not working together with
envrc.el. It might be helpful to add envrc devs into the loop or debug
things yourself.

> Tangentially, if the block's header includes =:session=, as in
> =#+begin_src python :session=, then the error is slightly different and
> is displayed in the minibuffer as opposed to a separate buffer:
>
> #+begin_quote
> make-process--with-editor-process-filter: Searching for program: No such file 
> or directory, python
> #+end_quote

This looks like "with-editor" package doing something funny. Not Org.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[BUG] ob-js "SyntaxError: Unexpected end of input" when code block ends with comment

2023-04-17 Thread General discussions about Org-mode.
Hello,

I would like to report a bug, I am using the following versions

GNU Emacs 28.2
Org mode version 9.6.1
Node v19.9.0


The following code snippet fails to execute

#+begin_src js
console.log("Hello Friends!");
// -> logs "Hello Friends"
#+end_src

I encounter the following error message:

#+begin_src text
/tmp/js-script-dn2Wrp:2
// -> logs "Hello Friends"}()));

SyntaxError: Unexpected end of input
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1195:20)
    at Module._compile (node:internal/modules/cjs/loader:1239:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Function.executeUserEntryPoint [as runMain] 
(node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47
#+end_src


Upon further inspection, I found that the generated JavaScript code in the tmp 
file contains an unbalanced brace and parentheses, as shown below:


#+begin_src js
require('process').stdout.write(require('util').inspect(function(){console.log("Hello
 Friends!");
// -> logs "Hello Friends"}()));
#+end_src


Since the last line of the code snippet contains a comment the brace and parens 
are unbalanced
This seems to point to the way the following variable is defined in ob-js.el


#+begin_src emacs-lisp
(defvar org-babel-js-function-wrapper
  "require('process').stdout.write(require('util').inspect(function(){%s}()));"
  "Javascript code to print value of body.")
#+end_src

As a simple fix, I have added a \n after %s

#+begin_src emacs-lisp
(defvar org-babel-js-function-wrapper
  
"require('process').stdout.write(require('util').inspect(function(){%s\n}()));"
  "Javascript code to print value of body.")
#+end_src


Please let me know if you need any additional information or if there's 
anything else I can do to help resolve this issue.


Best regards,
--
Salah



[BUG] Org publish makeindex doesn't work on symlinked path [9.6.4 ( @ /home/bence/src/org-mode/lisp/)]

2023-04-17 Thread Bence Fábián
Hi,

When performing an `org-publish' if the `:base-directory' property
contians a symlink in its path, then the `theindex.inc' file is not
populated.

I created a repo to help reproduce the bug:
https://github.com/bencef/org-publish-symlink-repro

Please see version information below.

Best Regards,
Bence





Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit,
cairo version 1.16.0, Xaw3d scroll bars)
Package: Org mode version 9.6.4 ( @ /home/bence/src/org-mode/lisp/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function '(closure
  (org-id-locations org-agenda-search-view-always-boolean
org-agenda-overriding-header t)
  (entry) (cdr (assq :title entry)))
 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-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
org-cycle-optimize-window-after-visibility-change
 org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '((closure
 (org--rds reftex-docstruct-symbol org--single-lines-list-is-paragraph
org-element-greater-elements
  visual-fill-column-width org-clock-history org-agenda-current-date
org-with-time org-defdecode org-def
  org-read-date-inactive org-ans2 org-ans1
org-columns-current-fmt-compiled org-clock-current-task
  org-clock-effort org-agenda-skip-function
org-agenda-skip-comment-trees org-agenda-archives-mode
  org-end-time-was-given org-time-was-given org-log-note-extra
org-log-note-purpose org-log-post-message
  org-last-inserted-timestamp org-last-changed-timestamp
org-entry-property-inherited-from org-state
  org-agenda-headline-snapshot-before-repeat org-agenda-buffer-name
org-agenda-start-on-weekday
  org-agenda-buffer-tmp-name org-priority-regexp org-mode-abbrev-table
org-mode-syntax-table
  org-element-cache-persistent buffer-face-mode-face org-tbl-menu
org-org-menu org-struct-menu org-entities
  org-last-state org-id-track-globally org-clock-start-time
texmathp-why remember-data-file
  org-agenda-tags-todo-honor-ignore-options calc-embedded-open-mode
calc-embedded-open-formula
  calc-embedded-close-formula align-mode-rules-list org-emphasis-alist
org-emphasis-regexp-components
  org-export-registered-backends org-modules crm-separator
org-babel-load-languages org-id-overriding-file-name
  org-indent-indentation-per-level org-element--timestamp-regexp
org-element-cache-map-continue-from
  org-element-paragraph-separate org-agenda-buffer-name
org-inlinetask-min-level t)
 nil (add-hook 'change-major-mode-hook 'org-fold-show-all 'append 'local))
(closure
 (org-src-window-setup *this* org-babel-confirm-evaluate-answer-no
org-babel-tangle-uncomment-comments
  org-src-preserve-indentation org-src-lang-modes
org-edit-src-content-indentation org-babel-library-of-babel t)
 nil (add-hook 'change-major-mode-hook #'org-babel-show-result-all
'append 'local))
org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-confirm-shell-link-function 'yes-or-no-p
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-persist-directory "/run/user/1000/org-persist-oW4EqF"
 org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 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)
  ("eww" :follow org-eww-open :store org-eww-store-link)
  ("rmail" :follow org-rmail-open :store org-rmail-store-link)
  ("mhe" :follow org-mhe-open :store org-mhe-store-link)
  ("irc" :follow org-irc-visit :store org-irc-store-link :export
org-irc-export)
  ("info" :follow org-info-open :export org-info-export :store
org-info-store-link :insert-description
org-info-description-as-command)
  ("gnus" :follow org-gnus-open :store org-gnus-store-link)
  ("docview" :follow org-docview-open :export org-docview-export
:store org-docview-store-link)
  ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
 

[BUG] org-cite-activate causes org-fontify-like-in-org-mode to fail for a citation [9.6.4]

2023-04-17 Thread Lin Jian


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Steps to reproduce this bug:
0. emacs -q
1. (require 'org)
2. (setq org-cite-global-bibliography '("/path/to/references.bib"))
3. Here is the content of /path/to/references.bib:

@article{23-access-aalope,
  author   = {Valentine Aalo and
  Kostas P. Peppas and
  George P. Efthymoglou},
  title= {Performance Analysis of Beacon-Assisted Wireless Powered 
Communications
  With Spatially Random Sensors},
  journal  = {{IEEE} Access},
  volume   = {11},
  pages= {12754--12763},
  year = {2023},
  url  = {https://doi.org/10.1109/ACCESS.2023.3241755},
  doi  = {10.1109/ACCESS.2023.3241755},
  timestamp= {Sat, 25 Feb 2023 21:34:36 +0100},
  biburl   = {https://dblp.org/rec/journals/access/AaloPE23.bib},
  bibsource= {dblp computer science bibliography, https://dblp.org}
}

4. (org-fontify-like-in-org-mode "[cite:@23-access-aalope]")
5. check the *Message* buffer and you will see:

font-lock-default-fontify-region: End of buffer

6. I think the message in step 5 is a bug.  If this bug is fixed, we
should see this in the *Message* buffer instead:

#("[cite:@23-access-aalope]" 0 6 (font-lock-multiline t face org-cite) 6 23 
(font-lock-multiline t face (org-cite-key org-cite) mouse-face highlight 
help-echo "Valentine Aalo, Kostas P. Peppas, George P. Efthymoglou. Performance 
Analysis of Beacon-Assisted Wireless Powered Communications With Spatially 
Random Sensors, {IEEE} Access, 2023." keymap (keymap (mouse-1 . 
org-open-at-point))) 23 24 (font-lock-multiline t face org-cite))

Bellow is my findings of this bug.

(org-fontify-like-in-org-mode)
-> (font-lock-ensure)
  -> ...
-> (font-lock-fontify-keywords-region) ;; [1]
  -> (org-cite-activate) ;; [2]
-> (org-cite-basic-activate)
  -> (org-cite-basic--print-entry)
-> (org-cite-basic--shorten-names)
  -> (split-string) ;; match data is changed here
-> ...
  -> (org-cite-activate) ;; [3]
-> (font-lock-fontify-keywords-region) ;; [4] [5]

At the end of [2], (match-beginning 0) is 1.  At the end of [3],
(match-beginning 0) is changed to 35 by split-string.  So, [4] is nil.
As a result, [5] runs, which causes an end-of-buffer error.

I propose wrapping the whole let[6] in save-match-data to fix this bug.

[1]: 
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/font-lock.el?h=emacs-28.2#n1760
[2]: 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/oc.el?h=release_9.6.4#n1231
[3]: 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/oc.el?h=release_9.6.4#n1235
[4]: 
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/font-lock.el?h=emacs-28.2#n1763
[5]: 
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/font-lock.el?h=emacs-28.2#n1764
[6]: 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/oc.el?h=release_9.6.4#n1232

Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 
1.16.0, Xaw3d scroll bars)
Package: Org mode version 9.6.4



Re: capturing and filling

2023-04-17 Thread Max Nikulin

On 15/04/2023 08:36, Samuel Wales wrote:

i am very sorry, i got myself in over my head.  i do not undestrand
what you are suggesting.  if a change on the ff side i cannot do it,
bu perhaps you are suggesting making emac pop up an x seector that
chooses the filing option.


My idea is to setup as org-protocol: URI handler a simple script (e.g. 
shell) that displays a GUI dialog what template should be used, modifies 
the received URI to set = parameter, and passes the URI to 
emacsclient. There is a number of GUI dialog utilities for using from 
shell scripts: zenity, kdialog, gxmessage, yad, etc. Such implementation 
does not require any modification of browser extension or Org code.





Re: A dream?

2023-04-17 Thread Jean Louis
* Eduardo Ochs  [2023-04-16 01:45]:
> do you have a page in https://gnu.support/ explaining in detail how
> you teach Emacs to beginners? It would be nice to have something like
> that...

I just tell them to do Emacs Tutorial. There is no need for page when
it is built-in.

I tell them, open Emacs and do the tutorial, then let me know. Later
we do not talk much, we just do the work.

> Btw, I've taught Emacs to beginners many times, but as "Emacs-the-
> Lisp-environment", not as "Emacs-the-editor"... in some cases, like in
> LaTeX workshops, lots of students who had never used Emacs before were
> happily writing their own one-line elisp hyperlinks and defuns after
> just one hour, but in some other cases my approach failed miserably...

Answer is simple:
(info "(eintr) Top")

You could use that as curriculum for the workshop. 

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: A dream?

2023-04-17 Thread Jean Louis
* Christopher Dimech  [2023-04-15 22:37]:
> 
> > Sent: Saturday, April 15, 2023 at 2:16 PM
> > From: "Jean Louis" 
> > To: "George Mauer" 
> > Cc: emacs-orgmode@gnu.org
> > Subject: Re: A dream?
> >
> > * George Mauer  [2023-04-03 18:17]:
> > > Emacs is a complex tool that itself can take a semester or more to get
> > > productive in. I know I myself tried for years to move to it and was only
> > > able to after learning vim bindings pretty well, and starting to use
> > > Spacemacs. Forcing students to use emacs, much less org - especially in
> > > this day and age where students *will* ask online, and *will* get a
> > > response of "no one actually uses that" - will probably meet with a ton of
> > > resistance.
> 
> We ran it on the International Space Station.  If that is the response of 
> students,
> then they are lame bro,

My child of 11 years writes fantasy book using Emacs, and I did not
teach him at all how to use it, he just learned it on different
computer himself.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/