PATCH: don't emit empty attributes for lstlistings in LaTeX listings backend

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

attached is a small patch for the Latex export backend that suppresses
emitting empty labels and captions when exporting src blocks using
'listings. This cleans up the emitted LaTeX.

BR,/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
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 5b29a284c..1291aff95 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3594,11 +3594,11 @@ and FLOAT are extracted from SRC-BLOCK and INFO in `org-latex-src-block'."
   ((and float (not (assoc "float" lst-opt)))
`(("float" ,(plist-get info :latex-default-figure-position)
  `(("language" ,lst-lang))
- (if label
- `(("label" ,(org-latex--label src-block info)))
-   '(("label" " ")))
- (if caption-str `(("caption" ,caption-str)) '(("caption" " ")))
- `(("captionpos" ,(if caption-above-p "t" "b")))
+ (when label; label= w/o label makes little sense
+ `(("label" ,(org-latex--label src-block info
+ (when caption-str  ; caption= w/o caption makes little sense
+   `(("caption" ,caption-str))
+   `(("captionpos" ,(if caption-above-p "t" "b" ; as does captionpos w/o caption
  (cond ((assoc "numbers" lst-opt) nil)
((not num-start) '(("numbers" "none")))
(t `(("firstnumber" ,(number-to-string (1+ num-start)))


Re: [BUG] org-mouse is activated without explicit require

2022-12-10 Thread Samuel Wales
hi matt,

superb bug report.  happy human rights day.

isn't there a policy someplace in the elisp manual that states that
loading a package should have no major[tm] side effects?

the emacs behavior of loading upon completion is new to me and a
surprise.  the org list of links behavior is new to me.

n.b. i personally find org-mouse to a be excellent for accessibility
reasons.  i am always either in mouse mode or keyboard mode and it
adds a lot of functionality.  could even use a bit more, such as
selecting todo kw.

sorry cannot address your bug further.  it does seem there are things
needing fixing.



On 12/10/22, Matt Lundin  wrote:
> I'm not too familiar with how emacs handles autoloads. However, I find
> org-mouse is automatically loaded if I call describe-function and then
> tab complete after typing "", "org-", "org-m", etc. This seems enough to
> load the entirely of the org-mouse.el file.
>
> The problem is that this adds a lambda function to org-mode-hook that
> activates all org-mouse functionality at the next call of org-mode or
> org-mode-restart. This has two unexpected effects:
>
> 1. It changes the behavior of mouse clicks without the user's explicit
>request.
> 2. It advise org-open-at-point, with the result that it is no longer
>possible to get a list of all links in an entry when calling
>org-open-at-point on a headline. (See separate bug report on this.)
>
> I am able to reproduce this with a minimal .emacs config and the most
> recent git version (after running "make clean && make").
>
> Steps to reproduce:
>
> 1. /usr/bin/emacs -Q -l ~/minimal.el
>
> where ~/minimal.el is...
>
> --8<---cut here---start->8---
> (add-to-list 'load-path "~/org-mode/lisp/")
> --8<---cut here---end--->8---
>
> 2. C-h f org-m [tab]
>
> Note that "org-mouse-" functions appear in the completion list. Even if
> one aborts describe-function at this point, org-mouse has been loaded
> and org-mode-hook now contains a lambda function to activate the
> functionality of org-mouse (org-defkey, advice-add, etc.).
>
> 3. Open an org buffer for the first time or call "M-x org-mode-restart"
>in an already opened buffer
>
> "C-h v org-open-at-point" now reports the following advice:
>
> --8<---cut here---start->8---
> This function has :around advice: ‘org--mouse-open-at-point’.
> --8<---cut here---end--->8---
>
> Also notice that org-mouse features are now active in org buffers.
>
> Thanks,
>
> Matt
>
>


-- 
The Kafka Pandemic

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



Re: [BUG] org-mouse is activated without explicit require

2022-12-10 Thread Greg Minshall
Matt,

> I'm not too familiar with how emacs handles autoloads. However, I find
> org-mouse is automatically loaded if I call describe-function and then
> tab complete after typing "", "org-", "org-m", etc. This seems enough
> to load the entirely of the org-mouse.el file.

i'm also not an expert on autoload, but i noticed this in the e-lisp
info pages:

Autoload by Prefix

During completion for the commands ‘describe-variable’ and
‘describe-function’, Emacs will try to load files which may contain
definitions matching the prefix being completed.


and, i wonder if that at least explains part of your question.

cheers, Greg



Re: [MAINTENANCE] Do we have any backwards-compatibility policy for third-party packages?

2022-12-10 Thread Tim Cross


Ihor Radchenko  writes:

> Tim Cross  writes:
>
>> I guess we are limited by what the packages we rely on support. For
>> example, if geiser doesn't support Emacs 26 but org is supposed to,
>> there isn't much we can do. We cannot afford to fork geiser and modify
>> it to add the support and even if we provided a patch to add the support
>> to the geiser project, they may not merge it.
>>
>> Best we can do is best effort and reflect this limitation in the manual
>> where we stipulate what our backwards compatibility policy is. 
>
> Ok. Here are the tentative patches for Org manual and WORG maintenance
> page.
>

No objections from me. Just based on reading the patches, they appear to
clarify our support policy and therefore should be helpful. 




[BUG] org-mouse.el breaks org-open-at-point

2022-12-10 Thread Matt Lundin
The org-mouse feature advises org-open-at-point in a way that overrides
the desired behavior of calling "M-x org-open-at-point" on a headline.

See the advice function org--mouse-open-at-point. It seems the intended
behavior of this advice is to allow the user to click on headline stars
and cycle the visibility of an entry. However, there is no test to see
if the user is indeed clicking with a mouse.

As a result, this advice also overrides org-open-at-point even when one
is typing.

- Expected behavior 

  - calling org-open-at-point with the keyboard "C-c C-o" should produce
a list of links in the entry as advertised in the docstring ("When
point is on a headline, display a list of every link in the entry,
so it is possible to pick one, or all, of them.")

- What currently happens if org-mouse has been loaded:

  - calling "C-c C-o" with the keyboard cycles the visibility of the
entry

Thanks,

Matt



[BUG] org-mouse is activated without explicit require

2022-12-10 Thread Matt Lundin
I'm not too familiar with how emacs handles autoloads. However, I find
org-mouse is automatically loaded if I call describe-function and then
tab complete after typing "", "org-", "org-m", etc. This seems enough to
load the entirely of the org-mouse.el file.

The problem is that this adds a lambda function to org-mode-hook that
activates all org-mouse functionality at the next call of org-mode or
org-mode-restart. This has two unexpected effects:

1. It changes the behavior of mouse clicks without the user's explicit
   request.
2. It advise org-open-at-point, with the result that it is no longer
   possible to get a list of all links in an entry when calling
   org-open-at-point on a headline. (See separate bug report on this.)

I am able to reproduce this with a minimal .emacs config and the most
recent git version (after running "make clean && make").

Steps to reproduce:

1. /usr/bin/emacs -Q -l ~/minimal.el

where ~/minimal.el is...

--8<---cut here---start->8---
(add-to-list 'load-path "~/org-mode/lisp/")
--8<---cut here---end--->8---

2. C-h f org-m [tab]

Note that "org-mouse-" functions appear in the completion list. Even if
one aborts describe-function at this point, org-mouse has been loaded
and org-mode-hook now contains a lambda function to activate the
functionality of org-mouse (org-defkey, advice-add, etc.).

3. Open an org buffer for the first time or call "M-x org-mode-restart"
   in an already opened buffer

"C-h v org-open-at-point" now reports the following advice:

--8<---cut here---start->8---
This function has :around advice: ‘org--mouse-open-at-point’.
--8<---cut here---end--->8---

Also notice that org-mouse features are now active in org buffers.

Thanks,

Matt



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

2022-12-10 Thread Max Nikulin

On 11/12/2022 03:28, Tom Gillespie wrote:

 Here is a patch that improves the ergonomics and thus hopefully
the security for the recent changes to check evaluation for cells.


Tom, thank you for the patch. Frankly speaking, I was expecting this 
kind of complains, but I could not suggest any solution. I am not 
familiar with org-babel code, so my comments may be false alarms.



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


I am not sure concerning "exactly".

lisp/ob-core.el:248
`org-confirm-babel-evaluate' is called with 2 arguments. In your patch 
`org-confirm-babel-evaluate-cell' has a single argument.



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


It seems, you do not change defaults. Could you, please, provide an 
example of configuration that is less annoying, but still safe?



This is necessary because there is no easy way to hop swap
org-confirm-babel-evaluate between org-get-src-block-info where
org-babel-read is called and the execution of that src block. It could
probably be done using advice around org-babel-read, but that is a
level of hackery that should be avoided.


I was thinking if it is possible to collect requests to confirm and to 
allow the user to decide for the whole bunch of expressions and code 
blocks. Besides implementation issues, there is a question concerning UI 
that will allow to inspect code to be evaluated.



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

...> +(defcustom org-confirm-babel-evaluate-cell t

+  "Confirm before evaluating a cell."
Calling convention for the case of function value is not described. If 
it is really the same as for `org-confirm-babel-evaluate' then this user 
option should be mentioned in the docstring.



+  :group 'org-babel
+  :version "29.1"


:package-version instead of :version?


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


Is there any reason to not use the :safe property of `defcustom'? I see 
that you take definition of `org-confirm-babel-evaluate' as a template 
so I wonder if there is some particular reason or the original code was 
just written before introducing of :safe.





Re: Can org-attach attach a single file to multiple headlines?

2022-12-10 Thread Max Nikulin



On 11/12/2022 05:12, aroz...@gmail.com wrote:
Using org-attach, is it possible to attach a single file to multiple 
headlines, so that each headline shares the same attachment folder 
(rather than having each headline have its own attachment folder with 
its own version of the file)?


Headings may have the same :DIR: property that specifies location of 
attachments.


info "(org) Attachments"
https://orgmode.org/manual/Attachments.html


Another method is attachments, which are files located in a directory
belonging to an outline node. Org uses directories either named by a
unique ID of each entry, or by a ‘DIR’ property.


* Chapter A
  :PROPERTIES:
  :DIR: chap-a
  :END:



Re: Flyspell causes severe slowdown when manipulating footnotes

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

> I just pushed a slight optimization to the footnote sorting code.

Unrelated to the footnotes mentioned above, but I noticed that Org
starts and kills Ispell all the time.  I see the following messages
repeated over and over when working with Org:

  Starting new Ispell process aspell with american dictionary...done
  ...
  Ispell process killed

For the sake of experiment, I have just tried to export (to HTML) a
subtree that contains nothing in it but a single BibTeX source block.
Sure enough, Org started and killed a new Ispell process!

P.S. I use Flyspell with the following (standard) configuration:

  (add-hook 'after-init-hook
(lambda ()
  (add-hook 'text-mode-hook #'flyspell-mode)
  (add-hook 'prog-mode-hook #'flyspell-prog-mode)))

Rudy
-- 
"Strange as it may sound, the power of mathematics rests on its evasion
of all unnecessary thought and on its wonderful saving of mental
operations."
-- Ernst Mach, 1838-1916

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



Can org-attach attach a single file to multiple headlines?

2022-12-10 Thread arozbiz
Using org-attach, is it possible to attach a single file to multiple
headlines, so that each headline shares the same attachment folder (rather
than having each headline have its own attachment folder with its own
version of the file)?

Thanks,
Alan


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

2022-12-10 Thread Tom Gillespie
Here is an updated patch. Best!
Tom

On Thu, Dec 8, 2022 at 3:42 AM Ihor Radchenko  wrote:
>
> Tom Gillespie  writes:
>
> > Hi,
> >Here is a patch for org-contrib/lisp/org-expiry.el to account for
> > recent changes to org-time-stamp-formats. Best,
> > Tom
> >
> > PS is this list still the best place to send org-contrib patches?
>
> Yes, this list is suitable as long as org-expiry is orphaned.
>
> For the patch, note that it is not a good idea to bump the minimal
> required Org version of Org 9.6. I'd rather suggest keeping backwards
> compatibility by stripping "<" and ">" from org-time-stamp-formats, if
> any. That will not affect existing users of older Emacs versions and
> built-in Org.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
From 248104955707a7195a594712d1c7ad9d64dee1c1 Mon Sep 17 00:00:00 2001
From: Tom Gillespie 
Date: Sun, 4 Dec 2022 01:02:35 -0800
Subject: [PATCH] lisp/org-expiry.el: Account for org-time-stamp-formats
 refactor

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

diff --git a/lisp/org-expiry.el b/lisp/org-expiry.el
index 98ad58a..0909aaf 100644
--- a/lisp/org-expiry.el
+++ b/lisp/org-expiry.el
@@ -299,10 +299,13 @@ update the date."
   (setq d-hour (format-time-string "%H:%M" d-time))
   (setq timestr
 	;; two C-u prefixes will call org-read-date
-	(if (equal arg '(16))
-		(concat "<" (org-read-date
-			 nil nil nil nil d-time d-hour) ">")
-	  (format-time-string (cdr org-time-stamp-formats
+(concat "<"
+(if (equal arg '(16))
+(org-read-date nil nil nil nil d-time d-hour)
+  (format-time-string
+   (string-replace "<" ""
+   (string-replace ">" "" (cdr org-time-stamp-formats)
+">"))
   ;; maybe transform to inactive timestamp
   (if org-expiry-inactive-timestamps
 	  (setq timestr (concat "[" (substring timestr 1 -1) "]")))
@@ -320,10 +323,13 @@ and insert today's date."
 (setq d-time (if d (org-time-string-to-time d)
 		   (current-time)))
 (setq d-hour (format-time-string "%H:%M" d-time))
-(setq timestr (if today
-		  (format-time-string (cdr org-time-stamp-formats))
-		(concat "<" (org-read-date
- nil nil nil nil d-time d-hour) ">")))
+(setq timestr (concat "<"
+  (if today
+  (format-time-string
+   (string-replace "<" ""
+   (string-replace ">" "" (cdr org-time-stamp-formats
+(org-read-date nil nil nil nil d-time d-hour))
+  ">"))
 ;; maybe transform to inactive timestamp
 (if org-expiry-inactive-timestamps
 	(setq timestr (concat "[" (substring timestr 1 -1) "]")))
-- 
2.37.4



Re: Multiple versions of Org in load-path problem

2022-12-10 Thread Tom Gillespie
> I don't think there is any safe way to install an updated version of
> org-mode other than

I don't know whether it counts as safe, but since I don't see it
mentioned anywhere else in the thread you can do the following.

(require 'package)
(unless package--initialized
  (package-initialize))
(assq-delete-all 'org package--builtins)
(assq-delete-all 'org package--builtin-versions)
(package-install 'org)



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

2022-12-10 Thread Tom Gillespie
Hi,
Here is a patch that improves the ergonomics and thus hopefully
the security for the recent changes to check evaluation for cells. Full
details in the commit message on the patch. Best!
Tom
From da3a88e2919ec5bac6328d55eb99b3352f25b9b4 Mon Sep 17 00:00:00 2001
From: Tom Gillespie 
Date: Sat, 10 Dec 2022 12:11:17 -0800
Subject: [PATCH] ob-core: add org-confirm-babel-evaluate-cell custom variable

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

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

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

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

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



Re: [BUG] Setting export scope to subtree not working as expected [9.6 (9.6-gb3da42 @ /Users/apc/.emacs.d/straight/build/org/)]

2022-12-10 Thread Alejandro Perez Carballo
Thanks for the quick fix!!

On Saturday, December 10, 2022, Kaushal Modi  wrote:

> Hi Alejandro,
>
> Thanks for reporting this issue. I was seeing the same issue and I wasn't
> sure if this issue was in org-mode or the ox-hugo package. It was on my
> to-debug list.
>
> Ihor: Thank you for the quick response and fix!
>
> On Sat, Dec 10, 2022, 4:47 AM Ihor Radchenko  wrote:
>
>> Alejandro Pérez Carballo  writes:
>>
>> > If point is on a heading followed by a subheading without any text in
>> between, the export process is using the tree starting with the subheading
>> instead of the tree starting from point position. If instead you have some
>> text after the first heading and before the subheading, the tree that is
>> exported is the tree starting from point position, as expected. I’m
>> assuming this is a bug, but maybe I’m missing something.
>> >
>> > For example, take a buffer containing just this:
>> >
>> >* The title
>> >** A subtitle
>> >Some text
>> >
>> > If I export this to an HTML buffer, with point at the beginning of the
>> first line and  after setting the scope to ‘subtree’, I get an HTML buffer
>> whose title is “A subtitle”.
>> >
>> > If I follow the same steps on a buffer containing just this:
>> >
>> >* The title
>> >Some text
>> >** A subtitle
>> >
>> > I get an HTML buffer whose title is “The title”.
>>
>> Thanks for reporting!
>> Fixed on bugfix.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0616b3c37
>>
>> --
>> Ihor Radchenko // yantar92,
>> Org mode contributor,
>> Learn more about Org mode at .
>> Support Org development at ,
>> or support my work at 
>>
>>


Re: bash code block runs slow on org 9.6

2022-12-10 Thread Majzoub, Eric
Yes, the fix works! It reduces the run time from about 2s down to 0.1s.
Thank you.

On Sat, 2022-12-10 at 05:53 +, Ihor Radchenko wrote:
> WARNING: This message has originated from an External Source. This
> may be a phishing expedition that can result in unauthorized access
> to our IT System. Please use proper judgment and caution when opening
> attachments, clicking links, or responding to this email.
> 
> "Majzoub, Eric"  writes:
> 
> > I've got a code block that looks like the following.
> > 
> > #+name: read_csv
> > #+begin_src bash :results replace :exports none
> >   cat ./file.csv | gawk -f ./awkfile.awk | tee .tmp1.dat;
> > #+end_src
> > 
> > This runs essentially instantaneously in org 9.5.5, but it takes
> > much
> > longer, about 2 seconds or more on org 9.6, using the first release
> > version. Pre-release versions of 9.6 were even slower, so it seems
> > it's
> > improved. But still, it's a lot slower than 9.5.5. What can I do to
> > diagnose the slowdown?
> 
> I partially solved the slowdown in
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=76a725317
> 
> There is still some slowdown originated from table alignment.  We now
> use a more accurate approach to calculate string width, which gives
> performance penalty. If needed, table alignment might also be
> optimized,
> but it will not be trivial.
> 
> For diagnosing slowdowns, you may refer to
> https://list.orgmode.org/orgmode/87ee2nlslt.fsf@localhost/
> 
> Let me know if the latest bugfix branch gives you acceptable
> performance.
> 
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 


Re: To convert and simplify units in tables (was:LIterate programming with calc (help))

2022-12-10 Thread ypuntot
Hi Ihor.
I'm null at elisp. Could you please refer to me a simple example of math 
operation and unit simplification in elisp?
Thanks :$

10 dic 2022 14:51:39 Ihor Radchenko :

> Ypo  writes:
> 
>> (defmath uconvert (v u)
>>   "Convert value V to compatible unit U."
>>   (math-convert-units v u))
>> 
>> 
>> But no luck, "cs" result is an ERROR. Is it feasible to get a value for
>> "cs" with no units?
> 
> Note that apart from Calc formula notation, you can use Elisp. That will
> avoid all the gotchas Calc has.
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 



Re: bug#59882: Multiple versions of Org in load-path problem

2022-12-10 Thread Ihor Radchenko
Eli Zaretskii  writes:

>> In my testing, I found a strange case where, in *scratch*, I get:
>> 
>> (message "%s" org-version)
>> ;; Error undefined
>> ;; Do 'C-h v org-version'
>> (message "%s" org-version)
>> 9.3
>> 
>> So, 'describe-variable' on org-version causes Org to be loaded?!?
>
> Why is it so surprising?  Is this the first time you see that a Help
> command loads something to do its job?

Please note that David's recipe is _not_ what I described in the bug
report.

I am referring to the problem people run into when using M-x
package-install.

AFAIU, package-install must not depend on the older version of a package
being loaded/not loaded.

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



Re: [BUG] org-table-blank-field keybinding [9.5.4 (N/A @ /gnu/store/sry9khwisaq1jnrjbfnhx6ki8qy2z0db-emacs-org-9.5.4/share/emacs/site-lisp/org-9.5.4/)]

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

> André A. Gomes  writes:
>
 Also, it might be worth mentioning in the manual that this command works
 when a region is selected.
>>>
>>> Indeed M-x org-table-blank-field does work when region is selected. Just
>>> as documented.
>>
>> I meant in the manual, not in the docstring.  But perhaps it does
>> suffice as it is.

I just updated the manual.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=dbad11b35

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



Re: To convert and simplify units in tables (was:LIterate programming with calc (help))

2022-12-10 Thread Ihor Radchenko
Ypo  writes:

> (defmath uconvert (v u)
>    "Convert value V to compatible unit U."
>    (math-convert-units v u))
>
>
> But no luck, "cs" result is an ERROR. Is it feasible to get a value for 
> "cs" with no units?

Note that apart from Calc formula notation, you can use Elisp. That will
avoid all the gotchas Calc has.

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



Re: [MAINTENANCE] Do we have any backwards-compatibility policy for third-party packages?

2022-12-10 Thread Ihor Radchenko
Tim Cross  writes:

> I guess we are limited by what the packages we rely on support. For
> example, if geiser doesn't support Emacs 26 but org is supposed to,
> there isn't much we can do. We cannot afford to fork geiser and modify
> it to add the support and even if we provided a patch to add the support
> to the geiser project, they may not merge it.
>
> Best we can do is best effort and reflect this limitation in the manual
> where we stipulate what our backwards compatibility policy is. 

Ok. Here are the tentative patches for Org manual and WORG maintenance
page.

>From 15a929176e9c03be6ef3bdb5b6401a8732c188a7 Mon Sep 17 00:00:00 2001
Message-Id: <15a929176e9c03be6ef3bdb5b6401a8732c188a7.1670680001.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Sat, 10 Dec 2022 16:46:10 +0300
Subject: [PATCH] org-maintenance.org: Document third-party package
 compatibility

* org-maintenance.org (Org releases are compatible with the latest
three major Emacs releases): Document that we only guarantee
compatibility with the latest stable versions of third-party packages.

Link: https://orgmode.org/list/86iljd3x90@gmail.com
---
 org-maintenance.org | 4 
 1 file changed, 4 insertions(+)

diff --git a/org-maintenance.org b/org-maintenance.org
index 8c7d9492..13f0b30c 100644
--- a/org-maintenance.org
+++ b/org-maintenance.org
@@ -172,6 +172,10 @@ ** Org releases are compatible with the latest three major Emacs releases
 older Emacsen: but maintainers are not bound to fix bugs reported on
 them.
 
+Some Org components also depend on third-party packages available
+through package archives.  Org is only guaranteed to be compatible
+with the last stable versions of these third-party packages.
+
 Org versions that are not yet released (from the main or bugfix
 branch) don't come with any promise regarding compatibility.
 
-- 
2.38.1

>From de2a6b9a924d2c5b135104dc2a383bafdb1995bb Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Sat, 10 Dec 2022 16:45:03 +0300
Subject: [PATCH] org-manual: Document third-party package compatibility

* doc/org-manual.org (Installation): Document that we only guarantee
compatibility with the latest stable versions of third-party packages.

Link: https://orgmode.org/list/86iljd3x90@gmail.com
---
 doc/org-manual.org | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 63e9d4139..8f4da3149 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -96,6 +96,10 @@ ** Installation
 that Org stable versions are meant to be fully compatible with the
 last three stable versions of Emacs but not with older Emacsen.
 
+Some Org components also depend on third-party packages available
+through package archives.  Org is only guaranteed to be compatible
+with the last stable versions of these third-party packages.
+
 *** Using Emacs packaging system
 :PROPERTIES:
 :UNNUMBERED: notoc
-- 
2.38.1


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


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

2022-12-10 Thread Ihor Radchenko
Jonathan Gregory  writes:

> Sure, patch attached. BTW there are some small differences between 
> pt and pt-BR (Brazilian Portuguese). I speak the latter, so that's 
> what I used.

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

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



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

2022-12-10 Thread Johan Tolö



Ihor Radchenko  writes:


Greg Minshall  writes:

[snipped]
The time span is years and I do not recall any related bug 
reports.

So, nobody seems to care.


I do pass org plain lists to R source code blocks which is why I 
found the current issue. It is easy enough for me to adapt my R 
code whenever there is a change in the way it is handled. It is 
unfortunate that it will no longer be possible to access any 
nested elements of plain lists but it does not affect me because I 
was not using that feature.


I think that the output from R source code blocks should be as 
close to the example in the org manual as possible. I also think 
that the handling within ob-R.el should be as simple as possible. 
I do not mind if that means that I have to convert a data.frame 
from columns to rows.


For anyone wondering, you can simply unlist() a data.frame to get 
a vector of the columns.


Johan

--
Johan Tolö



Re: [BUG] beamer export

2022-12-10 Thread Ihor Radchenko
Daniel Fleischer  writes:

> Hi, I'm on vacation for the next month. I can look at it when I'm back.

There is no activity in this thread for over one month.
Bumping.

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



Re: Pasting an image with org-download in org-capture buffer

2022-12-10 Thread Max Nikulin

On 10/12/2022 17:08, Ihor Radchenko wrote:

Max Nikulin writes:


... but recently added
`org--confirm-resource-safe' is affected by this kind of bugs.


May you elaborate?
`org--confirm-resource-safe' uses variable, not a function.


I called `org-tree-to-inderect-buffer', switched to the created buffer 
and tried to evaluate value of the `buffer-file-name' variable. At least 
in Emacs-26.3 I get nil. I suppose, it is the reason why 
(buffer-file-name (buffer-base-buffer)) composition is used instead of 
the variable in other expressions.





Re: LaTeX src block export

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

> ... because this greatly improves the copy-and-paste behaviour of my PDFs. 
> Now,
> when exporting to laTeX, there are some extra parameters included, which
> are not supported by fancyvrb. namely
> `language=`
> and
> `caption.*= (take .* as a regexp)`
>
> I have included a filter to get rid of the offending parameters in my
> .emacs.d org configuration, but this is difficult to port to other emacs
> setups (e.g. other co-workers).

I suggest writing a derived backend that will use a custom src block
transcoder. You can put the backend into setupfile and then ask your
co-workers to use that custom backend.

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



LaTeX src block export

2022-12-10 Thread Pedro Andres Aranda Gutierrez
Hi

I was wondering if there is a way to control which parameters are exported
when translating a src block to LaTeX in a document-wide fashion. I.e. with
a directive at the beginning of the .org file.

The background:

I have 'listings' to export src and example blocks and use
```
#+LATEX_HEADER: \\usepackage{upquote}
#+LATEX_HEADER: \\RequirePackage{fancyvrb}
#+LATEX_HEADER:
\\DefineVerbatimEnvironment{verbatim}{Verbatim}{fontsize=\footnotesize}
#+LATEX_HEADER:
\\DefineVerbatimEnvironment{lstlisting}{Verbatim}{fontsize=\scriptsize}
```
because this greatly improves the copy-and-paste behaviour of my PDFs. Now,
when exporting to laTeX, there are some extra parameters included, which
are not supported by fancyvrb. namely
`language=`
and
`caption.*= (take .* as a regexp)`

I have included a filter to get rid of the offending parameters in my
.emacs.d org configuration, but this is difficult to port to other emacs
setups (e.g. other co-workers).

Thanks, /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: Keys to Category Filter Agenda

2022-12-10 Thread Ihor Radchenko
Colin Baxter  writes:

> Indeed. I understand that, but the question was about '>' not '<'. The
> initial agenda buffer has
>
> < Buffer, subtree/region restriction
> > Remove restriction
>
> If I remove the restriction with >, as suggested by the initial buffer,
> I get the date prompt. I have to enter either '<' again or '|' to clear
> the restrictions. This information is given only in org-mode info not in
> the initial agenda buffer.

Initial prompt buffer only describes bindings for that buffer.
They are totally different from agenda-mode buffer.
I don't see any issue.

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



Re: Keys to Category Filter Agenda

2022-12-10 Thread Colin Baxter
> Ihor Radchenko  writes:

> Colin Baxter  writes:
>> In agenda, you can filter by category by pressing '<' when point
>> on that particular category. To remove filtering, press '<'
>> again. All this is explained in the org-mode info. However the
>> initial agenda buffer, viewed by 'C-c a', gives the keys '<' for
>> filtering but '>' to remove the restriction. This surely is wrong
>> since '>' is the key to call the org-agenda-date-prompt, or am I
>> missing something very basic here?

> You are misunderstanding agenda buffer and the initial agenda
> dialog.  The former is where "<" acts as category filter. The
> dialog uses "<" to set agenda restriction, as it is explained in
> the dialog message.

Indeed. I understand that, but the question was about '>' not '<'. The
initial agenda buffer has

< Buffer, subtree/region restriction
> Remove restriction

If I remove the restriction with >, as suggested by the initial buffer,
I get the date prompt. I have to enter either '<' again or '|' to clear
the restrictions. This information is given only in org-mode info not in
the initial agenda buffer.

Best wishes,



Re: [BUG] Setting export scope to subtree not working as expected [9.6 (9.6-gb3da42 @ /Users/apc/.emacs.d/straight/build/org/)]

2022-12-10 Thread Kaushal Modi
Hi Alejandro,

Thanks for reporting this issue. I was seeing the same issue and I wasn't
sure if this issue was in org-mode or the ox-hugo package. It was on my
to-debug list.

Ihor: Thank you for the quick response and fix!

On Sat, Dec 10, 2022, 4:47 AM Ihor Radchenko  wrote:

> Alejandro Pérez Carballo  writes:
>
> > If point is on a heading followed by a subheading without any text in
> between, the export process is using the tree starting with the subheading
> instead of the tree starting from point position. If instead you have some
> text after the first heading and before the subheading, the tree that is
> exported is the tree starting from point position, as expected. I’m
> assuming this is a bug, but maybe I’m missing something.
> >
> > For example, take a buffer containing just this:
> >
> >* The title
> >** A subtitle
> >Some text
> >
> > If I export this to an HTML buffer, with point at the beginning of the
> first line and  after setting the scope to ‘subtree’, I get an HTML buffer
> whose title is “A subtitle”.
> >
> > If I follow the same steps on a buffer containing just this:
> >
> >* The title
> >Some text
> >** A subtitle
> >
> > I get an HTML buffer whose title is “The title”.
>
> Thanks for reporting!
> Fixed on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0616b3c37
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>
>


Re: Flyspell causes severe slowdown when manipulating footnotes

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

> Thanks Ihor for the response. Unfortunately, setting
> org-element--cache-self-verify to nil didn't work. Profile report attached.

Thanks!
I just pushed a slight optimization to the footnote sorting code.
Can you try again using the latest main?

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=169333e1c

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



Re: How to prevent emacs from asking “file is read only on disk make buffer read only, too?”

2022-12-10 Thread Ihor Radchenko
Alexei Gilev  writes:

> Basically that :) This comes up in helm-ag searches a lot. Very annoying!
> Thank you!

Is it related to Org?
I also don't see this phrase coming in Emacs 29 sources.
Maybe from some package?

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



Re: Pasting an image with org-download in org-capture buffer

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

> ... but recently added 
> `org--confirm-resource-safe' is affected by this kind of bugs.

May you elaborate?
`org--confirm-resource-safe' uses variable, not a function.

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



Re: Images generated by R code blocks do not display

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

> I now reported this to Emacs upstream.
> I do not see anything wrong on Org side in this case.
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59902

Since the bug will affect older Emacs versions, I pushed a workaround to
bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=7fefc3027

It will no longer be necessary when Emacs fixes the issue and when we
stop supporting all the older Emacs versions with this bug being present.

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



Re: [BUG] Setting export scope to subtree not working as expected [9.6 (9.6-gb3da42 @ /Users/apc/.emacs.d/straight/build/org/)]

2022-12-10 Thread Ihor Radchenko
Alejandro Pérez Carballo  writes:

> If point is on a heading followed by a subheading without any text in 
> between, the export process is using the tree starting with the subheading 
> instead of the tree starting from point position. If instead you have some 
> text after the first heading and before the subheading, the tree that is 
> exported is the tree starting from point position, as expected. I’m assuming 
> this is a bug, but maybe I’m missing something.
>
> For example, take a buffer containing just this:
>
>* The title
>** A subtitle
>Some text
>
> If I export this to an HTML buffer, with point at the beginning of the first 
> line and  after setting the scope to ‘subtree’, I get an HTML buffer whose 
> title is “A subtitle”.
>
> If I follow the same steps on a buffer containing just this: 
>
>* The title
>Some text
>** A subtitle
>
> I get an HTML buffer whose title is “The title”.

Thanks for reporting!
Fixed on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0616b3c37

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



Re: Keys to Category Filter Agenda

2022-12-10 Thread Ihor Radchenko
Colin Baxter  writes:

> In agenda, you can filter by category by pressing '<' when point on that
> particular category. To remove filtering, press '<' again. All this is
> explained in the org-mode info. However the initial agenda buffer,
> viewed by 'C-c a', gives the keys '<' for filtering but '>' to remove
> the restriction. This surely is wrong since '>' is the key to call the
> org-agenda-date-prompt, or am I missing something very basic here?

You are misunderstanding agenda buffer and the initial agenda dialog.
The former is where "<" acts as category filter. The dialog uses "<" to
set agenda restriction, as it is explained in the dialog message.

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



Re: [BUG] issue with texmathp [9.6 (release_9.6-22-g78d283 @ /home/jds6696/.emacs.d/straight/build/org-mode/)]

2022-12-10 Thread Ihor Radchenko
Justin Silverman  writes:

> texmathp when used in org-mode seems to have problems with multiline align* 
> environments.
>
> Consider the following math environment: 
>
>
> \begin{align*}
> y_{i} &\sim f(\mu_{i}) \\ 
> |
> \end{align*}
>
> where cursor is at `|'. With cursor at this point try `(texmathp)'. I get 
> `nil'. It seems to only be a problem on the start of a blank line.

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

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



Re: [BUG] org-ctrl-c-ctrl-c on keyword makes entire buffer visible

2022-12-10 Thread Ihor Radchenko
Matt Lundin  writes:

> After upgrading to org 9.6, I find that refreshing the org buffer with
> org-ctrl-c-ctrl-c causes the entire buffer (including drawers and other
> folded items) to become visible.
>
> I've tested this with a minimal config and the following org file:

Thanks for reporting!
Fixed now on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=aba51fb58

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