Re: org-agenda-dim-blocked-tasks don't use org-todo face

2022-12-12 Thread Ihor Radchenko
Mark Kerr  writes:

> Thank you. I may have been unclear but the result seems to be the
> opposite of what I was hoping for.
>
> I was hoping to be able to gain the ability to use the org-todo face
> with blocked tasks, while retaining the org-priority face which was
> previously working..
>
> Now blocked tasks are entirely rendered with
> org-agenda-dimmed-todo-face, including the priority.

What you observe is what I intended to do.

What you want is an opposite of "dimming" (IMHO).

To achieve what you want, you may consider customizing
`org-agenda-dimmed-todo-face' face. This face is applied on top of all
other faces. If you, say, set only a background, the todo keywords will
retain their foreground colour.

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



Re: org-babel shell in windows not finishing command

2022-12-12 Thread Ihor Radchenko
Vlastimil Vondra  writes:

> after upgrading to 9.6. The output is exactly the same.

It would be great if someone with access to Windows could debug this.

First, the version without session. It should be slightly less tricky -
Org creates a temporary script file and executes it.

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



9.6 - hide-drawer-startup option(s?) [9.5.5 (release_9.5.5 @ /usr/local/share/emacs/29.0.50/lisp/org/)]

2022-12-12 Thread Kévin Le Gouguec
Hey Org,

Trying out Emacs 29 and going over ORG-NEWS, this item stands out to me:

> *** A new custom setting =org-hide-drawer-startup= to control initial folding 
> state of drawers

A quick grep for org(-cycle)?-hide-drawer-startup turns this up:

File: etc/ORG-NEWS
 459  27 *** A new custom setting =org-hide-drawer-startup= to control initial 
folding state of drawers

File: lisp/org-cycle.el
 128  12 (defcustom org-cycle-hide-drawer-startup t
 630  11 (when org-cycle-hide-drawer-startup (org-cycle-hide-drawers 'all))

File: lisp/org.el
4074  20 ("hidedrawers" org-hide-drawer-startup t)
4075  22 ("nohidedrawers" org-hide-drawer-startup nil)

AFAICT those were all introduced in 2022-06-25 "org-cycle.el: New custom
setting `org-cycle-hide-drawer-startup'" (bcfed0f34).  Is the patch
below in order, or have I missed something that makes this all work?

(Haven't actually tried the feature and won't be able to before this
evening; sending this speculatively in case things are as simple as they
look.  Apologies for the noise if not)


diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 67889c0b1..e3b3f802d 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -456,7 +456,7 @@ options:
 =:icalendar-scheduled-summary-prefix=,
 =:icalendar-deadline-summary-prefix=
 
-*** A new custom setting =org-hide-drawer-startup= to control initial folding 
state of drawers
+*** A new custom setting =org-cycle-hide-drawer-startup= to control initial 
folding state of drawers
 
 Previously, all the drawers were always folded when opening an Org
 file.  This only had an effect on the drawers outside folded
diff --git a/lisp/org.el b/lisp/org.el
index 3018e4d6f..80e44d85a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4071,8 +4071,8 @@ After a match, the following groups carry important 
information:
 ("noptag" org-tag-persistent-alist nil)
 ("hideblocks" org-hide-block-startup t)
 ("nohideblocks" org-hide-block-startup nil)
-("hidedrawers" org-hide-drawer-startup t)
-("nohidedrawers" org-hide-drawer-startup nil)
+("hidedrawers" org-cycle-hide-drawer-startup t)
+("nohidedrawers" org-cycle-hide-drawer-startup nil)
 ("beamer" org-startup-with-beamer-mode t)
 ("entitiespretty" org-pretty-entities t)
 ("entitiesplain" org-pretty-entities nil))



[BUG] org-cycle-max-level is broken, especially when using org-element-cache (was: Problem in org-inlinetask-min-level's docstring?)

2022-12-12 Thread Ihor Radchenko
alain.coch...@unistra.fr writes:

> NB: While experimenting, I noticed that, if I customize
> org-cycle-max-level to 0, then a  on a headline generates the
> cryptic "org-match-line: Invalid regexp: "Invalid content of
> \\{\\}"".  

Well. It does not really make much sense to set this variable to 0 or
negative values. I guess we can add a guard against such scenarios.

Also, this whole thing is broken when cache is active.

I will need to look into this further. The current approach with
let-binding org-outline-regexp appears to be broken, especially when
using element cache.

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



Re: Problem in org-inlinetask-min-level's docstring?

2022-12-12 Thread Ihor Radchenko
alain.coch...@unistra.fr writes:

> Ihor Radchenko writes on Fri 25 Nov 2022 10:33:
>  > alain.coch...@unistra.fr writes:
>
>  > > I do not understand the last sentence, even assuming that the 1st
>  > > 'of' is 'or'.  Is my English the problem?
>  > 
>  > That sentence is indeed screwed up.
>  > 
>  > Does `org-cycle-max-level' docstring sound better?
>
> Yes.

Fixed on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=45dc19516

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



[BUG] Documentation fix needed in "4.4 External Links" [9.6 ( @ /home/dsmasterson/.emacs.d/elpa/org-9.6/)]

2022-12-12 Thread David Masterson



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.


The documentation page for "4.4 External Links" could provide the
answers to following questions:

1. What "file types" are supported by link type "file"?

2. If #1 depends on some org variable settings, can you mention what
variables control the answer to #1?

Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll 
bars)
 of 2021-03-27, modified by Debian
Package: Org mode version 9.6 ( @ /home/dsmasterson/.emacs.d/elpa/org-9.6/)
-- 
David Masterson



Re: Latest MathJax?

2022-12-12 Thread Ihor Radchenko
Galaxy Being  writes:

> I just perused my org-html-mathjax-options and the path seems outdated
>
> '((path "
> https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS_HTML;)
> ...
> Shouldn't it be
>
> https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

Please update Org to the latest release. See
https://orgmode.org/Changes.html#org2d0067a

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



Latest MathJax?

2022-12-12 Thread Galaxy Being
I just perused my org-html-mathjax-options and the path seems outdated

'((path "
https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS_HTML;)
  (scale "100")
  (align "center")
  (font "TeX")
  (linebreaks "false")
  (autonumber "AMS")
  (indent "0em")
  (multlinewidth "85%")
  (tagindent ".8em")
  (tagside "right"))

Shouldn't it be

https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

Is that up to me to change in my own org-html-mathjax-options? I'm not
doing any header arguments in org-mode buffers, no #+HTML_MATHJAX: stuff.
Basically, I'd like a different font for my LaTex/MathJax markup.

⨽
Lawrence Bottorff
Grand Marais, MN, USA
borg...@gmail.com


Re: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

2022-12-12 Thread Kyle Meyer
Ihor Radchenko writes:

> I am also wondering if we should include this into bugfix.
> This is a new feature, but it appears to be important enough to be
> merged into built-in Org.
> Bastien, Kyle, any thoughts?

Sounds reasonable to me.



Re: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

2022-12-12 Thread Tom Gillespie
Hi Ihor,
   Here's the updated patch using :safe, and an additional
patch for the news entry to make it easier to apply the
core change to bugfix if needed. Best!
Tom

> I am also wondering if we should include this into bugfix.

I can vouch for the fact that trying to work around this in
any other way is going to be a massive pain. For example,
it will be hard to use vanilla 29 for various CI types of things
where someone might need to execute a cell but not
want to allow arbitrary codeblocks.
From 4a78e1b5ea98dee569ff690037c661ab5c300194 Mon Sep 17 00:00:00 2001
From: Tom Gillespie 
Date: Sat, 10 Dec 2022 12:11:17 -0800
Subject: [PATCH 1/2] ob-core: add org-confirm-babel-evaluate-cell custom
 variable

* lisp/ob-core.el (org-confirm-babel-evaluate-cell): Added to control
execution of cells separate from execution of src blocks, it works in
exactly the same way as `org-confirm-babel-evaluate'.
* lisp/ob-core.el (org-babel-read): `org-confirm-babel-evaluate-cell'
is used to check cells independent of `org-confirm-babel-evaluate'.

Following the change in 10e857d42859a55b23cd4206ffce3ebd0f678583 it
became extremely annoying to tangle files that make extensive use of
elisp expression in src block #+header: statements.

This commit resolves the issue by making it possible to ignore checks
on cells (the old behavior) without compromising general security for
running src blocks.

This is necessary because there is no easy way to hop swap
`org-confirm-babel-evaluate' between `org-get-src-block-info' where
`org-babel-read' is called and the execution of that src block.  It
could probably be done using advice around `org-babel-read', but that
is a level of hackery that should be avoided.
---
 lisp/ob-core.el | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 2fa9d8978..d56e47de5 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -128,6 +128,14 @@ remove code block execution from the `\\[org-ctrl-c-ctrl-c]' keybinding."
 ;; don't allow this variable to be changed through file settings
 (put 'org-confirm-babel-evaluate 'safe-local-variable (lambda (x) (eq x t)))
 
+(defcustom org-confirm-babel-evaluate-cell t
+  "Confirm before evaluating a cell.
+This follows the same conventions as `org-confirm-babel-evaluate'."
+  :group 'org-babel
+  :package-version '(Org . "9.6")
+  :type '(choice boolean function)
+  :safe (lambda (x) (eq x t)))
+
 (defcustom org-babel-no-eval-on-ctrl-c-ctrl-c nil
   "\\\
 Remove code block evaluation from the `\\[org-ctrl-c-ctrl-c]' key binding."
@@ -3180,11 +3188,14 @@ situations in which is it not appropriate."
 		  (string= cell "*this*")))
  ;; Prevent arbitrary function calls.
  (if (and (memq (string-to-char cell) '(?\( ?`))
+  (if (functionp org-confirm-babel-evaluate-cell)
+  (funcall org-confirm-babel-evaluate-cell "emacs-lisp" cell)
+org-confirm-babel-evaluate-cell)
   (not (org-babel-confirm-evaluate
-  ;; See `org-babel-get-src-block-info'.
-  (list "emacs-lisp" (format "%S" cell)
-'((:eval . yes)) nil (format "%S" cell)
-nil nil
+;; See `org-babel-get-src-block-info'.
+(list "emacs-lisp" (format "%S" cell)
+  '((:eval . yes)) nil (format "%S" cell)
+  nil nil
  ;; Not allowed.
  (user-error "Evaluation of elisp code %S aborted." cell)
 	   (eval (read cell) t)))
-- 
2.37.4

From 03aad0a73acfca05245a01e83bae3609e6d3ed04 Mon Sep 17 00:00:00 2001
From: Tom Gillespie 
Date: Mon, 12 Dec 2022 17:45:14 -0800
Subject: [PATCH 2/2] * etc/ORG-NEWS: Add entry for
 `org-confirm-babel-evaluate-cell'.

---
 etc/ORG-NEWS | 36 
 1 file changed, 36 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 5d5e726e0..16ff5ba67 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -12,6 +12,42 @@ See the end of the file for license conditions.
 Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.7 (not released yet)
+
+** New options
+*** A new custom setting ~org-confirm-babel-evaluate-cell~ to control confirming execution of cells
+
+Following recent changes to ~org-babel-read~ it became annoying to
+tangle files that make extensive use of elisp expression in src
+block #+header: statements.
+
+~org-confirm-babel-evaluate-cell~ resolves the issue by making it
+possible to ignore checks on cells (the old behavior) without
+compromising general security for running src blocks.
+
+It works in the same way as ~org-confirm-babel-evaluate~, accepting a
+boolean or a function of two arguments (lang body).
+
+Here is an example that works for ~(and)~, ~(or)~, and simple calls to
+~(identity ...)~.
+
+#+begin_src emacs-lisp
+(setq-local
+ 

Re: [PATCH] lisp/org-expiry.el: Account for org-time-stamp-formats

2022-12-12 Thread Tom Gillespie
Here's the rebased patch. It should apply without issue. Best!
Tom
From 5247d2459800f82434f1bc3aeea136c18af7923c Mon Sep 17 00:00:00 2001
From: Tom Gillespie 
Date: Sun, 4 Dec 2022 01:02:35 -0800
Subject: [PATCH] lisp/org-expiry.el: Account for org-time-stamp-formats
 refactor

* lisp/org-expiry.el (org-expiry-insert-created)
(org-expiry-insert-expiry): timestamp formats dropped delimiters so a
slight modification is required following org commit
e3a7c01874c9bb80e04ffa58c578619faf09e7f0, the change is made backward
compatible by removing < and > from the old timestamp format
---
 lisp/org-expiry.el | 32 +---
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/lisp/org-expiry.el b/lisp/org-expiry.el
index b359610..c3dad28 100644
--- a/lisp/org-expiry.el
+++ b/lisp/org-expiry.el
@@ -301,12 +301,17 @@ update the date."
 		 (current-time)))
   (setq d-hour (format-time-string "%H:%M" d-time))
   (setq timestr
-(org-expiry-format-timestamp
- ;; two C-u prefixes will call org-read-date
-	 (if (equal arg '(16))
-		 (org-read-date nil nil nil nil d-time d-hour)
-	   (format-time-string (cdr org-time-stamp-formats)))
- org-expiry-inactive-timestamps))
+	;; two C-u prefixes will call org-read-date
+(concat "<"
+(if (equal arg '(16))
+(org-read-date nil nil nil nil d-time d-hour)
+  (format-time-string
+   (replace-regexp-in-string "\\(^<\\|>$\\)" ""
+   (cdr org-time-stamp-formats
+">"))
+  ;; maybe transform to inactive timestamp
+  (if org-expiry-inactive-timestamps
+	  (setq timestr (concat "[" (substring timestr 1 -1) "]")))
   (save-excursion
 	(org-entry-put
 	 (point) org-expiry-created-property-name timestr)
@@ -321,11 +326,16 @@ and insert today's date."
 (setq d-time (if d (org-time-string-to-time d)
 		   (current-time)))
 (setq d-hour (format-time-string "%H:%M" d-time))
-(setq timestr (org-expiry-format-timestamp
-   (if today
-		   (format-time-string (cdr org-time-stamp-formats))
-		 (org-read-date nil nil nil nil d-time d-hour))
-   org-expiry-inactive-timestamps))
+(setq timestr (concat "<"
+  (if today
+  (format-time-string
+   (replace-regexp-in-string "\\(^<\\|>$\\)" ""
+   (cdr org-time-stamp-formats)))
+(org-read-date nil nil nil nil d-time d-hour))
+  ">"))
+;; maybe transform to inactive timestamp
+(if org-expiry-inactive-timestamps
+	(setq timestr (concat "[" (substring timestr 1 -1) "]")))
 
 (save-excursion
   (org-entry-put
-- 
2.37.4



Re: Switching over from package org-radiobutton to native support

2022-12-12 Thread Samuel Wales
not sure what you mean by return.

org core code for a while now has included a minor mode for radio
buttons.  i think, however, #+ syntax and no mode is better if it
means that you can do it per list or per sublist.

that can also be used for other list features, such as ensuring bullet
style cnsistency or so.

On 11/26/22, Terje Larsen  wrote:
> So I found out that there is now native support for radio-button style
> selects and I have tested it and it seems to work well.
>
> However I am missing a function similar to `org-radiobutton-value`:
> https://github.com/Fuco1/org-radiobutton/blob/master/org-radiobutton.el#L111-L121
>
> That will return the value of the currently selected checkbox by the
> attached name.
>
> So for example:
>
> #+ATTR_ORG: :radio t
> #+NAME: named_radio_value
> - [ ] Value A
> - [X] Value B
> - [ ] Value C
>
> Would return `Value B` for `named_radio_value`. This is useful when
> creating interfaces in Org Mode and acting on those.
>
> I know it is possible via a mouthful of lisp. But it would be nice if it
> was natively supported. It would also be nice if this also worked for
> normal lists, e.g. having the possibility to easily extract all selected
> values.
>
> What do you think? Is something like this already implemented, but I missed
> it?
>
> Best regards,
> Terje Larsen
>


-- 
The Kafka Pandemic

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



Incorrect numbering of tables (and other elements like figures) [Org 9.6]

2022-12-12 Thread Kaushal Modi
Hello,

Since Org 9.6, I am seeing that the numbering of tables (and other elements
like figures) resets to 1 and stays so, thought I cannot see a pattern of
why that happens.

Org version: Org mode version 9.6 (release_9.6-40-g49cf3e ..)

Here's a small reproducible example that shows the problem in any exporter
(ox-ascii, ox-html, ..)

=
#+title: Table numbering test
#+options: author:nil toc:nil

#+caption: Should be Table 1
| h1   | h2   | h3   |
|--+--+--|
| abcdefgh | ijklmnop | qrstuvwx |

#+caption: Should be Table 2
| h1   | h2   | h3   |
|--+--+--|
| abcdefgh | ijklmnop | qrstuvwx |

#+caption: Should be Table 3
| h1   | h2   | h3   |
|--+--+--|
| abcdefgh | ijklmnop | qrstuvwx |

#+caption: Should be Table 4
| h1   | h2   | h3   |
|--+--+--|
| abcdefgh | ijklmnop | qrstuvwx |
=

Output of C-c C-e t A:

=
 __

  TABLE NUMBERING TEST
 __


 h1h2h3
--
 abcdefgh  ijklmnop  qrstuvwx
Table 1: Should be Table 1

 h1h2h3
--
 abcdefgh  ijklmnop  qrstuvwx
Table 2: Should be Table 2

 h1h2h3
--
 abcdefgh  ijklmnop  qrstuvwx
Table 1: Should be Table 3

 h1h2h3
--
 abcdefgh  ijklmnop  qrstuvwx
Table 1: Should be Table 4
=



--
Kaushal Modi


Re: org-insert-structure-template

2022-12-12 Thread Tim Cross


Anthony Carrico  writes:

> I'm trying to remember what the old keybinding was before it got switched to 
> 'C-c C-,'...

IIRC there wasn't one.


Previously, a completely different system was used for adding these
templates and it was bound to  <  (or was it >, I cannot remember).

The problem was that the old 'template' system was not terribly
flexible/powerful. For example, you could not mark a region, call tte
template function and have it wrap the template around the marked
region. 



Re: org-agenda-dim-blocked-tasks don't use org-todo face

2022-12-12 Thread Mark Kerr
From: Ihor Radchenko 

> [-- Attachment #1: Type: text/plain, Size: 534 bytes --]
>
> Mark Kerr  writes:
>
> > The org-todo face is used for todo keywords in non-blocked items.
> >
> > When org-agenda-dim-blocked-tasks is set to true, however, the todo keyword
> > is instead displayed using org-agenda-dimmed-todo-face.
> >
> > The org-priority face, however, is still used for blocked tasks.
> >
> > Is this by design or due to an error on my part? Is there a possible
> > workaround?
>
> This appears to be an omission on Org part, related some overlay
> implementation details in Emacs.
>
> Can you try the attached patch?
>
>
> [-- Warning: decoded text below may be mangled, UTF-8 assumed --]
> [-- Attachment #2: 
> 0001-org-agenda-dim-blocked-tasks-Prioritize-face-over-ot.patch --]
> [-- Type: text/x-patch, Size: 1422 bytes --]
>
> From 1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3 Mon Sep 17 00:00:00 2001
> Message-Id: 
> <1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3.1670839095.git.yanta...@posteo.net>
> From: Ihor Radchenko 
> Date: Mon, 12 Dec 2022 12:56:11 +0300
> Subject: [PATCH] org-agenda-dim-blocked-tasks: Prioritize face over other
>  overlays
>
> * lisp/org-agenda.el (org-agenda-dim-blocked-tasks): Use high overlays
> priority when adding dimmed face.  Otherwise, contained overlays, like
> created by `org-agenda-fontify-priorities', will take
> priority (default Emacs behavior).
>
> Reported-by: Mark Kerr 
> Link: 
> https://orgmode.org/list/CAM9qJ5+C3nvbNaJyq6ofRgPsuAMcaBD=2un-n96kb68nbbx...@mail.gmail.com
> ---
>  lisp/org-agenda.el | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index eda248938..05f2e3669 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -4166,7 +4166,9 @@ (defun org-agenda-dim-blocked-tasks ( 
> _invisible)
> (line-beginning-position))
>   (line-end-position
>(when todo-blocked
> -(overlay-put ov 'face 'org-agenda-dimmed-todo-face))
> +(overlay-put ov 'face 'org-agenda-dimmed-todo-face)
> +;; Override other overlays.
> +(overlay-put ov 'priority 50))
>(when invisible
>  (org-agenda-filter-hide-line 'todo-blocked)))
>  (if (= (point-max) (line-end-position))
> --
> 2.38.1
>
>
> [-- Attachment #3: Type: text/plain, Size: 224 bytes --]
>
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 


This is my first time applying a patch, so I hope I did it properly.

Thank you. I may have been unclear but the result seems to be the
opposite of what I was hoping for.

I was hoping to be able to gain the ability to use the org-todo face
with blocked tasks, while retaining the org-priority face which was
previously working..

Now blocked tasks are entirely rendered with
org-agenda-dimmed-todo-face, including the priority.

In case I messed up the patch, here is the patched function:

--
(defun org-agenda-dim-blocked-tasks ( _invisible)
  "Dim currently blocked TODOs in the agenda display.
When INVISIBLE is non-nil, hide currently blocked TODO instead of
dimming them."   ;FIXME: The arg isn't used, actually!
  (interactive "P")
  (when (called-interactively-p 'interactive)
(message "Dim or hide blocked tasks..."))
  (dolist (o (overlays-in (point-min) (point-max)))
(when (eq (overlay-get o 'face) 'org-agenda-dimmed-todo-face)
  (delete-overlay o)))
  (save-excursion
(let ((inhibit-read-only t))
  (goto-char (point-min))
  (while (let ((pos (text-property-not-all
(point) (point-max) 'org-todo-blocked nil)))
  (when pos (goto-char pos)))
(let* ((invisible
(eq (org-get-at-bol 'org-todo-blocked) 'invisible))
  (todo-blocked
(eq (org-get-at-bol 'org-filter-type) 'todo-blocked))
  (ov (make-overlay (if invisible
(line-end-position 0)
  (line-beginning-position))
(line-end-position
 (when todo-blocked
   (overlay-put ov 'face 'org-agenda-dimmed-todo-face)
;; Override other overlays.
(overlay-put ov 'priority 50))
 (when invisible
   (org-agenda-filter-hide-line 'todo-blocked)))
(if (= (point-max) (line-end-position))
(goto-char (point-max))
 (move-beginning-of-line 2)
  (when (called-interactively-p 'interactive)
(message "Dim or hide blocked tasks...done")))
--

Thank you, Mark



For your consideration: Extending org-info-js with additional hooks

2022-12-12 Thread David O'Toole
Greetings, Orgmoders.

After some discussion with Yantar on IRC, I humbly submit the attached diff
for your consideration.

It adds new hooks to org-info-js to allow the following: 1. inserting
page-specific HTML into each OrgInfo header, and 2. calling a custom
JavaScript function to run after any page navigation button/link is
clicked. I have used these hooks to implement Org-fleuron, a custom config
with nice navigation buttons, a greeting balloon, and embedded theme/fonts.
You can find out more about org-fleuron here:
https://davidotoole.info/fleuron.html?#org5dc18bc and the page was made
with the setup.

I also corrected some of the English messages displayed by org-info-js.

I hope you will find this useful.

Please let me know if you have any questions or comments!
diff -u /home/dto/Downloads/org-info-src.js /home/dto/notebook/org-info-src.js
--- /home/dto/Downloads/org-info-src.js	2022-12-10 11:47:20.086746072 -0500
+++ /home/dto/notebook/org-info-src.js	2022-12-12 11:48:20.471441625 -0500
@@ -28,30 +28,57 @@
  * 
  *
  *
- * The script is now roughly devided in sections by form-feeds. Editors can
- * move section wise using the common emacs commands for this purpos ('C-x ]'
- * and  'C-x ]').
+ * The script is now roughly divided into sections by
+ * form-feeds. Editors can move section-wise using the common emacs
+ * commands for this purpose ('C-x ]' and 'C-x ]').
  *
  * The sections are:
  *1. This comment block.
- *2. Everything around =OrgNodes=.
- *3. =org_html_manager= constructor and setup.
- *4. =org_html_manager= folding and view related stuff.
- *5. =org_html_manager= history related methods.
- *6. =org_html_manager= minibuffer handling.
- *7. =org_html_manager= user input.
- *8. =org_html_manager= search functonality.
- *9. =org_html_manager= misc.
- *10. Global functions.
+ *2. Content hooks
+ *3. Everything around =OrgNodes=.
+ *4. =org_html_manager= constructor and setup.
+ *5. =org_html_manager= folding and view related stuff.
+ *6. =org_html_manager= history related methods.
+ *7. =org_html_manager= minibuffer handling.
+ *8. =org_html_manager= user input.
+ *9. =org_html_manager= search functonality.
+ *10. =org_html_manager= misc.
+ *11. Global functions.
  */
 
+/**
+ * This program has been modified from its original version to add
+ * hooks for per-page HTML injection and per-click navigation event
+ * response. A patch is being submitted to upstream. 
+ *  - David T. O'Toole 
+ */
+
+
+
+
+/**
+ * The following variable should hold a function which accepts an
+ * integer pageNumber and should return HTML to be inserted in the
+ * OrgInfo header of each page.
+ */
+var OrgInfoPageInsertFunction = function(pageNumber) {return '';};
+
+
+/**
+ * The following variable should hold a function which accepts an
+ * integer pageNumber and performs a user-defined action after the
+ * page has flipped.
+ *
+ */
+var OrgInfoAfterNavigateFunction = function(pageNumber) {};
+
 
 
 
 
 /**
  * Creates a new OrgNode.
- * An OrgOutline stores some refs to its assoziated node in the document tree
+ * An OrgOutline stores some refs to its associated node in the document tree
  * along with some additional properties.
  */
 function OrgNode ( _div, _heading, _link, _depth, _parent, _base_id, _toc_anchor)
@@ -904,14 +931,16 @@
 for(var i = 0; i < this.SECS.length; ++i)
 {
   this.SECS[i].IDX = i;
-  var html = ''
-+''
-+''
-+'Top: '+index_name+''
-+''
-+ this.LINKS
-+'toggle view'
-+'';
+var html =
+OrgInfoPageInsertFunction(i)
++ ''
++''
++ ''
++ 'Top: '+index_name+''
++ ''
++  this.LINKS
++ 'toggle view'
++ '';
 
   if(i>0)
 html += ''
-+''
++''
 +this.SECS[i].PARENT.HEADING.innerHTML+'';
   else
-html += ''+this.SECS[i].HEADING.innerHTML+'';
+html += ''+this.SECS[i].HEADING.innerHTML+'';
 
   // Right:
   html += '';
@@ -1321,7 +1350,7 @@
 var T = this;
 var i = T.NODE.IDX + 1;
 if(i0) t.navigateTo(i-1);
-else t.warn("Already first section.");
+else t.warn("This is already the first section.");
   },
 
 
@@ -1345,6 +1374,8 @@
 if(t.VIEW == t.SLIDE_VIEW) t.adjustSlide(sec);
 t.pushHistory(sec, t.NODE.IDX);
 t.showSection(sec);
+
+OrgInfoAfterNavigateFunction();
   },
 
 
@@ -1386,7 +1417,7 @@
   else if(t.HFO && history.length) history.forward();
   else {
 t.HFO=1;
-t.warn("History: No where to foreward go from here. Any key and `B' to move to next file in history.");
+t.warn("History: There is nowhere to go forward to from here. Press `B' to move to the next page in your browser history.");
   }
 } else {
   if(t.HISTORY[t.HIST_INDEX - 1]) {
@@ -1406,7 +1437,7 @@
   else 

Re: Two problems with export to Google calendar

2022-12-12 Thread Max Nikulin

On 12/12/2022 21:00, Ihor Radchenko wrote:

Max Nikulin writes:


By default, ox-icalendar takes the value of your TZ environment variable.


I think, in most cases TZ is not set, so (format-time-string "%Z") is
used to get abbreviation (that is ambiguous).

On Linux we may try

  timedatectl show --property=Timezone --value


According to POSIX standard
(https://pubs.opengroup.org/onlinepubs/9699919799/), we need to use "TZ"
environment variable, when present. Otherwise, fallback to defaults.


I do not try to dispute such statement. The question is what should be 
taken as the default.



This is exactly what ox-icalendar does. If TZ is set, use it. Otherwise,
use `current-time-zone'.

...

The issue in this bug report is that TZ is actually set. Ambiguously. In
OS. We cannot do much about it. Outsmarting system settings is not a
good idea.


The TZ environment variable is not set and that is the issue. Otherwise 
the .ics file would have


X-WR-TIMEZONE:Europe/London

The problem is that there is no API to get time zone identifier in elisp 
because such function is missed in libc. It is possible to get only 
BST/GMT (depending on current season).


Identifiers like Europe/London allows to get history of time 
transitions. (format-time-string "%z %Z") and (current-time-zone) may 
only report time offset and ambiguous abbreviation at particular moment. 
Return values of these functions may vary for different timestamps in 
the calendar file. If list of time zones were available then it would be 
possible to iterate over it and to match particular time zone by 
abbreviation and offset for most of zones (perhaps some ambiguity would 
remain).


Actually `current-time-zone' is an example of fragile API for *current* 
time. Offset is valid for particular moment. There is no guarantee that 
offset would not change between obtaining it and applying to a 
timestamp. So the only safe way of using this function is with the 
SPECIFIED-TIME argument. In such case *current* in the function name is 
confusing.


So in my previous message I was considering feasibility of some 
platform-dependent code to determine time zone when neither TIMEZONE Org 
file property nor TZ environment are specified.





Re: Autoloading side effects (was: Re: [BUG] org-mouse is activated without explicit require)

2022-12-12 Thread Max Nikulin

On 12/12/2022 17:25, Ihor Radchenko wrote:

Max Nikulin writes:


I am afraid, requirement that loading should not cause side effects is
too strict and it will make usage inconvenient. Examples:
- ol-info calls `org-link-set-parameters'.


We have `org-modules' that can handle calling `org-link-set-parameters'.


Sorry, but I have not got your idea. Currently `org-modules' is just a 
list of packages that should be loaded with org.el.


It is possible to introduce some convention either in Org or in Emacs to 
add default action for a package. Then in addition to just loading a 
package (with no side effects) a set of functions should be implemented 
that loads and *activates* the package.



- org-protocol installs an advice for `server-visit-files'. (It should
not be necessary, but currently Emacs does not provide a better option.)


Can we ask Emacs devs to help us with this problem?


org-protocol may use approach similar to emacsclient-mail.desktop 
without advice:


Exec=sh -c "exec emacsclient --alternate-editor= 
--display=\\"\\$DISPLAY\\" --eval (message-mailto 
\\"%u\\")"


By adding another bunch of backslashes and a bit more complex shell 
command it is possible to avoid at least obvious issues with the command 
above.


Actually I have created

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59743
Implement `command-line-args-left' for emacsclient --eval expressions

but I was too late to the party. The discussion in

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57752
28.1.91; emacsclient-mail.desktop doesn't work for me

was stalled with no outcome.




Re: Autoloading side effects (was: Re: [BUG] org-mouse is activated without explicit require)

2022-12-12 Thread Matt Lundin
Max Nikulin  writes:

> I am afraid, requirement that loading should not cause side effects is 
> too strict and it will make usage inconvenient. Examples:
> - ol-info calls `org-link-set-parameters'.
> - org-protocol installs an advice for `server-visit-files'. (It should 
> not be necessary, but currently Emacs does not provide a better option.)
>
> However I agree that it is undesired when attempt to call interactive 
> help causes side effects. I would say that in such cases loading of 
> packages should be sandboxed and should not propagate to global scope.

For reference, another module that causes global side effects when
calling interactive help is org-ctags.el. It advises `visit-tags-table`
and `xref-find-definitions` and adds a hook to `org-mode-hook`.

Matt



Re: org-babel shell in windows not finishing command

2022-12-12 Thread Vlastimil Vondra
Hi,
after upgrading to 9.6. The output is exactly the same.

V.

On Mon, 12 Dec 2022 at 14:10, Ihor Radchenko  wrote:

> Vlastimil Vondra  writes:
>
> > Org mode version 9.5.5
> > GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13
>
> We have made a number of fixes in this area in Org 9.6.
> Please upgrade and let us know if you are still seeing the problem.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: org-insert-structure-template

2022-12-12 Thread Alain . Cochard
Anthony Carrico writes on Mon 12 Dec 2022 09:41:
 > On 12/12/22 09:20, alain.coch...@unistra.fr wrote:
 > > Perhaps you have in min >
 > >'<', followed by a template selector and '
 > 
 > Yes!
 
 > Was this deprecated because it isn't a regular emacs keybinding?

I don't remember.  It was debated in the past.  Hopefully someone else
can summarize it.  Otherwise, perhaps start with:

https://list.orgmode.org/87lgd671k7@bzg.fr/


-- 
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: org-insert-structure-template

2022-12-12 Thread Anthony Carrico

On 12/12/22 09:20, alain.coch...@unistra.fr wrote:

Perhaps you have in min >
   '<', followed by a template selector and '


Yes! I didn't realize that could be enabled. I trained myself not to 
rely on this when the new keybinding came. Only recently did I realize 
the reason the new keybinding is sometimes unreliable is the limited 
ASCII control keys on the TTY.


Thanks!

Was this deprecated because it isn't a regular emacs keybinding?

--
Anthony Carrico



Re: org-insert-structure-template

2022-12-12 Thread Anthony Carrico

On 12/12/22 09:04, Ihor Radchenko wrote:

Note that we have alternative key bindings for TTY. See
`org-use-extra-keys'.

The general pattern is C-c C-x . Maybe we can add "C-c C-x ,"?


Thanks, that is probably a good pattern to use. I'll look into 
org-use-extra-keys. This is the only keybinding that regularly bites me 
on the TTY.


--
Anthony Carrico



Re: org-insert-structure-template

2022-12-12 Thread Alain . Cochard
Anthony Carrico writes on Mon 12 Dec 2022 08:50:

 > I'm trying to remember what the old keybinding was before it got
 > switched to 'C-c C-,'...

Perhaps you have in mind

  '<', followed by a template selector and '

?

See 17.2 Structure Templates:

   For example, ‘< s ’ creates a code block.  Enable it by
   customizing ‘org-modules’ or add ‘(require 'org-tempo)’ to your
   Emacs init file

-- 
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: Switching over from package org-radiobutton to native support

2022-12-12 Thread Ihor Radchenko
Terje Larsen  writes:

> However I am missing a function similar to `org-radiobutton-value`:
> https://github.com/Fuco1/org-radiobutton/blob/master/org-radiobutton.el#L111-L121
> ...
> I know it is possible via a mouthful of lisp. But it would be nice if it
> was natively supported. It would also be nice if this also worked for
> normal lists, e.g. having the possibility to easily extract all selected
> values.
>
> What do you think? Is something like this already implemented, but I missed
> it?

Check out `org-list-struct'.

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



Re: Org and Multimedia..?

2022-12-12 Thread Ihor Radchenko
David Masterson  writes:

> Is it possible to attach (say) an image to a task?

> I'd like to use images to help explain tasks better (or just remind me
> what my intention was).  I imagine you could do something with file
> links, but is there a defined method?  Issues:

https://orgmode.org/manual/Attachments.html ?
Or just use file links to images stored alongside the org file in the
folder.

> 1. Directory structure containing Org / Media files
> 2. Syncing images with Org files to other systems
> 3. In particular, syncing to smart phones (BeOrg, Orgzly, ...) 

You can store attachments/separate files in "data/" or "images/" folder
near the Org file. Then, sync the files as usual.

I am not sure if BeOrg/Orgzly support inline images, but it is probably
the feature they are going to implement eventually.

> 4. Any add-on packages that would help

Looks like built-ins should be sufficient.

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



Re: Flyspell causes severe slowdown when manipulating footnotes

2022-12-12 Thread Ihor Radchenko
aroz...@gmail.com writes:

> Happy to. What is the best way to temporarily downgrade to 9.5.5? I install
> Emacs through this  Arch AUR
> package, which installs the latest version of Org automatically.

If you have Emacs 28, Org 9.5.5 is built-in there.
Or you can git clone Org repo, checkout release_9.5.5, and use it in
front of Emacs load-path when loading Emacs. See
https://orgmode.org/manual/Installation.html

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



Re: Flyspell causes severe slowdown when manipulating footnotes

2022-12-12 Thread arozbiz
Happy to. What is the best way to temporarily downgrade to 9.5.5? I install
Emacs through this  Arch AUR
package, which installs the latest version of Org automatically.

Best,
Alan

On Mon, Dec 12, 2022 at 3:32 AM Ihor Radchenko  wrote:

> aroz...@gmail.com writes:
>
> > Thanks. It definitely helps, but it's still quite slow. What's made the
> > biggest difference is is advising the relevant functions to turn flyspell
> > off beforehand and then turn it back on.
>
> Sure, but it is not going to help others.
>
> Could you try to produce the profile using Org 9.5.5 and Org 9.6?
> I am wondering if there is anything in Org 9.6 that is slowed compared
> to Org 9.5.5.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: org-insert-structure-template

2022-12-12 Thread Ihor Radchenko
Anthony Carrico  writes:

> I use this command all the time because the literal syntax is so heavy. 
> The problem is that the current keybinding is not available on the TTY, 
> and every time I use it there I get org-priority which is bound to 'C-c 
> ,'. Does anyone else find this frustrating? Which keybinding do you use 
> for org-insert-structure-template? I don't think I've ever used 
> org-priority, so I'll probably just rebind 'C-c ,' to fix the problem.

Note that we have alternative key bindings for TTY. See
`org-use-extra-keys'.

The general pattern is C-c C-x . Maybe we can add "C-c C-x ,"?

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



Re: Two problems with export to Google calendar

2022-12-12 Thread Ihor Radchenko
Max Nikulin  writes:

>> By default, ox-icalendar takes the value of your TZ environment variable.
>
> I think, in most cases TZ is not set, so (format-time-string "%Z") is 
> used to get abbreviation (that is ambiguous).
>
> On Linux we may try
>
>  timedatectl show --property=Timezone --value
>
> during generation of export template. There is a chance that init system 
> is not systemd, so the command is not available. It is possible to get 
> timezone from /etc/timezone, but the code would not concise since it may 
> be a text file or a symlink to the definition. I have no idea concerning 
> macOS or Windows.

According to POSIX standard
(https://pubs.opengroup.org/onlinepubs/9699919799/), we need to use "TZ"
environment variable, when present. Otherwise, fallback to defaults.

This is exactly what ox-icalendar does. If TZ is set, use it. Otherwise,
use `current-time-zone'.

> Emacs relies on libc to handle time zones, and there is no API to get 
> the identifier. I miss the option available in modern browser JavaScript
>
>  new Intl.DateTimeFormat().resolvedOptions().timeZone

The issue in this bug report is that TZ is actually set. Ambiguously. In
OS. We cannot do much about it. Outsmarting system settings is not a
good idea.

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



Re: org-insert-structure-template

2022-12-12 Thread Anthony Carrico
I'm trying to remember what the old keybinding was before it got 
switched to 'C-c C-,'...


--
Anthony Carrico



org-insert-structure-template

2022-12-12 Thread Anthony Carrico
I use this command all the time because the literal syntax is so heavy. 
The problem is that the current keybinding is not available on the TTY, 
and every time I use it there I get org-priority which is bound to 'C-c 
,'. Does anyone else find this frustrating? Which keybinding do you use 
for org-insert-structure-template? I don't think I've ever used 
org-priority, so I'll probably just rebind 'C-c ,' to fix the problem.


‘C-c C-,’ (‘org-insert-structure-template’)
 Prompt for a type of block structure, and insert the block at
 point.  If the region is active, it is wrapped in the block.  First
 prompts the user for keys, which are used to look up a structure
 type from the variable below.  If the key is ‘’, ‘’, or
 ‘’, the user is prompted to enter a block type.

--
Anthony Carrico



Re: Looking for new maintainer for ob-sql-mode

2022-12-12 Thread Ihor Radchenko
Nik Clayton  writes:

> I wrote https://github.com/nikclayton/ob-sql-mode as a thing that scratched
> my own itch a few years ago. Since then my need for it has disappeared, but
> kind people occasionally report issues or send PRs.
>
> I'm not really in a position to review them, so I'm looking for someone who
> would be interested in taking over maintainership.

If you cannot find anybody interested to take over the maintenance, we
can house your package under https://sr.ht/~bzg/org/, Org mailing
list, and provide some minimal maintenance.

The package will then need to be moved to sourcehut under our control.
The bug reports/feature requests will go through Org mailing list.

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



Re: Prevent files with excluded FILETAGS from being exported

2022-12-12 Thread Ihor Radchenko
Thomas Ingram  writes:

> Currently when trying to export an org file with FILETAGS set to
> "noexport" (or any value in `org-export-exclude-tags') the file is still
> exported with the title and top level text.  I propose that be changed
> so files with FILETAGS in `org-export-exclude-tags' are completely
> skipped by the exporter.

> This would be extremely useful in combination with ox-publish, as it
> would allow users to easily exclude files from publishing from within
> the file.  Currently this can only be done by adjusting the ':exclude'
> value to match the filename in the `org-publish-project-alist' settings.

With current implementation, `org-export-exclude-tags' does not imply
that nothing is done during export. Source blocks inside excluded
subtrees are still executed, for example. The trees are only removed
from the exported Org AST after all the pre-processing is completed,
giving user a chance to set noexport tags dynamically.

In-buffer export settings are also applied, even when set inside
noexport trees.

So, producing an output even when everything is excluded is logically
expected. At least, in a form of empty export template.

That said, I do think that it will make sense to exclude top-level
section if #+FILETAGS contain :noexport:.

In addition, we can introduce a new export option that will make Org
skip exporting empty files (empty after pre-processing).

Then, you will be able to get the described publishing behaviour.

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



Re: [PATCH] LSP support in org-src buffers

2022-12-12 Thread Ihor Radchenko
João Pedro  writes:

> Were you thinking of having a
> =:context {yes|no}= option on src blocks?

I am not sure if yes|no are good values.

If an src block has :tangle option, it is probably reasonable to display
it together with other tangled blocks.
If an src blocks does not have a :tangle option, :context might be used
as the means to group blocks together. But then, the value should be
some kind of string - blocks with the same :context name will be grouped
together.

And, of course, the whole thing may be behind a defcustom switch. Or
file option.

> Also, I will have more free time to work on it starting on the second
> week of December. Before that I'll be incredibly busy, unfortunately.

We are not in hurry. Any progress will be appreciated as long as there
is some.

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



Re: org-babel shell in windows not finishing command

2022-12-12 Thread Vlastimil Vondra
 Hi Ihor,
Org mode version 9.5.5
GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13

Best regards,
Vlastimil Vondra

On Mon, 12 Dec 2022 at 13:39, Ihor Radchenko  wrote:

> Vlastimil Vondra  writes:
>
> > I'm trying to run some shell block code (in windows they should evaluate
> in
> > cmd). But when executing org-babel block code, it seems that org-babel is
> > not finishing the last command.
>
> What is your Org version and Emacs version? (the output of
> M-x org-version and M-x emacs-version).
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: org-babel shell in windows not finishing command

2022-12-12 Thread Ihor Radchenko
Vlastimil Vondra  writes:

> Org mode version 9.5.5
> GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13

We have made a number of fixes in this area in Org 9.6.
Please upgrade and let us know if you are still seeing the problem.

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



Re: PATCH: include controlling language= in my previous patch

2022-12-12 Thread Pedro Andres Aranda Gutierrez
Hi,

I've (finally) followed the procedure and broken up the patch in two. One
for the labels= ,caption=  and one for the language= control.

FYI, I have already cleared the FSF paperwork for an emacs patch.

Best, /PA

On Mon, 12 Dec 2022 at 11:11, Ihor Radchenko  wrote:

> Pedro Andres Aranda Gutierrez  writes:
>
> > thanks for the patience. I have a comment on the message you refer to...
> If
> > comes from 2014.
> >
> > So I have resorted to my fresh Emacs29, opened it with emacs -Q for a
> clean
> > environment.
> > ...
> > In my most humble opinion, I looks like the global \lstset{} isn't used
> and
> > that the caption/label is set locally. And this makes me believe that
> > label= or caption= are not very useful.
>
> I guess it is after
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6ef33b6dd
>
> If the cited issue is no longer need to be accounted for, your version
> should be fine.
>
> > I'm attaching the patch generated with git diff -p.
> > Mea culpa, I should have RTFM before sending anything :-)
>
> For the final version of the patch, you may better follow
> https://orgmode.org/worg/org-contribute.html#orgbc683f3 to create a
> .patch file. The .patch file will include your authorship. Do not forget
> the changelog entry.
>
> > +(defcustom org-latex-listings-src-omit-language nil
> > +  "Set this option to t to omit the
> > +\"language=\"
> > +in the parameters to \\begin{lstlisting} when exporting a src block"
> > +  :group 'org-export-latex
> > +  :version "30.0"
> > +  :package-version '(Org . "9.7")
> > +  :type 'boolean
> > +  )
>
> Please do not leave handing ")" on separate lines. It is against common
> Elisp style conventions. See D.1 Emacs Lisp Coding Conventions section
> of Elisp manual:
>
>• Don’t make a habit of putting close-parentheses on lines by
>  themselves; Lisp programmers find this disconcerting.
>
> > + (when label; label= w/o label makes little
> sense
> > + `(("label" ,(org-latex--label src-block info
> > + (when caption-str  ; caption= w/o caption makes
> little sense
> > +   `(("caption" ,caption-str))
> > +   `(("captionpos" ,(if caption-above-p "t" "b" ; as does
> captionpos w/o caption
>
> These comments are not really needed. Actually, it is that `if' that
> deserved explanation. Not putting empty caption/label is intuitive.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


-- 
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
From 3a4705f454ed5f692ce9d04f81d3ae9bc2efad56 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda Gutierrez" 
Date: Mon, 12 Dec 2022 13:51:49 +0100
Subject: [PATCH 2/2] Allow to suppress language= in SRC blocks

---
 lisp/ox-latex.el | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index f03903605..924afb399 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1021,6 +1021,15 @@ in this list - but it does not hurt if it is present."
 	   (symbol :tag "Major mode   ")
 	   (string :tag "Listings language"
 
+(defcustom org-latex-listings-src-omit-language nil
+  "Set this option to t to omit the
+\"language=\"
+in the parameters to \\begin{lstlisting} when exporting a src block"
+  :group 'org-export-latex
+  :version "30.0"
+  :package-version '(Org . "9.7")
+  :type 'boolean)
+
 (defcustom org-latex-listings-options nil
   "Association list of options for the latex listings package.
 
@@ -3593,7 +3602,8 @@ and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
   ((string= "multicolumn" float) '(("float" "*")))
   ((and float (not (assoc "float" lst-opt)))
`(("float" ,(plist-get info :latex-default-figure-position)
- `(("language" ,lst-lang))
+ (unless org-latex-listings-src-omit-language
+   `(("language" ,lst-lang)))
  (when label
  `(("label" ,(org-latex--label src-block info
  (when caption-str
-- 
2.25.1

From 3bc08d0ccabb2d3f4a0ea09bec5bc6a896c351ac Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda Gutierrez" 
Date: Mon, 12 Dec 2022 13:49:35 +0100
Subject: [PATCH 1/2] Don't emit empty labels and captions in SRC blocks

---
 lisp/ox-latex.el | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index a2d60d5db..f03903605 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3594,11 +3594,14 @@ and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
   ((and float (not (assoc 

Re: [PATCH] Make broken link markers customizable

2022-12-12 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Org provides no good way to ignore broken links when exporting subtrees
> with lots of links.  With `org-export-with-broken-links' set to `nil',
> the exporter aborts.  When set to `t', the exporter removes the linked
> words altogether, breaking the sentences.  Lastly, when set to `mark',
> the sentences become unreadable due to the million [BROKEN LINK: ...]
> fragments everywhere.
>
> What do you folks think about the WIP patch below?  It allows the user
> to customize the broken link marker the Org exporter will use.  A user
> like me, one who works in a large Org file and often exports only its
> parts, can use a more gentle marker or even no marker at all.

In general, sounds like a reasonable addition.
Though it should be accompanied by a NEWS entry.

>  When this variable is non-nil, broken links are ignored, without
>  stopping the export process.  If it is set to `mark', broken
> -links are marked as such in the output, with a string like
> +links are marked with `org-export-broken-link-marker'.
>  
> -  [BROKEN LINK: path]
> -
> -where PATH is the un-resolvable reference.
> -
> -This option can also be set with the OPTIONS keyword, e.g.,
> +This variable can also be set with the OPTIONS keyword, e.g.,
>  \"broken-links:mark\"."

This is wrong.
broken-links:mark is an option defined in `org-export-options-alist'.

You may instead add a sentence that the string may be customized via the
new variable.

> +(defcustom org-export-broken-link-marker "[BROKEN LINK: %s]"
> +  "The string used to mark broken links.
> +
> +This variable applies only when `org-export-with-broken-links' is
> +set to `mark'.  If the value contains the %-sequence `%s', the
> +exporter will replace it with the broken reference which it
> +cannot resolve."
> +  :group 'org-export-general
> +  :package-version '(Org . "9.7")
> +  :type 'string
> +  :safe #'stringp)

What will happen if multiple %s are inside the string?

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



Re: org-babel shell in windows not finishing command

2022-12-12 Thread Ihor Radchenko
Vlastimil Vondra  writes:

> I'm trying to run some shell block code (in windows they should evaluate in
> cmd). But when executing org-babel block code, it seems that org-babel is
> not finishing the last command.

What is your Org version and Emacs version? (the output of
M-x org-version and M-x emacs-version).

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



Re: Problem in org-inlinetask-min-level's docstring?

2022-12-12 Thread Alain . Cochard
Ihor Radchenko writes on Fri 25 Nov 2022 10:33:
 > alain.coch...@unistra.fr writes:

 > > I do not understand the last sentence, even assuming that the 1st
 > > 'of' is 'or'.  Is my English the problem?
 > 
 > That sentence is indeed screwed up.
 > 
 > Does `org-cycle-max-level' docstring sound better?

Yes.

NB: While experimenting, I noticed that, if I customize
org-cycle-max-level to 0, then a  on a headline generates the
cryptic "org-match-line: Invalid regexp: "Invalid content of
\\{\\}"".  

 > We may simply replace the faulty sentence with a link to
 > `org-cycle-max-level' docstring.

-- 
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: [HELP] Translate/extend `org-clock-clocktable-language-setup' for Spanish/Dutch/more languages

2022-12-12 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Rudolf Adamkovič  writes:
>
>> Slovak:
>>
>> ("sk" "Súbor" "L" "Časová značka" "Záhlavie" "Čas" "VŠETKO" "Celkový
>> čas" "Čas súboru" "Časový súhrn pre")
>
> Thanks! A patch would make it easier for me to apply the change with a
> proper attribution ;)

I created and applied a patch on your behalf.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d440b242b

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



Re: [HELP] Translate/extend `org-clock-clocktable-language-setup' for Spanish/Dutch/more languages

2022-12-12 Thread Pedro Andres Aranda Gutierrez
This is why I'm using "Duración"...
Being bilingual ES/DE I tried to align the Spanish translation to the
German translation

My .02c /PA

On Mon, 12 Dec 2022 at 13:18, Ihor Radchenko  wrote:

> Pedro Andres Aranda Gutierrez  writes:
>
> > I'd rather go for
> >
> >  ("es" "Archivo"  "N"  "Fecha y hora" "Tarea" "Duración" "TODO" "Duración
> > total" "Tiempo archivo" "Generado el")
> >
> > To be in line with the ("de" ...) line
>
> So, we have two suggested variants now: yours and from Esteban Ordóñez.
>
>("en" "File" "L"  "Timestamp"  "Headline" "Time"  "ALL"
> "Total time"   "File time" "Clock summary at")
>
> can be translated as
>
> (your version)
>
> ("es" "Archivo"  "N"  "Fecha y hora" "Tarea" "Duración" "TODO"
>  "Duración total" "Tiempo archivo" "Generado el")
>
> or
>
> (Esteban's version)
>
> ("es" "Archivo"  "N"  "Fecha y hora" "Tarea" "Tiempo" "TODO"
>  "Tiempo total" "Tiempo de archivo" "Resumen de tiempos en")
>
> Note that "time" in English version refers to clocked time, which is
> probably closer in its meaning to "duration" or "time spent".
>
> Pedro, Esteban, any comments?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


-- 
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: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-12 Thread Ihor Radchenko
Greg Minshall  writes:

>> ** List references in source block variable assignments are now proper lists
>
> just for background, one oddity is that the meaning of a "list" in R is
> a bit loose.
> ...
> so, to me, at least, "proper list" is not a well-defined term in R.

Sounds reasonable.

I also tried

> list_data <- list("a", list("b"), "c")
> print(list_data[1])
[[1]]
[1] "a"

> print(list_data[2])
[[1]]
[[1]][[1]]
[1] "b"


> print(list_data[3])
[[1]]
[1] "c"

Although, I am not sure if there are no subtle issues with the actual
representation.

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



Re: [HELP] Translate/extend `org-clock-clocktable-language-setup' for Spanish/Dutch/more languages

2022-12-12 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> I'd rather go for
>
>  ("es" "Archivo"  "N"  "Fecha y hora" "Tarea" "Duración" "TODO" "Duración
> total" "Tiempo archivo" "Generado el")
>
> To be in line with the ("de" ...) line

So, we have two suggested variants now: yours and from Esteban Ordóñez.

   ("en" "File" "L"  "Timestamp"  "Headline" "Time"  "ALL"
"Total time"   "File time" "Clock summary at")

can be translated as

(your version)

("es" "Archivo"  "N"  "Fecha y hora" "Tarea" "Duración" "TODO"
 "Duración total" "Tiempo archivo" "Generado el")

or

(Esteban's version)

("es" "Archivo"  "N"  "Fecha y hora" "Tarea" "Tiempo" "TODO"
 "Tiempo total" "Tiempo de archivo" "Resumen de tiempos en")

Note that "time" in English version refers to clocked time, which is
probably closer in its meaning to "duration" or "time spent".

Pedro, Esteban, any comments?

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



Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-12 Thread Greg Minshall
hi, Ihor,

> ** List references in source block variable assignments are now proper lists

just for background, one oddity is that the meaning of a "list" in R is
a bit loose.

> list(1,2,3)
[[1]]
[1] 1

[[2]]
[1] 2

[[3]]
[1] 3

> c(1,2,3)
[1] 1 2 3

(where =c= is the "concatenation operator".)

so, to me, at least, "proper list" is not a well-defined term in R.

cheers, Greg



[PATCH 1] lisp/org-fold.el: Fold header lines in blocks (was: Proposal: folding stacked `#+header:' lines in src blocks)

2022-12-12 Thread hugo

On 2022-12-07 19:58, Thomas S. Dye wrote:

I would use this feature.  My stack typically includes headers, a
name, and a caption.  It would be nice to fold them all out of sight.


Great! I've worked up a patch (well, two patches), attached.

Some details of the implementation:
- folding blocks now cycles:
  - everything folded (only top header line visible if present,
otherwise only `#+begin' line visible).
  - all content visible, (header stack folded, top header visible,
`#+begin' and `#+end' lines visible).
  - everything visible
  - (the second and third are treated as equivalent unless there is
more than one header line.)
- Folding will happen on pressing  (or whatever you have bound)
  with point:
  - anywhere on the `#+begin' or `#+end' line
  - on any header keyword (`#+name:', `#+header', etc.)
  - anywhere else in the header stack where completion does not
otherwise kick in (not quite sure of the exact mechanics on this
one, might be dependant on one's configuration)? This includes
part-way through header lines.
  - This seemed to me the most comfortable configuration for use.
- Retain the old behaviour of moving point to the beginning of the
  remaining visible lines when point is hidden by folding.
- renames `org-fold--hide-wrapper-toggle' to
  `org-fold--hide-wrapper-cycle', which seemed more appropriate under
  the circumstances.
- All the tests in testing/lisp/test-org-fold.el pass for me.

Some less-than-perfections:
- I'm not sure what to do about default block folding (as in, how
  blocks are folded when a file is first visited). First, I don't have
  a complete list of things (variables, startup options, etc.) which
  affect it. Secondly, I'm not sure what the behaviour should be now
  that blocks can be in up to three folding states. Advice would be
  appreciated.
- I'm not sure what other documentation I should add. Once this patch
  is stable and people approve of it, I can add a news entry. Should I
  update the manual at all?

Hope this is useful!

HugoFrom 04186df871b94d4a961a5193a7cb050f2a4bc2ff Mon Sep 17 00:00:00 2001
From: Hugo Heagren 
Date: Mon, 12 Dec 2022 11:30:10 +
Subject: [PATCH 2/2] lisp/org-fold.el: Rename `org-fold--hide-wrapper-toggle'
 to `org-fold--hide-wrapper-cycle'

* lisp/org-fold.el: rename
(org-fold--hide-wrapper-toggle): Rename to
`org-fold--hide-wrapper-cycle'.
(org-fold-hide-block-toggle, org-fold-hide-drawer-toggle): Replace old
function name with new.
---
 lisp/org-fold.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org-fold.el b/lisp/org-fold.el
index 21cdc6fad..37e6d6450 100644
--- a/lisp/org-fold.el
+++ b/lisp/org-fold.el
@@ -477,7 +477,7 @@ heading to appear."
 
 ; Blocks and drawers visibility
 
-(defun org-fold--hide-wrapper-toggle (element category force no-error)
+(defun org-fold--hide-wrapper-cycle (element category force no-error)
   "Cycle visibility for ELEMENT.
 
 ELEMENT is a block or drawer type parsed element.  CATEGORY is
@@ -579,7 +579,7 @@ ELEMENT is provided, consider it instead of the current block.
 
 Return a non-nil value when toggling is successful."
   (interactive)
-  (org-fold--hide-wrapper-toggle
+  (org-fold--hide-wrapper-cycle
(or element (org-element-at-point)) 'block force no-error))
 
 (defun org-fold-hide-drawer-toggle ( force no-error element)
@@ -592,7 +592,7 @@ ELEMENT is provided, consider it instead of the current drawer.
 
 Return a non-nil value when toggling is successful."
   (interactive)
-  (org-fold--hide-wrapper-toggle
+  (org-fold--hide-wrapper-cycle
(or element (org-element-at-point)) 'drawer force no-error))
 
 (defun org-fold-hide-block-all ()
-- 
2.20.1

From 62ef11504f361d058c5425ad5e1184be6e19bd6f Mon Sep 17 00:00:00 2001
From: Hugo Heagren 
Date: Mon, 12 Dec 2022 11:25:14 +
Subject: [PATCH 1/2] lisp/org-fold.el: Fold header lines in blocks

* lisp/org-fold.el (org-fold--hide-wrapper-toggle): Cycle blocks
between three folding states, potentially including headers in
folding.  Update docstring accordingly.
---
 lisp/org-fold.el | 65 +++-
 1 file changed, 53 insertions(+), 12 deletions(-)

diff --git a/lisp/org-fold.el b/lisp/org-fold.el
index 05ac71ea4..21cdc6fad 100644
--- a/lisp/org-fold.el
+++ b/lisp/org-fold.el
@@ -478,14 +478,27 @@ heading to appear."
 ; Blocks and drawers visibility
 
 (defun org-fold--hide-wrapper-toggle (element category force no-error)
-  "Toggle visibility for ELEMENT.
+  "Cycle visibility for ELEMENT.
 
 ELEMENT is a block or drawer type parsed element.  CATEGORY is
 either `block' or `drawer'.  When FORCE is `off', show the block
 or drawer.  If it is non-nil, hide it unconditionally.  Throw an
 error when not at a block or drawer, unless NO-ERROR is non-nil.
 
-Return a non-nil value when toggling is successful."
+A property drawer will cycle between open and closed states.
+
+A block with not extra header arguments (lines beginning

Re: [BUG] org-babel-comint-with-output: incorrect prompt detection [9.6-pre]

2022-12-12 Thread Ihor Radchenko
Ihor Radchenko  writes:

> One possible fix could be replacing `comint-prompt-regexp' one more time
> at the very end in addition to `org-babel-comint-prompt-separator'. We
> must also make `comint-prompt-regexp' more precise to avoid "lude> "
> being detected as a prompt.

This is what I ended up doing because of another similar bug report.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=456462741

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



Re: [BUG] hyperbole action key on path name results in org-element-cache warning [9.6-pre (release_9.5.5-997-ge58bd0 @ /home/grfz/src/org-mode/lisp/)]

2022-12-12 Thread Ihor Radchenko
Robert Weiner  writes:

> So if we want to determine the Org type of an element outside of an Org
> buffer (when using org-type minor modes for example), how would we change
> this 'let' code:
>
>  (let* ((context
>  ;; Only consider supported types, even if they are not
>  ;; the closest one.
>  (org-element-lineage
>   ;; Next line can trigger an error when `looking-at' is called
>   ;; with a `nil' value of `org-complex-heading-regexp'.
>   (org-element-context)
>   '(clock footnote-definition footnote-reference headline
> inlinetask link timestamp)
>   t))
> (type (org-element-type context))
>  ...)

Strictly speaking, thing at point outside Org buffers is ambiguous
because Org syntax is recursive, and we often need to parse buffer from
the very beginning to determine what is at point. One needs to load
org-mode on text in buffer to know for sure.

So, one way to address the issue may be creating an indirect buffer,
switching it to Org mode and calling `org-element-context'. Or you can
use `org-export-copy-buffer'.

The performance may be affected though.

Also, you may get unexpected result when trying to match Org object in
non-Org buffer when some other text there looks like Org.

If necessary, we may also define generic versions of predicates, similar
to what is done in `org-at-table-p': When in Org mode, use accurate
parser data, but fallback to regexp matching otherwise.

Then, we can also modify `org-context' to be generic.

If you want the latter, you can help us by searching all the predicate
functions to be converted in Org codebase. Then, I can extract them into
a separate library org-context.el.

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



Re: [PATCH] oc-csl: Improve LaTeX bibliography formatting

2022-12-12 Thread Ihor Radchenko
András Simonyi  writes:

>> Would it be possible
>> to provide an example of bibliography output and how it is affected by
>> the new custom variables?
>> In the news, it could be example image indicating the distances,
>
> Hm, I tried to find an image in the ORG-NEWS file and even in the
> Manual but couldn't find any, so I'm
> unsure how to do this in concrete terms (where to put the embedded
> image file etc.). Is there an example
> I could follow?

I don't think we have an example.
Probably, we can create etc/org-news-images folder, set :DIR: property
in etc/ORG-NEWS to that folder, and then use attachments.

CCing Bastien in case if he has any objections/ideas.

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



Re: [PATCH] oc-csl: Improve LaTeX bibliography formatting

2022-12-12 Thread András Simonyi
Dear All,

On Mon, 12 Dec 2022 at 10:07, Ihor Radchenko  wrote:

> Would it be possible
> to provide an example of bibliography output and how it is affected by
> the new custom variables?
> In the news, it could be example image indicating the distances,

Hm, I tried to find an image in the ORG-NEWS file and even in the
Manual but couldn't find any, so I'm
unsure how to do this in concrete terms (where to put the embedded
image file etc.). Is there an example
I could follow?

thanks & best wishes,
András

> in the docstrings you can schematically indicate the spacings using text
> example.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



Re: Autoloading side effects (was: Re: [BUG] org-mouse is activated without explicit require)

2022-12-12 Thread Ihor Radchenko
Max Nikulin  writes:

> On 11/12/2022 16:45, Ihor Radchenko wrote:
>> We cannot do much about Emacs' handling of autoloads, but what we can
>> (and should) do is changing org-mouse to become a global minor mode.
>> Then, loading org-mouse will cause no side effects.
>
> I am afraid, requirement that loading should not cause side effects is 
> too strict and it will make usage inconvenient. Examples:
> - ol-info calls `org-link-set-parameters'.

We have `org-modules' that can handle calling `org-link-set-parameters'.

> - org-protocol installs an advice for `server-visit-files'. (It should 
> not be necessary, but currently Emacs does not provide a better option.)

Can we ask Emacs devs to help us with this problem?

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



Re: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

2022-12-12 Thread Ihor Radchenko
Tom Gillespie  writes:

> Got it. Here's the updated patch (I think I did it correctly?).

Thanks!
You also need a NEWS entry here.

> * lisp/ob-core.el (org-confirm-babel-evaluate-cell): Added to control
> execution of cells separate from execution of src blocks, it works in
> exactly the same way as org-confirm-babel-evaluate.

Please quote `symbols' in the commit message and separate sentences with
double space.

> +;; don't allow this variable to be changed through file settings
> +(put 'org-confirm-babel-evaluate-cell 'safe-local-variable (lambda (x) (eq x 
> t)))

You can simply use :safe keyword for `defcustom'.

I am also wondering if we should include this into bugfix.
This is a new feature, but it appears to be important enough to be
merged into built-in Org.
Bastien, Kyle, any thoughts?

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



Re: PATCH: include controlling language= in my previous patch

2022-12-12 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> thanks for the patience. I have a comment on the message you refer to... If
> comes from 2014.
>
> So I have resorted to my fresh Emacs29, opened it with emacs -Q for a clean
> environment.
> ...
> In my most humble opinion, I looks like the global \lstset{} isn't used and
> that the caption/label is set locally. And this makes me believe that
> label= or caption= are not very useful.

I guess it is after 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6ef33b6dd

If the cited issue is no longer need to be accounted for, your version
should be fine.

> I'm attaching the patch generated with git diff -p.
> Mea culpa, I should have RTFM before sending anything :-)

For the final version of the patch, you may better follow
https://orgmode.org/worg/org-contribute.html#orgbc683f3 to create a
.patch file. The .patch file will include your authorship. Do not forget
the changelog entry.

> +(defcustom org-latex-listings-src-omit-language nil
> +  "Set this option to t to omit the
> +\"language=\"
> +in the parameters to \\begin{lstlisting} when exporting a src block"
> +  :group 'org-export-latex
> +  :version "30.0"
> +  :package-version '(Org . "9.7")
> +  :type 'boolean
> +  )

Please do not leave handing ")" on separate lines. It is against common
Elisp style conventions. See D.1 Emacs Lisp Coding Conventions section
of Elisp manual:

   • Don’t make a habit of putting close-parentheses on lines by
 themselves; Lisp programmers find this disconcerting.

> + (when label; label= w/o label makes little sense
> + `(("label" ,(org-latex--label src-block info
> + (when caption-str  ; caption= w/o caption makes little 
> sense
> +   `(("caption" ,caption-str))
> +   `(("captionpos" ,(if caption-above-p "t" "b" ; as does 
> captionpos w/o caption

These comments are not really needed. Actually, it is that `if' that
deserved explanation. Not putting empty caption/label is intuitive.

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



Re: org-agenda-dim-blocked-tasks don't use org-todo face

2022-12-12 Thread Ihor Radchenko
Mark Kerr  writes:

> The org-todo face is used for todo keywords in non-blocked items.
>
> When org-agenda-dim-blocked-tasks is set to true, however, the todo keyword
> is instead displayed using org-agenda-dimmed-todo-face.
>
> The org-priority face, however, is still used for blocked tasks.
>
> Is this by design or due to an error on my part? Is there a possible
> workaround?

This appears to be an omission on Org part, related some overlay
implementation details in Emacs.

Can you try the attached patch?

>From 1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3 Mon Sep 17 00:00:00 2001
Message-Id: <1bd6d8bd13deb9e7f57826ea492bbc88fddf5ee3.1670839095.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Mon, 12 Dec 2022 12:56:11 +0300
Subject: [PATCH] org-agenda-dim-blocked-tasks: Prioritize face over other
 overlays

* lisp/org-agenda.el (org-agenda-dim-blocked-tasks): Use high overlays
priority when adding dimmed face.  Otherwise, contained overlays, like
created by `org-agenda-fontify-priorities', will take
priority (default Emacs behavior).

Reported-by: Mark Kerr 
Link: https://orgmode.org/list/CAM9qJ5+C3nvbNaJyq6ofRgPsuAMcaBD=2un-n96kb68nbbx...@mail.gmail.com
---
 lisp/org-agenda.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index eda248938..05f2e3669 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4166,7 +4166,9 @@ (defun org-agenda-dim-blocked-tasks ( _invisible)
    (line-beginning-position))
  (line-end-position
 	  (when todo-blocked
-	(overlay-put ov 'face 'org-agenda-dimmed-todo-face))
+	(overlay-put ov 'face 'org-agenda-dimmed-todo-face)
+;; Override other overlays.
+(overlay-put ov 'priority 50))
 	  (when invisible
 	(org-agenda-filter-hide-line 'todo-blocked)))
 (if (= (point-max) (line-end-position))
-- 
2.38.1


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


Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)]

2022-12-12 Thread Ihor Radchenko
Jeremie Juste  writes:

> On Thursday,  8 Dec 2022 at 09:07, Ihor Radchenko wrote:
>
>> I am not sure if I like the approach you used in the commit.
>>
>> -(unless (listp (car value)) (setq value (list value)))
>> +(unless (listp (car value)) (setq value (mapcar 'list value)))
>>
>> In the above, you are transforming (val1 val2 val3 ...) list into
>> ((val1) (val2) (val3) ...).
>>
>> Does it make sense from the point of view of R code?
>> AFAIU, the current ob-R implementation converts lists into R tables,
>> which is not accurate? Would it make sense to convert Elisp lists into R
>> lists directly?
>
> Many thanks for the feedback. At this point I don't know. On one hand you are
> right on the other, this option is backward compatible, and the user can
> always create an interface in R to suit his need.
>
> If there are more complaints about that in the future, I'll reconsider. 

Note that my NEWS entry may not be accurate for ob-R then:

** List references in source block variable assignments are now proper lists

So, we may create confusion one way or another.

Or I may need to put a special clause regarding ob-R into the NEWS item.

Bastien, maybe you have something to say about this situation?

-- 
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-expiry.el: Account for org-time-stamp-formats

2022-12-12 Thread Ihor Radchenko
Tom Gillespie  writes:

> Looks like string-replace doesn't support that notation,
> so both too aggressive and without sufficient control.
> I've switched to replace-regexp-in-string which does
> what we want.
>
> Here's the updated patch.

Thanks!
Note that your patch does not apply onto master.
There is another recent patch attempting the same fix, but in less
general way. I can apply your patch if you adjust it to the current
master as your patch is going to be compatible with older Org as well.

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



Re: Flyspell causes severe slowdown when manipulating footnotes

2022-12-12 Thread Ihor Radchenko
aroz...@gmail.com writes:

> Thanks. It definitely helps, but it's still quite slow. What's made the
> biggest difference is is advising the relevant functions to turn flyspell
> off beforehand and then turn it back on.

Sure, but it is not going to help others.

Could you try to produce the profile using Org 9.5.5 and Org 9.6?
I am wondering if there is anything in Org 9.6 that is slowed compared
to Org 9.5.5.

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



Re: Flyspell process called frequently when using Org export (was: Flyspell causes severe slowdown when manipulating footnotes)

2022-12-12 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Upon further investigation, Org frequently starts and kills the
> spellchecker when the document contains `LocalWords' comments.
>
> 1. Start Emacs
>
>emacs -Q
>
> 2. Configure Flyspell
>
>(add-hook 'text-mode-hook #'flyspell-mode)
>(add-hook 'prog-mode-hook #'flyspell-prog-mode)
>
> 3. Create a new Org file
>
># LocalWords: xyz
>
>Hello there!
>
> 4. Export the file to HTML
>
> Expected:
>
>   No Ispell process started on export.
>
> Actual:
>
>   A new Ispell process started on export.

Confirmed.
This is because `org-html-final-function' uses `mhtml-mode' to indent the
resulting html file. `mhtml-mode' unconditionally runs `prog-mode-hook'
thus starting Ispell.

We may try `delay-mode-hooks' around `set-auto-mode', but it is not
honoured by `mhtml-mode'. I guess we can report this as Emacs bug.

> P.S. I also see Org starting Ispell over and over when holding down
> `C-v' in a long document that contains lots of scattered `LocalWords'
> comments.

This sounds like a normal Ispell behaviour.

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



Re: To convert and simplify units in tables

2022-12-12 Thread Fraga, Eric
On Sunday, 27 Nov 2022 at 20:19, Ypo wrote:
> The alternative way I am trying is using an org-table. It is not
> literate programming, but it is a spreadsheet with units ;D
> [...]
> Now, in a more practical case, I have some problems with units:
>
> | $ | E = 2141404.05  kg/cm^2  |
> | $ | s_lim = 275  N/mm^2  |
> | $ | s_lim = 2800  kg/cm^2|
> | $ | W = 1 kg |
> | $ | l = 65  cm   |
> | $ | I = 25166  cm^4  |
> | $ | Z = 1680  cm^3   |
> | _ | s|
> |   | 386.90476 kg cm / cm^3   |
> | _ | cs   |
> |   | 7.2369231 kg cm^3 / (cm^2 kg cm) |
>
> #+TBLFM: $s=$W*$l/$Z::$cs=$s_lim/$s

org tables do have support for units, based on Emacs Calc.  You need to
add the "u" option to the formulas for this support.  If I change your
formulas to:

#+TBLFM: $cs=$s_lim/$s;u::$s=$W*$l/$Z;u

everything seems to work just fine.  

-- 
: Eric S Fraga, with org release_9.6-14-g53814a in Emacs 30.0.50


Re: [PATCH] oc-csl: Improve LaTeX bibliography formatting

2022-12-12 Thread Ihor Radchenko
András Simonyi  writes:

> first of all, apologies for the delay, unfortunately, I haven't been
> able to work on my WIP patches for a while. Now I've attached a new
> version of the patch, which hopefully addresses all issues discussed
> earlier.

Thanks!

The patch looks good in general, but I feel like the purpose of the new
customization is not very clear to the end user.  Would it be possible
to provide an example of bibliography output and how it is affected by
the new custom variables?

In the news, it could be example image indicating the distances, while
in the docstrings you can schematically indicate the spacings using text
example.

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



org-babel shell in windows not finishing command

2022-12-12 Thread Vlastimil Vondra
Hello,

I'm trying to run some shell block code (in windows they should evaluate in
cmd). But when executing org-babel block code, it seems that org-babel is
not finishing the last command. If I run:

#+begin_src shell :results output
  echo %cd%
  echo "hello"
#+end_src

then the output is

#+RESULTS:
: Microsoft Windows [Version 10.0.19045.2251]
: (c) Microsoft Corporation. All rights reserved.
:
: c:\Users\johndoe\Org>echo %cd%
: c:\Users\johndoe\Org
:
: c:\Users\johndoe\Org>More?

More? means cmd is expecting some additional command (creating multiline
statemens). In cmd typying either ( or ^ result in More?, but I don't know
what is causing this error in org-babel. Interestingly, if run like this:

#+begin_src shell :results output :session shell
  echo "%cd%"
  echo "hello"
#+end_src

I'm getting the right output:

#+RESULTS:
: Microsoft Windows [Version 10.0.19045.2251]
: (c) Microsoft Corporation. All rights reserved.
: echo "%cd%"
: "c:\Users\johndoe\Org"
: echo "hello"
: "hello"

But only when run for the first time, if running for second time, I'm
getting this:

#+RESULTS:
:
: cd%"
: "c:\Users\johndoe\Org"
: echo "hello"
: "hello"

Any way how to fix it either with :session shell command or without?
Best regards,
Vlastimil Vondra