Re: [FR] org-num-mode inverse defaults

2023-10-16 Thread tomas
On Mon, Oct 16, 2023 at 08:39:14PM +0200, Maske wrote:
> Hi Ihor
> 
> I added: (setq org-global-properties '(("UNNUMBERED" . "t")))

This Elisp code has to be evaluated. Just adding it in an Org
file won't do that.

Where did you add it,and how?

Cheers
-- 
t


signature.asc
Description: PGP signature


[BUG] Search leaves draws open [9.7-pre (release_9.6.10-835-gf3de4c @ ~/.emacs.d/org-mode-git/lisp/)]

2023-10-16 Thread Paul Stansell
Hello,

Using Ctrl-S to search an org file leaves drawers open after the search.
For example, open the attached org file, search_bug.org, and, with the
cursor initially at the first line of the file, search for "text" with
- Ctrl-s text
This finds the first occurrence of "text" in "Subsection 1".  Then press
Ctrl-a to go to the beginning of the line.  At this point all the drawers
in "Subsection 1" are opened and left open.  They are not closed by
Shift-tab visibility cycling.

This doesn't happen with Org mode version 9.5.5 (release_9.5.5).

Thanks,

Paul


Emacs  : GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0)
 of 2023-03-16, modified by Debian
Package: Org mode version 9.7-pre (release_9.6.10-835-gf3de4c @
~/.emacs.d/org-mode-git/lisp/)

current state:
==
(setq
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
   org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
 org-cycle-optimize-window-after-visibility-change
 org-cycle-display-inline-images)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
  [add-hook change-major-mode-hook org-fold-show-all append
   local]
  5]
#[0 "\300\301\302\303\304$\207"
  [add-hook change-major-mode-hook org-babel-show-result-all
   append local]
  5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-confirm-shell-link-function 'yes-or-no-p
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-speed-command-hook '(org-speed-command-activate
 org-babel-speed-command-activate)
 org-persist-directory "/tmp/org-persist-Fs6tWx"
 org-fold-core-isearch-open-function 'org-fold--isearch-reveal
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
 org-babel-header-arg-expand)
 org-link-shell-confirm-function 'yes-or-no-p
 org-babel-pre-tangle-hook '(save-buffer)
 org-agenda-loop-over-headlines-in-active-region nil
 org-occur-hook '(org-first-headline-recenter)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
  ("id" :follow org-id-open)
  ("eww" :follow org-eww-open :store org-eww-store-link)
  ("rmail" :follow org-rmail-open :store
org-rmail-store-link)
  ("mhe" :follow org-mhe-open :store org-mhe-store-link)
  ("irc" :follow org-irc-visit :store org-irc-store-link
:export org-irc-export)
  ("info" :follow org-info-open :export org-info-export
:store org-info-store-link :insert-description
org-info-description-as-command)
  ("gnus" :follow org-gnus-open :store
org-gnus-store-link)
  ("docview" :follow org-docview-open :export
org-docview-export :store org-docview-store-link)
  ("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
  ("bbdb" :follow org-bbdb-open :export org-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb-store-link)
  ("w3m" :store org-w3m-store-link)
  ("doi" :follow org-link-doi-open :export
org-link-doi-export)
  ("file+sys") ("file+emacs")
  ("shell" :follow org-link--open-shell)
  ("news" :follow
#[514 "\301\300\302 Q \"\207"
 ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("mailto" :follow
#[514 "\301\300\302 Q \"\207"
 ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("https" :follow
#[514 "\301\300\302 Q \"\207"
 ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("http" :follow
#[514 "\301\300\302 Q \"\207"
 ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
  ("ftp" :follow
#[514 "\301\300\302 Q \"\207" ["ftp" browse-url ":"]
 6 "\n\n(fn URL ARG)"]
)
  ("help" :follow org-link--open-help :store
org-link--store-help)
  ("file" :complete org-link-complete-file)
  ("elisp" :follow org-link--open-elisp))
 org-metaup-hook '(org-babel-load-in-session-maybe)
 )
-- 
Paul
#+STARTUP: content
* Section

** STARTED Subsection 1
   :LOGBOOK:
   - State "STARTED"from  [2022-04-25 Mon 10:56]
   :END:
   :CLOCK:
   CLOCK: [2023-01-29 Sun 19:10]--[2023-01-29 Sun 19:34] =>  0:24
   CLOCK: [2023-01-28 Sat 21:24]--[2023-01-28 Sat 21:53] =>  0:29
   CLOCK: [2022-04-26 Tue 15:48]--[2022-04-26 Tue 16:43] =>  0:55
   CLOCK: [2022-04-25 Mon 10:56]--[2022-04-25 Mon 11:36] =>  0:40
   :END:
 
   text

** STARTED Subsection 2
   :LOGBOOK:
   - State 

Re: [BUG] org agenda showing current time - not task time when closing repeatedly-scheduled task [9.7-pre (release_9.6.10-840-g9fcbd1 @ /home/d/src/git-org-mode/lisp/)]

2023-10-16 Thread Daniel Ortmann

A bit more clarity ...

 * If the task clock is activated on a TODO in the agenda,
 * and closed quickly enough that the elapsed time is 0:00,
 * then MOMENTARILY the agenda shows the CURRENT WALLCLOCK TIME.
 * The actual logbook entry shows the correct 0:00 elapsed task time.
 * And when the agenda is merely REFRESHED the wallclock time is
   replaced with the 0:00.


So there seems to be NO BUG.  It's just an odd transient behavior which 
I now noticed only because of tracking "time" on some small tasks.


Definitely not worth touching brittle code.  "It's just how it is."

And that's ok!  :-)

Thank you for your attention to this matter which now is clearly smaller 
than expected.


On 10/16/23 02:38, Ihor Radchenko wrote:

Daniel Ortmann  writes:


No, no, not clock check mode.

- I created a TODO with a scheduled time that repeats.  When completed
it remains alive to be scheduled the next day.

- I started the clock on that TODO task.

- Then completed the task with 't' in the Agenda view.

- The task's "clock time" shows in the log ... i.e. how much time I
spent completing that task.

Ok. Got it.


==>> Previously, a day or so ago, the current local time was recorded in
the Agenda log rather than the "clock time" (i.e. rather than the time
spent to complete the task).

==>> Now, the current "clock time" again is correctly recorded in the log.

I looked into the code, and I do have a feeling that it is brittle
(agenda is a very old and convoluted code), but without a concrete
reproducer I wouldn't dare to touch it.


I hope the screen captured images came across in the previous email?
They should help explain.

I indeed did not notice the attachments - they were not indicated in the
plain/text part of the email. They indeed did help to explain things.



Re: Case insensitivity of simple [[links]]

2023-10-16 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> Note that there is generally no guarantee that [[name]] link will be
> exported as "name" by any particular backend. Your workaround with
> num:nil is just a workaround that may or may not work in future.

I did not know this is considered a workaround!  I have always thought
this is how Org is specified to work (as in tests).

> I can see how this can be helpful in certain scenarios.
> I made headline and radio target link matching case-insensitive on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ed42dc34a
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ec2399330

Wait, did you just solve my *biggest* problem with Org?  OMG!

One more question before I declare a full victory: I want my notebook to
show literal links by default, but the following does not seem to work:

# -*- fill-column: 79; org-link-descriptive: nil -*-

The line seems to confuse Org in that not only it shows descriptive
links but the first call to 'org-toggle-link-display' does nothing.

Rudy
-- 
"'Obvious' is all too often a synonym for 'wrong'."
-- Jeff Erickson, Algorithms, 2019

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



Re: [FR] org-num-mode inverse defaults

2023-10-16 Thread Maske

Hi Ihor

I added: (setq org-global-properties '(("UNNUMBERED" . "t")))

But it doesn't work, every headline is numbered. (Not tried in emacs -q).

Bests


On 15/10/2023 14:40, Ihor Radchenko wrote:

Maske  writes:


  From the first day, I liked org-num-mode, but I think that its default
which numbers all headlines could be problematic.

Right now it only has the options to exclude headlines from being
numbered, so it could be necessary to modify a big amount of headlines,
for numbering just a tree.

I think it would be helpful to have a "positive" way to numbering
headlines, for example "NUMBERED" keyword, while all the other headlines
stay unnumbered.

You can simply set UNNUMBERED property to t for the whole document via
#+PROPERTY keyword or by customizing `org-global-properties'. Then, the
headings that should be numbered should have their UNNUMBERED set to nil.


Re: org-agenda t giving "Wrong type argument: stringp, nil"

2023-10-16 Thread William Denton

On 11 October 2023, Ihor Radchenko wrote:


Thanks for reporting!
I am unable to reproduce the problem on my side, unfortunately.
May you enable `debug-on-error' and post the backtrace? Or provide a
reproducer.


Whatever my problem was, it has now gone away.  I updated the source tree and 
all was fine.  Whew!



Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada
CO₂: 419.81 ppm (Mauna Loa Observatory, 2023-10-15)

Re: Comments following not-really-affiliated keywords are becoming paragraphs

2023-10-16 Thread Tom Alexander
Thanks!

--
Tom Alexander
pgp: https://fizz.buzz/pgp.asc



Incorrect quantity of en-spaces

2023-10-16 Thread Tom Alexander
The org-mode syntax document describes entities as:
> \NAME POST
> \NAME{}
> Where NAME and POST are not separated by a whitespace character.

and POST is defined as:
> Either the end of line or a non-alphabetic character.

So using the test document:
```
\_   Foo
```
(a backslash, underscore, three spaces, and then the word Foo)

I would expect to get only 2 en-spaces but I am getting 3. Looking at 
org-entities, an underscore with 2 spaces gets 2 en-spaces, whereas an 
underscore with 3 spaces gets 3 en-spaces, but if we match all 3 spaces as NAME 
then POST becomes invalid because "F" is neither the end of the line nor a 
non-alphabetic character, so we can only match the first two spaces as NAME.

emacs version: 29.1
org-mode version: 9bbc21df84d507e568a3ebd17e105cdb9e163784 (latest in git)

--
Tom Alexander
pgp: https://fizz.buzz/pgp.asc



Re: Clock becomes a paragraph by prefixing with not-really-affiliated-keyword

2023-10-16 Thread Tom Alexander
Thanks!

--
Tom Alexander
pgp: https://fizz.buzz/pgp.asc



Escape :end: inside #+begin_example

2023-10-16 Thread Max Nikulin

Hi,

is there a way to quote a drawer inside a literal example that resides 
in another drawer? Leading comma ",:end:", unlike for ",* Heading" or 
",#+end_src", is not stripped on export or C-c ' (`org-edit-special')


:drawer:
#+begin_src elisp
  ":src:
  %s
  :end:
  "
#+end_src
:end:




Re: [PATCH] ob-core: Fix `org-babel-result-names'

2023-10-16 Thread Ihor Radchenko
hrdl  writes:

> * lisp/ob-core.el (org-babel-result-names): Do not change
>   visibility of windows when called.

Thanks!
Applied, onto bugfix, amending the commit summary to

org-babel-result-names: Do not alter window configuration

I also added you to the contributor list.
https://git.sr.ht/~bzg/worg/commit/112d4eaa

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



[PATCH] ob-core: Fix `org-babel-result-names'

2023-10-16 Thread hrdl
* lisp/ob-core.el (org-babel-result-names): Do not change
  visibility of windows when called.

TINYCHANGE
---
 lisp/ob-core.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index a7c4f2cab..54dcf400e 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2015,12 +2015,12 @@ buffer or nil if no such result exists."
 
 (defun org-babel-result-names ( file)
   "Return the names of results in FILE or the current buffer."
-  (save-excursion
-(when file (find-file file)) (goto-char (point-min))
-(let ((case-fold-search t) names)
+  (with-current-buffer (if file (find-file-noselect file) (current-buffer))
+(org-with-point-at 1
+  (let ((case-fold-search t) names)
   (while (re-search-forward org-babel-result-w-name-regexp nil t)
(setq names (cons (match-string-no-properties 9) names)))
-  names)))
+  names
 
 ;;;###autoload
 (defun org-babel-next-src-block ( arg)
-- 
2.42.0




Re: Should we move constants.el by Carsten Dominik to Org orphanage?

2023-10-16 Thread Bastien Guerry
Ihor Radchenko  writes:

> Bastien Guerry  writes:
>
>> I see no reason not to use
>> https://github.com/cdominik/constants-for-Emacs as the source for
>> constants.el, the package seems stable (as its name suggests...)
>
> I was mostly concerned that a pull request back from 2020 is still
> open.

AFAICT the PR is about whitespaces in the README, so not a blocker.

> That said, there is indeed no rush and actually no urgent need to do
> anything - it is not like we are getting an large inflow of bug reports
> related to constants.el.

Indeed :)

-- 
 Bastien Guerry



Re: [BUG] CI jobs do not appear to be running

2023-10-16 Thread Bastien Guerry
Ihor Radchenko  writes:

> Yasushi SHOJI  writes:
>
>>  It appears that Emacs 27 lacks the optional argument for
>> `get-buffer-create`, while `org-element-parse-secondary-string`
>> relies on it. This problem was introduced by the commit 37d6bde27fe2.
>
> This was not caught by our CI tests for some reason, despite
> make test EMACS=emacs-27 failing locally.
> And the last message in https://lists.sr.ht/~bzg/org-build-failures is a
> month ago.

There was a problem with the oauth token not being able to interact
with the (legacy) builds.sr.ht API.  I've updated the script so that
it now uses the hut utility (see https://git.sr.ht/~emersion/hut) 
and tests are running again.

-- 
 Bastien Guerry



Re: Should we move constants.el by Carsten Dominik to Org orphanage?

2023-10-16 Thread Ihor Radchenko
Bastien Guerry  writes:

> I see no reason not to use
> https://github.com/cdominik/constants-for-Emacs as the source for
> constants.el, the package seems stable (as its name suggests...)

I was mostly concerned that a pull request back from 2020 is still open.

That said, there is indeed no rush and actually no urgent need to do
anything - it is not like we are getting an large inflow of bug reports
related to constants.el.

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



Re: Current Org-mode does not work with Emacs 27

2023-10-16 Thread Ihor Radchenko
Yasushi SHOJI  writes:

>  It appears that Emacs 27 lacks the optional argument for
> `get-buffer-create`, while `org-element-parse-secondary-string`
> relies on it. This problem was introduced by the commit 37d6bde27fe2.

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

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



Re: [BUG] FAILED test-ob-python/session-multiline

2023-10-16 Thread Ihor Radchenko
Jack Kamm  writes:

>> If we can (eventually) remove some custom code from Org and move it to
>> Emacs, it will be the best for working towards RMS request
>> https://orgmode.org/list/e1kiph1-0001lu...@fencepost.gnu.org
>
> I started down this path here:
>
> https://lists.gnu.org/archive/html/emacs-devel/2023-10/msg4.html
>
> But I haven't followed up because I started to have some doubts. In
> particular, `python-shell-send-string-no-output' will terminate once it
> detects a prompt, so if some output looks like it ends in a prompt then
> it will terminate prematurely. Whereas in our current indicator-based
> approach, the user accidentally emitting
> `org-babel-python-eoe-indicator' is unlikely.

This problem is not new - it exist in comint.el itself.
I worked around it in ob-shell by re-defining prompt to be unique - see
`org-babel-shell-set-prompt-commands'. Of course, it is not a universal
solution.

> Another approach I have considered is to redirect sys.stdout from within
> Python. In particular, set it to a custom class inheriting from IOBase
> during the block's execution, that both prints and saves the output. I
> think this approach could ultimately be more robust, and without needing
> to print an ugly indicator token, but it could be complicated to do it
> right.

It may work, although it will affect certain workflows. I know that some
people use a mix of babel session blocks and manual comint buffer
interaction where they type commands manually. Hiding the output may not
be ideal in such scenario.

That said, the described scenario is somewhat buggy already.

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



Re: [BUG] FAILED test-ob-python/session-multiline

2023-10-16 Thread Ihor Radchenko
Jack Kamm  writes:

> Ihor Radchenko  writes:
>
> ...
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=1eb598758980d5fa4d7bb21c98dfc56f42cae59a
>
> Please let me know whether the problem continues, or whether it seems to
> improve.

As soon as we fix CI :/ I think it is not working for the last month.

> As an aside -- I am having a hard time figuring out how to monitor our
> CI for this. When I search in
>
> https://lists.sr.ht/~bzg/org-build-failures
>
> I can only find an example from 11 months ago. The example you sent
> (https://builds.sr.ht/~bzg/job/1047678#task-build) is more recent, but
> is "Unlisted" and doesn't show up when I search for it.

The most recent report in https://lists.sr.ht/~bzg/org-build-failures is
https://lists.sr.ht/~bzg/org-build-failures/%3CCVFCM84I774J.3RMTMSL25EMW2%40cirno2%3E
linking to https://builds.sr.ht/~bzg/job/1055574 where the failing test
is FAILED  test-ob-python/session-multiline

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



[BUG] CI jobs do not appear to be running (was: Current Org-mode does not work with Emacs 27)

2023-10-16 Thread Ihor Radchenko
Yasushi SHOJI  writes:

>  It appears that Emacs 27 lacks the optional argument for
> `get-buffer-create`, while `org-element-parse-secondary-string`
> relies on it. This problem was introduced by the commit 37d6bde27fe2.

This was not caught by our CI tests for some reason, despite
make test EMACS=emacs-27 failing locally.
And the last message in https://lists.sr.ht/~bzg/org-build-failures is a
month ago.

Bastien, may you please check if there is anything wrong with the script
running tests on sr.ht?

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



Re: [BUG] error that came up that freezes the cycle of opening subtrees [9.6.6 (release_9.6.6 @ /snap/emacs/current/usr/share/emacs/29.1/lisp/org/)]

2023-10-16 Thread Ihor Radchenko
Matthew Nelson Hendryx  writes:

> Re: [BUG] error that came up that freezes the cycle of opening subtrees 
> [9.6.6 (release_9.6.6 @ /snap/emacs/current/usr/share/emacs/29.1/lisp/org/)]

Thanks for reporting, but may you also show the error/warning text?

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



Re: [BUG] org agenda showing current time - not task time when closing repeatedly-scheduled task [9.7-pre (release_9.6.10-840-g9fcbd1 @ /home/d/src/git-org-mode/lisp/)]

2023-10-16 Thread Ihor Radchenko
Daniel Ortmann  writes:

> No, no, not clock check mode.
>
> - I created a TODO with a scheduled time that repeats.  When completed 
> it remains alive to be scheduled the next day.
>
> - I started the clock on that TODO task.
>
> - Then completed the task with 't' in the Agenda view.
>
> - The task's "clock time" shows in the log ... i.e. how much time I 
> spent completing that task.

Ok. Got it.

> ==>> Previously, a day or so ago, the current local time was recorded in 
> the Agenda log rather than the "clock time" (i.e. rather than the time 
> spent to complete the task).
>
> ==>> Now, the current "clock time" again is correctly recorded in the log.

I looked into the code, and I do have a feeling that it is brittle
(agenda is a very old and convoluted code), but without a concrete
reproducer I wouldn't dare to touch it.

> I hope the screen captured images came across in the previous email?  
> They should help explain.

I indeed did not notice the attachments - they were not indicated in the
plain/text part of the email. They indeed did help to explain things.

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