Re: Setting the default todo priority ?

2023-01-10 Thread David Masterson
Nick Dokos  writes:

> David Masterson  writes:
>
>> I see that Org treats TODOs without a priority cookie as having a
>> priority that is midway between highest and lowest.
>>
>> Use case: I may have a task type that fully expresses what it's priority
>> is.  Example would be SOMEDAY which is going to have the lowest
>> priority.  Adding a cookie to all SOMEDAY tasks seems superfluous.
>>
>> Is there a way of changing the default priority?
>
> C-h v org-priority-{highest,lowest,default}

Doh!  That was obvious.  I'm getting old.  Thanks.

-- 
David Masterson



Re: Setting the default todo priority ?

2023-01-10 Thread Nick Dokos
David Masterson  writes:

> I see that Org treats TODOs without a priority cookie as having a
> priority that is midway between highest and lowest.
>
> Use case: I may have a task type that fully expresses what it's priority
> is.  Example would be SOMEDAY which is going to have the lowest
> priority.  Adding a cookie to all SOMEDAY tasks seems superfluous.
>
> Is there a way of changing the default priority?

C-h v org-priority-{highest,lowest,default}

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [PATCH] lisp/ob-octave.el, was [PATCH] rfc: using ert-deftest with side-effects

2023-01-10 Thread Leo Butler
On Sat, Jan 07 2023, Leo Butler  wrote:

> On Fri, Jan 06 2023, Ihor Radchenko  wrote:
>
>>
>> Leo Butler  writes:
>>
 https://builds.sr.ht/~bzg/job/914954
 2 unexpected results:
FAILED  ob-octave/graphics-file  ((should-not (get-buffer "*Org-Babel
Error Output*")) :form (get-buffer "*Org-Babel Error Output*") :value
#) 
FAILED  ob-octave/graphics-file-space  ((should-not (get-buffer
"*Org-Babel Error Output*")) :form (get-buffer "*Org-Babel Error
Output*") :value #) 

 As you can see *Org-Babel Error Output* buffer does not exist when
 running the test.

 Leo, could you please take a look?
>>>
>>> An earlier test is creating that *Org Babel Error Output* buffer.
>
> I will try to look into improving the tests so that we can trap the test(s)
> that is(are) creating that error buffer.

See the attachment. There are four test failures that are currently
untrapped. I also see the `buffer-live-p' bug. 

Leo

#+AUTHOR: Leo Butler
#+DATE: 10 Jan 2023
#+TITLE: False positives in ~org~ tests
#+STARTUP: show2levels

* Summary
Applying the [[patch-to--org-test-with-temp-text]] reveals 4 tests that fail, but which are passed with the unpatched ~org-test-with-temp-text~ macro.
The next sections show the test failures. References:
- *Org-Babel Error Output* :: [[https://orgmode.org/list/87bknh5nva.fsf@localhosthttps://orgmode.org/list/87bknh5nva.fsf@localhost]]
- buffer-live-p :: [[https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60626]]
  
#+name: patch-to--org-test-with-temp-text
#+begin_example
diff --git a/testing/org-test.el b/testing/org-test.el
index 22ac60670..7909f36cc 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -196,7 +196,18 @@ otherwise place the point at the beginning of the inserted text."
 	   (insert inside-text)
 	   (goto-char (point-min
(font-lock-ensure (point-min) (point-max))
-   ,@body)))
+   (prog1
+   (progn ,@body)
+ (unwind-protect
+ (should-not (buffer-live-p (get-buffer "*Org-Babel Error Output*")))
+   (when (get-buffer "*Org-Babel Error Output*")
+ (message "Detected: *Org-Babel Error Output*")
+ (message "Contents:")
+ (message (with-current-buffer "*Org-Babel Error Output*"
+(buffer-substring-no-properties (point-min) (point-max
+ (message "End:")
+ (kill-buffer "*Org-Babel Error Output*"
+ )))
 
 (defmacro org-test-with-temp-text-in-file (text  body)
   "Run body in a temporary file buffer with Org mode as the active mode.
   #+end_example
* Command
The tests are run in-place like so:
#+begin_src sh :exports none :results raw drawer
make test-dirty
#+end_src

* Test Failures
** Failure 1
#+begin_example
Detected: *Org-Babel Error Output*
Contents:
/tmp/tmp-orgtest/fortran-src-ym6m0X.F90:5:17:

5 | write (*, ’(i2)’), nint(s(1,2))
  | 1
Warning: Legacy Extension: Comma before i/o item list at (1)
[ Babel evaluation exited with code 0 ]
/tmp/tmp-orgtest/fortran-src-EYVgCk.F90:5:17:

5 | write (*, ’(i2)’), nint(s(2,3))
  | 1
Warning: Legacy Extension: Comma before i/o item list at (1)
[ Babel evaluation exited with code 0 ]
/tmp/tmp-orgtest/fortran-src-SwTuHS.F90:5:20:

5 | write (*, ’(3f5.2)’), s
  |1
Warning: Legacy Extension: Comma before i/o item list at (1)
[ Babel evaluation exited with code 0 ]
/tmp/tmp-orgtest/fortran-src-xnH1cO.F90:5:20:

5 | write (*, ’(2f5.2)’), s
  |1
Warning: Legacy Extension: Comma before i/o item list at (1)
[ Babel evaluation exited with code 0 ]
End:
Test ob-java/args-quoted-string backtrace:
  ert-fail(((should-not (buffer-live-p (get-buffer "*Org-Babel Error O
  (if (not (unwind-protect (setq value-1015 (apply fn-1013 args-1014))
  (let (form-description-1017) (if (not (unwind-protect (setq value-10
  (let ((value-1015 'ert-form-evaluation-aborted-1016)) (let (form-des
  (let* ((fn-1013 #'buffer-live-p) (args-1014 (condition-case err (let
  (unwind-protect (let* ((fn-1013 #'buffer-live-p) (args-1014 (conditi
  (prog1 (progn (let* ((fn-1008 #'string=) (args-1009 (condition-case 
  (progn (org-mode) (let ((point (string-match "" inside-text))
  (unwind-protect (progn (org-mode) (let ((point (string-match ")
  :value t))
   FAILED71/1116  ob-java/args-quoted-string (0.313545 sec)
#+end_example
** Failure 2
#+begin_example
Detected: *Org-Babel Error Output*
Contents:
[ Babel evaluation exited with code 1 ]
[ Babel evaluation exited with code 2 ]
End:
Test ob-shell/remote-with-stdin-or-cmdline backtrace:
  ert-fail(((should-not (buffer-live-p (get-buffer "*Org-Babel Error O
  (if (not (unwind-protect (setq value-2299 (apply fn-2297 args-2298))
  (let (form-description-2301) (if (not (unwind-protect (setq value-22
  (let ((value-2299 'ert-form-evaluation-aborted-2300)) (let (form-des
  (let* 

Setting the default todo priority ?

2023-01-10 Thread David Masterson
I see that Org treats TODOs without a priority cookie as having a
priority that is midway between highest and lowest.

Use case: I may have a task type that fully expresses what it's priority
is.  Example would be SOMEDAY which is going to have the lowest
priority.  Adding a cookie to all SOMEDAY tasks seems superfluous.

Is there a way of changing the default priority?
-- 
David Masterson



Re: setting export_file_name during export

2023-01-10 Thread Leo Butler
On Tue, Jan 10 2023, Nick Dokos  wrote:

> Leo Butler  writes:
>
>>>
>>> So: if you insert 
>>>
>>>   :PROPERTIES:
>>>   :EXPORT_FILE_NAME: lecture-1.pdf
>>>   :END:
>>>
>>
>> Aha! Thank you very much. I had forgotten about using property
>> drawers. It would be a simple matter to create a filter to insert that
>> property drawer under the heading that contains point.
>>
>
> IIUC, you really don't need to insert things dynamically: you can add
> an appropriate property drawer after every top-level heading once and
> for all.

Yes, you are correct. And, in fact, the naïve way to insert the property
dynamically (using ~org-export-before-processing-hook~) does not work:

#+name: does-not-work
#+begin_src emacs-lisp :exports none
  (defun ltb-org-insert-export-file-name (backend)
(save-excursion
  (goto-char (point-min))
  (while (search-forward-regexp "^[*] Lecture \\([0-9]+\\)" nil t)
(forward-line 1)
(let ((num (match-string 1)))
  (unless (looking-at "^:PROPERTIES:")
(let ((pty (format ":PROPERTIES:\n:EXPORT_FILE_NAME: 
lecture-%s.pdf\n:END:\n" num)))
  (insert pty)
  (message (buffer-substring-no-properties (point-min) 
(point-max)
  (add-hook 'org-export-before-processing-hook 'ltb-org-insert-export-file-name)
#+end_src

The property drawer is ignored, presumably because org has already
scanned the file and determined the filename. I guess one would need to
reach inside the document structure and alter the filename there, but I
don't have that knowledge.

Suggestions are welcome.

Leo

Re: [QUERY] Anyone using multiple org-preview-latex-process-alist commands?

2023-01-10 Thread Nick Dokos
Timothy  writes:

> Hi All,
>
> In my rewrite of the LaTeX preview system, I’m finding it a bit
> annoying dealing with the potential of multiple commands being used
> in the `org-preview-latex-process-alist'’s
> `:latex-compiler'/`:latex-precompiler'/`:image-converter'
> properties.
>
> I’m hence considering adding support for a string value, and
> deprecating support for multiple-command lists.
>
> Does anybody actually use multiple commands? If so, for what
> purpose?
>

I guess I misunderstood you: you are objecting to e.g. the
:latex-compiler value being a list, rather than a single string.

I think that was modeled after `org-latex-pdf-process' which is a list
of commands because LaTeX needed to be run multiple times in various
cases, so originally, this was a list of three invocations of LaTeX
("what I tell you three times is true"). With `latexmk' and similar,
that has thankfully become a thing of the past, so a single command is
enough, but making it not a list is probably going to break backward
compatibility.

OTOH, although I seem to have modified some details of
`org-preview-latex-process-alist', I have not added multiple commands
for any of the above. But it's conceivable that someone has - although
it's probably less likely than with `org-latex-pdf-process' - so you
may hear complaints in some distant future about it :-) 

So assuming that I've understood you correctly this time, I have no
objection to simplifying (at least, I cannot think of any ATM).

-- 
Nick




Re: [QUERY] Anyone using multiple org-preview-latex-process-alist commands?

2023-01-10 Thread Nick Dokos
Timothy  writes:

> Hi All,
>
> In my rewrite of the LaTeX preview system, I’m finding it a bit
> annoying dealing with the potential of multiple commands being used
> in the `org-preview-latex-process-alist'’s
> `:latex-compiler'/`:latex-precompiler'/`:image-converter'
> properties.
>
> I’m hence considering adding support for a string value, and
> deprecating support for multiple-command lists.
>
> Does anybody actually use multiple commands? If so, for what purpose?
>

I have entries for `dvipng', `dvisvgm' and `imagemagick' in that
variable (with different values for the various processors). I use
mostly imagemagick for my purposes, but I've used the other two
occasionally when I had to debug other people's setups.

I find the setup flexible and easy to deal with: what do you find
annoying about it?

-- 
Nick




Re: TODO state for heading intersection?

2023-01-10 Thread Nick Dokos
Jean Louis  writes:

> Is there a way to change TODO state for intersection of headings,
> for example, for some headings by tag to change the TODO state at
> once?

IIUC, you can use `org-map-entries` to apply the function `org-todo`
(or a different function if you want) to a collection of nodes in a
file that are specified through tags/properties matches:

   (org-map-entries #'org-todo "LEVEL=1" 'file)

will apply it to top-level nodes only.

See

   (info "(org)Using the Mapping API")

and

   (info "(org)Matching tags and properties")

-- 
Nick




Re: setting export_file_name during export

2023-01-10 Thread Nick Dokos
Leo Butler  writes:

>>
>> So: if you insert 
>>
>>   :PROPERTIES:
>>   :EXPORT_FILE_NAME: lecture-1.pdf
>>   :END:
>>
>
> Aha! Thank you very much. I had forgotten about using property
> drawers. It would be a simple matter to create a filter to insert that
> property drawer under the heading that contains point.
>

IIUC, you really don't need to insert things dynamically: you can add
an appropriate property drawer after every top-level heading once and
for all.

-- 
Nick





[BUG] org-element-cache warning while capturing [9.6 (release_9.6-204-g2f7052.dirty @ /home/grfz/src/org-mode/lisp/)]

2023-01-10 Thread Gregor Zattler
Dear org-mode developers, I caught this org-element--cache:
Warning(*Capture*) with `max-lisp-eval-depth` set to 32000.
With a value of 16000 I got
org-capture: Capture abort: Lisp nesting exceeds ‘max-lisp-eval-depth’: 16001
With a value of 16 I got a segfault and the backtrace
was so huge it took too long to generate it.



So this is with 

Emacs  : GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, cairo version 1.16.0)
 of 2023-01-04
Package: Org mode version 9.6 (release_9.6-204-g2f7052.dirty @ 
/home/grfz/src/org-mode/lisp/)

and max-lisp-eval-depth set to 32000:


 ■  Warning (org-element-cache): org-element--cache: Warning(*Capture*): (nil) 
Cached element is incorrect in *Capture*. (Cache tic up to date: "yes") 
Resetting.
If this warning appears regularly, please report the warning text to Org mode 
mailing list (M-x org-submit-bug-report).
The element is: "(headline (:raw-value \"7f8d26507d7a6f4104411c314ed8adcf\" 
:begin 1 :end 267 :pre-blank 0 :contents-begin 17 :contents-end 267 
:robust-begin 60 :robust-end 265 :level 1 :priority nil :tags nil :todo-keyword 
\"TODO\" :todo-type todo :post-blank 0 :footnote-section-p nil :archivedp nil 
:commentedp nil :post-affiliated 1 :ID \"%(org-id-new)\" :title 
\"7f8d26507d7a6f4104411c314ed8adcf\" :mode first-section :granularity element 
:cached t :parent (org-data (:begin 1 :contents-begin 1 :contents-end 267 :end 
267 :robust-begin 3 :robust-end 265 :post-blank 0 :post-affiliated 1 :path nil 
:mode org-data :CATEGORY nil :cached t)) :org-element--cache-sync-key (1 . 1)))"
 The real element is: "(headline (:raw-value 
\"7f8d26507d7a6f4104411c314ed8adcf\" :begin 1 :end 265 :pre-blank 0 
:contents-begin 17 :contents-end 265 :robust-begin 60 :robust-end 263 :level 1 
:priority nil :tags nil :todo-keyword #(\"TODO\" 0 4 (face (org-todo 
org-level-1) fontified t)) :todo-type todo :post-blank 0 :footnote-section-p 
nil :archivedp nil :commentedp nil :post-affiliated 1 :ID \"%(org-id-new)\" 
:title \"7f8d26507d7a6f4104411c314ed8adcf\" :mode first-section :granularity 
element :parent (org-data (:begin 1 :contents-begin 1 :contents-end 265 :end 
265 :robust-begin 3 :robust-end 263 :post-blank 0 :post-affiliated 1 :path nil 
:mode org-data :CATEGORY nil"
 Cache around :begin:
nil
(headline (:raw-value "%? %^{}G" :begin 1 :end 267 :pre-blank 0 :contents-begin 
17 :contents-end 267 :robust-begin 60 :robust-end 265 :level 1 :priority nil 
:tags nil :todo-keyword "TODO" :todo-type todo :post-blank 0 
:footnote-section-p nil :archivedp nil :commentedp nil :post-affiliated 1 :ID 
"%(org-id-new)" :title "%? %^{}G" :mode first-section :granularity element 
:cached t :parent (org-data (:begin 1 :contents-begin 1 :contents-end 267 :end 
267 :robust-begin 3 :robust-end 265 :post-blank 0 :post-affiliated 1 :path nil 
:mode org-data :CATEGORY nil :cached t)) :org-element--cache-sync-key (1 . 1)))
nil
Backtrace:
  org-element-cache diagnostics(*Capture*): org-element-cache: Finished 
process. The cache size is 2. The remaining sync requests: "([16 17 107 160 ... 
0])"
  org-element-cache diagnostics(*Capture*): Phase 0 deleted all elements in 
cache after 16!
  org-element-cache diagnostics(*Capture*): Decreasing cache size to 2
  org-element-cache diagnostics(*Capture*): removing (1 . 16)::"(section 
(:begin 17 :end 107 :contents-begin 17 :contents-end 107 :robust-begin 17 
:robust-end 105 :post-blank 0 :post-affiliated 17 :mode section :granularity 
element :cached t :parent (headline (:raw-value \"%? %^{}G\" :begin 1 :end 267 
:pre-blank 0 :contents-begin 17 :contents-end 267 :robust-begin 60 :robust-end 
265 :level 1 :priority nil :tags nil :todo-keyword \"TODO\" :todo-type todo 
:post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil 
:post-affiliated 1 :ID \"%(org-id-new)\" :title \"%? %^{}G\" :mode 
first-section :granularity element :cached t :parent (org-data ...) 
:org-element--cache-sync-key (1 . 1))) :org-element--cache-sync-key (1 . 16)))"
  org-element-cache diagnostics(*Capture*): Phase 0
  org-element-cache diagnostics(*Capture*): org-element-cache: Processing 
request [16 17 107 160 (headline (:raw-value "%? %^{}G" :begin 1 :end 267 
:pre-blank 0 :contents-begin 17 ...)) 0] up to 85-267, next: nil
  org-element-cache diagnostics(*Capture*): Syncing down to 85-267
  org-element-cache diagnostics(*Capture*): Adding new phase 0 request
  org-element-cache diagnostics(*Capture*): Submitting new synchronization 
request for [85..267]흙-2
  org-element-cache diagnostics(*Capture*): org-capture is about to modify 
text: warning nil
  org-element-cache diagnostics(*Capture*): After change
  org-element-cache diagnostics(*Capture*): org-capture is about to modify 
text: warning nil
  org-element-cache diagnostics(*Capture*): Extending to non-robust element 
"(section (:begin 17 :end 107 :contents-begin 17 :contents-end 107 
:robust-begin 17 :robust-end 105 :post-blank 0 :post-affiliated 17 :mode 
section :granularity element :cached t :parent 

Re: columnview over file not working

2023-01-10 Thread Vlastimil Vondra
OK, I found out that it is not working if the file (reading_list.org) is
not opened in the buffer. If opened then it works all right.

I guess it should be working like that.

BR,
V.

On Tue, 10 Jan 2023 at 10:45, Vlastimil Vondra 
wrote:

> Hi,
> when I try to do this:
>
> #+COLUMNS: %28AUTHOR(Author) %32ITEM(Name) %TODO %TAGS(Tags)
> %CLOSED(Closed) %STARTED(Started)
>
> #+BEGIN: columnview :id "file:~/Org/reading_list.org"
>
> #+END:
>
> I'm getting wrong type argument stringp nil error. Filepath is good
> otherwise some different error is popping and columnview is working in that
> file. Do you know what can be wrong?
>
> Org mode version 9.6
> GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13
>
> Best regards,
> Vlastimil Vondra
>


columnview over file not working

2023-01-10 Thread Vlastimil Vondra
Hi,
when I try to do this:

#+COLUMNS: %28AUTHOR(Author) %32ITEM(Name) %TODO %TAGS(Tags)
%CLOSED(Closed) %STARTED(Started)

#+BEGIN: columnview :id "file:~/Org/reading_list.org"

#+END:

I'm getting wrong type argument stringp nil error. Filepath is good
otherwise some different error is popping and columnview is working in that
file. Do you know what can be wrong?

Org mode version 9.6
GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13

Best regards,
Vlastimil Vondra


Re: [QUERY] Anyone using multiple org-preview-latex-process-alist commands?

2023-01-10 Thread Fraga, Eric
On Tuesday, 10 Jan 2023 at 16:15, Timothy wrote:
> Does anybody actually use multiple commands? If so, for what purpose?

If it helps, I didn't even know this variable existed.

However, implicitly, I guess I've used it in that I specific one of the
three methods in my documents, sometimes switching between alternatives
depending on the type of LaTeX snippets I have in my document and how I
am going to use the exported version.  I guess you will still enable
alternative methods for image generation?

-- 
: Eric S Fraga, with org release_9.6-201-gb58fba in Emacs 30.0.50


[QUERY] Anyone using multiple org-preview-latex-process-alist commands?

2023-01-10 Thread Timothy
Hi All,

In my rewrite of the LaTeX preview system, I’m finding it a bit annoying dealing
with the potential of multiple commands being used in the
`org-preview-latex-process-alist'’s
`:latex-compiler'/`:latex-precompiler'/`:image-converter' properties.

I’m hence considering adding support for a string value, and deprecating support
for multiple-command lists.

Does anybody actually use multiple commands? If so, for what purpose?

All the best,
Timothy

-- 
Timothy (‘tecosaur’/‘TEC’), Org mode contributor.
Learn more about Org mode at .
Support Org development at ,
or support my work at .