Re: [PATCH] Re: [BUG] org-element-map doco should refer to org-element-parse-buffer [9.5.2 (9.5.2-gfbff08 @ /home/phil/.emacs.d/elpa/org-9.5.2/)]

2022-05-13 Thread Ihor Radchenko
Phil Hudson  writes:

> Thanks Ihor, that's great!
>
> One tiny nit-pick: I think "e.g." is deprecated in favor of the
> explicit literal "for example". My source for this is (info "(elisp)
> Documentation Tips").

Fair point, though searching across org-element.el reveals that e.g. is
used in many places. I do not see it as too much of a big deal. Will
just update the patch here.

> Also, just spotted what I think is a pre-existing typo, "objects
> types", which I think should probably be just "object types". Might as
> well fix that while we're at it.

Fixed.

Applied the new version of the patch onto main as 3996ea99a.

Best,
Ihor



\minus entity and LaTeX export

2022-05-13 Thread Max Nikulin

Hi,

I was checking which changes had been landed to the main branch as the 
result of Ihor's work and I noticed a commit unrelated to my initial 
curiosity but that might be questionable:



commit 15d25644cc8d88fd5cd0ad53caedaedad3635d8d
author TEC Sat Jan 22 20:41:55 2022 +0800

org-entities: Change \minus to -

* lisp/org-entities.el: The LaTeX command \minus doesn't exist, but a
hyphen in math mode produces a minus symbol.

diff --git a/lisp/org-entities.el b/lisp/org-entities.el
index 2bd4f2fe3..9c64cb854 100644
--- a/lisp/org-entities.el
+++ b/lisp/org-entities.el
@@ -307,7 +307,7 @@ packages to be loaded, add these packages to 
`org-latex-packages-alist'."
  ("trade" "\\texttrademark{}" nil "" "TM" "TM" "™")
 
  "** Science et al."

- ("minus" "\\minus" t "" "-" "-" "−")
+ ("minus" "-" t "" "-" "-" "−")


Should it be "\textminus" instead? I never used it but my expectation 
that it was added for text mode outside of equations: \minus1. It 
required \usepackage{textcomp} in the past, but it seems it is not the 
issue any more, so the symbol is available out of the box. I was not 
following that changes in LaTeX so I may miss something.



  ("pm" "\\textpm{}" nil "" "+-" "±" "±")
  ("plusmn" "\\textpm{}" nil "" "+-" "±" "±")
  ("times" "\\texttimes{}" nil "" "*" "×" "×")




Re: [PATCH] Re: Concatenate properties

2022-05-13 Thread Tyler Grinn
Ihor Radchenko  writes:

>> From f474cb25840fdc6b24618b1452cb7fdd32545092 Mon Sep 17 00:00:00 2001
>> From: Tyler Grinn 
>> Date: Mon, 9 May 2022 15:52:58 -0400
>> Subject: [PATCH] lisp/org.el: Add org-property-separators option
>
> LGTM!
>
> I will leave this for another week to give other people a chance to
> comment.
>
> For reference, this patch might be useful in 
> https://orgmode.org/list/87o821dv7o.fsf@localhost
>
> Best,
> Ihor

Great; it's exciting to have my first patch accepted and I look forward
to future development.

Best,

Tyler



Multi-line headers with longtable

2022-05-13 Thread Brett Presnell


Sorry I sent this twice.  Forgot that I was subscribed from my
member.fsf.org email address.

I have come upon a problem with export of multi-line table headers in
long (multi-page) tables.  I can't imagine that this hasn't come up
before, but I wasn't able to google up any other reports, so ...

As a simple example (using \pagebreak to reduce the number of rows
required to illustrate the problem), exporting the org table

#+attr_latex: :environment longtable
| First| Second |
| Column   | Column |
|--+|
| a|  1 |
| b|  2 |
| \pagebreak c |  3 |
| d|  4 |

to LaTeX yields

\begin{longtable}{lr}
First & Second\\
Column & Column\\
\hline
\endfirsthead
\multicolumn{2}{l}{Continued from previous page} \\

Column & Column \\

\hline
\endhead
\hline\multicolumn{2}{r}{Continued on next page} \\
\endfoot
\endlastfoot
\hline
a & 1\\
b & 2\\
\pagebreak c & 3\\
d & 4\\
\end{longtable}
\end{document}

Notice that only the "firsthead" has the multi-line table header; on the
2nd page the columns will both have the one-line header "Column" when
I/we want the full column headers on every page.

This is using org version 9.5.3 and GNU Emacs 29.0.50 (snapshot).

I think that the problem occurs in the handling of the header in
org-latex-table-row.  The 2nd row ends the header, so in the excerpted
code below it is output as =contents=, i.e., it gets inserted for the
4th %s.  Of course this means that the previous lines of the header are
missing.


;; Special case for long tables.  Define header and footers.
((and longtablep (org-export-table-row-ends-header-p table-row info))
 (let ((columns (cdr (org-export-table-dimensions
  (org-export-get-parent-table table-row) info
   (format "%s
\\endfirsthead
\\multicolumn{%d}{l}{%s} 
%s
%s \n
%s
\\endhead
%s\\multicolumn{%d}{r}{%s} 
\\endfoot
\\endlastfoot"
   (if booktabsp "\\midrule" "\\hline")
   columns
   (org-latex--translate "Continued from previous page" info)
   (cond
((not (org-export-table-row-starts-header-p table-row info))
 "")
(booktabsp "\\toprule\n")
(t "\\hline\n"))
   contents
   (if booktabsp "\\midrule" "\\hline")
   (if booktabsp "\\midrule" "\\hline")
   columns
   (org-latex--translate "Continued on next page" info
;; When BOOKTABS are activated enforce bottom rule even when
;; no hline was specifically marked.
((and booktabsp (not (org-export-get-next-element table-row info)))
 "\\bottomrule"))



Re: simple request letter - help

2022-05-13 Thread andrés ramírez
Hi. Juan. Mi comments below.
[...]

Juan> ID:  #+end_signature

Adding that part:
--8<---cut here---start->8---
#+OPTIONS: date:nil author:nil timestamp:nil e:nil creator:nil toc:nil num:nil 
title:nil
#+LaTeX_Header: \parindent=0em\parskip=\bigskipamount
#+LaTeX_Header: 
\newenvironment{signature}{\vspace{2cm}\raggedright\makebox[1.5in]{\hrulefill}\newline}{\par}

* 
Me John Doe with ID number  request to install me the water service 

I am sharing the payment receipt for the service in an attachment

Sincerely.

#+begin_signature
John Doe \\
ID: 
#+end_signature
--8<---cut here---end--->8---

Thanks for your help
Best Regards



Re: simple request letter - help

2022-05-13 Thread andrés ramírez
Hi. Juan.

It ended this way:

--8<---cut here---start->8---
#+OPTIONS: date:nil author:nil timestamp:nil e:nil creator:nil toc:nil num:nil 
title:nil
#+LaTeX_Header: \parindent=0em\parskip=\bigskipamount

* 
Me John Doe with ID number  request to install me the water service 

I am sharing the payment receipt for the service in an attachment

Sincerely.

#+latex: \vspace{2cm}

#+BEGIN_EXPORT latex
\makebox[1.5in]{\hrulefill} \hspace {1.0in} \\
John Doe \\
ID: 
#+END_EXPORT
--8<---cut here---end--->8---
Best Regards

[...]


Me> Right. It is giving me an error I have NOT noticed it because the pdf 
is being generated.



Re: simple request letter - help

2022-05-13 Thread Juan Manuel Macías
andrés ramírez writes:

> Right. It is giving me an error I have NOT noticed it because the pdf is
> being generated.

Your document is probably compiled on export with the
`-intercaction=nonstopmode' option, and thus does not break the
compilation with an error. In any case, I don't really understand why
you export that part literally to LaTeX and why you add the & at
beginning of line:

& John Doe\\
& ID: 

Those characters are usually reserved for tabular
environments, so LaTeX returns an error. If you want to use an &
literally in LaTeX you must escape it as \&. But if you write the
anpersand directly in Org Mode you don't need to escape it, since Org
takes care of it when it exports the document.

Also, in the signature you could also avoid direct formatting. You can
define a simple environment, with an extra space before it, if you need
to add that space. This is a very elementary example, based on your
format. Then you can use in Org a special block, with the name of the
environment:

#+LaTeX_Header: 
\newenvironment{signature}{\bigskip\raggedright\makebox[1.5in]{\hrulefill}\par}{\par}

#+begin_signature
John Doe

ID: 
#+end_signature

Best regards,

Juan Manuel 



Re: simple request letter - help

2022-05-13 Thread andrés ramírez
Hi. Juan.
My comments below.

> "Juan" == Juan Manuel Macías  writes:

[...]

Juan> section is not indented.  This is what is happening :):

That is good to know.

Juan> section no indent - indent -- indent --

[...]

Juan> is enough that you add this:

Juan> #+LaTeX_Header: \parindent=0em\parskip=\bigskipamount

It worked for most part of the document. But I Think I need the double
of space before the signature.

[...]

Juan> On the other hand, this code at the end does not give you an error?

Juan> \makebox[1.5in]{\hrulefill} \hspace {1.0in} \\ & John Doe \\ & ID: 
\\

Right. It is giving me an error I have NOT noticed it because the pdf is
being generated.

Best Regards



Re: simple request letter - help

2022-05-13 Thread Juan Manuel Macías
hi Andrés,

andrés ramírez writes:

> Hi. Juan.
> My comments below.

I'll explain what happens. There really isn't an alignment issue. TeX by
default applies a first line indent to paragraphs. It also defaults to
applying English typographical conventions, as is the case in your
document, where the first paragraph following a section is not indented.
This is what is happening :):

section
no indent -
indent   --
indent   --

Another more general typographical convention is that when paragraphs
are separated by a vertical space, they do not need to indent the first
line, as it is a redundant mark. Besides, you are making paragraph
separation by direct format (\bigskip). I usually recommend not applying
direct format in LaTeX, or applying it as little as possible. To disable
the first line indentation and make the paragraphs have a space between
them, it is enough that you add this:

#+LaTeX_Header: \parindent=0em\parskip=\bigskipamount

That way, you're giving the first line indentation a global value of
zero and a paragraph spacing value equivalent to \bigskip, and you don't
need to put a \bigsip every time you start a paragraph.

On the other hand, this code at the end does not give you an error?

\makebox[1.5in]{\hrulefill} \hspace {1.0in} \\
& John Doe \\
& ID: \\

best regards, 

Juan Manuel 



Re: [PATCH] org-macs.el: Do not compare wall time and file modification time

2022-05-13 Thread Paul Eggert

On 5/13/22 05:28, Max Nikulin wrote:


Feel free to commit your variant though, I will not object, but I am not 
going to update my patch in this way as well.


I'll leave it up to you; it's not a big deal either way.



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
Hi,

I think I spotted the problem. It's difficult to be sure, but
apparently, since version 4.31, latexmk automatically detects and run
biber as a citation engine (see this post
https://tex.stackexchange.com/a/231351/259874). In fact, in the latexmk
man page, it is said to use the option -bibtex to use BibTeX.

Indeed, if I try to run "latexmk -pdf -bibtex -f" (the -f option is
needed due to some errors given by whitespaces in the citations), it all
works fine. From my point of view, the problem here is that the variable
org-LaTeX-pdf-process doesn't track any of this!
+ If the variable cite_export is set to basic or to csl, the formatting
is external to LaTeX, so no problem.
+ If it is set to biblatex, then biber is automatically called by
latexmk
+ If it is set to natbib, LaTeX needs BibTeX to be called, but it is
not!

So I'd say this is a bug of the org-LaTeX-pdf-process variable. Should
it be buffer-local, and set when exporting? This is not something I'm
expert of, to be honest. As I was saying, using AuCTeX there's no
problem, because the compilation command is an elisp function that
checks which one of the two is needed. May that be helpful?

Alessandro



Re: simple request letter - help

2022-05-13 Thread andrés ramírez
Hi. Juan.
My comments below.
> "Juan" == Juan Manuel Macías  writes:

Juan> Can you please copy the contents of your .tex file here: `M-x 
org-export-disptatch l l'?

--8<---cut here---start->8---
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\date{}
\title{}
\hypersetup{
 pdfauthor={Andrés Ramírez},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 28.1 (Org mode 9.5.2)}, 
 pdflang={English}}
\begin{document}


\section*{}
\label{sec:orgbc8783b}
Me John Doe with ID number  request to install me the water service 
\ldots{}.

\bigskip
I am sharing the payment receipt for the service in an attachment

\bigskip
Sincerely.

\makebox[1.5in]{\hrulefill} \hspace {1.0in} \\
& John Doe \\
& ID: \\
\end{document}
--8<---cut here---end--->8---


Best Regards



Re: simple request letter - help

2022-05-13 Thread Juan Manuel Macías
Hi Andrés,

Andrés Ramírez writes:

> When I export the file M-x org-export-distpach l p
>
> The second and third paragraph do nat have right alignment as the first
> paragraph.

Can you please copy the contents of your .tex file here: `M-x
org-export-disptatch l l'?

Best regards,

Juan Manuel 



simple request letter - help

2022-05-13 Thread Andrés Ramírez
Hi.

I am trying to do a simple request letter. This is the content of the
file.
--8<---cut here---start->8---
#+OPTIONS: date:nil author:nil timestamp:nil e:nil creator:nil toc:nil num:nil 
title:nil

* 
Me John Doe with ID number  request to install me the water service 

#+latex: \bigskip
I am sharing the payment receipt for the service in an attachment

#+latex: \bigskip
Sincerely.

#+BEGIN_EXPORT latex
\makebox[1.5in]{\hrulefill} \hspace {1.0in} \\
& John Doe \\
& ID: \\
#+END_EXPORT
--8<---cut here---end--->8---

When I export the file M-x org-export-distpach l p

The second and third paragraph do nat have right alignment as the first
paragraph.

How Could I solve it?.

Best Regards



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Eric S Fraga
On Friday, 13 May 2022 at 09:48, Bruce D'Arcus wrote:
> It's not undocumented; it's poorly documented :-)

I don't that's entirely fair... just a little sparse maybe. ;-) (but
your comment taken as intended)

I've made use of it recently and it had what I needed.

-- 
: Eric S Fraga, with org release_9.5.3-481-gaea24b in Emacs 29.0.50



Re: [PATCH] Re: How to stop results being hidden when using ":results drawer"?

2022-05-13 Thread Ihor Radchenko
Eric S Fraga  writes:

> On Friday, 13 May 2022 at 21:35, Ihor Radchenko wrote:
>> In fact, forcefully folding the drawers is relatively recent addition by
>> Nicolas in 1027e0256903bc2.
>
> I wonder if this is related to my issue with ediff-ing org buffers and
> having drawers hidden?  I've not had time yet to investigate but
> interesting coincidence maybe?

If I recall correctly, you had some drawers folded and some not in
ediff. That is a different issue and it should be fixed on the latest
main.

Best,
Ihor



Re: [PATCH] Re: How to stop results being hidden when using ":results drawer"?

2022-05-13 Thread Eric S Fraga
On Friday, 13 May 2022 at 21:35, Ihor Radchenko wrote:
> In fact, forcefully folding the drawers is relatively recent addition by
> Nicolas in 1027e0256903bc2.

I wonder if this is related to my issue with ediff-ing org buffers and
having drawers hidden?  I've not had time yet to investigate but
interesting coincidence maybe?

-- 
: Eric S Fraga, with org release_9.5.3-481-gaea24b in Emacs 29.0.50



Re: [PATCH v4] org-encode-time compatibility and convenience helper

2022-05-13 Thread Max Nikulin

On 11/05/2022 20:20, Ihor Radchenko wrote:

Max Nikulin writes:


+  ;; In Emacs-27 and Emacs-28 `encode-time' does not support 6 
elements
+  ;; list argument so `org-encode-time' can not be outside of 
`pcase'.
+  (pcase-let
+  ((`(,_ ,_ ,_ ,d ,m ,y ,dow . ,_) (decode-time start)))
+(pcase step
+  (`day (org-encode-time 0 0 org-extend-today-until (1+ d) m 
y))
+  (`week
+   (let ((offset (if (= dow week-start) 7
+   (mod (- week-start dow) 7
+ (org-encode-time 0 0 org-extend-today-until (+ d offset) 
m y)))
+  (`semimonth (org-encode-time 0 0 0
+   (if (< d 16) 16 1)
+   (if (< d 16) m (1+ m)) y))
+  (`month (org-encode-time 0 0 0 month-start (1+ m) y))
+  (`year (org-encode-time 0 0 org-extend-today-until 1 1 (1+ 
y))


I do not like repeating of `org-encode-time' but do not see another way
till Emacs-29 will become the lowest supported version.


This is fine. AFAIK, other parts of time handling code is full of conds
and pcases.


I mean that before my patch there was single `encode-time' outside of 
`pcase', I replace `list' by `org-encode-time' inside each pattern.



+   (org-encode-time
+ (apply #'list
+(or (car time0) 0)
+(+ (if (eq timestamp? 'minute) n 0) (nth 1 time0))
+(+ (if (eq timestamp? 'hour) n 0)   (nth 2 time0))
+(+ (if (eq timestamp? 'day) n 0)(nth 3 time0))
+(+ (if (eq timestamp? 'month) n 0)  (nth 4 time0))
+(+ (if (eq timestamp? 'year) n 0)   (nth 5 time0))
+(nthcdr 6 time0
(when (and (memq timestamp? '(hour minute))
 extra
 (string-match "-\\([012][0-9]\\):\\([0-5][0-9]\\)" extra))


I am tempting to write something like

(let* ((ts (copy-sequence time0))
 (ord (memq timestamp? '(year month day hour minute)))
 (field (and ord (nthcdr (length ord) ts
  (when field
(setcar field (+ (car field) n)))
  (org-encode-time ts))

but I am afraid it will make the code rather obscure.


Yes, the second version is rather hard to understand. The proper
solution would be writing (or using) some high-level time handling
library and then using it in Org. Then, we would not need to deal with
low-level time representations so frequently.


From my point of view

  (cl-mapcar
   (lambda (value part)
 (if (and part (eq part timestamp?))
 (+ n value)
   value))
   time0 '(second minute hour day month year nil nil nil))

is better than the original code, but...

Nicolas Goaziou to emacs-orgmode. [Patch] to correctly sort the items 
with emphasis marks in a list. Mon, 19 Apr 2021 18:08:17 +0200.

https://list.orgmode.org/87r1j6b6ku@nicolasgoaziou.fr
>

I stay away from CL as much as possible, otherwise newcomers will have
to learn two languages to start contributing, Elisp and CL (cl-loop,
ewww). CL is still necessary however, as we cannot use `seq' yet.




Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Ihor Radchenko
"Bruce D'Arcus"  writes:

>> Last thing: I heard that the citation part of the manual is still
>> undocumented. Is this right? If so, do you think what we discovered
>> (especially about manually requiring libraries) may be useful? May I
>> help?
>
> It's not undocumented; it's poorly documented :-)
>
> https://orgmode.org/manual/Citation-handling.html#Citation-handling
>
> I don't know the process here on this, but definitely it needs improvements.

The process is just as any other patch. That is
https://orgmode.org/worg/org-contribute.html

Best,
Ihor



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Bruce D'Arcus
On Fri, May 13, 2022 at 9:32 AM Alessandro Bertulli
 wrote:

> Last thing: I heard that the citation part of the manual is still
> undocumented. Is this right? If so, do you think what we discovered
> (especially about manually requiring libraries) may be useful? May I
> help?

It's not undocumented; it's poorly documented :-)

https://orgmode.org/manual/Citation-handling.html#Citation-handling

I don't know the process here on this, but definitely it needs improvements.

I'm not actually sure about the processor loading issue, given that it
should have been addressed months ago?

Bruce



[PATCH] Re: How to stop results being hidden when using ":results drawer"?

2022-05-13 Thread Ihor Radchenko
John Kitchin  writes:

> This issue is specific to using a scimax function
> `scimax-ob-execute-and-next-block` that executes the current block then
> moves to the next or creates a new block if needed. This is a UI feature
> from jupyter notebooks that I like to use.
>
> That function uses `(org-babel-next-src-block)`, which uses
> org-next-block, which calls org-show-context, which uses
> org-show-set-visibility, which calls org-show-entry, which hides the
> drawers.
>
> It isn't an org-core issue perhaps, other than it is not obvious why
> org-show-entry has a hard-coded line to hide drawers in it.

I'd say that it is org-core issue. The current behaviour does not really
follow what org-fold-show-entry docstring promises:

>> Show the body directly following its heading.

>> Show the heading too, if it is currently invisible.

In fact, forcefully folding the drawers is relatively recent addition by
Nicolas in 1027e0256903bc2.

I am attaching the patch making drawer folding controllable via optional
argument. WDYT?

Best,
Ihor

>From bd3c7ac6162d64a19eff370b7b22ba233f8480ad Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Fri, 13 May 2022 21:30:46 +0800
Subject: [PATCH] org-fold-show-entry: Do not fold drawers unless requested

* lisp/org-fold.el (org-fold-show-entry): Do not fold drawers in the
unfolded entry unless the new optional argument is non-nil.  Folding
the drawers was introduced in 1027e0256903bc2, but does not follow the
function docstring.  Moreover, folding drawers creates unexpected
behaviour in some cases.  See
https://orgmode.org/list/m2a6bl4mmr@andrew.cmu.edu

* etc/ORG-NEWS (~org-fold-show-entry~ does not fold drawers by default
anymore): Document the change.

* lisp/org-agenda.el (org-agenda-show):
(org-agenda-show-and-scroll-up):
(org-agenda-show-1):
* lisp/org-clock.el (org-clock-goto):
* lisp/org-compat.el (outline-toggle-children):
* lisp/org-timer.el (org-timer--get-timer-title):
* lisp/org.el (org-move-subtree-down):
(org-return): Explicitly request folding drawers inside the revealed
entry in the places where it appears to make sense.
---
 etc/ORG-NEWS   | 7 +++
 lisp/org-agenda.el | 6 +++---
 lisp/org-clock.el  | 2 +-
 lisp/org-compat.el | 2 +-
 lisp/org-fold.el   | 4 ++--
 lisp/org-timer.el  | 2 +-
 lisp/org.el| 4 ++--
 7 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 582816534..15986c935 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -190,6 +190,13 @@ installed. It uses Emacs' font-lock information, and so tends to
 produce results superior to Minted or Listings.
 
 ** New functions and changes in function arguments
+*** ~org-fold-show-entry~ does not fold drawers by default anymore
+
+~org-fold-show-entry~ now accepts an optional argument HIDE-DRAWERS.
+When the argument is non-nil, the function folds all the drawers
+inside entry.  This was the default previously.
+
+Now, ~org-fold-show-entry~ does not fold drawers by default.
 
 *** New function ~org-element-cache-map~ for quick mapping across Org elements
 
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 0479a0e1f..6fd0e4498 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9701,7 +9701,7 @@ (defun org-agenda-show ( full-entry)
   (interactive "P")
   (let ((win (selected-window)))
 (org-agenda-goto t)
-(when full-entry (org-fold-show-entry))
+(when full-entry (org-fold-show-entry 'hide-drawers))
 (select-window win)))
 
 (defvar org-agenda-show-window nil)
@@ -9720,7 +9720,7 @@ (defun org-agenda-show-and-scroll-up ( arg)
 	  (select-window org-agenda-show-window)
 	  (ignore-errors (scroll-up)))
   (org-agenda-goto t)
-  (org-fold-show-entry)
+  (org-fold-show-entry 'hide-drawers)
   (if arg (org-cycle-hide-drawers 'children)
 	(org-with-wide-buffer
 	 (narrow-to-region (org-entry-beginning-position)
@@ -9764,7 +9764,7 @@ (defun org-agenda-show-1 ( more)
  ((and (called-interactively-p 'any) (= more 1))
   (message "Remote: show with default settings"))
  ((= more 2)
-  (org-fold-show-entry)
+  (org-fold-show-entry 'hide-drawers)
   (org-fold-show-children)
   (save-excursion
 	(org-back-to-heading)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index ec87aaf8a..c04a8fdcf 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1849,7 +1849,7 @@ (defun org-clock-goto ( select)
 (pop-to-buffer-same-window (marker-buffer m))
 (if (or (< m (point-min)) (> m (point-max))) (widen))
 (goto-char m)
-(org-fold-show-entry)
+(org-fold-show-entry 'hide-drawers)
 (org-back-to-heading t)
 (recenter org-clock-goto-before-context)
 (org-fold-reveal)
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 704197645..8553500d6 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -1400,7 +1400,7 @@ (defadvice outline-toggle-children (around outline-toggle-children@fix-for-org-f
   (if (not (org-fold-folded-p 

Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
Thanks, I'll mail to mr Collins to inform him then. Thank you all for
your help!

Last thing: I heard that the citation part of the manual is still
undocumented. Is this right? If so, do you think what we discovered
(especially about manually requiring libraries) may be useful? May I
help?

Thank you,
Alessandro



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Bruce D'Arcus
On Fri, May 13, 2022 at 9:15 AM Alessandro Bertulli
 wrote:

...

> So, shall we conclude that latexmk has an issue with correctly
> recognizing natbib and calling bibtex?

Yes!

I just tried it now, and see the same thing. It's weird, because I
don't recall seeing that before.

I'd call that a bug.

Bruce



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
Ok, I think I got something.

Indeed, setting org-latex-pdf-process to

'("pdflatex -output-directory %o %f"
  "bibtex %b" "pdflatex -output-directory %o %f"
  "pdflatex -output-directory %o %f")

produces the correct pdf output. I think I have a hint of the reason for
this.

When exporting to a LaTeX file, and then compiling, the keybinding "C-c
C-a" invokes TeX-command-run-all, which in turn invokes
TeX-command-sequence, which in turn invokes TeX-command-default: this is an 
elisp function that
basically replaces the work of latexmk, checking the timestamps of files
and deciding wether to use bibtex or biber. Here's the snippet:
   (if (bound-and-true-p LaTeX-using-Biber)
   TeX-command-Biber TeX-command-BibTeX))

So, latexmk is never actually called!

The point is that natbib needs bibtex to be called: in fact setting
org-latex-pdf-process to manually call it produces the correct output,
and setting it to call biber instead produces the "(?)" (as well as an
empty .bbl file).

So, shall we conclude that latexmk has an issue with correctly
recognizing natbib and calling bibtex?

Alessandro



Re: How to stop results being hidden when using ":results drawer"?

2022-05-13 Thread John Kitchin
If you add this and click on it:


[[elisp:(org-show-entry)]]

The drawer will collapse.

This issue is specific to using a scimax function
`scimax-ob-execute-and-next-block` that executes the current block then
moves to the next or creates a new block if needed. This is a UI feature
from jupyter notebooks that I like to use.

That function uses `(org-babel-next-src-block)`, which uses
org-next-block, which calls org-show-context, which uses
org-show-set-visibility, which calls org-show-entry, which hides the
drawers.

It isn't an org-core issue perhaps, other than it is not obvious why
org-show-entry has a hard-coded line to hide drawers in it.


Ihor Radchenko  writes:

> John Kitchin  writes:
>
>> This does not change anything for me.
>>
>> The function that causes folding for me is `org-entry-show'. Presumably
>> because of this line: (org-cycle-hide-drawers 'children)
>>
>> My solution was an override advice that makes this function not run when
>> point is in a src-block
>> (https://github.com/jkitchin/scimax/blob/master/scimax-jupyter.el#L281).
>
> Could you elaborate? I am not sure how `org-entry-show' has anything to
> do with hiding results.
>
> I tried the following Org file with latest Org main (after (require 
> 'ob-python)):
>
> * test heading
>
> #+begin_src python :results drawer output
>   print(1+2)
> #+end_src
>
> #+RESULTS:
> :results:
> 3
> :end:
>
> The drawer does not get hidden.
>
> Best,
> Ihor


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
Pronouns: he/him/his



Re: [PATCH] Re: Concatenate properties

2022-05-13 Thread Ihor Radchenko
Tyler Grinn  writes:

> Ihor Radchenko  writes:
>
>> Note that your patch is >15LOC long and you need to sign the copyright
>> agreement with FSF in order to contribute. See
>> https://orgmode.org/worg/org-contribute.html#copyright
>
> I've already submitted a copyright assignment to the FSF in order to
> publish on ELPA. Do I need one specific to org-mode?

Nope. The ELPA one is good enough. Basically, Org has the same
requirement as Emacs (Org is a part of Emacs).

>>> +(defcustom org-property-separators nil
>>> ...
>>> +  :group 'org-properties
>>> +  :type '(alist :key-type string :value-type sexp))
>>
>> This defcustom type does not match what you described in the docstring.
>> You need something like :type '(alist :key-type (choice string (repeat 
>> string)) :value-type string)
>
> Setting ':value-type string' is confusing, in my opinion, because the
> default single space looks like:   in the customization buffer, which is
> indistinguishable from no space: . I just found out about the restricted-sexp
> type, which I think makes the customization buffer more user-friendly.

restricted-sexp is fine. Though you could also do something like
(choice (const :tag "Single space" " ") (string :tag "Other string"))

> From f474cb25840fdc6b24618b1452cb7fdd32545092 Mon Sep 17 00:00:00 2001
> From: Tyler Grinn 
> Date: Mon, 9 May 2022 15:52:58 -0400
> Subject: [PATCH] lisp/org.el: Add org-property-separators option

LGTM!

I will leave this for another week to give other people a chance to
comment.

For reference, this patch might be useful in 
https://orgmode.org/list/87o821dv7o.fsf@localhost

Best,
Ihor




Re: [PATCH] org-macs.el: Do not compare wall time and file modification time

2022-05-13 Thread Max Nikulin

On 13/05/2022 05:52, Paul Eggert wrote:

On 5/12/22 09:55, Max Nikulin wrote:


+    (unless (file-exists-p file)
+  (error "File to tangle does not exist: %s" file))
+    (when (file-newer-than-file-p file tangled-file)
   (org-babel-tangle-file file ...


file-newer-than-file-p succeeds only if FILE exists, so in that case 
it'd be a bit more efficient to avoid testing FILE's existence again, e.g.:


    (cond
  ((file-newer-than-file-p file tangled-file)
   (org-bable-tangle-file file ...))
  ((not (file-exists-p file))
   (error "File to tangle does not exist: %s" file)))


My opinion is that performance improvement is negligible while negative 
impact related to code readability is noticeable. Maybe it is just 
because elisp is not my favorite language.


Feel free to commit your variant though, I will not object, but I am not 
going to update my patch in this way as well.


P.S. Since I believe it should be fixed in the bugfix branch, I tried to 
keep changes as minimal as possible.


I am not sure which kind of code I would prefer to see. I do not like 
`cond' with 2 branches. Even nested ifs are a bit better while still to 
"heavy"


(if (not (file-newer-than-file-p file tangled-file))
(unless (file-exists-p file)
  (error ...))
  (org-babel-tangle-file ...)) ; intentionally put below to the 
else branch


Maybe I would prefer something like file-target-is-up-to-date-p 
predicate that returns nil if target does not exist. For some reason 
`org-babel-tangle-file' silently ignores missed file neither signalling 
a error nor returning a special value. Delegating error handling to 
`org-babel-tangle-file' would allow to get consistent error messages.


In the previous version of the patch (with inline implementation of file 
modification time comparison) the suggested optimization was quite 
natural, with `file-newer-than-file-p' it is trade off with code 
readability.





Re: How to stop results being hidden when using ":results drawer"?

2022-05-13 Thread Ihor Radchenko
John Kitchin  writes:

> This does not change anything for me.
>
> The function that causes folding for me is `org-entry-show'. Presumably
> because of this line: (org-cycle-hide-drawers 'children)
>
> My solution was an override advice that makes this function not run when
> point is in a src-block
> (https://github.com/jkitchin/scimax/blob/master/scimax-jupyter.el#L281).

Could you elaborate? I am not sure how `org-entry-show' has anything to
do with hiding results.

I tried the following Org file with latest Org main (after (require 
'ob-python)):

* test heading

#+begin_src python :results drawer output
  print(1+2)
#+end_src

#+RESULTS:
:results:
3
:end:

The drawer does not get hidden.

Best,
Ihor



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Bruce D'Arcus
On Fri, May 13, 2022 at 6:54 AM Eric S Fraga  wrote:
>
> On Friday, 13 May 2022 at 11:55, Alessandro Bertulli wrote:
> >> Check out org-latex-pdf-process maybe?
> >
> > I don't know the library so in depth, but I'll try, thank you!
>
> I have the following in my init file:
>
> (setq org-latex-pdf-process '("pdflatex -output-directory %o %f"
>   "bibtex %b"
>   "pdflatex -output-directory %o %f"
>   "pdflatex -output-directory %o %f"))
>
> which tells org to run pdflatex, then bibtex, and then pdflatex twice
> more to ensure that all references are satisfied.

I thought org now by default, if available, uses latexmk, which should
take care of all this?

At least, it does for me.

Bruce



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Eric S Fraga
On Friday, 13 May 2022 at 11:55, Alessandro Bertulli wrote:
>> Check out org-latex-pdf-process maybe?
>
> I don't know the library so in depth, but I'll try, thank you!

I have the following in my init file:

(setq org-latex-pdf-process '("pdflatex -output-directory %o %f"
  "bibtex %b"
  "pdflatex -output-directory %o %f"
  "pdflatex -output-directory %o %f"))

which tells org to run pdflatex, then bibtex, and then pdflatex twice
more to ensure that all references are satisfied.

The default might not include bibtex...  I don't know.

-- 
: Eric S Fraga, with org release_9.5.3-481-gaea24b in Emacs 29.0.50



Re: [BUG] org-babel-load-file can not compile file

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

>>> It seems, it is a regression caused by the Org commit
>>> 0193b543e9ef84bfefe76d55e330d5b1cb842cef
>>>
 -(byte-compile-file tangled-file 'load)
 +(byte-compile-file tangled-file)
 +(load tangled-file)
>> 
>> 
>> What if you substitute the load call with
>> (load (byte-compile-dest-file tangled-file))?
>
> I do not mind (of course if there is no plan to deprecate the function).

Fixed on bugfix via 4fe59b688

Best,
Ihor



Re: [BUG] org-babel-load-file can not compile file

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

>> What if you substitute the load call with
>> (load (byte-compile-dest-file tangled-file))?
>
> I do not mind (of course if there is no plan to deprecate the function).
>
> In addition, from my point of view, `byte-recompile-file' with 0 as the 
> FORCE argument is more suitable than simple `byte-compile-file' since 
> the former does not rewrite the compiled file when it is up to date.

What about simply using touch?

>From 9746b9cd0a1accfc20b9d59c387bb05624154fe2 Mon Sep 17 00:00:00 2001
Message-Id: <9746b9cd0a1accfc20b9d59c387bb05624154fe2.1652438075.git.yanta...@gmail.com>
From: Ihor Radchenko 
Date: Fri, 13 May 2022 18:21:36 +0800
Subject: [PATCH] org-babel-load-file: Do not rely on `org-babel-tangle-file'
 making changes

* lisp/org.el (org-babel-load-file): Update modification time even
when `org-babel-tangle-file' does not actually modify the tangled
file.  This makes sure that modify-time comparison logic does not make
Org re-tangle Org file that had been changed but the changes did not
affect the tangled code.

See https://orgmode.org/list/t5j75h$dbo$1...@ciao.gmane.io
---
 lisp/org.el | 5 +
 1 file changed, 5 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 47a16e94b..09a001414 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -256,6 +256,11 @@ (defun org-babel-load-file (file  compile)
 	 tangled-file
 	 (file-attribute-modification-time
 	  (file-attributes (file-truename file
+  ;; Make sure that tangled file modification time is
+  ;; updated even when `org-babel-tangle-file' does not make changes.
+  ;; This avoids re-tangling changed FILE where the changes did
+  ;; not affect the tangled code.
+  (set-file-times tangled-file)
   (org-babel-tangle-file file
  tangled-file
  (rx string-start
-- 
2.35.1



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
> IDK; my version is newer:
> 
> Org mode version 9.6 (9.6-??-2bd34edb64 @
> /home/bruce/.config/emacs/.local/straight/build-29.0.50/org/)

I downloaded it from MELPA (since I'm using Emacs 28.1, the one built-in
is 9.5.2).

> I'm using doom, which as you can tell is using straight.

I suppose straight does all the loading automatically, then. No problem
so, I think.

Thank you!

Alessandro



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
> For the record, n.d. means "no date" so your BiBTeX entry must be
> missing the year field, for instance.

Actually, it has the field "date". I have read some advice saying that
using "date" over "year", "month" and "day" is encouraged, but searching
online it appears that it is not supported by BiBTeX (and therefore
natbib), only by biblatex. So you're right, it's not a problem of org
export.

> Check out org-latex-pdf-process maybe?

I don't know the library so in depth, but I'll try, thank you!

Alessandro





Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Eric S Fraga
On Thursday, 12 May 2022 at 20:31, Alessandro Bertulli wrote:
> displays some annoing "n.d."). 

For the record, n.d. means "no date" so your BiBTeX entry must be
missing the year field, for instance.

> After that, if I try again to directly export to pdf, it works. I
> suppose it's a problem in producing the intermediate bibliography
> files.

Check out org-latex-pdf-process maybe?

-- 
: Eric S Fraga, with org release_9.5.3-481-gaea24b in Emacs 29.0.50



how to obtain a line to a file when using the remote command in a tabl

2022-05-13 Thread Uwe Brauer



Hi

I have the following two files

#+begin_src 

File1.org

,** Table
   :PROPERTIES:
   :ID: student1
   :END:


,#+BEGIN: columnview :maxlevel 2  :skip-empty-rows t :indent nil :hlines 2  
:format "%5TODO(Status) %5Ap(Name) %5Ej1(Ej1/20)  %5Ej2(Ej2/25)  %5Ej3(Ej3/55)  
%5Res(Result)"
| Status | Name | Ej1/20 | Ej2/25 | Ej3/55 | Result |
|+--++++|
| DONE   | Student1 | 15 | 20 | 35 |  7 |
,#+TBLFM: $6=vsum($3..$5)/10;
,#+END
#+end_src

And  after using org-id-update-id-locations 

#+begin_src 


File2.org

Create a master file with the following content

| Status | Name | Ej1/20 | Ej2/25 | Ej3/55 | Result |
|+--++++|
||  |||||
,#+TBLFM: @2='(identity remote(student1,@>$$#));
#+end_src

Is there any possibility also to obtain a (clickable link, for the file1
location) via the remote command?

Thanks and regards

Uwe Brauer 

-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.