Re: Slowdowns and hangs when loading org from elpa

2024-06-05 Thread Pedro Andres Aranda Gutierrez
On Wed, 5 Jun 2024 at 17:00, Ihor Radchenko  wrote:

> Pedro Andres Aranda Gutierrez  writes:
>
> > Background: the origin for bug #71356 was that I was trying to get org
> > installed from elpa, which apparently didn't work and Emacs (master) took
> > the bundled mode instead.
> >
> > Observation: loading org from elpa with M-x p-l-p leads to errors and
> > emacs(master) freezing for a long time. When looking at the *Warnings*
> > buffer, I see:
> >
> > Warning (comp): org-clock.el:2635:23: Warning: the function
> > ‘org-add-archive-files’ is not known to be defined.
> > ⛔ Warning (comp): org-clock.el:962:40: Warning: the function
> > ‘org-element-at-point’ is not known to be defined.
>
> I am on Emacs master 2b7056 (CommitDate: Sat Jun 1 15:41:54 2024 +0800)
>
> I am unable to reproduce doing the following:
>
> 1. Clear elpa dir
> 2. emacs -Q
> 3. M-x package-list-packages
> 4. Click on "org"
> 5. Install the version from Elpa
> 6. Open an Org file
> 7. Observe native compilation finishing without warnings
>
> Your commit is slightly newer - 2024-06-02 22:33:54 -0700
>
> I know, I recompile master every now and then, so I'll keep updating on
the situation.
Vaeat: This post may become a blog ;-)

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

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

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


Re: ob-sql-mode/session

2024-06-05 Thread Phil




* [2024-06-06 02:20] Phil:

* [2024-06-05 20:50] Ihor Radchenko:


Phil  writes:


In need for a sessions support on SQL, I checked
ob-sql.el and sql.el lately, then wrote
https://github.com/flintforge/ob-sql-session



CCing Daniel, the ob-sql maintainer.

it sounds to me like a proposal to add :session support to Org mode's 
ob-sql.



Yes, it is. The re-wiring will need to federate
and differentiate some command-line options
without them clashing. Of course it's easier to
get it operational on databases one is used to work
with.
I'll be testing further these new functions in real
conditions before, and think about a complete test
coverage on the other DBs.

Phil



Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-05 Thread Suhail Singh
Ihor Radchenko  writes:

> Indeed. But I wanted to nudge you to do a bit better :)

"Better" here is subjective and we have a difference in opinion, which
is okay.  While I am not motivated to submit such an alternative patch,
I also am not aware of any common usecases that would become much more
complicated as a result of it.

> Further, the distant goal is to implement integration of org-lint into
> flycheck/flymake. And we do need user-level config for which checkers
> should be enabled for "full" org-lint check and for "quick" check on
> the fly then.

I am unfamiliar with flymake, but since flycheck checkers run in a
different Emacs process, the patch I sent is sufficient.  FWIW, I have
been using an org-lint flycheck checker for several months now.  The
code for the checker, if curious, is adapted from
.  If flymake doesn't
use a different Emacs process and your goal is to be able to support it
easily, it makes sense to extend the current API in a manner similar to
what you proposed.

-- 
Suhail



Re: [BUG] org-capture: %\N template expansion

2024-06-05 Thread Bruno Cardoso


On 2024-06-05, 11:29 +, Ihor Radchenko  wrote:

> See the attached tentative patch.
>
> I introduced a new placeholder - %\*N. It refers to _all_ the prompts,
> unlike %\N. If you have better ideas about syntax, please share.
>

Thank you, Ihor! I tested it both from `org-capture-templates' and from an Org 
template file and the patch worked as expected. I'm fine with the proposed 
syntax.

Best,

Bruno.



Re: [PATCH] Add support for shortdoc link type

2024-06-05 Thread Bruno Cardoso

On 2024-06-05, 22:37 +0700, Max Nikulin  wrote:
>
> A couple of notes that unlikely affect real life usage.
>
>> +  (defun org-link--store-shortdoc ( _interactive?)
>> +"Store \"shortdoc\" type link."
>> +(when (eq major-mode 'shortdoc-mode)
>
> `derived-mode-p' is more reliable in general.

Fixed.

The attached patch is now rebased to new Org version.

>From 43de471e577d530ea76dc48460efea12864b5675 Mon Sep 17 00:00:00 2001
From: bruno 
Date: Wed, 5 Jun 2024 19:14:36 -0300
Subject: [PATCH] Add support for shortdoc link type

ol.el: Add support for `shortdoc' link type

* lisp/ol.el (org-link--open-shortdoc org-link--store-shortdoc)
(org-link--complete-shortdoc): Add support for storing and inserting links
to `shortdoc' documentation groups for Emacs Lisp functions.
* doc/org-manual.org (External Links): Add shortdoc link type
documentation.
* etc/ORG-NEWS (=ol.el=: Support for =shortdoc= link type): Document
the new feature.

---
 doc/org-manual.org | 11 +++
 etc/ORG-NEWS   |  5 +
 lisp/ol.el | 41 +
 3 files changed, 57 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 170eea506..e931e1cc1 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -3393,6 +3393,15 @@ Here is the full set of built-in link types:
 
   Execute a shell command upon activation.
 
+- =shortdoc= ::
+
+  Link to short documentation summary for an Emacs Lisp function group.
+  Since Emacs 28, user command ~shortdoc-display-group~ shows all known
+  documentation groups.
+
+  For more information, see [[info:emacs#Name Help][Name Help]]
+  and [[info:elisp#Documentation Groups][Documentation Groups]].
+
 
 For =file:= and =id:= links, you can additionally specify a line
 number, or a text search string, separated by =::=.  In Org files, you
@@ -3434,6 +3443,8 @@ options:
 | irc| =irc:/irc.com/#emacs/bob=  |
 | help   | =help:org-store-link=  |
 | info   | =info:org#External links=  |
+| shortdoc   | =shortdoc:text-properties= |
+|| =shortdoc:text-properties::#get-pos-property=  |
 | shell  | =shell:ls *.org=   |
 | elisp  | =elisp:(find-file "Elisp.org")= (Elisp form to evaluate)   |
 || =elisp:org-agenda= (interactive Elisp command) |
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 4b0b77ca8..a8f3a37f6 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -40,6 +40,11 @@ all the references are resolved in the generated png.
 
 # This also includes changes in function behavior from Elisp perspective.
 
+*** =ol.el=: Support for =shortdoc= link type
+
+Add support for storing and inserting links to =shortdoc= documentation
+groups for Emacs Lisp functions.
+
 ** Miscellaneous
 
 * Version 9.7
diff --git a/lisp/ol.el b/lisp/ol.el
index 20f1b89c0..4cda0cb60 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -1582,6 +1582,47 @@ PATH is a symbol name, as a string."
  :follow #'org-link--open-help
  :store #'org-link--store-help)
 
+ "shortdoc" link type
+(when (version<= "28.0.90" emacs-version)
+  (defun org-link--open-shortdoc (path _)
+"Open a \"shortdoc\" type link.
+PATH is a group name, \"group::#function\" or \"group::search string\"."
+(string-match "\\`\\([^:]*\\)\\(?:::\\(.*\\)\\'\\)?" path)
+(let* ((group (match-string 1 path))
+   (str (match-string 2 path))
+   (fn (and str
+(eq ?# (string-to-char str))
+(intern-soft (substring str 1)
+  (condition-case nil
+  (progn
+(shortdoc-display-group group fn)
+(and str (not fn) (search-forward str nil t)))
+(error (user-error "Unknown shortdoc group or malformed link: `%s'"
+   path)
+
+  (defun org-link--store-shortdoc ( _interactive?)
+"Store \"shortdoc\" type link."
+(when (derived-mode-p 'org-mode)
+  (let* ((buffer (buffer-name))
+ (group (when (string-match "*Shortdoc \\(.*\\)\\*" buffer)
+  (match-string 1 buffer
+(if (and group (assoc (intern-soft group) shortdoc--groups))
+(org-link-store-props :type "shortdoc"
+  :link (format "shortdoc:%s" group)
+  :description nil)
+  (user-error "Unknown shortdoc group: %s" group)
+
+  (defun org-link--complete-shortdoc ()
+"Create a \"shortdoc\" link using completion."
+(concat "shortdoc:"
+(completing-read "Shortdoc summary for functions in: "
+ (mapcar #'car shortdoc--groups
+
+  (org-link-set-parameters "shortdoc"
+   :follow 

Re: [PATCH] function and symbol for headline and olp for org-capture-templates

2024-06-05 Thread Bastien Guerry
Ihor Radchenko  writes:

> Nafiz Islam  writes:
>
>> Craig Topham has cleared me to contribute to Emacs.
>
> Bastien, may you please check the FSF records?

Yes, things are okay.  Thanks Nafiz!

-- 
 Bastien Guerry



Re: [PATCH] Add support for shortdoc link type

2024-06-05 Thread Bastien Guerry
Ihor Radchenko  writes:

> Bruno Cardoso  writes:
 Please, proceed with the copyright agreement form.
>>>
>>> Thank you very much, Max. Just sent the form.
>>
>> Hi all. My copyright assignment with the FSF is complete.
>
> Bastien, may you please confirm?

I do.  Thanks Bruno for contributing!

-- 
 Bastien Guerry



Re: [FR] Org babel: mixing multiple outputs (was: Output of R code block: only text or plot but not both? And only one "result" can be output?)

2024-06-05 Thread Berry, Charles


> On Jun 5, 2024, at 11:17 AM, Ihor Radchenko  wrote:
> 
> "Berry, Charles"  writes:
> 
>>> I am trying to have an R code block output both the results of a numerical 
>>> expression AND a plot, but if I set up the header arguments to display the 
>>> plot, the numerical outcome is not displayed.  A simple example:
>>> 
>>> #+begin_src R :file example.png :results output graphics file
>>>  x <- rnorm(100)
>>>  print(mean(x))
>>>  hist(x)
>>> #+end_src
>>> 
>> 
>> 
>> Babel is a great tool, but has some inherent limitations.
> 
> While it is currently not directly possible to get a mix output and
> graphics results, this is _not_ inherent limitation.
> 

Fair enough, it is not `inherent'.


> One can write a patch for ob-R to produce output type that mixes all the
> block results, including textual output, graphical output, and any other
> perceivable output.

Won't you still have issues like the `:session :results output' conundrum 
mentioned below?

> 
> Such patch would be a reasonable addition to babel backends like ob-R or 
> ob-python.
> 
>> Whilst you can work around this by breaking the above block into
>> multiple src blocks, you might have an easier time using ox-ravel
>> [1]. Basically, you export your *.org document to one of the
>> knitr/Rmarkdown/quarto formats (e.g. *.Rmd) and then render the final
>> output using one of those engines. This gives you access to the
>> capabilities of any of those engines.  The downside, of course, is
>> that you need to learn a bit about the formatting rules in one of them
>> to fine tune your final output.
>> 
>> FWIW, I copy and pasted your query to a `*.org` file, exported it to
>> `*.Rmd` with the latest ox-ravel version and rendered it as html -
>> displaying all the printed output and all three plots. That did not
>> need any modifications to your markup.
> 
> Thanks for sharing the project!
> Although, I would not call going through double export, and producing
> html output "easier time".
> 

The `easier' part is that knitr/Rmarkdown requires very little markup to 
produce nice documents in various formats (pdf, html, Word, ...). And dealing 
with R code and markup of the results of R code for use in documents is what 
that environment is attuned to, so getting a desired result often seemed easier 
to me in that environment.

In terms of my usual workflow, the double export (with ox-ravel and an 
`org-render` helper function loaded) requires these keystrokes:

`C-c C-e r m M-x org-render RET`

or subsequently

`C-u C-c C-e M-x M-p RET`

which adds only two keystrokes. 


> While we are here, are there any other features you find missing in Org
> babel that are present in knitr/Rmarkdown/quarto?
> 

`:session :results output` handling in R lang src blocks can fail as the 
heuristics for finding the output of a command in the session buffer and 
removing the prompts have limited success. An ECM:

#+begin_src R :session :results output
  cat("2 > 1\n")
#+end_src

There are workarounds, of course.

There was discussion here years ago of using an R package (evaluate?) to better 
parse the session results. I can't recall why this was dropped - maybe it was 
the requirement of additional software.

I recall hearing that `comint.el` would someday be replaced by a hardier 
package, so maybe if/when that happens this can be cured. 

A big motivation for creating `ox-ravel' was to be able to cache large objects. 
I know the `:cache` header arg helps for small objects that require a lot of 
computation, but AFAICS does not help once the object size gets large. The 
caching options [1] of knitr and friends are flexible and powerful enough to 
support the genomics work I do. 

I mentioned above that knitr is attuned to working with R code/output. The 
handling of warnings, errors, and messages resulting from R code has a number 
of useful options under `Text Output` [2].

I guess a rewrite of ob-R.el to implement such features as object caching and 
error/warning/message handling is feasible, but would require a lot of effort. 
And since those features (and more - like animation support) are already 
implemented in the knitr/Rmarkdown domain is it really worth pursuing?

Best,

Chuck 

[1] https://yihui.org/knitr/options/#cache

[2] https://yihui.org/knitr/options/#text-output





Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-05 Thread Ihor Radchenko
Suhail Singh  writes:

> Ihor Radchenko  writes:
>
>> This would work, but it modifies the checker list destructively.
>
> Yes, as does org-lint-add-checker.  In the same vein,
> org-lint-remove-checker is intended to be able to undo the "effect" of
> one or more org-lint-add-checker invocations.

Indeed. But I wanted to nudge you to do a bit better :)

>> What about introducing some kind of selector variable instead?
>
> That could also work; there is more than one way to achieve the end.
> However, I am not convinced that it's the "better" approach.  It's
> altering an existing API for, what I deem to be, little value.

A new custom variable is not altering the existing API, it is extending
it. The extension is also not entirely out of nowhere - `org-lint'
already accepts a list of checkers as an argument.

Further, the distant goal is to implement integration of org-lint into
flycheck/flymake. And we do need user-level config for which checkers
should be enabled for "full" org-lint check and for "quick" check on the
fly then.

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



Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-05 Thread Suhail Singh
Ihor Radchenko  writes:

> This would work, but it modifies the checker list destructively.

Yes, as does org-lint-add-checker.  In the same vein,
org-lint-remove-checker is intended to be able to undo the "effect" of
one or more org-lint-add-checker invocations.

> What about introducing some kind of selector variable instead?

That could also work; there is more than one way to achieve the end.
However, I am not convinced that it's the "better" approach.  It's
altering an existing API for, what I deem to be, little value.

-- 
Suhail



Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-05 Thread Ihor Radchenko
Suhail Singh  writes:

> Ihor Radchenko  writes:
>
>> There is currently no such way. Although, it would be nice to have such
>> a feature. Patches welcome!
>
> See attached.

Thanks!

> +;;;###autoload
> +(defun org-lint-remove-checker (name  names)
> +  "Remove checker(s) from linter.
> +NAME is the unique check identifier, as a non-nil symbol.  NAMES
> +are additional check identifiers to be removed."
> +  (let ((removelist (cons name names)))
> +(setq org-lint--checkers
> +  (seq-remove (lambda (c) (memq (org-lint-checker-name c) 
> removelist))
> +  org-lint--checkers

This would work, but it modifies the checker list destructively.

What about introducing some kind of selector variable instead?

Something like

org-lint-default-selector
= '((not misspelled-export-option) :categories export :trust high)

Then, we can make `org-lint' accept ARG to have this
`org-lint-default-selector' format, in addition to currently supported
list of checker names.

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



Re: ob-sql-mode/session

2024-06-05 Thread Ihor Radchenko
Phil  writes:

> In need for a sessions support on SQL, I checked
> ob-sql.el and sql.el lately, then wrote
> [[https://github.com/flintforge/ob-sql-session][ob-sql-session]]
> (no pun intended, at all:)
>
> It started with a quick workaround on ob-sql,
> which turned out to be the same logic to what
> _ob-sql-mode_ does: a simple sql-redirect.  Most of
> the content found in it was general consideration
> regarding org-mode usage with source blocks, and a
> working solution is more demanding, so I felt a
> little embarassed to fork ob-sql-mode after, but
> still, would like to volunteer.
>
> Perhaps it would also be embrassement to have a
> package named ob-sql-session in the repos (because
> it's not related to Emacs sessions of course;)?

CCing Daniel, the ob-sql maintainer.

I am not sure if I 100% understand this email, but it sounds to me like
a proposal to add :session support to Org mode's ob-sql.

Note that we do have session support in the todo list:

;; TODO:
;;
;; - support for sessions
;; - support for more engines
;; - what's a reasonable way to drop table data into SQL?

So, adding sessions to ob-sql would be certainly welcome.

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



Re: Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-05 Thread Ihor Radchenko
Giuseppe Pagnoni  writes:

> #+begin_src R :file example.png :results output graphics file
>   x <- rnorm(100)
>   print(mean(x))
>   hist(x)
>   hist(x^2)
> #+end_src
>
> Here, only the last plot gets displayed.  Is it not possible to display
> more than 1 plot?

We currently do not have automatic way to do it, so that the resulting
plots are inserted as previewable file links.  However, in addition to
the approach with several :session source blocks proposed by Berry, you
can do it by hand in R:

#+begin_src R :results output raw drawer :dir ./
  x <- rnorm(100)
  print(mean(x))
  png(file="hist1.png")
  hist(x)
  png(file="hist2.png")
  hist(x^2)
  print("[[./hist1.png]]")
  print("[[./hist2.png]]")
#+end_src

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



[FR] Org babel: mixing multiple outputs (was: Output of R code block: only text or plot but not both? And only one "result" can be output?)

2024-06-05 Thread Ihor Radchenko
"Berry, Charles"  writes:

>> I am trying to have an R code block output both the results of a numerical 
>> expression AND a plot, but if I set up the header arguments to display the 
>> plot, the numerical outcome is not displayed.  A simple example:
>> 
>> #+begin_src R :file example.png :results output graphics file
>>   x <- rnorm(100)
>>   print(mean(x))
>>   hist(x)
>> #+end_src
>> 
>
>
> Babel is a great tool, but has some inherent limitations.

While it is currently not directly possible to get a mix output and
graphics results, this is _not_ inherent limitation.

One can write a patch for ob-R to produce output type that mixes all the
block results, including textual output, graphical output, and any other
perceivable output.

Such patch would be a reasonable addition to babel backends like ob-R or 
ob-python.

> Whilst you can work around this by breaking the above block into
> multiple src blocks, you might have an easier time using ox-ravel
> [1]. Basically, you export your *.org document to one of the
> knitr/Rmarkdown/quarto formats (e.g. *.Rmd) and then render the final
> output using one of those engines. This gives you access to the
> capabilities of any of those engines.  The downside, of course, is
> that you need to learn a bit about the formatting rules in one of them
> to fine tune your final output.
>
> FWIW, I copy and pasted your query to a `*.org` file, exported it to
> `*.Rmd` with the latest ox-ravel version and rendered it as html -
> displaying all the printed output and all three plots. That did not
> need any modifications to your markup.

Thanks for sharing the project!
Although, I would not call going through double export, and producing
html output "easier time".

While we are here, are there any other features you find missing in Org
babel that are present in knitr/Rmarkdown/quarto?

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



Re: Incremental search in hidden text does not work in Org 9.7 Emacs 28

2024-06-05 Thread Ihor Radchenko
Max Nikulin  writes:

> On 05/06/2024 22:06, Ihor Radchenko wrote:
>> `org-fold-core-style' text-properties is going to be obsoleted.
>> I tried to support isearch, but it is ultimately an uphill battle
>> against bugs popping out here and there.
>
> I have seen these words in another thread, but I did not expect a 
> regression in comparison to 9.6.

I had to do it because `org-fold-core-style' 'overlays was broken with
the previous implementation. I could avoid regression risking to
introduce other bugs, but ultimately decided that it is not worth it in
the long run - there *will* be more bugs related to text properties.

Between keeping a bug for overlay folding, not breaking the link search,
and writing more workarounds for text properties, I chose the first
option. I did not find any better solution.

> At least search in folded headers and drawers works, but without search 
> in link targets 9.7 is hardly usable for daily usage for me. I have not 
> tested yet to which degree overlays are painful for my notes file.

Remember that older Org mode also did not have link paths searchable.
But you can always (1) disable org-link-descriptive; (2) enable
search-invisible.

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



Re: Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-05 Thread Berry, Charles
Giuseppe,



> On Jun 3, 2024, at 6:47 AM, Giuseppe Pagnoni  wrote:
> 
> Hi,
> 
> I am trying to have an R code block output both the results of a numerical 
> expression AND a plot, but if I set up the header arguments to display the 
> plot, the numerical outcome is not displayed.  A simple example:
> 
> #+begin_src R :file example.png :results output graphics file
>   x <- rnorm(100)
>   print(mean(x))
>   hist(x)
> #+end_src
> 


Babel is a great tool, but has some inherent limitations.

Whilst you can work around this by breaking the above block into multiple src 
blocks, you might have an easier time using ox-ravel [1]. Basically, you export 
your *.org document to one of the knitr/Rmarkdown/quarto formats (e.g. *.Rmd) 
and then render the final output using one of those engines. This gives you 
access to the capabilities of any of those engines.  The downside, of course, 
is that you need to learn a bit about the formatting rules in one of them to 
fine tune your final output.

FWIW, I copy and pasted your query to a `*.org` file, exported it to `*.Rmd` 
with the latest ox-ravel version and rendered it as html - displaying all the 
printed output and all three plots. That did not need any modifications to your 
markup.


> Here I get the histogram plot back in the buffer, but NOT the result of 
> "print(mean(x))".   Is it not possible to get both?
> 
> Furthermore, what if I wanted to display *two* or more plots that get built 
> by the code, for instance:
> 
> #+begin_src R :file example.png :results output graphics file
>   x <- rnorm(100)
>   print(mean(x))
>   hist(x)
>   hist(x^2)
> #+end_src
> 
> Here, only the last plot gets displayed.  Is it not possible to display more 
> than 1 plot?
> 


If you want to do this with babel, do the computations in an initial block and 
then use subsequent blocks for each of the displayed outputs/graphs. You will 
need to use the `:session` header arg to retain the data in `x' across blocks. 

HTH,

Chuck

[1] https://github.com/chasberry/orgmode-accessories



ob-sql-mode/session

2024-06-05 Thread Phil

Hi all,

In need for a sessions support on SQL, I checked
ob-sql.el and sql.el lately, then wrote
[[https://github.com/flintforge/ob-sql-session][ob-sql-session]]
(no pun intended, at all:)

It started with a quick workaround on ob-sql,
which turned out to be the same logic to what
_ob-sql-mode_ does: a simple sql-redirect.  Most of
the content found in it was general consideration
regarding org-mode usage with source blocks, and a
working solution is more demanding, so I felt a
little embarassed to fork ob-sql-mode after, but
still, would like to volunteer.

Perhaps it would also be embrassement to have a
package named ob-sql-session in the repos (because
it's not related to Emacs sessions of course;)?

https://github.com/nikclayton/ob-sql-mode/issues/14#issue-1855387618
https://github.com/flintforge/ob-sql-session

Phil




Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-05 Thread Suhail Singh
Ihor Radchenko  writes:

> There is currently no such way. Although, it would be nice to have such
> a feature. Patches welcome!

See attached.

>From 7d7a240d82202fcb3323453648dd2d8b78d22a6f Mon Sep 17 00:00:00 2001
From: Suhail 
Date: Wed, 5 Jun 2024 11:55:10 -0400
Subject: [PATCH] org-lint: Add function to remove checker(s)

* lisp/org-lint.el (org-lint-remove-checker): Remove one or more
checkers from org-lint--checkers.

TINYCHANGE
---
 lisp/org-lint.el | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index aed774ee2..ec28f5255 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -159,6 +159,16 @@ (defun org-lint-add-checker
   (seq-remove (lambda (c) (eq name (org-lint-checker-name c)))
   org-lint--checkers
 
+;;;###autoload
+(defun org-lint-remove-checker (name  names)
+  "Remove checker(s) from linter.
+NAME is the unique check identifier, as a non-nil symbol.  NAMES
+are additional check identifiers to be removed."
+  (let ((removelist (cons name names)))
+(setq org-lint--checkers
+  (seq-remove (lambda (c) (memq (org-lint-checker-name c) removelist))
+  org-lint--checkers
+
 
 ;;; Reports UI
 

base-commit: bb633b67400de67b37317b6ae0741034c196c8d9
-- 
2.45.1


> Thanks! It is indeed a good idea.
> I added this check on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=51aea4946

Thank you!

-- 
Suhail


Re: [ANN] Org mode 9.7 is out

2024-06-05 Thread Juergen Fenn



Am 05.06.24 um 08:01 Uhr schrieb Visuwesh:
>> M-x yank-media-types RET yields:
>>
>> Yank type:
>> clipboard:image/tiff
>> clipboard:STRING
>> clipboard:text/plain
> I'm afraid there's nothing much we can do.  IIUC, you copy the file from
> a file manager, so Org expects clipboard to be something like
>
> Possible completions are:
> clipboard:x-special/gnome-copied-files
> primary:...
>
> where clipboard:x-special/gnome-copied-files gives
>
> copy
> file:///home/viz/tmp/2-gnus_stipple.png
>
> but given there's neither image/jpeg nor a special type like the above,
> Org's yank-media copies the image/tiff data (the regexp used by Org
> looks for mime-types that match the regexp "image/.*").
> I am guessing clipboard:text/plain contains the link to the file, am I
> right?  But this feels fragile to rely on.
>
> What happens when you copy multiple images to the clipboard from the
> file manager?  Is there a difference in yank-media-types' output?  What
> if you copy a non-image file to the clipboard? Say a PDF file.

If I copy Command-c two different jpg files in Finder, Org seems not to
be able to process any file. There is only

clipboard:STRING
clipboard:text/plain

in the completions buffer, no image MIME type.

When I try M-x yank-media RET I get the message:

user-error: No handler in the current buffer for anything on the clipboard

But it is getting even more weird when I try a different MIME type, say
PDF, as you suggested. I've just tried the latest LaTeX News 39 which
happens to be on my desktop. It has not been published yet, but you can
easily compile it yourself from
.
Copy with Command-c from Finder, then M-x yank-media RET also yields:

clipboard:image/tiff
clipboard:STRING
clipboard:text/plain

While M-x yank-media RET yields:


* Test
:ATTACH:
:PROPERTIES:
:ID:   105A314B-BCA8-41CC-8ED8-FA97F70AAE85
:END:

[[attachment:clipboard-20240605T174306.tiff]]
-

and now I am indeed prompted for the =Yank type= from the three options
above. I can select with Cursor-up or Cursor-down.

- If I select image/tiff the PDF is added in plain text, it seems.
- Selecting STRING simply pastes the filename =ltnews39.pdf= to buffer.
- Selecting text/plain pastes the path to the file to buffer.

> I don't have access to a Mac but if you can find documentation on how
> Finder puts the relevant data in the clipboard, that would be useful.
> [ In Linux, you expect the x-special/gnome-copied-files or somesuch
>   TARGET.  ]

I'm afraid I cannot provide this information because I am not a
developer, so I don't know which documents to consult for this.

I just would like to add that such internals in macOS may change over
time. I'm on Ventura, which is not the latest version of macOS, that's
Sonoma. Its successor macOS 15 will probably be released in a few
months. Even the way self-compiled Emacs is run are said to vary from
one version to another. I cannot tell because I did not compile Emacs
before I switched to Ventura, but I trust such reports are true.

Regards,
Jürgen.



Re: [PATCH] Add support for shortdoc link type

2024-06-05 Thread Max Nikulin

On 13/05/2024 20:04, Bruno Cardoso wrote:

+++ b/etc/ORG-NEWS


Bruno, I am sorry, but Org-9.7 has been released and your patch can not 
be cleanly applied any more. Please, rebase it and check that the new 
feature is described in the proper section for changes that have not 
released yet.


A couple of notes that unlikely affect real life usage.


+  (defun org-link--store-shortdoc ( _interactive?)
+"Store \"shortdoc\" type link."
+(when (eq major-mode 'shortdoc-mode)


`derived-mode-p' is more reliable in general.


+  (let* ((buffer (buffer-name))
+ (group (when (string-match "*Shortdoc \\(.*\\)\\*" buffer)
+  (match-string 1 buffer
+(if (and group (assoc (intern-soft group) shortdoc--groups))
+(org-link-store-props :type "shortdoc"
+  :link (format "shortdoc:%s" group)
+  :description nil)
+  (user-error "Unknown shortdoc group: %s" group)


I believed that store link functions should fail silently if no suitable 
link may be offered.




Re: Incremental search in hidden text does not work in Org 9.7 Emacs 28

2024-06-05 Thread Max Nikulin

On 05/06/2024 22:06, Ihor Radchenko wrote:

`org-fold-core-style' text-properties is going to be obsoleted.
I tried to support isearch, but it is ultimately an uphill battle
against bugs popping out here and there.


I have seen these words in another thread, but I did not expect a 
regression in comparison to 9.6.


At least search in folded headers and drawers works, but without search 
in link targets 9.7 is hardly usable for daily usage for me. I have not 
tested yet to which degree overlays are painful for my notes file.





Re: [PATCH] Add support for shortdoc link type

2024-06-05 Thread Ihor Radchenko
Bruno Cardoso  writes:
>>> Please, proceed with the copyright agreement form.
>>
>> Thank you very much, Max. Just sent the form.
>
> Hi all. My copyright assignment with the FSF is complete.

Bastien, may you please confirm?

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



Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-05 Thread Ihor Radchenko
Suhail Singh  writes:

>> You can always ignore this warning.
>
> I presently update (via setq) org-lint--checker after filtering out this
> checker.  Is there a better way (i.e., one that doesn't rely on an
> internal variable) for non-interactive use?  Perhaps an
> #'org-lint-remove-checker could be added to org-lint.el.  For context, I
> have code that non-interactively invokes org-lint and reports the
> warnings.  As such, ignoring by pressing "i" in the *Org Lint* buffer
> isn't an option.

There is currently no such way. Although, it would be nice to have such
a feature. Patches welcome!

>> (If you have better ideas about how to approach the problem of
>> misspelled language names, feel free to share them)
>
> I don't have a recommendation specific to the languages that only
> support code execution, however, for languages in general wouldn't it be
> better to consult something like the output of #'org-src-get-lang-mode
> and see if that mode is either defined or can be loaded (depending on
> whether or not we require the user to ensure whether the feature
> representing the mode is already loaded or simply that it be possible to
> be loaded)?

Thanks! It is indeed a good idea.
I added this check on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=51aea4946

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



Re: Incremental search in hidden text does not work in Org 9.7 Emacs 28

2024-06-05 Thread Ihor Radchenko
Max Nikulin  writes:

> Consider a file with a link
>  8< 
> Text
>
> [[file:text.org][Something]]
>  >8 
>
> Incremental search
> C-s file
> does not work with current main HEAD (v9.7) and Emacs-28.
>
> `org-fold-core-style' text-properties
>
> There is no issue for Org 9.6.28. Link part is temporary revealed when 
> search is active.

`org-fold-core-style' text-properties is going to be obsoleted.
I tried to support isearch, but it is ultimately an uphill battle
against bugs popping out here and there.

So, alas, no dedicated Org mode support for searching inside invisible text
properties. This got to be implemented on Emacs side to work properly,
without ugly workarounds.

Wontfix.
Canceled.

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



Re: Slowdowns and hangs when loading org from elpa

2024-06-05 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> Background: the origin for bug #71356 was that I was trying to get org
> installed from elpa, which apparently didn't work and Emacs (master) took
> the bundled mode instead.
>
> Observation: loading org from elpa with M-x p-l-p leads to errors and
> emacs(master) freezing for a long time. When looking at the *Warnings*
> buffer, I see:
>
> Warning (comp): org-clock.el:2635:23: Warning: the function
> ‘org-add-archive-files’ is not known to be defined.
> ⛔ Warning (comp): org-clock.el:962:40: Warning: the function
> ‘org-element-at-point’ is not known to be defined.

I am on Emacs master 2b7056 (CommitDate: Sat Jun 1 15:41:54 2024 +0800)

I am unable to reproduce doing the following:

1. Clear elpa dir
2. emacs -Q
3. M-x package-list-packages
4. Click on "org"
5. Install the version from Elpa
6. Open an Org file
7. Observe native compilation finishing without warnings

Your commit is slightly newer - 2024-06-02 22:33:54 -0700

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



Re: Org mode version 9.7.2 (release_N/A-N/A-88dd2c)

2024-06-05 Thread Ihor Radchenko
Sharon Kimble  writes:

> I've just updated my elpa setup and got the new version of org-mode, which 
> when I check the version shows up as -
>
> 
> Org mode version 9.7.2 (release_N/A-N/A-88dd2c @ 
> /home/boudiccas/.emacs.d/elpa/org-9.7.2/)
> 
>
> And that doesn't look right!  

Yeah. Org mode tags used to construct the version header are indeed not
available on the ELPA build.
Should be fixed for in the next Org release.

Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=04d56f757

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



Re: What might ‘org-element-at-point’ be doing in *scratch*?

2024-06-05 Thread Ihor Radchenko
Bob Newell  writes:

> ...  It does however leave open the
> question about whether there are or are not legitimate cases
> for org-element-at-point in buffers which are not org buffers
> but present summary or custom views of org material like the
> agenda.

Yes, calling `org-element-at-point' in non-Org buffers is most likely a
mistake - `org-element-at-point' either returns nil, a garbage, or errs
in non-Org buffers.

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



Re: What might ‘org-element-at-point’ be doing in *scratch*?

2024-06-05 Thread Bob Newell


Christian Moe  writes:

> Hi,
>
> After upgrading to 9.7.1 on Emacs 27.1, I get a curious warning on Emacs
> start-up:
>
> "Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org
> buffer # (fundamental-mode)"
>
> It does not happen with 'emacs -Q', but it also did not happen before
> the upgrade, so I don't know what in my configuration now triggers it,
> or why anything would want to do this.
>
> Anyone else seeing this?

I also started to see this.  I too traced it to some of my own
coding where I was doing some fancy reformatting of the "*Org
Agenda*" buffer with a definition of org-agenda-prefix-format
that called my user function with an argument including
(org-get-outline-path).  This now gives the above warning
because *Org Agenda* is not an org buffer per se.

I worked around it by removing the custom code which was
pretty awkward in any case.  It does however leave open the
question about whether there are or are not legitimate cases
for org-element-at-point in buffers which are not org buffers
but present summary or custom views of org material like the
agenda.

-- 
Bob Newell
Honolulu, Hawai`i

- Via GNU-Linux/Emacs/Gnus/BBDB



Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-05 Thread Giuseppe Pagnoni
Hi,

I am trying to have an R code block output both the results of a numerical
expression AND a plot, but if I set up the header arguments to display the
plot, the numerical outcome is not displayed.  A simple example:

#+begin_src R :file example.png :results output graphics file
  x <- rnorm(100)
  print(mean(x))
  hist(x)
#+end_src

Here I get the histogram plot back in the buffer, but NOT the result of
"print(mean(x))".   Is it not possible to get both?

Furthermore, what if I wanted to display *two* or more plots that get built
by the code, for instance:

#+begin_src R :file example.png :results output graphics file
  x <- rnorm(100)
  print(mean(x))
  hist(x)
  hist(x^2)
#+end_src

Here, only the last plot gets displayed.  Is it not possible to display
more than 1 plot?

many thanks in advance for any help

giuseppe
-- 
Giuseppe Pagnoni
Dip. Scienze Biomediche, Metaboliche e Neuroscienze
Sezione Fisiologia e Neuroscienze
Univ. di Modena e Reggio Emilia
Via Campi 287
I-41125 Modena, Italy
Tel: +39-059-205-5742
Fax: +39-059-205-5363


Re: [ANN] Org mode 9.7 is out

2024-06-05 Thread Ihor Radchenko
Visuwesh  writes:

> BTW, we might have similar problems in Windows too.  See this thread in
> emacs-devel when yank-media was initially added:
> https://yhetil.org/emacs-devel/837ddk9tc8@gnu.org

Looking at that thread, I see
https://yhetil.org/emacs-devel/yz18w18vybg7cb%...@idiocy.org/

+  /* Dictionary for looking up NS types from MIME types, and vice versa.  */
+  typeLookup
+= [NSDictionary
+   dictionaryWithObjectsAndKeys:
+ @"text/plain",NSPasteboardTypeURL,
+#if NS_USE_NSPasteboardTypeFileURL
+ @"text/plain",NSPasteboardTypeFileURL,
+#else
+ @"text/plain",NSFilenamesPboardType,
+#endif
+ @"text/html", NSPasteboardTypeHTML,
+ @"text/plain",NSPasteboardTypeMultipleTextSelection,
+ @"application/pdf",   NSPasteboardTypePDF,
+ @"image/png", NSPasteboardTypePNG,
+ @"application/rtf",   NSPasteboardTypeRTF,
+ @"application/rtfd",  NSPasteboardTypeRTFD,
+ @"STRING",NSPasteboardTypeString,
+ @"text/plain",NSPasteboardTypeTabularText,
+ @"image/tiff",NSPasteboardTypeTIFF,
+ nil];

For images, only image/png and image/tiff are listed for some reason. No
jpeg. (and no jpeg in the spec at
https://developer.apple.com/documentation/appkit/nspasteboardtype)

I suspect that image/tiff entry in the clipboard is garbled by Emacs.
We may want to report this as a bug.

We may also need to request a feature to support clipboard on MacOS
better. Using the same example image.

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



Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-05 Thread Suhail Singh
Ihor Radchenko  writes:

> Org mode has no idea which languages are intended to be executed, but
> happen to not have their ob-lang.el backend loaded; and which
> languages do not need execution. So, Org mode warns just in case.

If the primary function of this check is to ensure that the user isn't
missing an ob-lang.el requirement, then I propose that the check be
renamed to something specific to babel.  Perhaps
'suspcious-babel-language-in-src-block ?

> You can always ignore this warning.

I presently update (via setq) org-lint--checker after filtering out this
checker.  Is there a better way (i.e., one that doesn't rely on an
internal variable) for non-interactive use?  Perhaps an
#'org-lint-remove-checker could be added to org-lint.el.  For context, I
have code that non-interactively invokes org-lint and reports the
warnings.  As such, ignoring by pressing "i" in the *Org Lint* buffer
isn't an option.

> (If you have better ideas about how to approach the problem of
> misspelled language names, feel free to share them)

I don't have a recommendation specific to the languages that only
support code execution, however, for languages in general wouldn't it be
better to consult something like the output of #'org-src-get-lang-mode
and see if that mode is either defined or can be loaded (depending on
whether or not we require the user to ensure whether the feature
representing the mode is already loaded or simply that it be possible to
be loaded)?

-- 
Suhail



Re: Structure templates moving point

2024-06-05 Thread Ihor Radchenko
Psionic K  writes:

> As of 9.7.2
>
> Using `org-insert-structure-template' to add comment blocks to a
> document where I previously added comment blocks is moving the point
> to unrelated comments, and definitely not to the body of the block
> that was just inserted.

I am unable to reproduce. May you please provide more detailed instructions?

> The display buffer behavior is at least no longer creating frames I
> didn't want, but shouldn't it be a pop-up buffer?

May you please elaborate? It does not seem to be relevant to structure
templates.

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



Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-05 Thread Ihor Radchenko
"Suhail Singh"  writes:

> When there is, say, an "example" result block that is indented (i.e.,
> the entire block including the delimiters is indented) and it contains
> some asterisks in the middle, org-lint considers it to be a possible
> case of misplaced-heading.  Case in point:
>
> #+begin_src org
>   - Some words
> ,#+begin_example
>   this is a line with asterisks** in the middle
> ,#+end_example
> #+end_src
>
> The lint check should guard against occurrences that happen within code
> blocks.

Makes sense.
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b8497aa7f

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



Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-05 Thread Ihor Radchenko
"Suhail Singh"  writes:

> Any code block in a language that isn't intended to be executed results in a
> warning from 'suspicious-language-in-src-block checker.  For instance:
>
> #+begin_src conf
>   [Unit]
>   Description=Blah
> #+end_src
>
> In the above example, conf-mode exists and is used by Org to provide
> syntax highlighting and yet, org-lint reports a warning.

Org mode has no idea which languages are intended to be executed, but
happen to not have their ob-lang.el backend loaded; and
which languages do not need execution. So, Org mode warns just in case.

You can always ignore this warning.

Not a bug.
Canceled.

(If you have better ideas about how to approach the problem of
misspelled language names, feel free to share them)

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



Incremental search in hidden text does not work in Org 9.7 Emacs 28

2024-06-05 Thread Max Nikulin

Hi,

Consider a file with a link
 8< 
Text

[[file:text.org][Something]]
 >8 

Incremental search
   C-s file
does not work with current main HEAD (v9.7) and Emacs-28.

`org-fold-core-style' text-properties

There is no issue for Org 9.6.28. Link part is temporary revealed when 
search is active.





Re: [BUG] org-capture: %\N template expansion

2024-06-05 Thread Ihor Radchenko
Bruno Cardoso  writes:

>> We may also make %^{prompt}X expansions to work with %\N, but it can
>> break the existing templates that are tuned to the current behaviour.
>
> I see. Would it make sense to have another placeholder for '%^{prompt}X'?

See the attached tentative patch.

I introduced a new placeholder - %\*N. It refers to _all_ the prompts,
unlike %\N. If you have better ideas about syntax, please share.

>From 276f7755e0337631eb9a202a8275fcbe7f1cdfe8 Mon Sep 17 00:00:00 2001
Message-ID: <276f7755e0337631eb9a202a8275fcbe7f1cdfe8.1717586846.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Wed, 5 Jun 2024 13:24:43 +0200
Subject: [PATCH] org-capture-templates: New placeholder to refer to
 %^{prompt}X answers

* lisp/org-capture.el (org-capture-fill-template): Support new
placeholder %\*N to insert answers to all prompts - %^{prompt} and
%^{prompt}X.
(org-capture-templates):
* etc/ORG-NEWS (New =%\*N= placeholder in ~org-capture-templates~):
* doc/org-manual.org (Template expansion): Document the new
placeholder.

Link: https://orgmode.org/list/87le40puvb@gmail.com
---
 doc/org-manual.org  |  8 ++--
 etc/ORG-NEWS|  5 +
 lisp/org-capture.el | 50 -
 3 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 170eea506..fd842acca 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -8338,8 +8338,12 @@  Template expansion
 
 - =%\N= ::
 
-  Insert the text entered at the {{{var(N)}}}th =%^{PROMPT}=, where
-  {{{var(N)}}} is a number, starting from 1.
+  Insert the text entered at the {{{var(N)}}}th =%^{PROMPT}= (but not
+  =%^{PROMPT}X=), where {{{var(N)}}} is a number, starting from 1.
+
+- =%\*N= ::
+
+  Same as =%\N=, but include all the prompts.
 
 - =%?= ::
 
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 4b0b77ca8..52c6cb7b2 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -29,6 +29,11 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 # adding new customizations, or changing the interpretation of the
 # existing customizations.
 
+*** New =%\*N= placeholder in ~org-capture-templates~
+
+The new placeholder is like =%\N=, gives access not only to the
+=%^{prompt}= values, but also to =%^{prompt}X= values.
+
 *** The default value of ~org-babel-latex-process-alist~ is no longer taken from ~org-preview-latex-process-alist~
 
 The default value used to be pulled from =dvipng= process type from
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 34f9363e2..1dbe422d1 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -376,8 +376,10 @@ (defcustom org-capture-templates nil
   prompt/completions.  Default value and completions as in
   %^{prompt|default|...}X are allowed.
   %?  After completing the template, position cursor here.
-  %\\1 ... %\\N Insert the text entered at the nth %^{prompt}, where N
-  is a number, starting from 1.
+  %\\1 ... %\\N Insert the text entered at the nth %^{prompt} (but not
+  %^{prompt}X), where N is a number, starting from 1.
+  %\\*1...%\\*N Same as \\N, but for all the prompts, including
+  %^{prompt} and %^{prompt}X.
 
 Apart from these general escapes, you can access information specific to
 the link type that is created.  For example, calling `org-capture' in emails
@@ -1783,7 +1785,9 @@ (defun org-capture-fill-template ( template initial annotation)
   ;; completion in interactive prompts.
   (let ((org-inhibit-startup t)) (org-mode))
   (org-clone-local-variables buffer "\\`org-")
-  (let (strings)			; Stores interactive answers.
+  (let (strings			; Stores interactive answers.
+strings-all ; ... include %^{prompt}X answers
+)
 	(save-excursion
 	  (let ((regexp "%\\^\\(?:{\\([^}]*\\)}\\)?\\([CgGLptTuU]\\)?"))
 	(while (re-search-forward regexp nil t)
@@ -1818,6 +1822,7 @@ (defun org-capture-fill-template ( template initial annotation)
  'org-tags-history))
   ":")))
 		   (when (org-string-nw-p ins)
+ (push (concat ":" ins ":") strings-all)
 			 (unless (eq (char-before) ?:) (insert ":"))
 			 (insert ins)
 			 (unless (eq (char-after) ?:) (insert ":"))
@@ -1827,13 +1832,18 @@ (defun org-capture-fill-template ( template initial annotation)
 	 (lambda (s) (org-insert-link 0 s)
 		   (pcase org-capture--clipboards
 			 (`nil nil)
-			 (`(,value) (funcall insert-fun value))
+			 (`(,value)
+  (funcall insert-fun value)
+  (push value strings-all))
 			 (`(,first-value . ,_)
 			  (funcall insert-fun
-   (read-string "Clipboard/kill value: "
-		first-value
-		'org-capture--clipboards
-		first-value)))
+   (let ((val
+  (read-string "Clipboard/kill value: "
+		   first-value
+		   'org-capture--clipboards
+	

Re: [PATCH 1/2] org-capture: Allow entry template to start without heading

2024-06-05 Thread Rens Oliemans
Ihor Radchenko  writes:

> Applied, onto main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0c8fba93f
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a62f75c84
>
> I added you to the contributor list:
> https://git.sr.ht/~bzg/worg/commit/05c4acae

Great, thanks!



Slowdowns and hangs when loading org from elpa

2024-06-05 Thread Pedro Andres Aranda Gutierrez
Hi,

Background: the origin for bug #71356 was that I was trying to get org
installed from elpa, which apparently didn't work and Emacs (master) took
the bundled mode instead.

Observation: loading org from elpa with M-x p-l-p leads to errors and
emacs(master) freezing for a long time. When looking at the *Warnings*
buffer, I see:

Warning (comp): org-clock.el:2635:23: Warning: the function
‘org-add-archive-files’ is not known to be defined.
⛔ Warning (comp): org-clock.el:962:40: Warning: the function
‘org-element-at-point’ is not known to be defined.
⛔ Warning (comp): org-clock.el:753:30: Warning: the function
‘org-duration-from-minutes’ is not known to be defined.
⛔ Warning (comp): org-clock.el:751:36: Warning: the function
‘org-duration-to-minutes’ is not known to be defined.
⛔ Warning (comp): org-attach.el:759:20: Warning: the function
‘org-element-context’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:10271:6: Warning: the function
‘org-clock-cancel’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:10258:11: Warning: the function
‘org-clock-out’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:10229:8: Warning: the function
‘org-clock-in’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:6242:23: Warning: the function
‘org-duration-from-minutes’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:5684:61: Warning: the function
‘org-duration-to-minutes’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:4564:30: Warning: the function
‘org-clock-get-clocktable’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:2541:51: Warning: the function
‘org-mobile-push’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:2540:51: Warning: the function
‘org-mobile-pull’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:2538:47: Warning: the function
‘org-timer-stop’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:2537:39: Warning: the function
‘org-timer-set-timer’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:2512:50: Warning: the function
‘org-clock-goto’ is not known to be defined.
⛔ Warning (comp): org-agenda.el:2494:46: Warning: the function ‘org-attach’
is not known to be defined.
⛔ Warning (comp): org-id.el:736:16: Warning: the function
‘org-element-cache-reset’ is not known to be defined.
⛔ Warning (comp): org-id.el:577:33: Warning: the function
‘org-element-at-point’ is not known to be defined.

I do have native compilation enabled on my Emacs on Linux

I don't know if there are other people experiencing issues like this... but
I think we need to investigate this

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

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


Re: [PATCH] function and symbol for headline and olp for org-capture-templates

2024-06-05 Thread Ihor Radchenko
Nafiz Islam  writes:

> Craig Topham has cleared me to contribute to Emacs.

Bastien, may you please check the FSF records?

>  > All you need to create a new symbol in local context is (let ((my-symbol
>  > value)) ...).
>
> I don't think that will work because of lexical binding. For example:
> ..

Right. You need dynamic let:

(dlet ((test-org-capture/entry/headline "B"))
 ...)

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



Org mode version 9.7.2 (release_N/A-N/A-88dd2c)

2024-06-05 Thread Sharon Kimble
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

  
I've just updated my elpa setup and got the new version of org-mode, which when 
I check the version shows up as -


Org mode version 9.7.2 (release_N/A-N/A-88dd2c @ 
/home/boudiccas/.emacs.d/elpa/org-9.7.2/)


And that doesn't look right!  

Thanks
  Sharon.  
- -- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 12.5, TDE R14.1.1, emacs 30.0.50, org 9.7.2 
-BEGIN PGP SIGNATURE-

iQJRBAEBCgA7FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAmZgGSIdHGJvdWRpY2Nh
c0Bza2ltYmxlMDkucGx1cy5jb20ACgkQNoGAGQr4g1sW9hAAkozsJQ5N0MV5fAWn
qPmQGPqRzUIqRID6R2mQCFfW2WPVxL8jTpeLyNMVBc6+i8C4MhKiZ6/jrmke/DGg
94A/6LrU+bo0zo/nHs1EWRIpE5htaTSh50Yn+Dhy8zELHhxX+CMltn5rB+k8UPet
Lc/J/rCa8SwokIU1Fl+gTWfHDfFCQKVAGtjGMmP5mJO5lGWm/79NdMGTIJ8DvRRX
0fcZ8KHenpL5fXyBnAwWEaF/+lAxtblVmNUPPsVPa9TPN3e5Kxrlhltyz02WsV4/
gwRpmM8rVSBebo4x5k6ItnPYYjXBB4lUElVsvgFxkFLqClt/3w6ahVf6WScFdDKQ
AbMf/CsT3vvgfXTgTeJWA3PsBJX3qHIU0D8RRS0h0rbZVVoOAgYINMvXY5n0iEom
YDFQxa+2aeiMVdVFWGCwsOXf3ltsfUQEyAHb58HJc1JVws8PVrrSuzqCZZVhTtHi
SwKhaaCS8nNGQMy9QrZq4bPEWApifwKMmnl6w+yn4ekR9Rhu+zriiZQQLaJJwaFD
l1kpa/lX0Y9LqrLGL/bzEb7ScLr9AEUtlbXUQ6Pcy0/enq9RStT2WRBz+OI6LAko
oJ5cyCft/EJUZLvwinqDZQFg8yxAmuNjaQP8sx3HQol3EaUa4hcxTPeQDJ5Wb0+6
ruLNfLt54FuXBOhUVBSS3wKazko=
=219J
-END PGP SIGNATURE-



Re: [ANN] Org mode 9.7 is out

2024-06-05 Thread Visuwesh
[புதன் ஜூன் 05, 2024] Juergen Fenn wrote:

> Am 03.06.24 um 07:06 Uhr schrieb Visuwesh:
>> [ஞாயிறு ஜூன் 02, 2024] Juergen Fenn wrote:
>>> [...]
>>> I'm afraid I forgot to mention that I don't get prompted, and I did not
>>> copy the image from my webbrowser. Rather, I downloaded the jpg file
>>> over Europeana's proxy from Finnish National Library and then copied
>>> this one with Command-c in Finder (the macOS file manager) from local
>>> system SSD. I do not understand how the tiff comes in here. But is is
>>> there in the data folder Org created. I tried to open it in Preview, I
>>> even changed the file ending to .jpg, but I cannot open it. The tiff
>>> file seems to be corrupt.
>>>
>>
>> Please tell what is shown in the *Completions* buffer when you do M-x
>> yank-media-types RET after you copy the image to the clipboard.  I
>> suspect the problem is with the regexp used to detect the mime-type.
>>
>
> Sorry for my late reply. I have updated to Org 9.7.2 in the meanwhile.
>
> M-x yank-media-types RET yields:
>
> Yank type:
> clipboard:image/tiff
> clipboard:STRING
> clipboard:text/plain

I'm afraid there's nothing much we can do.  IIUC, you copy the file from
a file manager, so Org expects clipboard to be something like

Possible completions are:
clipboard:x-special/gnome-copied-files
primary:...

where clipboard:x-special/gnome-copied-files gives

copy
file:///home/viz/tmp/2-gnus_stipple.png

but given there's neither image/jpeg nor a special type like the above,
Org's yank-media copies the image/tiff data (the regexp used by Org
looks for mime-types that match the regexp "image/.*").
I am guessing clipboard:text/plain contains the link to the file, am I
right?  But this feels fragile to rely on.

What happens when you copy multiple images to the clipboard from the
file manager?  Is there a difference in yank-media-types' output?  What
if you copy a non-image file to the clipboard? Say a PDF file.

I don't have access to a Mac but if you can find documentation on how
Finder puts the relevant data in the clipboard, that would be useful.
[ In Linux, you expect the x-special/gnome-copied-files or somesuch
  TARGET.  ]

BTW, we might have similar problems in Windows too.  See this thread in
emacs-devel when yank-media was initially added:
https://yhetil.org/emacs-devel/837ddk9tc8@gnu.org

> M-x yank-media RET still inserts an attachment with a tiff file that I
> cannot open in Preview.

Given the above, I hope you understand why this happens.

HTH.