Re: How to set latex preview font to regular instead of italics?

2022-11-05 Thread Ihor Radchenko
Mati  writes:

> As in subject, I can't find any info with search engine. Latex preview 
> is (imho) ugly italic. Is there an easy way to make it regular?

It would help if you provided more details on what you tried, including
your original Org file and the screenshots.
See https://orgmode.org/manual/Feedback.html#Feedback
I also suggest reading https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

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



Re: Interest in an Org video meetup?

2022-11-05 Thread Ihor Radchenko
Russell Adams  writes:

> Would there be any interest in a monthly 1-2 hour long ad-hoc screen
> sharing and video discussion for Org-mode?
>
> I'm offering to schedule and moderate the first few events. I'd
> propose a Saturday meeting in the afternoon European time to cover EU
> and NA.
>
> I'm considering using Jitsi, or maybe GNU Jami.
>
> Topics could include Q, demonstrations of features, interactive
> troubleshooting, etc. I hadn't considered presentations, but
> that could be an option too.
>
> Comments?

There seems to be general interest.

Do you plan to start the meetups any time soon?
If you do, we may also ask Timothy to announce it during his "This year
in Org" talk at Emacsconf.

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



Re: [PATCH] Re: Update Org to MathJax 3

2022-11-05 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Rudolf Adamkovič  writes:
>
>> Good points; I will fix everything.
>
> Please see the attached (3rd) revision of the patch.

Nothing is attached.
If you are using Emacs to send email, I suggest you to enable checks for
attachments, as I do in notmuch
(add-hook 'notmuch-mua-send-hook #'notmuch-mua-attachment-check)

I am sure that similar functionality exists in other Emacs mail clients.

> It seems that some part of the *batch* testing swallows the messages in
> a way that makes `(current-message)' work incorrectly in tests.
>
> Any ideas?  Asking for an Emacs veteran.  :)

AFAIK, `current-message' always returns nil in noninteractive batch
mode. Messages are written directly into stderr. You need to use a
different approach for testing.

> P.S. As a workaround I also tried to set `set-message-function',
> dependency-injection style, but it did not work either.

I do not think that this function is ever executed in noninteractive
mode either.

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



bug#53393: 29.0.50; org mode timestamp C-c C-c not updating day of week

2022-11-05 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Ihor Radchenko  writes:
>
>> Let's not use 00:00 times. This may fail the test in some unusual time
>> zones.
>
> Changed to 06:00.

Thanks!
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=eefb14f9fa73b07cb14a0429953fa55f9c78e1cf

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





[BUG] Escaping "<" and ">" inside math blocks when exporting to HTML/MathJax (was: Inequalities in math blocks)

2022-11-05 Thread Ihor Radchenko
Max Nikulin  writes:

> This is a reminder of an old bug. From my point of view it is serious 
> enough, but not release critical due to its age.
>
> &<> characters must be escaped as HTML entities when LaTeX snippets and 
> blocks are exported for MathJax
>
> Form my year-old notes:
> - =#+options: tex:verbatim= properly escapes symbols.
> - There are functions that performs such replacement in ox-html and 
> ox-odt, but `org-format-latex` resides in org.el, so some refactoring 
> and backward compatibility stubs are necessary.

>From my understanding, all we need is to fix `org-format-latex' by
calling `org-html-encode-plain-text'.

Could you please elaborate about refactoring and backward compatibility?

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



Re: [PATCH] Re: Maxima code blocks does not work in windows revisited

2022-11-05 Thread Ihor Radchenko
Leo Butler  writes:

>> I do not have a Windows machine to test and not motivated enough to
>> try Emacs in wine.
>
> Max, a minor modification of the test you sent earlier shows that when
> system-type is ms-dos, the placement does not matter (the command-line
> is the same); but for gnu/linux, placement matters and Eric is right
> (the command-lines are not the same and the dollar sign needs to be
> escaped).
>
> I have attached a patch that puts the dollar sign in the right place for
> both. The existing tests pass when running 'make test'.

Thanks for your contribution!
Applied onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9abf1b5167e94291eee7c1400277ed55993106f9

You are now also listed as an Org mode contributor.
https://git.sr.ht/~bzg/worg/commit/8750cbeccf4283be5ec7078f635f8328b2cbee09

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



Re: CI tests

2022-11-05 Thread Max Nikulin

On 06/11/2022 02:42, Christian Köstlin wrote:


 From time to time some tests fail, because the time when e.g. a
timestamp is written to the buffer is different to when the timestamp
is calculated in the test (the minute just flips there).


The testing/org-test.el file defines the `org-test-at-time' macro. 
Perhaps it may help.


I am unsure if I have seen such errors. I had impression of strange 
failures sometimes, but failure messages are not always clear enough to 
figure out the real problem.






bug#53393: 29.0.50; org mode timestamp C-c C-c not updating day of week

2022-11-05 Thread General discussions about Org-mode.
Ihor Radchenko  writes:

> Let's not use 00:00 times. This may fail the test in some unusual time
> zones.

Changed to 06:00.

>From e39e3fa3e58963e7ef15258ed267fa9ed0de936b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Thu, 3 Nov 2022 22:47:44 +0100
Subject: [PATCH] test-org-clock: Test DWIM update of days

* testing/listp/test-org-clock (test-org-clock/clock-drawer-dwim): Add
new test for DWIM updates of days for clocks in logbook drawers.

Reported-by: Bruce E. Robertson 
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=53393
---
 testing/lisp/test-org-clock.el | 16 
 1 file changed, 16 insertions(+)

diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index f992c8d7a..68286b174 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -273,6 +273,22 @@ the buffer."
   (org-log-into-drawer nil))
   (org-clock-drawer-name))
 
+(ert-deftest test-org-clock/clock-drawer-dwim ()
+  "Test DWIM update of days for clocks in logbook drawers."
+  (should (equal "* Foo
+:LOGBOOK:
+CLOCK: [2022-11-03 Thu 06:00]--[2022-11-03 Thu 06:01] =>  0:01
+:END:
+"
+ (org-test-with-temp-text
+ "* Foo
+:LOGBOOK:
+CLOCK: [2022-11-03 ??? 06:00]--[2022-11-03 ??? 06:01] =>  0:01
+:END:
+"
+   (org-ctrl-c-ctrl-c)
+   (buffer-string)
+
 
 ;;; Clocktable
 
-- 
2.38.1

-- 
"Simplicity is complexity resolved."
-- Constantin Brâncuși, 1876-1957

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


Re: View next 7 days of agenda, not next week

2022-11-05 Thread Quiliro Ordóñez
El 2022-11-05 15:51, Renato Pontefice escribió:
> With this command
> (org-agenda-list)
> (delete-other-windows)
> 
> My org-mode open with the present week days appointment and TODO
> 
> I would open with next 7 days view every day, not just on Monday.
> Is it possible?

Did you read the Org manual?



Re: [PATCH] Re: Update Org to MathJax 3

2022-11-05 Thread Rudolf Adamkovič
Rudolf Adamkovič  writes:

> Good points; I will fix everything.

Please see the attached (3rd) revision of the patch.

However, the tests still fail when ran via `make test'.  See below.

> Ihor Radchenko  writes:
>
>> Your tests are failing on my side...
>
> The tests *pass* when ran in-buffer but *fail* when ran via 'make
> test'.  Just the tests that call (current-message) have this problem.
> Interesting.

I cannot figure out why these tests pass when ran from inside of Emacs
but fail when ran via 'make tests'.  I found in `default.mk' that Make
runs `ert-run-tests-batch', but even that *passes* from within Emacs:

1. load `testing/org-test.el',

2. evaluate `ox-html/mathjax-legacy-scale-message-in-buffer` test in
`testing/lisp/test-ox-html.el', and

3. run `M-: ert-run-tests-batch'.

It produces the following output in the `*Messages*' buffer:

  Running 1 tests (2022-11-05 23:17:56+0100, selector ‘t’)
  Converting legacy MathJax scale: 20 to 0.2
 passed  1/1  ox-html/mathjax-legacy-scale-message-in-buffer (0.008186 sec)
  
  Ran 1 tests, 1 results as expected, 0 unexpected (2022-11-05 23:17:56+0100, 
0.010790 sec)

It seems that some part of the *batch* testing swallows the messages in
a way that makes `(current-message)' work incorrectly in tests.

Any ideas?  Asking for an Emacs veteran.  :)

P.S. As a workaround I also tried to set `set-message-function',
dependency-injection style, but it did not work either.

Rudy
-- 
"'Contrariwise,' continued Tweedledee, 'if it was so, it might be; and
if it were so, it would be; but as it isn't, it ain't.  That's logic.'"
-- Lewis Carroll, Through the Looking Glass, 1871/1872

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



How to set latex preview font to regular instead of italics?

2022-11-05 Thread Mati
As in subject, I can't find any info with search engine. Latex preview 
is (imho) ugly italic. Is there an easy way to make it regular?





View next 7 days of agenda, not next week

2022-11-05 Thread Renato Pontefice
With this command
(org-agenda-list)
(delete-other-windows)

My org-mode open with the present week days appointment and TODO

I would open with next 7 days view every day, not just on Monday.
Is it possible?

Thank you

Renato



CI tests

2022-11-05 Thread Christian Köstlin
Dear org-mode users,


at the moment I am trying to enable as much of the org-mode testsuite
on the ci server (see https://builds.sr.ht/~bzg for the latest
testruns).

>From time to time some tests fail, because the time when e.g. a
timestamp is written to the buffer is different to when the timestamp
is calculated in the test (the minute just flips there).

The buildserver already stumbled over:
- test-org/org-log-done
- test-org-capture/fill-template
but I think there might be more problems like that.

Did you also see that when running the tests locally?

Kind regards,
Christian



Re: [PATCH] Re: Update Org to MathJax 3

2022-11-05 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

Thank you for taking a look, Ihor!

> Your tests are failing on my side...

Oh, I see!  The tests *pass* when ran in-buffer but *fail* when ran via
'make test'.  Just the tests that call (current-message) have this
problem.  Interesting.

> ...

Good points; I will fix everything.

Rudy
-- 
"'Contrariwise,' continued Tweedledee, 'if it was so, it might be; and
if it were so, it would be; but as it isn't, it ain't.  That's logic.'"
-- Lewis Carroll, Through the Looking Glass, 1871/1872

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



Re: [BUG] org-string-width: Window is dedicated error [9.6-pre (release_9.5.5-1075-g3e010d)]

2022-11-05 Thread Bruno Barbier
Ihor Radchenko  writes:

> Thanks for reporting!
> Fixed on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=946abeb49a73d7d04233a53fbb7fd422c7e294b6


It now works.

Thanks Ihor!

Bruno




Re: Inequalities in math blocks

2022-11-05 Thread Max Nikulin
This is a reminder of an old bug. From my point of view it is serious 
enough, but not release critical due to its age.


&<> characters must be escaped as HTML entities when LaTeX snippets and 
blocks are exported for MathJax


Form my year-old notes:
- =#+options: tex:verbatim= properly escapes symbols.
- There are functions that performs such replacement in ox-html and 
ox-odt, but `org-format-latex` resides in org.el, so some refactoring 
and backward compatibility stubs are necessary.


This thread was tracked at https://updates.orgmode.org for a minor fix 
of the manual.


On 07/10/2021 22:05, Max Nikulin wrote:

On 07/10/2021 20:05, Timothy wrote:
Org should rewrite < and > to  and  to avoid broken HTML, or 
as < and  in general.


I think we’ve drifted a bit to the differences in processing (where 
the `\( ... \)'
vs `$ ... $' comments are most pertinent), but as you say for valid 
HTML < and >
should be rewritten. I don’t think I’ve seen an issue because MathJax 
seems to
take care of it, but it looks like MathJax is also fine with  and 
.


"<" and ">" characters are valid only markup elements in HTML (part of 
tags, comments). MathJax interprets text content. Normally, to add text 
"<" or ">", "" or "" should be used in HTML sources. Browsers 
may pass "<" and ">" from source to text content if they are totally 
confused by invalid markup that does not resemble tags or something 
else. I do not think, it should be abused.


I cited MathJax docs just to show a temporary workaround till the bug 
will be fixed in Org. It is quite strange that Org properly converts 
"<>&" to entities in text but leaves them as is in math snippets. Unsure 
whether git history might clarify some reasons of such behavior.







Re: [PATCH] Re: Update Org to MathJax 3

2022-11-05 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Rudolf Adamkovič  writes:
>
>> I will resurrect the thread when I have something to show.
>
> All right, I have finished the second version of the patch.

Thanks!

> What do you think?

Your tests are failing on my side...


Also,

In org-html--build-mathjax-config:
ox-html.el:1999:40: Warning: malformed cond form: ‘nil’

I'll wait for a new version of the patch with tests passing before I do
a more elaborate review.

Some quick comments below.

> ox-html/mathjax-legacy-line-breaks-message-in-buffer): Test MathJax.

You forgot changelog entries for ORG-NEWS.

Also, you did not update the relevant manual sections.

> Reported-by: Rudolf Adamkovič 

There is no need to add Reported-by here. It is not a bug.

> +*** HTML export uses MathJax 3+ instead of MathJax 2
> +
> +Org 9.6 uses MathJax 3, a ground-up rewrite of MathJax 2 released
> +in 2019.  The new version brings modularity, better and faster
> +rendering, improved LaTeX support, and more.
> +
> +For more information about new features, see:
> +
> +https://docs.mathjax.org/en/latest/upgrading/whats-new-3.0.html
> +https://docs.mathjax.org/en/latest/upgrading/whats-new-3.1.html
> +https://docs.mathjax.org/en/latest/upgrading/whats-new-3.2.html

This paragraph would look better at the end, after you discuss specific
features.

> +
> +See the updated =org-html-mathjax-options= for more details.

Please use code markup for symbols:  ~org-html-mathjax-options~.

>  (defcustom org-html-mathjax-options
> -  '((path 
> "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML;
>  )
> -(scale "100")
> +  '((path "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js;)
> +(scale 1.0)

It will be worth mentioning that we change the JS provider.
People at least need to take note about different privacy policy.

> +  (when value
> +(pcase symbol
> +  ('font

It is recommended to use backquote `font in favor of direct quote 'font.

> +   (when-let
> +   ((new-value (cond
> +((string= value "TeX")

> + "mathjax-tex")
> +((string= value "STIX-Web")
> + "mathjax-stix2")
> +((string= value "Asana-Math")
> + "mathjax-asana")
> +((string= value "Neo-Euler")
> + "mathjax-euler")
> +((string= value "Gyre-Pagella")
> + "mathjax-pagella")
> +((string= value "Gyre-Termes")
> + "mathjax-termes")
> +((string= value "Latin-Modern")
> + "mathjax-modern")
> +nil)))

Why not pcase?


> + (setq value new-value)))
> +  ('linebreaks
> +   (message "Converting legacy MathJax option: linebreaks")

Maybe warning?

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



Re: Single story around subtree export and footnotes, several issues

2022-11-05 Thread Alain . Cochard


 > Fixed on main.
 > https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=3e010d81dcabafcdd97199b8122491a74ad9cbed

Thanks a lot.  I checked that the problem is no longer present for me
either. 

 > This is because the error terminated export process in the middle
 > of it.  Org export uses a temporary buffer copy during export. That
 > buffer is cleaned up to remove commented headings, and whatever
 > parts of the original buffer that should not be exported. When,
 > exporting subtree, the buffer may also be narrowed.
 > 
 > You should not know this when things do not err in the middle,
 > which is now fixed.

Thanks for the explanations; very useful.

 > Thanks for reporting and for the detailed reproducer!

Thanks once more; I spent a whole day on this :-) With non
reproducible features in the process (when using the elpa 9.5.5
version) -- sometimes the buffer was narrowed to nothing and then
widen to the buffer without only the COMMENTed headline missing;
sometimes, after the problem occurred, files with the .org extension
further visited were in Fundamental mode ...

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France | [ slot available for rent ]




Re: Inserting tables programatically in elisp

2022-11-05 Thread Jean Louis
* Heime  [2022-11-05 12:27]:
> The problem I see is that the code assumes use of org-mode, whereas
> I am interested in more general tables in any buffer.  At first
> perhaps just making a table for display rather than for user
> interaction.

You said you want them generated programmatically first. That is what
I also do and like.

Though I may often use PostgreSQL for data storage, and it's
Asciidoc table output function. It is built-in.

For presentation purposes I use HTML or PDF.

For presentation and purposes in Emacs, I use tabulated-list-mode and
often Org mode.

-- 
Jean

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

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



Re: Inserting tables programatically in elisp

2022-11-05 Thread Jean Louis
* Heime  [2022-11-05 12:27]:
> > And now the final result:
> > 
> > (rcd-org-table my-table) ⇒ "
> > | ID | Description | Amount |
> > |--++|
> > | 1.00 | Payment for domain | 10.50 |
> > | 2.00 | Transfer from Doe | 250.00 |
> > 
> > "
> 
> The problem I see is that the code assumes use of org-mode, whereas
> I am interested in more general tables in any buffer.  At first
> perhaps just making a table for display rather than for user
> interaction.

Me too, that is what I do.

The output of that function is string, not "Org". The table format is
in Org format. 

Once you have got table as string, you may use Org export functions to
get for example nicely formatted Unicode table.

Mix anything.

-- 
Jean

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

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



Re: [BUG] org-string-width: Window is dedicated error [9.6-pre (release_9.5.5-1075-g3e010d)]

2022-11-05 Thread Ihor Radchenko
Bruno BARBIER  writes:

> The function `org-string-width' fails if the selected window is strongly
> dedicated.
>
> Here is a way to reproduce this error:
>
>   #+begin_src elisp
> (let ((old-dedicated (window-dedicated-p)))
>   (unwind-protect
>   (progn 
> (set-window-dedicated-p nil t)
> (org-string-width "a string"))
> (set-window-dedicated-p nil old-dedicated)))
>   #+end_src

Thanks for reporting!
Fixed on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=946abeb49a73d7d04233a53fbb7fd422c7e294b6

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



Re: Inserting tables programatically in elisp

2022-11-05 Thread Heime
--- Original Message ---
On Saturday, November 5th, 2022 at 9:02 AM, Jean Louis  wrote:

> * Heime heimebor...@protonmail.com [2022-11-05 10:45]:
> 
> > Have been introspecting the possibility of conveniently inserting table 
> > programatically
> > in elisp and encountered "table.el".

> I would go programmatically not by hard coding the table walk, but by
> using some structure, for example:
> 
> (setq my-table '(("ID" "Description" "Amount") ;; this must be header
> (1 "Payment for domain" 10.50)
> (2 "Transfer from Doe" 250)))
> 
> Then I would use some function, something like:
> 
> (my-org-table-generate my-table calculat-total 3rd-column)
> 
> Then the function would only interpolate the table with basic
> small details, which allow later automatic table alignment:
> 
> (defun rcd-org-table-cell (object)
> (cond ((numberp object) (format "| %.2f " object))
> (t (format "| %s " object
> 
> (rcd-org-table-cell "Hello") ⇒ "| Hello "
> 
> (defun rcd-org-table-horizontal-line ()
> "Return `|-' as horizontal-line."
> "|--\n")
> 
> then for rows:
> 
> (defun rcd-org-table-row (list)
> (with-temp-buffer
> (while list
> (insert (rcd-org-table-cell (pop list
> (insert "\n")
> (buffer-string)))
> 
> This means you can do something like:
> 
> (rcd-org-table-row '("ID" "Description" "Amount")) ⇒ "| ID | Description | 
> Amount "
> 
> then you make the main function:
> 
> (defun rcd-org-table (structure)
> (let ((header (pop structure)))
> (with-temp-buffer
> (insert "\n")
> (insert (rcd-org-table-row header))
> (insert (rcd-org-table-horizontal-line))
> (while structure
> (insert (rcd-org-table-row (pop structure
> (insert "\n")
> (org-mode)
> (goto-char 2)
> (org-table-align)
> (buffer-substring-no-properties (point-min) (point-max)
> 
> And now the final result:
> 
> (rcd-org-table my-table) ⇒ "
> | ID | Description | Amount |
> |--++|
> | 1.00 | Payment for domain | 10.50 |
> | 2.00 | Transfer from Doe | 250.00 |
> 
> "

The problem I see is that the code assumes use of org-mode, whereas I am 
interested in
more general tables in any buffer.  At first perhaps just making a table for 
display rather
than for user interaction. 





Re: Inserting tables programatically in elisp

2022-11-05 Thread Heime
--- Original Message ---
On Saturday, November 5th, 2022 at 8:49 AM, Ihor Radchenko 
 wrote:


> Heime heimebor...@protonmail.com writes:
> 
> > Have constructed this function, but the difficulty centers around
> > the challenge of inserting text in specific tests.
> > 
> > (defun make-table ()
> > (interactive)
> > (table-insert 4 5)
> > (table-forward-cell)
> > (table-insert-sequence "icomplt-horz" 1 1 1 'center)
> > (table-forward-cell 4)
> > (table-insert-sequence "icomplt-vert" 1 1 1 'center)
> > (table-release))
> > 
> > It might be that "table.el" was designed under the assumption that the 
> > table would
> > be edited interactively rather than from ELisp. The lack of info may just 
> > reflect
> > that nobody has thought about it making tables programatically that also 
> > goes beyond
> > its utilisation in "org-mode".
> 
> You can call functions interactively from lisp, if needed.

One could work as you say, but only if the calls do not rely on finding table 
regions
and so on.
 
> > I understand that "Org" cooperates with its author Takaaki Ota, perhaps 
> > things could
> > be extended in a way that makes inserting tables programatically much 
> > easier to work
> > with.
> 
> 
> Do you refer to things on table.el side? Then, you may have more luck
> asking on emacs-devel list.

Correct.  Thanks.  
 
> As for programmatically inserting native Org tables, you can always
> construct table AST via org-element-create API and then insert it via
> org-element-interpret-data.

I am discussing the use of tables beyond "org".
 




[BUG] org-string-width: Window is dedicated error [9.6-pre (release_9.5.5-1075-g3e010d)]

2022-11-05 Thread Bruno BARBIER


Hi,

The function `org-string-width' fails if the selected window is strongly
dedicated.

Here is a way to reproduce this error:

  #+begin_src elisp
(let ((old-dedicated (window-dedicated-p)))
  (unwind-protect
  (progn 
(set-window-dedicated-p nil t)
(org-string-width "a string"))
(set-window-dedicated-p nil old-dedicated)))
  #+end_src



Emacs  : GNU Emacs 29.0.50 (x86_64-pc-linux-gnu, X toolkit, cairo version 
1.16.0)
Package: Org mode version 9.6-pre (release_9.5.5-1075-g3e010d)


Bruno



Re: Inserting tables programatically in elisp

2022-11-05 Thread Jean Louis
* Heime  [2022-11-05 10:45]:
> Have been introspecting the possibility of conveniently inserting table 
> programatically
> in elisp and encountered "table.el".
> 
> Have constructed this function, but the difficulty centers around
> the challenge of inserting text in specific tests.
> 
> (defun make-table ()
>   (interactive)
>   (table-insert 4 5)
>   (table-forward-cell)
>   (table-insert-sequence "icomplt-horz" 1 1 1 'center)
>   (table-forward-cell 4)
>   (table-insert-sequence "icomplt-vert" 1 1 1 'center)
>   (table-release))
> 
> It might be that "table.el" was designed under the assumption that the table 
> would
> be edited interactively rather than from ELisp.  The lack of info may just 
> reflect
> that nobody has thought about it making tables programatically that also goes 
> beyond
> its utilisation in "org-mode".
> 
> I understand that "Org" cooperates with its author Takaaki Ota, perhaps 
> things could
> be extended in a way that makes inserting tables programatically much easier 
> to work
> with.

I would go programmatically not by hard coding the table walk, but by
using some structure, for example:

(setq my-table '(("ID" "Description" "Amount") ;; this must be header
 (1 "Payment for domain" 10.50)
 (2 "Transfer from Doe" 250)))

Then I would use some function, something like:

(my-org-table-generate my-table calculat-total 3rd-column)

Then the function would only interpolate the table with basic
 small details, which allow later automatic table alignment:

(defun rcd-org-table-cell (object)
  (cond ((numberp object) (format "| %.2f " object))
(t (format "| %s " object

(rcd-org-table-cell "Hello") ⇒ "| Hello "

(defun rcd-org-table-horizontal-line ()
  "Return `|-' as horizontal-line."
  "|--\n")

then for rows:

(defun rcd-org-table-row (list)
  (with-temp-buffer
(while list
  (insert (rcd-org-table-cell (pop list
(insert "\n")
(buffer-string)))

This means you can do something like:

(rcd-org-table-row '("ID" "Description" "Amount")) ⇒ "| ID | Description | 
Amount "

then you make the main function:

(defun rcd-org-table (structure)
  (let ((header (pop structure)))
(with-temp-buffer
  (insert "\n")
  (insert (rcd-org-table-row header))
  (insert (rcd-org-table-horizontal-line))
  (while structure
(insert (rcd-org-table-row (pop structure
  (insert "\n")
  (org-mode)
  (goto-char 2)
  (org-table-align)
  (buffer-substring-no-properties (point-min) (point-max)

And now the final result:

(rcd-org-table my-table) ⇒ "
|   ID | Description| Amount |
|--++|
| 1.00 | Payment for domain |  10.50 |
| 2.00 | Transfer from Doe  | 250.00 |

"


-- 
Jean

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

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



Re: Inserting tables programatically in elisp

2022-11-05 Thread Ihor Radchenko
Heime  writes:

> Have constructed this function, but the difficulty centers around
> the challenge of inserting text in specific tests.
>
> (defun make-table ()
>   (interactive)
>   (table-insert 4 5)
>   (table-forward-cell)
>   (table-insert-sequence "icomplt-horz" 1 1 1 'center)
>   (table-forward-cell 4)
>   (table-insert-sequence "icomplt-vert" 1 1 1 'center)
>   (table-release))
>
> It might be that "table.el" was designed under the assumption that the table 
> would
> be edited interactively rather than from ELisp.  The lack of info may just 
> reflect
> that nobody has thought about it making tables programatically that also goes 
> beyond
> its utilisation in "org-mode".

You can call functions interactively from lisp, if needed.

> I understand that "Org" cooperates with its author Takaaki Ota, perhaps 
> things could
> be extended in a way that makes inserting tables programatically much easier 
> to work
> with.

Do you refer to things on table.el side? Then, you may have more luck
asking on emacs-devel list.

As for programmatically inserting native Org tables, you can always
construct table AST via org-element-create API and then insert it via
org-element-interpret-data.

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



Re: [PATCH] org.el: Warning for unsupported markers in `org-set-emphasis-alist'

2022-11-05 Thread Ihor Radchenko
Max Nikulin  writes:

>> 3. Remove verbatim in ("=" org-verbatim verbatim), ("~" org-code
>> verbatim), and the :type spec.  AFAIU, they are unused. But can you
>> please double-check?
>
> It seems, before the following commit, verbatim was used to suppress 
> flyspell, but now "~" and "=" are hardcoded.
>
> 9fb2e047d 2016-12-08 09:44:26 +0100 Nicolas Goaziou: Split `org-emph-re' 
> and `org-verbatim-re'
>
> I think, verbatim option should not be removed from `defcustom' :type 
> just now. For some users it might cause fallback to raw lisp value in 
> easy customization UI. Perhaps another warning should be added to the 
> `org-set-emphasis-alist' validator and the option should be labeled as 
> unused in the :type definition.

Makes sense.
What about the attached patch?
The idea is to tag the constant as deprecated.

>From 19f636e0d76dac3e1ca133adfac8bf97dfd52a68 Mon Sep 17 00:00:00 2001
Message-Id: <19f636e0d76dac3e1ca133adfac8bf97dfd52a68.1667636440.git.yanta...@posteo.net>
From: Max Nikulin 
Date: Mon, 22 Nov 2021 23:56:15 +0700
Subject: [PATCH v4] org.el: Warn about unsupported markers in
 `org-set-emphasis-alist'

* lisp/org.el (org-emphasis-alist, org-set-emphasis-alist): Change
custom variable type definition and add :set parameter to warn users
that non-standard marker characters are ignored.  Remove unused third
list entry from the default value.

Attempts to introduce new markers have been discussed enough times to
add some code that should prevent wasting of time.

Unfortunately there is no way to issue warning for e.g. `setq'.

Link: https://orgmode.org/list/878rxoa6lk.fsf@localhost
---
 lisp/org.el | 51 +++
 1 file changed, 43 insertions(+), 8 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index d8708f8f2..84ed78ef7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3628,12 +3628,31 @@ (defvar org-emphasis-regexp-components
 
 You need to reload Org or to restart Emacs after setting this.")
 
+(defun org-set-emphasis-alist (var value)
+  "Set VAR (`org-emphasis-alist') to VALUE.
+Warn user that Org syntax can not be extended with new emphasis
+markers if such attempt is detected.  The function is intended for
+:set argument of `defcustom'."
+  (set-default-toplevel-value var value)
+  (let ((unsupported
+	 (delq nil
+	   (mapcar
+(lambda (entry)
+  (let ((marker (car entry)))
+(unless (member marker '("*" "/" "_" "=" "~" "+")) marker)))
+value
+(when unsupported
+  (warn "Unsupported markup characters '%s' detected in `%s'"
+	(mapconcat #'identity unsupported " ")
+	(symbol-name var
+  value)
+
 (defcustom org-emphasis-alist
   '(("*" bold)
 ("/" italic)
 ("_" underline)
-("=" org-verbatim verbatim)
-("~" org-code verbatim)
+("=" org-verbatim)
+("~" org-code)
 ("+" (:strike-through t)))
   "Alist of characters and faces to emphasize text.
 Text starting and ending with a special character will be emphasized,
@@ -3641,18 +3660,34 @@ (defcustom org-emphasis-alist
 marker characters and the face to be used by font-lock for highlighting
 in Org buffers.
 
+Do not change the characters and do not add new ones to use custom
+markers for existing styles or to introduce new styles.  Org syntax is
+not meant to be configurable and such modifications will not work with
+export.
+
 You need to reload Org or to restart Emacs after customizing this."
   :group 'org-appearance
   :set 'org-set-emph-re
   :version "24.4"
   :package-version '(Org . "8.0")
+  :set #'org-set-emphasis-alist
   :type '(repeat
-	  (list
-	   (string :tag "Marker character")
-	   (choice
-	(face :tag "Font-lock-face")
-	(plist :tag "Face property list"))
-	   (option (const verbatim)
+  (group
+   (choice
+:tag "Marker"
+(const :tag "*Bold*" "*")
+(const :tag "/Italic/" "/")
+(const :tag "_Underline_" "_")
+(const :tag "+Strike-through+" "+")
+(const :tag "=Verbatim=" "=")
+(const :tag "~Code~" "~")
+;; To warn users that it does not work.
+(string :tag "Unsupported ignored character"))
+   (choice
+:tag "Font"
+(face :tag "Face")
+(plist :tag "Property list"))
+   (option (const :tag "Deprecated ignored constant" verbatim)
 
 (defvar org-protecting-blocks '("src" "example" "export")
   "Blocks that contain text that is quoted, i.e. not processed as Org syntax.
-- 
2.35.1



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


Re: @string abbreviation in bib file not honored in (basic) org-cite

2022-11-05 Thread Ihor Radchenko
Joost Kremers  writes:

>> aikrahguzar -- TINYCHANGE
>
> How did you determine this, if I may ask? aikrahguzar's contribution at first
> sight seems more involved, though I admit part of those changes is stuff being
> moved around.

Mmm.. By manually checking magit log. It can provide extra highlight for
things that have been changed and also moved around (which is more
accurate than raw LOC count from git).

And I missed one of the aikrahguzar's commits. With f41befa, his
contribution exceeds 15LOC.

-- 
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.el: (org-get-indirect-buffer) Allow indirect base buffers

2022-11-05 Thread Ihor Radchenko
Adam Porter  writes:

> The attached patch improves the function org-get-indirect-buffer, fixing 
> a bug, clarifying the code, and adding a docstring.

Thanks! I have some comments.

> +(cl-defun org-get-indirect-buffer ( (buffer (current-buffer)) 
> heading)
> +  "Return an indirect buffer based on BUFFER.
> +If HEADING, prepend it to the name of the new buffer."

Maybe append to the name?

> +  (let* ((base-buffer (or (buffer-base-buffer buffer) buffer))
> + (suffix-prefix (if heading
> +(concat heading "-")
> +  ""))

Why not pre-define the whole prefix instead?
(prefix (format "%s-%s" (buffer-name base-buffer)
(if heading (concat heading "-") "")))

then, can just say (format "%s%s" prefix n) in the loop.

> + (buffer-name (cl-loop for n from 1 to 100

why to 100? It may fail (even though unlikely) and also unnecessary.
Can just say for n from 1.

> +  ;; FIXME: Explain why this `condition-case' is necessary.  Why
> +  ;; could an error be signaled with the CLONE argument non-nil,
> +  ;; and why would trying again without CLONE solve the problem?
> +  (error (make-indirect-buffer base-buffer buffer-name)

I did not find why in the git logs. It looks like some ancient code. You
can remove it in a followup patch.

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



Inserting tables programatically in elisp

2022-11-05 Thread Heime
Have been introspecting the possibility of conveniently inserting table 
programatically
in elisp and encountered "table.el".

Have constructed this function, but the difficulty centers around
the challenge of inserting text in specific tests.

(defun make-table ()
  (interactive)
  (table-insert 4 5)
  (table-forward-cell)
  (table-insert-sequence "icomplt-horz" 1 1 1 'center)
  (table-forward-cell 4)
  (table-insert-sequence "icomplt-vert" 1 1 1 'center)
  (table-release))

It might be that "table.el" was designed under the assumption that the table 
would
be edited interactively rather than from ELisp.  The lack of info may just 
reflect
that nobody has thought about it making tables programatically that also goes 
beyond
its utilisation in "org-mode".

I understand that "Org" cooperates with its author Takaaki Ota, perhaps things 
could
be extended in a way that makes inserting tables programatically much easier to 
work
with.
 





[HELP] Clearing bug reports before the upcoming Org release

2022-11-05 Thread Ihor Radchenko
Dear all,

As we are preparing the next release, we should make sure that no
critical bugs go into the release version of Org.

I think I have closed all the straightforward bug reports listed in
updates.orgmode.org and a number of unconfirmed bug reports that were
left without response.

However, there is still a number of bugs that either require further
discussion or difficult to fix (for me). Some reports may also be
missing from my records.

It would be helpful if you can help with further feedback or fixing
the bug reports listed below. Especially the reports marked with [*].

Also, if you know some bug report that is not listed below, but
important to fix before the next Org release, please let me know in the
reply to this message.

-

Status: To be fixed

1. [*]
[ODT][BUG] Format error on export with table in list structure
https://list.orgmode.org/87edxn9z7n.fsf@localhost

2. [*]
Suggestion with footnotes when toggling headlines into plain lists
https://list.orgmode.org/877d3k70lu.fsf@localhost

3. [*]
Bug: org-html-example-block can produce multiple class attributes
https://list.orgmode.org/87fsfxfzex.fsf@localhost/

4. [*]
Identical attributes id="text-table-of-contents" of div with
role="doc-toc" when exporting to html when using tables of contents for
multiple subheadings
https://list.orgmode.org/87sfj6av4t.fsf@localhost

5. [*]
[BUG] beamer export
https://list.orgmode.org/877d1maogi.fsf@localhost/

6. [*]
Exporting italic link with bang inside to html fails to parse the link
https://list.orgmode.org/87a6c29aj6.fsf@localhost/

7. [*]
Link to inline-task not working
https://list.orgmode.org/875ys6m05b.fsf@localhost/

8.
Bug: org-timestamp-{down,up} with numeric argument on time range modifies length
https://list.orgmode.org/877dge5lic@gmail.com/

9.
[BUG] completion-at-point for [[* only works at end of line
https://list.orgmode.org/87ils0lut8.fsf@localhost/

10.
[BUG] (org-agenda-files) after restrict agenda to a file
https://list.orgmode.org/877d7kysth.fsf@localhost/

11.
org-mode #+SETUPFILE not working with properties
https://list.orgmode.org/87wnf96zkj.fsf@localhost/

12.
Future repeated tasks marked done in Org Agenda don't show as done
https://list.orgmode.org/87k0hwdk54.fsf@localhost/

13.
inconsistent handling of empty duration cells in table
https://list.orgmode.org/8735qpq1rn@gmail.com/

14.
Hourly repeating tasks only shown once per day in org-agenda
https://list.orgmode.org/878ruqu3oh.fsf@localhost/

15.
ob-R [BUG] Incorrect background color
https://list.orgmode.org/87h740i0ms.fsf@localhost/

16.
Bug: Appointments duration and effort sums in agenda column view
https://list.orgmode.org/87d02yqifl@gnu.org/

17.
Problem when tangling source blocks with custom coderefs
https://list.orgmode.org/87mt9np0ci.fsf@localhost

18.
Org-cite/Citar cannot recognize neither biblatex nor natbib
https://list.orgmode.org/87lev5wdqt@gmail.com

19.
Table of contents position in HTML export
https://list.orgmode.org/dd0ae51d-7d56-0ff6-5eb1-3786464ad...@arfer.net

20.
[BUG] bug in 'ox-man?
https://list.orgmode.org/2924644.1643637...@apollo2.minshall.org

21.
[BUG] `org-fill-paragraph' doesn't respect formatting
https://list.orgmode.org/87pmf549i0.fsf@localhost

22.
Problems running ob-julia tests (testing/test-ob-julia.el)
https://list.orgmode.org/877d0xhh7p.fsf@localhost



Status: require further discussion (or non-trivial decision to be made):

23. [*]
Arbitrary code execution in Org export macros
https://list.orgmode.org/124788.1655771850@alto

24. [*]
Re: Possible bug in `org-subtree--get-subtree-options`?
https://list.orgmode.org/87pmephisr.fsf@localhost

25. [*]
[bug] Macro in citation not expanded
https://list.orgmode.org/87k04xhhw3.fsf@localhost

26. [*]
Internal link broken when publishing (was org-id with ox-html)
https://list.orgmode.org/shqit9$8ds$1...@ciao.gmane.io/

27. [*]
[BUG] org-create-file-search-functions and description
https://list.orgmode.org/87k05qjpwg.fsf@localhost/

28. [*]
Bug: PDF Export of Link fails
https://list.orgmode.org/87mtouuiet.fsf@localhost/

29.
org-goto UI seems broken (popup window management)
https://list.orgmode.org/e169a2f9-72b1-02bb-96c1-6e7368f64...@gmail.com/

30.
Bug with exporting list with link item containing "::" to markdown
https://list.orgmode.org/164e193c-4b7d-398a-2375-622a9b42c...@gmail.com/

31.
Should we make org-fill-element respect the selected region and not
expand the selection to the element boundaties?
https://list.orgmode.org/87bl2g9ptk.fsf@localhost/

32.
Org lint and named source blocks
https://list.orgmode.org/87o88mqd6o.fsf@localhost/

33.
[BUG] EXPORT_FILE_NAME keyword is used by `org-export-output-file-name'
before macro expansion/INCLUDEs/removing COMMENTed trees
https://list.orgmode.org/87k05i25lq.fsf@localhost/

34.
Bug report: org-preview-latex fails when using tramp
https://list.orgmode.org/87sfuaqxk5@gmail.com/

35.
[BUG] Child's visibility property is overridden by parent's