Re: ox-latex: help: LATEX_HEADER from different subtrees collision

2024-09-04 Thread Pedro

Hi Rudy,

You nailed it!! Using property EXPORT_LATEX_HEADER exactly solves my 
problem, thank you very much. For completeness, I will re-attach the 
file with the solution


How did you know that, should that be mentioned in the corresponding 
section? (I could not find another one) [1] [2]. Maybe that two links 
together should be more linked and more explained the subtree case.


Serve at least this discussion as a pre-documentation

Regarding the attached file: I thought it was minimal enough, 94 lines 
that runs on vanilla emacs (emacs-30 branch); but maybe I missed a 
little summary: it is two subtree exports handled with a ~#+begin_src 
emacs-lisp~, and there was a clash using the LATEX_HEADER


Cheers,
Pedro

[1] https://orgmode.org/manual/LaTeX-header-and-sectioning.html

[2] https://orgmode.org/manual/Export-Settings.html
* ox-latex-problem
** [2024-09-02 Mon]
*** report #1 (landscape)
:PROPERTIES:
:EXPORT_LANGUAGE: en
:EXPORT_TITLE:
:EXPORT_SUBTITLE:
:EXPORT_AUTHOR:
:EXPORT_DATE:
:EXPORT_OPTIONS: toc:nil timestamp:nil num:nil
:EXPORT_TOC: headlines 2
:EXPORT_FILE_NAME: /tmp/report2.pdf
:EXPORT_LATEX_HEADER: \usepackage[a4paper, landscape, margin=0.5cm]{geometry}
:CLICK_TO_SEE_REPORT: file:/tmp/report2.pdf
:END:

#+name: sourceblock_created_2024-09-02_23-36-05
#+begin_src emacs-lisp :exports none :results none
(defun my/export-pdf ()
  "renders the PDF"
  (org-narrow-to-subtree)
  (org-show-subtree)

  (org-latex-export-to-pdf nil t t nil)

  (widen)
)
(my/export-pdf)
#+end_src

# do not use this LATEX_HEADER because is buffer scoped!
# #+LATEX_HEADER: \usepackage[a4paper, landscape, margin=0.5cm]{geometry}

 My report #2

* Introduction

Introduction text

* The report #2

Report #2 text

* Conclusions

Conclusions text

** [2024-09-01 Sun]

*** report #2 (portrait)
:PROPERTIES:
:EXPORT_LANGUAGE: ca
:EXPORT_TITLE:
:EXPORT_SUBTITLE:
:EXPORT_AUTHOR:
:EXPORT_DATE:
:EXPORT_OPTIONS: toc:nil timestamp:nil num:nil
:EXPORT_TOC: headlines 2
:EXPORT_FILE_NAME: /tmp/report1.pdf
:CLICK_TO_SEE_REPORT: file:/tmp/report1.pdf
:EXPORT_LATEX_HEADER: \usepackage[a4paper, margin=3cm]{geometry}
:END:

#+name: sourceblock_created_2024-09-02_23-36-07
#+begin_src emacs-lisp :exports none :results none
(defun my/export-pdf ()
  "renders the PDF"
  (org-narrow-to-subtree)
  (org-show-subtree)

  (org-latex-export-to-pdf nil t t nil)

  (widen)
)
(my/export-pdf)
#+end_src

# do not use this LATEX_HEADER because is buffer scoped!
# #+LATEX_HEADER: \usepackage[a4paper, margin=3cm]{geometry}

 My report #1

* Introduction

Introduction text

* The report #1

Report #1 text

* Conclusions

Conclusions text


OpenPGP_0x9D64597C3A982DCA.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature


[BUG] export blocks no longer fontifying [9.7.10 (release_9.7.10 @ /Users/ben/Scripts/emacs/lisp/org/)]

2024-09-04 Thread Benjamin McMillan
At some point in the last few months, org mode stopped fontifying my
latex export blocks. However, an older version of emacs on my computer
still does fontify.
(The difference is seen even opening emacs with the -q flag)
It seems that there was a change to the function
org-fontify-meta-lines-and-blocks-1 in org.el, specifically at the
conditional that checks org-src-fontify-natively.
As the comment there explains, the intention is to only fontify src
blocks, but I don't see any option exposed to enable fontififcation of
export blocks, which is a fairly crucial feature to my workflow.

I think fontification of export blocks should follow that of src blocks,
or a separate option should be made. (Or, I may be missing some already
existing solution!)

For what it is worth, I can get the desired behavior by modifying the
code mentioned above to include "export", as in the following:
(and org-src-fontify-natively
;; Technically, according to
;; `org-src-fontify-natively' docstring, we should
;; only fontify src blocks.  However, it is common
;; to use undocumented fontification of example
;; blocks with undocumented language specifier.
;; Keep this undocumented feature for user
;; convenience.
(member block-type '("src" "example" "export")))

Thanks,
Ben


Emacs  : GNU Emacs 31.0.50 (build 3, aarch64-apple-darwin23.5.0, NS
appkit-2487.60 Version 14.5 (Build 23F79))
 of 2024-08-29
Package: Org mode version 9.7.10 (release_9.7.10 @
/Users/ben/Scripts/emacs/lisp/org/)

current state:
==
(setq
 org-noter-get-selected-text-hook '(org-noter-djvu--get-selected-text
org-noter-nov--get-selected-text
   org-noter-pdf--get-selected-text)
 org-yank-image-file-name-function 'org-yank-image-autogen-filename
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-noter-doc-split-fraction '(0.6 . 0.5)
 org-html-format-headline-function
'org-html-format-headline-default-function
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-noter--get-current-view-hook '(org-noter-djvu--get-current-view
org-noter-nov--get-current-view
   org-noter-pdf--get-current-view)
 org-log-into-drawer "LOG"
 org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
 org-M-RET-may-split-line nil
 org-noter--pretty-print-location-for-title-hook
'(org-noter-djvu--pretty-print-location
  org-noter-nov--pretty-print-location
  org-noter-pdf--pretty-print-location-for-title)
 org-babel-tangle-lang-exts '(("python" . "py") ("emacs-lisp" . "el")
("elisp" . "el"))
 org-treat-insert-todo-heading-as-state-change t
 org-noter--get-highlight-location-hook '(org-noter-pdf--get-highlight)
 org-roam-db-node-include-function #[0 "\300\207" [t] 1]
 org-timer-done-hook '(my/org-timer-done-actions)
 org-roam-log-setup-hook '(org-roam--register-completion-functions-h)
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-export-in-background t
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-roam-preview-function 'org-roam-preview-default-function
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-agenda-window-setup 'current-window
 org-noter--convert-to-location-cons-hook
'(org-noter-pdf--convert-to-location-cons)
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-blank-before-new-entry '((heading) (plain-list-item))
 org-export-async-init-file "~/.emacs.d/org/export-dispatch-init.el"
 org-mode-hook '(my/org-mode-completion-setup #[nil ((org-bullets-mode 1))
(t)] er/add-org-mode-expansions
#[nil ((add-hook 'change-major-mode-hook 'org-fold-show-all 'append 'local))
  (org--rds reftex-docstruct-symbol org-attach-method
org--single-lines-list-is-paragraph
   org-element-greater-elements org-agenda-restrict-end
org-agenda-restrict-begin
   org-agenda-restrict visual-fill-column-width org-clock-history
org-agenda-current-date
   org-with-time org-defdecode org-def org-read-date-inactive org-ans2
org-ans1
   org-columns-current-fmt-compiled org-clock-current-task org-clock-effort
   org-agenda-skip-function org-agenda-skip-comment-trees
org-agenda-archives-mode
   org-end-time-was-given org-time-was-given org-log-note-extra
org-log-note-purpose
   org-log-post-message org-last-inserted-timestamp
org-last-changed-timestamp
   org-entry-property-inherited-from org-state
org-agenda-headline-snapshot-before-repeat
   org-agenda-buffer-name org-agenda-start-on-weekday
org-agenda-buffer-tmp-name
   org-log-note-marker org-priority-regexp org-mode-abbrev-table
org-element-cache-persistent
   org-element-cache-version org-tbl-menu org-org-menu org-struct-menu
org-entities
   org-last-state org-id-track-globally org-clock-start-time texmathp-why
remember-data-file
   org-agenda-tags-todo-honor-ignore-options calc-embedded-open-mode
calc-embedded-open-formula
   calc-embedded-close-formula alig

BUG (regression): clocktable with ~:link t~ looks visually inconsistent

2024-09-04 Thread Pedro

Hi,

On a clocktable with hierarchy (see attached file 
clocktable-link-bug.org), when ~:link t~ is used, it does not look 
visually good; that was not an issue with the previous versions of orgmode


Find attached screenshot 2024-09-01_23-05_clocktable-detail.png, that 
shows the inconsistency in my ~emacs -Q~ with orgmode 9.7.10 and 
emacs-30 branch with commit 44c2614


Cheers,
pinmacs
* [2024-08-31 Sat]
:PROPERTIES:
:CREATED:  [2024-09-01 Sun 23:00]
:CUSTOM_ID: clocktable-link-bug_2
:END:

** DONE task1
:LOGBOOK:
CLOCK: [2024-08-31 Sat 22:45]--[2024-08-31 Sat 22:56] =>  0:11
:END:

* [2024-09-01 Sun]
:PROPERTIES:
:CREATED:  [2024-09-01 Sun 23:00]
:CUSTOM_ID: clocktable-link-bug_1
:END:

** DONE task2
:LOGBOOK:
CLOCK: [2024-09-01 Sun 22:30]--[2024-09-01 Sun 22:56] =>  0:26
:END:

clocktable with ~:link nil~ shows it fine

#+NAME: my_clocktable_without_link
#+BEGIN: clocktable :maxlevel 4 :scope file :link nil
#+CAPTION: Clock summary at [2024-09-01 Sun 23:03]
| Headline | Time |  |
|--+--+--|
| Total time   | 0:37 |  |
|--+--+--|
| [2024-08-31 Sat] | 0:11 |  |
| \_  task1|  | 0:11 |
| [2024-09-01 Sun] | 0:26 |  |
| \_  task2|  | 0:26 |
#+END

clocktable with ~:link nil~ shows it bad

#+NAME: my_clocktable
#+BEGIN: clocktable :maxlevel 4 :scope file :link t
#+CAPTION: Clock summary at [2024-09-01 Sun 23:03]
| Headline  | Time |  |
|---+--+--|
| Total time| 0:37 |  |
|---+--+--|
| [[file:/home/music/clocktable-link-bug.org::*\[2024-08-31 Sat\]][[2024-08-31 Sat]​]] | 0:11 |  |
| \_  [[file:/home/music/clocktable-link-bug.org::*task1][task1]] |  | 0:11 |
| [[file:/home/music/clocktable-link-bug.org::*\[2024-09-01 Sun\]][[2024-09-01 Sun]​]] | 0:26 |  |
| \_  [[file:/home/music/clocktable-link-bug.org::*task2][task2]] |  | 0:26 |
#+END


OpenPGP_0x9D64597C3A982DCA.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature


[BUG] My hour registration file cannot be opened anymore., [9.6.15 (release_9.6.15 @ /usr/share/emacs/29.4/lisp/org/)]

2024-09-04 Thread Lourens van der Vliet

Emacs freezes upon opening the hours,org file.
This version comes up with a parser error, however this file has been
used and worked on at 7 july 2024. This file has been used after the
holidays up to 26 august 2024. Then at 28 august the file could not be
opened anymore. This was probably after an update, however I don't
remember that anymore, but most likely on 26 august. Then on 27 august I
didn't open the file. At 28 august the trouble started.

Expected behavior: File can be opened and worked on.

Emacs  : GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.42, cairo version 1.18.0)

 of 2024-06-30, modified by Debian
Package: Org mode version 9.6.15 (release_9.6.15 @ 
/usr/share/emacs/29.4/lisp/org/)


current state:
==
(setq
 org-archive-location "%s_archive::* Archived Tasks"
 org-link-elisp-confirm-function 'yes-or-no-p
 org-agenda-diary-file "~/org/diary.org"
 org-directory "~/org/"
 org-after-todo-state-change-hook '(bh/mark-next-parent-tasks-todo)
 org-bibtex-headline-format-function #[257 "\300.\236A\207" [:title] 3 
"\n\n(fn ENTRY)"]

 org-agenda-custom-commands '(("N" "Notes" tags "NOTITIE"
   ((org-agenda-overriding-header "Notes") 
(org-tags-match-list-sublevels t)))

  ("h" "Habits" tags-todo "STYLE=\"habit\""
   ((org-agenda-overriding-header "Habits")
    (org-agenda-sorting-strategy 
'(todo-state-down effort-up category-keep)))

   )
  ("z" "Agenda"
   ((agenda "" nil)
    (tags "REFILE"
 ((org-agenda-overriding-header "Taken 
verplaatsen")

  (org-tags-match-list-sublevels nil))
 )
    (tags-todo "-STAKEN/!"
 ((org-agenda-overriding-header 
"Vastgelopen projecten")
  (org-agenda-skip-function 
'bh/skip-non-stuck-projects)
  (org-agenda-sorting-strategy 
'(category-keep)))

 )
    (tags-todo "-WACHTEN-STAKEN/!"
 ((org-agenda-overriding-header 
"Projecten")
  (org-agenda-skip-function 
'bh/skip-non-projects)
  (org-agenda-sorting-strategy 
'(category-keep)))

 )
    (tags-todo "-STAKEN/!HIERNA"
 ((org-agenda-overriding-header
   (concat "Taken in uitvoering"
    (if 
bh/hide-scheduled-and-waiting-next-tasks ""
 " (inclusief wachtende en geplande 
taken)")

    )
   )
  (org-agenda-skip-function 
'bh/skip-projects-and-habits-and-single-tasks)

  (org-tags-match-list-sublevels t)
(org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
(org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
(org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
  (org-agenda-sorting-strategy 
'(todo-state-down effort-up category-keep)))

 )
    (tags-todo "-REFILE-STAKEN-WACHTEN/!"
 ((org-agenda-overriding-header
   (concat "Subtaken van projecten"
    (if 
bh/hide-scheduled-and-waiting-next-tasks ""
 " (inclusief wachtende en geplande 
taken)")

    )
   )
  (org-agenda-skip-function 
'bh/skip-non-project-tasks)

(org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
(org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
(org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
  (org-agenda-sorting-strategy 
'(category-keep)))

 )
    (tags-todo "-REFILE-STAKEN-WACHTEN/!"
 ((org-agenda-overriding-header
   (concat "Zelfstandige taken"
    (if 
bh/hide-scheduled-and-waiting-next-tasks ""
 " (inclusief wachtende en geplande 
taken)")

    )
   )
  (org-agenda-skip-function 
'bh/skip-project-tasks)

(org-agenda-todo-ignore-scheduled 

Re: ox-latex default template changed sentence spacing from 9.6 to 9.7 ?

2024-09-04 Thread pinmacs

Hi Pedro,

You were right!

In my success of starting to have more diverse number of latex exports 
in my yearly journal, it was being polluted because the global 
~#+LATEX_HEADER~ stuff [1]


it went unnoticed because it was in lowcase and I was only searching for 
the uppercase, these were the affecting lines:


#+latex_header: \usepackage{setspace}
#+latex_header: \onehalfspacing

Cheers,
pinmacs

[1] see here for more details: 
https://list.orgmode.org/orgmode/224ef5a7-33fc-4467-b146-0899aa61b...@cas.cat/T/#t


On 2024-09-04 07:43, Pedro Andres Aranda Gutierrez wrote:

Hi,

I have a Linux with a recent emacs 30.0.90, org-mode 9.7.10 and a 
freeBsd with an emacs 29.4, org-mode 9.6.15 and I see neither emitting 
the linespread command.


Tested with #LATEX_COMPILER: lualatex and without it.

It must be something you have in your headers...
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: ox-latex: help: LATEX_HEADER from different subtrees collision

2024-09-04 Thread pinmacs

Hey!

And this is trivial, but it took me a while to figure it out

Of course, if you want to use more than one EXPORT_LATEX_HEADER for that 
subtree export, you need to use multi-value property [0]:


:PROPERTIES:
:EXPORT_LATEX_HEADER: \usepackage{bookmark}
:EXPORT_LATEX_HEADER+: \usepackage{nopageno}
:EXPORT_LATEX_HEADER+: \usepackage{siunitx}
:EXPORT_LATEX_HEADER+: \usepackage{colortbl}
:EXPORT_LATEX_HEADER+: \usepackage{xcolor}
:EXPORT_LATEX_HEADER+: \usepackage[a4paper, margin=3cm]{geometry}
:EXPORT_LATEX_HEADER+: \usepackage[none]{hyphenat}
:END:

Debugging [1] I also found that once there is one property 
EXPORT_LATEX_HEADER, subsequent `#+LATEX_HEADER` are ignored, that's smart!


Cheers,
pinmacs

[0]
  If you want to add to the value of an existing property, append a ‘+’ 
to the property name. The following results in the property ‘var’ having 
the value ‘foo=1 bar=2’.


  #+PROPERTY: var  foo=1
  #+PROPERTY: var+ bar=2

  src https://orgmode.org/manual/Property-Syntax.html


[1] near the .pdf you have the .tex to debug, and you can export again 
outside emacs with ~pdflatex~




Re: [BUG] org element warning [9.8 (9.8-??-39272e216 @ /home/fan/.emacs.d/.local/straight/build-29.3/org/)]

2024-09-04 Thread Ihor Radchenko
Ihor Radchenko  writes:

> ray  writes:
>
>> Remember to cover the basics, that is, what you expected to happen and
>> what in fact did happen. You don't know how to make a good report? See
>>
>> ...
>
> Thanks for reporting, but may you please clarify what is the warning text?

More information have been requested, but none provided.
The report is not actionable.
Closing.
Canceled.

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



Re: ox-latex: help: LATEX_HEADER from different subtrees collision

2024-09-04 Thread Rudolf Adamkovič
Pedro  writes:

> How did you know that, should that be mentioned in the corresponding
> section? (I could not find another one) [1] [2].

It is written at the bottom of [2]:

  When exporting subtrees, special node properties can override the
  above keywords.  These properties have an ‘EXPORT_’ prefix.  For
  example, ‘DATE’ becomes, ‘EXPORT_DATE’ when used for a specific
  subtree.  Except for ‘SETUPFILE’, all other keywords listed above have
  an ‘EXPORT_’ equivalent.

Rudy
-- 
"I love deadlines.  I love the whooshing noise they make as they go by."
--- Douglas Adams, The Salmon of Doubt, 2002

Rudolf Adamkovič  [he/him]
http://adamkovic.org



Re: Should "org-element-parse-buffer" check whether the buffer's major mode is org mode?

2024-09-04 Thread Ihor Radchenko
Antonio Romano  writes:

> What I did was simply parse out a buffer, change all headlines's TODO
> keyword in its AST to "DONE", interpret the resulting AST and finally
> print out the resulting document to a new buffer. The issue I had
> encountered was that an headline like "* TODO Hello" would wrongly
> become "* DONE TODO Hello" instead of "* DONE Hello".

That might happen, yes. The behavior in non-Org buffers is currently
undefined. Sometimes, you may also get errors.

> A kind user pointed out that the issue was that I called "org-element-
> parse-buffer" in a fundamental-mode buffer and, in fact, turning on
> org-mode beforehand solved the issue. As the user suggested, I'm here
> to ask you if this is the intended behavior or if it would be better
> limiting the usage of the function to org-mode (and derived) buffers
> only. Thank you in advance.

If you look into the docstring, it says

...
This function assumes that current major mode is `org-mode'.

Should we complain when current buffer is not in Org mode? It is not
easy to answer. In Org 9.7 (before the release), we modified
`org-element-at-point' to do exactly this - complain when current major
mode is not Org mode. Soon, a number of people reported that
`org-element-at-point' is, in fact, misused by a number of packages and
does get called in non-Org buffers. At the end, I had to change
`org-element-at-point' to throw a warning rather than an error as some
packages simply _rely_ upon such misuse.

The current tentative plan for this is the following:

1. Slowly update the parser so that using it in non-Org buffers becomes
   less unreliable. (It mostly involves computing some variables that
   Org mode normally initializes dynamically)

2. Allow the parser to be used on arbitrary text.


So, you should be able to use `org-element-parse-buffer' in non-Org
buffers in the long run. For now, a note in the docstring is what we
have. I may also add a warning, but I am not sure - a number of people
are confused enough by the warning from `org-element-at-point' (caused
by packages abusing it in non-Org buffers); to the point that I am
thinking to remove it as well.

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



Re: Should "org-element-parse-buffer" check whether the buffer's major mode is org mode?

2024-09-04 Thread Antonio Romano
Ouch, that part of the docstring totally slipped my eye. 

The situation is a bit more complex than I imagined and am not
experienced enough to have a strong opinion on the matter. If things
are to stay as they are right now, I guess emphasizing even more in the
docstring that this function may have undefined behavior in different
modes can only do good. 

Thank you for clarifying.




What does "Deleting bad index entry" mean on save-buffers-kill-emacs?

2024-09-04 Thread Gregor Zattler
Dear org-mode developers, when shutting
down Emacs with save-buffers-kill-emacs,
I sometimes see shortly as the last
thing in the echo area "Deleting bad
index entry."  And before some message
about wrong type of sth.  I cannot read so
fast.

Is there anything I should do about
that?

Regards, Gregor



Sorting WAITING tasks from old to new

2024-09-04 Thread William Denton
If I look at all my TODOs (org-todo-list) and filter to WAITING (4 r) then all 
the tasks in this view are shown in the order they appear in the files where 
the tasks are listed.  Is there a way to sort them from old to new (or new to 
old) so I can see which ones have been in that status for the longest?

I looked in the manual and the mailing list archives, and did some searching 
elsewhere, but didn't turn up any examples of this, which surprised me, so 
perhaps I overlooked something obvious, but if not, perhaps someone has some 
code?

Thanks,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada