oc-basic load performance

2022-03-13 Thread Bruce D'Arcus
I've seen a number of people note how slow loading of BibTeX files is in
oc-basic.

Just wondering: do we know why, and whether there are opportunities to
improve it?

For comparison, parsebib (which I use in citar) is much faster.

Bruce


Re: [BUG] Resolving idle clocks needs multiple keystrokes [9.5.2 (release_9.5.2-24-g668205 @ /home/ignacio/repos/emacs/lisp/org/)]

2022-03-13 Thread Ignacio Casso

> So the problem is in (org-user-idle-seconds), which in my window system
> boils down to a call to (current-idle-time). It should return 0 after
> answering the prompt, but in my system it keeps counting up. At this
> point I stopped investigating since that function is defined in C.
>

I have investigated this a little bit further and it seems that reading
a character with read-char only resets the idle timer if the SECONDS
argument is nil (which is not the case here) . I reported it as a bug to
bug-gnu-em...@gnu.org, but it seems there is a reason for that. See
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54371

> Since this bug is already old and I have not found much information
> about it, I assume that in most systems answering the prompt does reset
> the idle timer and this bug does not occur.

It also seems to happen for all systems, so either much less people than
I thought use this feature, or there is something else that makes this
bug particular to my setup, although I can't think of anything else.

> As a quick fix for those
> systems where this is an issue, we could reset the idle timer ourselves
> after the prompt in org-resolve-clocks-if-idle.

I have thought of a better way to fix this, and currently there is no
way to do reset the idle timer with Elisp anyway. I attach the patch: it
just cancels the timer before prompting the user and sets it again if
needed after the prompt is answered. What do you think?

>From 288b25ea95699596762b199088ce6828a5e9a0ed Mon Sep 17 00:00:00 2001
From: Ignacio 
Date: Sun, 13 Mar 2022 21:41:43 +0100
Subject: [PATCH] fixed bug

---
 lisp/org/org-clock.el | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index dce5d9d4c0..81d4a85782 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -1228,7 +1228,9 @@ org-resolve-clocks-if-idle
 	   (org-clock-user-idle-start
 	(org-time-since org-clock-user-idle-seconds))
 	   (org-clock-resolving-clocks-due-to-idleness t))
-  (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
+  (when (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
+  (cancel-timer org-clock-idle-timer)
+  (setq org-clock-idle-timer nil)
 	  (org-clock-resolve
 	   (cons org-clock-marker
 		 org-clock-start-time)
@@ -1237,7 +1239,10 @@ org-resolve-clocks-if-idle
 		 (/ (float-time
 			 (time-since org-clock-user-idle-start))
 			60)))
-	   org-clock-user-idle-start)
+	   org-clock-user-idle-start)
+  (when (and (org-clocking-p) (not org-clock-idle-timer))
+(setq org-clock-idle-timer
+	  (run-with-timer 60 60 #'org-resolve-clocks-if-idle)))
 
 (defvar org-clock-current-task nil "Task currently clocked in.")
 (defvar org-clock-out-time nil) ; store the time of the last clock-out
-- 
2.25.1



Re: Code blocks and quotes export style

2022-03-13 Thread Tim Cross


"Barton, Mark"  writes:

> I manually check the pdf to see if it fits and use a code formatter to get the
> line widths shorter. I use blacken for python and sqlformat for SQL within
> Emacs. Even then I still hit limits where I recently changed to font size to
> small for the code blocks.
>
> I use minted for syntax highlighting of code blocks.
> #+LaTeX_HEADER: \usepackage{minted}
>
> I set a local variable for org using minted to change the fontsize.
> # Local Variables:
> # org-latex-minted-options: (("fontsize" "\\small"))
> # End:
>

That is basically what I do as well. I use minted and a smaller font for
code listings. I also ensure that when programming, I use a fill column
of 80.

In this day of large monitors, a fill column of 80 for programming
languages can often seem frustrating as it means less code in a
'screen' (window). Increasing fill column to (lets say) 100 can work
well, until it comes time to generate documentation and PDFs etc. Then I
remember why 80 is a better default!

I do use local variables more these days and will set a larger fill
column setting for code when I know I won't be needing to print it or
use it in Latex, but the default is 80 so that whenever I do org blocks,
things wrap at a width which works better for export to PDF etc.



Re: Code blocks and quotes export style

2022-03-13 Thread Barton, Mark
I manually check the pdf to see if it fits and use a code formatter to get the 
line widths shorter. I use blacken for python and sqlformat for SQL within 
Emacs. Even then I still hit limits where I recently changed to font size to 
small for the code blocks.

I use minted for syntax highlighting of code blocks.
#+LaTeX_HEADER: \usepackage{minted}

I set a local variable for org using minted to change the fontsize.
# Local Variables:
# org-latex-minted-options: (("fontsize" "\\small"))
# End:

Mark

> On Mar 13, 2022, at 3:54 AM, Sébastien Gendre  wrote:
> 
> Hello everyone. _o/
> 
> When I export an Org file to LaTeX and finally PDF, the code blocks and 
> quotes often exceed the width of the page.
> 
> Is it possible to set some style of the exported blocks ? Like we can set the 
> size for images ? I can't found it.
> 
> Thanks for your help.
> Séb



Re: Code blocks and quotes export style

2022-03-13 Thread Juan Manuel Macías
Kaushal Modi writes:

> Well, that will at least help the code blocks going out of bounds. It
> won't help the quotes. 

With the quotes going out of bounds issue it would be nice to see a
screenshot. But if a line of normal text goes outside the margin, it is
usually due to a TeX overfull hbox, perhaps because TeX hasn't been able
to hyphenate a long word correctly (also perhaps because the text is in
a language other than the main language, and that text should be encased
in the secondary language specifications).

For this type of lines outside the margin there are several LaTeX
solutions:

The quick fix is to add a discretionary hyphen (\-). For example, if the
word that goes outside the margin is "supercalifragilistic", the
discretionary can be added with an export snipett:

Supercali@@latex:\-@@fragilistic

Or even breakpoints can be indicated with the '\hyphenation' macro in the
preamble (we can add a list of words separated by commas):

#+LaTeX_Header: \hyphenation{Supercali-fragilistic}

Another solution is to disable TeX's line break algorithm at the
paragraph where the line overflows, using the slopypar environment. The
result can be ugly, with too wide separations between words.

On the other hand, loading the microtype package (in pdfTeX or LuaTeX)
usually helps a lot in the construction of the paragraphs.

And finally, if LuaTeX is used to compile, the linebreaker
(https://www.ctan.org/pkg/linebreaker) package automatically prevents
all overfull hboxes in the document.

Also note that the Org quote block supports the :environments attribute,
where we can apply environments other than 'quote', such as quotation or
those provided by the csquotes package. For example, for quotes in
another language:

#+LaTeX_Header:\usepackage[german,english]{babel}
#+LaTeX_Header:\usepackage{quoting}
#+LaTeX_Header:\usepackage[babel=true,autostyle=true,german=quotes]{csquotes}
#+LaTeX_Header:\SetBlockEnvironment{quoting}
#+ATTR_LaTeX: :environment foreigndisplayquote :options {german}
#+begin_quote
Eine Erklärung, wie sie einer Schrift in einer Vorrede nach der
Gewohnheit vorausgeschickt wird (Hegel).
#+end_quote

Best regards,

Juan Manuel 





Re: Code blocks and quotes export style

2022-03-13 Thread autofrettage
> When I export an Org file to LaTeX and finally PDF, the code blocks and 
> quotes often exceed the width of the page.

> Is it possible to set some style of the exported blocks ?

I wonder what the export engine can do about code which is too wide? As a 
programmer, I certainly wouldn't like some brainless line-breaking make a mess 
of my beautiful code

Most coding standards recommend lines at most 80 characters wide, or even a tad 
shorter, but this requires tiny letters, if generous LaTeX margins are used. 
...not least with A4-paper.

Before truly smart AI shows up, the only alternative I see is writing short 
enough lines manually.

...but I am no expert on Org Mode.

Cheers
Rasmus



Re: Code blocks and quotes export style

2022-03-13 Thread Kaushal Modi
On Sun, Mar 13, 2022, 6:55 AM Sébastien Gendre  wrote:

> Hello everyone. _o/
>
> When I export an Org file to LaTeX and finally PDF, the code blocks and
> quotes often exceed the width of the page.
>

Hello _o/

I fixed[1] that problem by using the LaTeX minted package that allows
wrapping around the lines using its "breaklines" option.

Well, that will at least help the code blocks going out of bounds. It won't
help the quotes.

Note that I added that to my Org mode config more than 6 years back or
something. So there might be a better way to do the same but that setup
still works! :)

[1]:
https://github.com/kaushalmodi/.emacs.d/blob/c643684ad675753c69df602d7298241d05173255/setup-files/setup-org.el#L941-L972

>


Re: Unable to resolve link; aborting: "roam:git"

2022-03-13 Thread Kaushal Modi
On Sun, Mar 13, 2022, 8:23 AM  wrote:

> In real I (try to) use ox-hug to export my org-files (org-roam-v2) to
> markdown (and later to HTML).
>
> After analyzing the my debug output [1] the ox-hugo people pointed me to
> org-roam community because the error is "thrown" (correct term in
> emas-lisp=?) by "org-export-resolve-fuzzy-link".
>

After revisiting this, I believe, this is something that needs to be fixed
in ox-hugo as it is calling org-export-resolve-fuzzy-link directly without
handling the broken link error.

I'll try to fix it in the next week.

>


Re: [BUG] LOGBOOK makes property search (in org-agenda) too slow(?)

2022-03-13 Thread Ihor Radchenko


Samuel Wales  writes:
> are there intereim workarounds like semi-automatically moving large
> logbook entries, or entire logbooks, to a task that says "was logbook
> for ..." and then archiving that task?  or automatically archiving old
> logbook entries?

My largest logbook contains ~2.5k clock records with no obvious impact
on performance (on main). However, when I was using older Org versions,
I used the following helper functions:

Credit: 
https://www.reddit.com/r/orgmode/comments/dg43hs/can_i_archive_a_property_drawer/f3frk2n/
Caveat: you might get duplicate IDs using the functions below. I just
changed the archived ID manually in the past.

#+begin_src emacs-lisp
(defun my/org-archive-delete-logbook ()
  (save-excursion
   (org-end-of-meta-data)
   (let ((elm (org-element-at-point)))
 (when (and
(equal (org-element-type elm) 'drawer)
(equal (org-element-property :drawer-name elm) "LOGBOOK"))
   (delete-region (org-element-property :begin elm)
  (org-element-property :end elm))

(defun my/org-archive-without-delete ()
  (cl-letf (((symbol-function 'org-cut-subtree) (lambda () nil)))
(org-archive-subtree)))

(defun my/org-archive-logbook ()
  (interactive)
  (my/org-archive-without-delete)
  (my/org-archive-delete-logbook))
#+end_src

Best,
Ihor



Unable to resolve link; aborting: "roam:git"

2022-03-13 Thread c.buhtz
In real I (try to) use ox-hug to export my org-files (org-roam-v2) to
markdown (and later to HTML).

After analyzing the my debug output [1] the ox-hugo people pointed me to
org-roam community because the error is "thrown" (correct term in
emas-lisp=?) by "org-export-resolve-fuzzy-link".

"org-export-with-broken-links" is set to "t" (checked via "C-h v").

It is my will that this link is dead. That is not an error for me in my
environment/workflow they are reminders for me.

This is the full debug output (incl. line numbers):

  1 Debugger entered--Lisp error: (org-link-broken "roam:git")
  2   signal(org-link-broken ("roam:git"))
  3   org-export-resolve-fuzzy-link((link (:type "fuzzy" :path
 "roam:git" :format bracket :raw-link "roam:git" :appli$
  4   #f(compiled-function (link) #)((link
 (:type "fuzzy" :path "roam:git" :format bracket :$
  5   #f(compiled-function (--data) #)((link
 (:type "fuzzy" :path "roam:git" :format bracket$
  6   mapc(#f(compiled-function (--data) #)
 (#("SSH-Key for Codeberg.org erstellen, um ohne $
  7   #f(compiled-function (--data) #)((paragraph (:begin 155 :end 294 :contents-begin 155 :$
  8   mapc(#f(compiled-function (--data) #)
 ((paragraph (:begin 155 :end 294 :contents-begin$
  9   #f(compiled-function (--data) #)((section (:begin 155 :end 295 :contents-begin 155 :co$
 10   mapc(#f(compiled-function (--data) #)
 ((section (:begin 155 :end 295 :contents-begin 1$
 11   #f(compiled-function (--data) #)((headline (:raw-value "Ziel" :begin 148 :end 295 :pre$
 12   mapc(#f(compiled-function (--data) #)
 ((section (:begin 1 :end 148 :contents-begin 1 :$
 13   #f(compiled-function (--data) #)((org-data nil (section (:begin 1 :end 148 :contents-b$
 14   org-element-map((org-data nil (section (:begin 1 :end 148
 :contents-begin 1 :contents-end 148 :post-blank 0 :po$
 15   org-hugo--get-pre-processed-buffer()
 16   org-hugo-export-wim-to-md(:all-subtrees)
 17   (save-current-buffer (set-buffer (find-file-noselect org-file))
 (message (format "[ox-hugo/export-all file %d/%$
 18   (let ((org-file (car --dolist-tail--))) (save-current-buffer
 (set-buffer (find-file-noselect org-file)) (messag$
 19   (while --dolist-tail-- (let ((org-file (car --dolist-tail--)))
 (save-current-buffer (set-buffer (find-file-nose$
 20   (let ((--dolist-tail-- org-files)) (while --dolist-tail-- (let
 ((org-file (car --dolist-tail--))) (save-current$
 21   (progn (message (format (if dont-recurse "[ox-hugo/export-all]
 Exporting %d files from %S .." "[ox-hugo/export-$
 22   (if (= 0 num-files) (message (format "No Org files found in %s"
 search-path)) (progn (message (format (if dont-$
 23   (let* ((org-files-root-dir (or org-files-root-dir
 default-directory)) (dont-recurse (or dont-recurse (and curre$
 24   ox-hugo/export-all("~/tab-cloud/my.org-roam")
 25   eval((ox-hugo/export-all "~/tab-cloud/my.org-roam") t)
 26   eval-expression((ox-hugo/export-all "~/tab-cloud/my.org-roam")
 nil nil 127)
 27   funcall-interactively(eval-expression (ox-hugo/export-all
 "~/tab-cloud/my.org-roam") nil nil 127)
 28   call-interactively(eval-expression nil nil)
 29   command-execute(eval-expression)


[1] -- 



Re: Re: Please add support for dlangs packagemanager to ob-C.el

2022-03-13 Thread Christian Köstlin
Hi Thierry,

thanks for your feedback and please let me know if I should change
anything to fit
better into the org-mode codebase.



> Easily adding DLang dependencies while keeping a single code block seems
> quite useful.
> I will take a deeper look at your proposal.
> Also, you marked your patch as TINYCHANGE, which imply it is less than
> 15 lines long. However your patch is 24 lines long. This requires that
> you assign the copyright for your contributions to the FSF. Have you
> signed the assignment? More on this process here:
> https://orgmode.org/contribute.html

Thanks for the hint. I filled and sent out the form, but did not yet
hear anything back.
Not sure if I can manage to squeeze the patch into 15 lines so I try
to do the signing.


Kind regards,
Christian


Code blocks and quotes export style

2022-03-13 Thread Sébastien Gendre
Hello everyone. _o/

When I export an Org file to LaTeX and finally PDF, the code blocks and quotes 
often exceed the width of the page.

Is it possible to set some style of the exported blocks ? Like we can set the 
size for images ? I can't found it.

Thanks for your help.


Séb