Re: [BUG] Org-reveal and setupfile conflict [9.6.1 (9.6.1-gaa48c8)]

2023-02-26 Thread Matt Price
On Sun, Feb 26, 2023 at 4:04 PM Joshua Lambert 
wrote:

> 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.
> 
> When Org files use both Org Reveal and a ~#+setupfile:~ link for
> exported web pages, the CSS of exported Org Reveal slides inherits some
> of the CSS from the setupfile. So, I have to comment out the setupfile
> line each time I export slides. See the sample file below and steps to
> reproduce.
>
> 1. With the following Org file open, it should export the Org Reveal
> slides fine.
> 2. After you add the following line to that Org file after the title,
> try exporting and viewing the Org Reveals slides again. This time, their
> text is too big in the unnumbered lists. I think the CSS from the two
> export
> methods seems to be clashing.
>
> #+setupfile:
> https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup
>
> 3. Now comment out that setupfile line or delete it and the export works
> fine again.
>


I’m pretty sure this is the expected behaviour. Reveal is very sensitive to
css changes and it’s not recommended to use a setup file in this way with
the reveal exporter

There may be a way for the exporter to strip out extraneous css files, but
I think such a feature may be difficult to implement. You could perhaps ask
Jens, who maintains org-re-reveal.

>
> m.
>
>  End sample Org file --
>
>  Thank you to all who have contributed to the development of Org Mode and
> Emacs.
> J. Lambert
>
>
> Emacs  : GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
>  of 2022-09-13
> Package: Org mode version 9.6.1 (9.6.1-gaa48c8 @ )
>
> current state:
> ==
> (setq
>  org-link-elisp-confirm-function 'yes-or-no-p
>
>  org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
> "\n\n(fn ENTRY)"]
>  org-download-file-format-function 'org-download-file-format-default
>  org-log-done 'time
>  org-fontify-done-headline nil
>  org-persist-after-read-hook '(org-element--cache-persist-after-read)
>  org-export-before-parsing-hook '(org-attach-expand-links)
>  org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
> org-babel-header-arg-expand)
>  org-download-method 'attach
>  org-archive-hook '(org-attach-archive-delete-maybe)
>  org-odt-format-inlinetask-function
> 'org-odt-format-inlinetask-default-function
>  org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME
> CONTENTS WIDTH)"]
>  org-cycle-hook '(org-cycle-hide-archived-subtrees
> org-cycle-show-empty-lines
> org-cycle-optimize-window-after-visibility-change
>   org-cycle-display-inline-images)
>  org-persist-before-read-hook '(org-element--cache-persist-before-read)
>  org-modules '(ol-bbdb ol-bibtex ol-docview ol-doi ol-eww ol-gnus
> ol-info ol-irc ol-mhe ol-rmail ol-w3m org-collector)
>  org-image-actual-width nil
>  org-mode-hook '(#[0 "\301\211 \207" [imenu-create-index-function
> org-imenu-get-tree] 2] t
> #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook
> org-fold-show-all append local] 5]
> #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook
> org-babel-show-result-all append local] 5] org-babel-result-hide-spec
> org-babel-hide-all-hashes)
>  org-babel-load-languages '((emacs-lisp . t) (python . t) (sql . t)
> (sqlite . t) (shell . t))
>  org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
>  org-download-abbreviate-filename-function 'file-relative-name
>  org-latex-format-headline-function
> 'org-latex-format-headline-default-function
>  org-confirm-shell-link-function 'yes-or-no-p
>  org-download-annotate-function 'org-download-annotate-default
>  org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME
> CONTENTS)"]
>  outline-isearch-open-invisible-function 'outline-isearch-open-invisible
>  org-startup-indented t
>  org-fold-catch-invisible-edits t
>  org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}"
> ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" .
> "\\subsection*{%s}")
>   ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
>  ("article" "\\documentclass[11pt]{article}" ("\\section{%s}" .
> "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
>   ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
> ("\\paragraph{%s}" . "\\paragraph*{%s}")
>   ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
>  ("report" "\\documentclass[11pt]{report}" ("\\part{%s}" .
> "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
>   ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" .
> "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
>  ("book" "\\documentclass[11pt]{book}" ("\\part{%s}" .
> "\\part*{%s}") ("\\chapter{%s}" . "\\chapter*{%s}")
>   

Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks

2023-02-26 Thread Ken Mankoff
Hi Max,

On 2023-02-26 at 02:11 -08, Max Nikulin  wrote:
> As to `org-babel-screen-test' perhaps the issue is additional newline
> added after random number. I have not tried stepping through the
> function in debugger though.

I haven't either. I'll see if I can figure out the issue with the help of the 
debugger.

> It seems top level headings were separated by single empty line.

Fixed.

> ;; Reuse the variable assignment code from ob-shell
>> +(defalias 'org-babel-variable-assignments:screen
>> +  'org-babel-variable-assignments:shell)
>
> Have you tried to compile using make? I expect a warning due to missed
> (require 'ob-shell).

Make did not complain about this, but did suggest mapcar -> mapc.

> P.S. My expectations based on the package name were that ob-screen is
> intended for running commands on remote hosts.

That too. But I also find it useful for running long commands on localhost 
without worrying about :async in emacs.

Another nice thing here is that this is, by default, session-based, and can be 
accessed outside of Org, while Bash blocks don't always play nice with 
sessions. I can, for example and all in Org Babel, spawn a screen session, ssh 
to a remote host, and then inject :var into the remote session. I find this 
quite powerful, and I haven't figured out how to do it with =BEGIN_SRC bash= or 
=BEGIN_SRC shell= blocks.

> Reading the code I noticed a couple of issues that may be fixed when
> you will decide to touch this file next time: -
> `org-babel-screen-session-socketname' does not respect
> `org-babel-screen-location' - `string-match' is used where it may be
> replaced by `string-match-p' since match data is not used.

Both fixed. Should these be separate patches (3 total), or two - one for the 
new feature, and one 'cleanup'?

> I noticed that ob-core besides org-babel-default-header-args:LANG uses
> org-babel-header-args:LANG. The latter is not defined in ob-screen,
> however I am unsure concerning its effect (completion?).

I don't understand this either.

  -k.



Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks

2023-02-26 Thread Ken Mankoff
Hi Ihor,

On 2023-02-26 at 04:18 -08, Ihor Radchenko  wrote:
>> +;; Reuse the variable assignment code from ob-shell
>> +(defalias 'org-babel-variable-assignments:screen
>> +  'org-babel-variable-assignments:shell)
>
> This will work, but you are relying on implementation detail of
> ob-shell.el. A more safe approach would be calling
> org-babel-variable-assignments:LANG depending on the :cmd header arg.
> For :cmd bash - org-babel-variable-assignments:bash, for :cmd fish -
> org-babel-variable-assignments:fish.
>
> To archive this, you can define a full
> org-babel-variable-assignments:screen function that does what I
> described.

You're pushing my lisp skills here. Which is fine, but I might need some help.

In ob-shell I see

(defcustom org-babel-shell-names
  '("sh" "bash" "zsh" "fish" "csh" "ash" "dash" "ksh" "mksh" "posh")

Should I create a function that, using case statement or something similar, 
checks for each of these and calls that flavor? I think I could do that.


But if I also see org-babel-shell-initialize in ob-shell that looks like it 
creates defaliases for each of these to (org-babel-execute:shell) and 
#'org-babel-variable-assignments:shell.

I'm not sure how that is very different from what I've done. I'm not sure what 
to do here, nor how to do what you suggest (yet - I've only read it so far, not 
spent a lot of time experimenting and searching, so I may be able to implement 
what I think is a solution to what you wrote, but I doubt it'll be what you 
expect).

  -k.



[BUG] Org-reveal and setupfile conflict [9.6.1 (9.6.1-gaa48c8)]

2023-02-26 Thread Joshua Lambert
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.

When Org files use both Org Reveal and a ~#+setupfile:~ link for
exported web pages, the CSS of exported Org Reveal slides inherits some
of the CSS from the setupfile. So, I have to comment out the setupfile
line each time I export slides. See the sample file below and steps to
reproduce.

1. With the following Org file open, it should export the Org Reveal
slides fine.
2. After you add the following line to that Org file after the title,
try exporting and viewing the Org Reveals slides again. This time, their
text is too big in the unnumbered lists. I think the CSS from the two export
methods seems to be clashing.

#+setupfile: 
https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup

3. Now comment out that setupfile line or delete it and the export works
fine again.

 Sample Org file below --

#+title: Org testing

:reveal_properties:
#+reveal_reveal_js_version: 4
#+reveal_theme: serif
#+options: reveal_single_file:t reveal_title_slide:nil
:end:

* To Bleach White Silk
When either white silk fabric or embroidery has become yellowed from
careless washing, it may be bleached in the following manner:
- Dissolve two ounces each of salt and oxalic acid in six quarts of cold water.
- Soak the silk in this until the yellow tinge disappears. This will
take about an hour in ordinary cases.
- Rinse immediately in several clear waters.
* Marshmallow Pudding
- Make a plain lemon jelly
- adding a little sherry wine if desired.
- Put a layer of sliced marshmallows in the bottom of the mold,
- and when the jelly has begun to set spread a little of it over them.
- Continue with jelly and marshmallows till the mold is full,
- then put away to harden.
- Serve with whipped cream.

 End sample Org file --

Thank you to all who have contributed to the development of Org Mode and Emacs.
J. Lambert


Emacs  : GNU Emacs 28.2 (build 2, x86_64-w64-mingw32)
 of 2022-09-13
Package: Org mode version 9.6.1 (9.6.1-gaa48c8 @ )

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p

 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-download-file-format-function 'org-download-file-format-default
 org-log-done 'time
 org-fontify-done-headline nil
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-download-method 'attach
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME
CONTENTS WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
org-cycle-optimize-window-after-visibility-change
  org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-modules '(ol-bbdb ol-bibtex ol-docview ol-doi ol-eww ol-gnus
ol-info ol-irc ol-mhe ol-rmail ol-w3m org-collector)
 org-image-actual-width nil
 org-mode-hook '(#[0 "\301\211 \207" [imenu-create-index-function
org-imenu-get-tree] 2] t
#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook
org-fold-show-all append local] 5]
#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook
org-babel-show-result-all append local] 5] org-babel-result-hide-spec
org-babel-hide-all-hashes)
 org-babel-load-languages '((emacs-lisp . t) (python . t) (sql . t)
(sqlite . t) (shell . t))
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-download-abbreviate-filename-function 'file-relative-name
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-download-annotate-function 'org-download-annotate-default
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-startup-indented t
 org-fold-catch-invisible-edits t
 org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}"
("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" .
"\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
 ("article" "\\documentclass[11pt]{article}" ("\\section{%s}" .
"\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}")
  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
  ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
 ("report" 

Re: Multiple noweb-ref

2023-02-26 Thread Théo Maxime Tyburn
Hi Ihor,

>> Anyway I tried to hack my way trough it. It seems there are two things
>> to do :
>> 1) Enable noweb-ref to contain multiple references.
>> 2) Accumulate references when using header-args+ or use tags to set the
>> value of noweb-ref
>>
>> I came up with a quick patch for 1):
>> modified   lisp/ob-core.el
>> @@ -2910,8 +2910,11 @@ block but are passed literally to the 
>> \"example-block\"."
>>  (if (org-in-commented-heading-p)
>>  (org-forward-heading-same-level nil t)
>>(let* ((info (org-babel-get-src-block-info t))
>> - (ref (cdr (assq :noweb-ref (nth 2 info)
>> -(push info (gethash ref cache))
>> + (refs (cdr (assq :noweb-ref (nth 2 info)
>> +(if refs
>> +(dolist (ref (s-split "+" refs))
>> +  (push info (gethash ref cache)))
>> +  (push info (gethash refs cache)))
>
> + is a bit awkward.
> Space would be more logical as separator.
> Though I am wondering if people are using noweb reference names with
> spaces in the wild.

Might be. So maybe we could use another non-alphabetical character? What
about "|" ?

>> For 2) I didn't check in detail how one could achieve this. I have the
>> impression it would be easier to use tags. One could define a
>> new variable `org-babel-set-noweb-refs-from-tags` that would be used in
>> `org-babel-get-src-block-info` to generate the value of noweb-ref we
>> would like to have depending on the tags of the headline of the
>> block. I'll try this soonish.
>
> I do not like the idea of using tags.
>
> What we might do is:
>
> 1. Leave :noweb-ref's current behavior of overwriting the parent
>parameter values.
> 2. Add a new :noweb-ref+ parameter to accumulate multiple noweb
>reference names. The relevant function to modify is
>`org-babel-merge-params'

I like the idea. Thanks for the hint, I'll try that out!

Best,

Théo



How to produce an org-ref citation from ivy-bibtex

2023-02-26 Thread Sven Bretfeld
Hi everybody

Is it at all possible to produce a correct org-ref citation format
from ivy-bibtex (or helm-bibtex, I tried both)? What I mean by
"correct" is the format: [[cite:]].

The problem seems to come down to the question what has to be inserted
in the 2nd line here:

(setq bibtex-completion-format-citation-functions
  '((org-mode  . ??)
(latex-mode. bibtex-completion-format-citation-cite)
(markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
(default   . bibtex-completion-format-citation-default)))

(A) Not setting the variable at all, defaults to producing an ebib
link which is of no use to me at all.

(B) Putting org-ref-helm-bibtex-insert-citation here (as found on
reddit) does not work, since the function does not seem to exist
anymore.

(C) Putting org-ref-insert-cite-link here is obviously wrong. Choosing
that from the list of ivy-bibtex-actions, just calls the function
interactively, you have to search for the bib-entry again and the
resulting link looks like: [[cite:]]^&. The terminating '^&'
obviously makes subsequent LaTeX-exports fall.

(D) Putting "bibtex-completion-format-citation-org-cite" here,
produces standard org-links: [cite:@citekey]. These are not correctly
exported to a tex file when the org-ref package is loaded.

The only working solution I have found is to use org-ref's own cite
function org-ref-insert-cite-link. I know that ivy-bibtex can be set
as backend (require 'org-ref-ivy). But in this way ivy-bibtex's other
actions (like opening an associated PDF or note file) are lost.

It would be nice to be able to use a SINGLE key-binding to select a
bib-entry and then decide what to do with it (insert org reference,
insert tex reference, open pdf, etc.). This was possible earlier (I
did that for years with older versions of org-ref-helm) but is
apparently no longer possible now.

Many thanks for help and suggestions,

Sven



Re: [BUG] org parser error [9.6.1 (9.6.1-g351279 @ /home/mah/.emacs.d/straight/build/org/)]

2023-02-26 Thread Ihor Radchenko
"Mark A. Hershberger"  writes:

> If I can reopen this issue, it would be good if the error message actually 
> said that.

Org has no idea which functions are built-in. Org has no idea which
functions are re-defined and just uses modified versions if the user
prefers re-defined version. Emacs gives this power to users. Use it with
caution. Or not use. Following naming conventions helps.

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



Re: [BUG] org parser error [9.6.1 (9.6.1-g351279 @ /home/mah/.emacs.d/straight/build/org/)]

2023-02-26 Thread Mark A. Hershberger
Thanks for pointing out that I'm re-defining an internal function.

If I can reopen this issue, it would be good if the error message actually said 
that.



[BUG] `(org-agenda-list)` doesn't respect the `org-agenda-start-day` when `org-agenda-span` is equal to 7. [9.6.1 (release_9.5.5-1519-gaa2249 @ /home/rmnull/lab/libre/org-mode/lisp/)]

2023-02-26 Thread rmnull
Hi, This is first my first bug report to org-mode. So I would like to 
start by thanking
everyone involved for making this life enhancing drug a reality. It's 
one of the rare software which

actually does what i mean. It's wonderful :cheers:

* One Line summary
   `org-agenda-list` shows the week agenda list, instead of respecting 
the org-agenda-start-day when the org-agenda-span is 7.


* A Little detailing about the bug and reproduction steps
When I run this, `org-agenda-list` lists the previous 2 days, current 
day and the next 2 days.

#+BEGIN_SRC emacs-lisp
  (setq org-agenda-span 5)
  (setq org-agenda-start-day "-2d")
  (org-agenda-list)
#+END_SRC
Which is quite nice because that's an expected behavior.

However when I run a similar code,
#+BEGIN_SRC emacs-lisp
  (setq org-agenda-span 7)
  (setq org-agenda-start-day "-3d")
  (org-agenda-list)
#+END_SRC
It lists the current week, start from the beginning of this week.
Instead I was expecting org to list previous 3 days, current day and the 
next 3 days.


The output looks like this
#+BEGIN_QUOTE
Monday 20 February 2023 W08
Tuesday21 February 2023
Wednesday  22 February 2023
Thursday   23 February 2023
Friday 24 February 2023
Saturday   25 February 2023
Sunday 26 February 2023
#+END_QUOTE

whereas it should have looked like

#+BEGIN_QUOTE
Thursday   23 February 2023
Friday 24 February 2023
Saturday   25 February 2023
Sunday 26 February 2023
Monday 27 February 2023 W09
Tuesday28 February 2023
Wednesday   1 March 2023
#+END_QUOTE

* Where exactly did you test this behavior?

I tested it on the emacs launched by `make repro` command of the 
org-mode,

the git was pointing to `main` branch(commit-id: aa2249787).

Emacs  : GNU Emacs 28.2 (build 2, x86_64-unknown-linux-gnu, GTK+ Version 
3.24.34, cairo version 1.16.0)

 of 2022-09-14
Package: Org mode version 9.6.1 (release_9.5.5-1519-gaa2249 @ 
/home/rmnull/lab/libre/org-mode/lisp/)



If any information has been left out, do let me know.

Thanks,
rmnull.




inconsistency with :eval yes in orgmode.org and gnu.org manuals for org 9.6, 9.5?

2023-02-26 Thread Dan Drake
The online manuals for 16.5 Evaluating Code Blocks seem inconsistent and
include a header argument that seems to no longer be respected.

https://orgmode.org/manual/Evaluating-Code-Blocks.html, for version 9.6,
right now says you can specify a header argument ":eval yes" on source code
blocks to bypass confirmation.

However, neither
https://www.gnu.org/software/emacs/manual/html_node/org/Evaluating-Code-Blocks.html
and
https://www.gnu.org/savannah-checkouts/gnu/emacs/manual/html_node/org/Evaluating-Code-Blocks.html
mention that. They are both for version 9.5.

It seems like ":eval yes" was removed some time ago -- see
https://emacs.stackexchange.com/a/3570/19526.

Did that get re-added? It seems like it was replaced by the
org-confirm-babel-evaluate mechanism --
https://www.gnu.org/savannah-checkouts/gnu/emacs/manual/html_node/org/Code-Evaluation-Security.html.


Just curious/confused. Thanks!

Dan



-- 
Ceci n'est pas une .signature.


Re: [POLL] Naming of "export features"

2023-02-26 Thread Sébastien Miquel

Ihor Radchenko writes:

Only the simplest cases of prepending/appending staff.
If we want to splice into the normal export template, users currently
must either write an output filter or rewrite the trnascoders
completely.

The proposed template system will provide more flexibility to modify the
default export transcoders.


Reading your original proposal, I see nothing that provides more
flexibility. I can guess at how it would allow one to prepend/append
stuff to the output of the default transcoder. Anything more flexible
than that would require breaking these default transcoders into parts,
which you did not originally mention.


Here's a couple interesting examples that currently cannot, I think.
   + a `multicol` heading property, that wraps the content of the
 heading in a multicol environment.

Could you please illustrate with examples?


Exported content would be:
#+BEGIN_SRC latex
\section{ABC}
\begin{multicols}{3}
  Section content
\end{multicols}
#+END_SRC


   + a `nocontent` property that do not export the content of the
 heading

This can be done with :filter-parse-tree or :filter-headline


I guess. This isn't "couple of lines"-easy though.


   + Some way to play with the numbering of section, beyond the
 `unumbered` property.

Could you elaborate what kind of "play" you are referring to?


I cannot think of anything that cannot be achieved through (somewhat
fragile) post-processing with `:filter-headline`.

Anyway, I was only trying to understand if your proposal could easily
do these things. What flexibility does it bring ?


It is indeed unfortunate that org doesn't provide an easy way to get
this behaviour, and achieving it would require the fragmentation
(templating ?) of at least some transcoders. I'm not sure that it
makes sense to do this for anything other than the headings
transcoders, and the main template.

Currently, transcoders are opaque functions that expose a limited number
of pre-defined settings. Turning them into templates will allow certain
non-standard alternations that we cannot think of in advance. Without
directly modifying the transcoder function code.


However, this seems orthogonal to your previous proposal. It is not
clear to me how it ties with your syntax.

Could you elaborate?


See higher. More flexibility requires breaking up some transcoders
into pieces. AFAIU it, the proposal you originally described does not
bring any more flexibility beyond what can be done through short
advices, or indeed the `:filter-` functions. I'm not sure this
dedicated syntax is preferable to advices.

--
Sébastien Miquel



Re: [PATCH] Introduce "export features"

2023-02-26 Thread Sébastien Miquel



Ihor Radchenko writes:

The traditional user-facing approach for toggling staff in export is
setting export options.

Indeed. Then I suggest that such use be described in the manual.
Having the user create a whole new option in order to toggle a
`chikenize` package seems a bit unwieldy, however.

What do you suggest instead of creating a new option?


Timothy's patch supports having a feature depend on a variable. I was
thinking here of a user variable (instead of an already defined org
variable) that could be toggled per document.

It is fairly orthogonal to the original purpose of the patch, but it
does scratch an annoying itch of mine: there's very little support in
org to minutely tweak the export on a per document basis, beyond the
default options.

One way to do this (easier than setting up a new option), is to define
any variable, make the feature depend on it, and set it using the
`#+bind` keyword. Combined with these export features, this could be
used to easily tweak the LaTeX preamble, per document.

If we find this use case to be legitimate and useful, I suggested
earlier making it even easier with a `#+org_export_features` keyword.
It would only take a list of feature names, and not require any
variable tied to the feature.

--
Sébastien Miquel



Re: [POLL] Naming of "export features"

2023-02-26 Thread Ihor Radchenko
Sébastien Miquel  writes:

>> If we implement export transcoders as much as possible using templates,
>> it will become very easy for users to adjust the export behavior beyond
>> what is already possible.
>
> This can be achieved in a couple of lines with advices.

Only the simplest cases of prepending/appending staff.
If we want to splice into the normal export template, users currently
must either write an output filter or rewrite the trnascoders
completely.

The proposed template system will provide more flexibility to modify the
default export transcoders.

> Here's a couple interesting examples that currently cannot, I think.
>   + a `multicol` heading property, that wraps the content of the
> heading in a multicol environment.

Could you please illustrate with examples?

>   + a `nocontent` property that do not export the content of the
> heading

This can be done with :filter-parse-tree or :filter-headline

>   + Some way to play with the numbering of section, beyond the
> `unumbered` property.

Could you elaborate what kind of "play" you are referring to?

> It is indeed unfortunate that org doesn't provide an easy way to get
> this behaviour, and achieving it would require the fragmentation
> (templating ?) of at least some transcoders. I'm not sure that it
> makes sense to do this for anything other than the headings
> transcoders, and the main template.

Currently, transcoders are opaque functions that expose a limited number
of pre-defined settings. Turning them into templates will allow certain
non-standard alternations that we cannot think of in advance. Without
directly modifying the transcoder function code.

> However, this seems orthogonal to your previous proposal. It is not
> clear to me how it ties with your syntax.

Could you elaborate?

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



Re: [PATCH] Introduce "export features"

2023-02-26 Thread Ihor Radchenko
Sébastien Miquel  writes:

>> The traditional user-facing approach for toggling staff in export is
>> setting export options.
>
> Indeed. Then I suggest that such use be described in the manual.
> Having the user create a whole new option in order to toggle a
> `chikenize` package seems a bit unwieldy, however.

What do you suggest instead of creating a new option?

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



Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks

2023-02-26 Thread Ihor Radchenko
Ken Mankoff  writes:

> From f7ca0258d72b3da5743b1134718b1d1f0d74491d Mon Sep 17 00:00:00 2001
> From: "Kenneth D. Mankoff" 
> Date: Mon, 20 Feb 2023 21:40:39 -0800
> Subject: [PATCH] lisp/ob-screen.el: Support var header args for babel blocks

Thanks for the patch!

> +;; Reuse the variable assignment code from ob-shell
> +(defalias 'org-babel-variable-assignments:screen
> +  'org-babel-variable-assignments:shell)

This will work, but you are relying on implementation detail of
ob-shell.el. A more safe approach would be calling
org-babel-variable-assignments:LANG depending on the :cmd header arg.
For :cmd bash - org-babel-variable-assignments:bash, for :cmd fish -
org-babel-variable-assignments:fish.

To archive this, you can define a full
org-babel-variable-assignments:screen function that does what I described.

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



Re: ox-rst still working?

2023-02-26 Thread Ihor Radchenko
Angel de Vicente  writes:

> I was trying to export an .org file to .rst. I have ox-rst 20200815.1511
> installed, and I have run (require 'ox-rst), but despite this, there is
> no option for rsT in the Org Export Dispatcher. Did I miss something to
> make it work?

Works on my side with the latest Org.
Note that ox-rst menu clashes with default org-ref menu.

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



Re: Bug or expected behavior? org-sparse-tree visibility toggling

2023-02-26 Thread Ihor Radchenko
Cassio Koshikumo  writes:

> Create an .org file with the following contents:
>
> * First Level
> ...
> Now, C-c / m (or M-x org-sparse-tree and select m) and Match: tag.
>
> The resulting sparse tree looks like this:
>
> * First Level
> ** One :tag:
> *** Child
> ** Four :tag:
>
> So far, so good. Now, put point on heading One and press TAB. Child is hidden.
>
> The problem: press TAB again. Now Two and Three are also shown,
> effectively breaking the sparse tree filtering. (Actually Five is
> shown, too, it seems...)

 is not affected by sparse tree.
Sparse tree just reveals headings that match certain criteria and
highlights them.

May you describe what you expected to happen?

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



Re: [PATCH] Avoid crash in `org-file-contents' in case of network failure

2023-02-26 Thread Ihor Radchenko
Damien Cassou  writes:

> Subject: [PATCH] org.el: Avoid crash in `org-file-contents' in case of network
>  failure

Applied, onto bugfix.
Thanks for your contribution!
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f9aeba5dd

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



Re: [BUG] org parser error [9.6.1 (9.6.1-g351279 @ /home/mah/.emacs.d/straight/build/org/)]

2023-02-26 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Re-defining built-in functions is generally dangerous. You need to know
> what you are doing.

I recommend reading D.1 Emacs Lisp Coding Conventions section of Elisp
manual. In particular the paragraph about naming symbols and functions:

   • You should choose a short word to distinguish your program from
 other Lisp programs.  The names of all global symbols in your
 program, that is the names of variables, constants, and functions,
 should begin with that chosen prefix.  Separate the prefix from the
 rest of the name with a hyphen, ‘-’.  This practice helps avoid
 name conflicts, since all global variables in Emacs Lisp share the
 same name space, and all functions share another name space(1).
 Use two hyphens to separate prefix and name if the symbol is not
 meant to be used by other packages.

It is common among Emacs users to prefix personal functions with
"username/". Like `username/count-lines'.

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



Re: [BUG] org parser error [9.6.1 (9.6.1-g351279 @ /home/mah/.emacs.d/straight/build/org/)]

2023-02-26 Thread Ihor Radchenko
"Mark A. Hershberger"  writes:

> Loading the following file with "emacs -Q", I'm un-able to type 'C-c
> C-c' in the source block to execute it.
>
> #+begin_src elisp
> (defun count-lines (dir)
> ...
> When I do the following error appears:
>
> ⛔ Warning (org-element-cache): org-element--cache: Org parser error in 
> tmp.org::4740. Resetting.
>  The error was: (wrong-number-of-arguments (lambda (dir)

Canceled.

You are re-defining a built-in Elisp function `count-lines'. This
function is used by Org parser. That's why you are getting an error.

Re-defining built-in functions is generally dangerous. You need to know
what you are doing.

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



Re: [PATCH] lisp/ob-screen.el: Support ~:var~ header args for babel blocks

2023-02-26 Thread Max Nikulin

On 25/02/2023 23:47, Ken Mankoff wrote:

On 2023-02-25 at 08:05 -08, Max Nikulin wrote:

I believe, it is safer to define
`org-babel-variable-assignments:screen' some way: alias, substitution,
function that calls `org-babel-variable-assignments:shell'. I am
unsure which variant is better. I see a couple of callers for specific
language in ob-core.el.


How's this with a defalias?


I do not mind since ob-shell.el uses it for particular shell names.

Concerning tables as variable values, it seems sh receives them as TAB 
separated text.


As to `org-babel-screen-test' perhaps the issue is additional newline 
added after random number. I have not tried stepping through the 
function in debugger though.



diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS

...

+#+END_src
+
+
+
 * Version 9.6


It seems top level headings were separated by single empty line.


diff --git a/lisp/ob-screen.el b/lisp/ob-screen.el

...
;; Reuse the variable assignment code from ob-shell

+(defalias 'org-babel-variable-assignments:screen
+  'org-babel-variable-assignments:shell)


Have you tried to compile using make? I expect a warning due to missed 
(require 'ob-shell).


I have no objections besides this couple of minor issues. I am not a 
maintainer though.


P.S. My expectations based on the package name were that ob-screen is 
intended for running commands on remote hosts. Reading the code I 
noticed a couple of issues that may be fixed when you will decide to 
touch this file next time:
- `org-babel-screen-session-socketname' does not respect 
`org-babel-screen-location'
- `string-match' is used where it may be replaced by `string-match-p' 
since match data is not used.


I noticed that ob-core besides org-babel-default-header-args:LANG uses 
org-babel-header-args:LANG. The latter is not defined in ob-screen, 
however I am unsure concerning its effect (completion?).




special blocks extras

2023-02-26 Thread Michael Welle
Hi,

I wanted to play with special blocks and started by installing the
package org-special-block-extras and defining a new block:

(org-defblock hmwfoo nil (reps 3)
  "Ahoj"
  (message "ahoj: %s" contents)
  (org-parse (s-repeat reps contents)))

For the tests I started with exporting to html.

A link like [[hmwfoo:][oink]] seems to work, I see three concatenated
oinks.

A block like

#+begin_hmwfoo
oink
#+end_hmwfoo

exports to only one single oink. According to my understanding both, the
link and the block, should be equivalent?

Well, then I activated the special block extras minor mode before
exporting and things got strange. The link still seems to work, but the
block results in an html page rendered like this:

#+end_export oink

oink

oink

#+begin_export html

Three oinks, but lots of line breaks and the export markers are part of
the rendered page. Hm, that's not what I expected ;). Do I use it the
wrong way or is there a bug hidden somewhere?

All the best
hmw