Re: [PATCH] Async evaluation in ob-shell

2023-02-08 Thread Matt
I've attached two patches which replace the previous.

I found cleaning the output was dramatically helped by calling 
`buffer-substring-no-properties' instead of `buffer-substring' in 
`org-babel-comint-async-filter'.  I'm not sure why `buffer-substring' was 
originally used.  `make test' shows no failures, so I assume it doesn't make a 
difference...?

  On Tue, 07 Feb 2023 06:40:51 -0500  Ihor Radchenko  wrote --- 
 > That's likely because of the same reasons why prompt did not get cleaned
 > in synchronous blocks earlier. See `org-babel-comint-with-output'.

That, my friend, was a wild ride.

I'm curious about people's feelings on `org-babel-comint-with-output'.

Personally, I get the heebie-jeebies.  I can't shake feeling that there's a 
better way, especially since `org-babel-comint-async-filter' achieves similar 
ends.  My hunch is that other Babel languages may want async and that now would 
be a good time to consolidate the common functionalities of 
`org-babel-comint-with-output' and  `org-babel-comint-async-filter' .   Maybe 
even unify the API.  So far, `org-babel-comint-with-output' touches 9 languages 
and `org-babel-comint-async-filter' appears to touch 2 (soon to be 3).   I 
suspect those numbers will only grow.

I also can't shake the feeling that I might become ob-comint maintainer at some 
point...(not yet!).  I'm curious what people's thoughts are.






01-ob-shell-remove-properties-from-callback-string.patch
Description: Binary data


02-ob-shell-async-non-file.patch
Description: Binary data


Re: Possible error in manual

2023-02-08 Thread TRS-80
J G  writes:

>>
>> 2.2.3 Catching invisible edits
>>
>> Sometimes you may inadvertently edit an invisible part of the buffer and
>> be confused on what has been edited and how to undo the mistake. Setting
>> org-fold-catch-invisible-edits to non-nil helps preventing this. See the
>> docstring of this option on how Org should catch invisible edits and
>> process them
>>
>
>  org-fold-catch-invisible-edits does not exist in Org mode version 9.5.2,
> it should be org-catch-invisible-edits.
>
>
> thanks
> Jim Graf

Hi Jim,

Do you think you might be able to submit a patch?  :)

-- 
Cheers,
TRS-80




Re: Setting the default todo priority ?

2023-02-08 Thread TRS-80
David Masterson  writes:

> 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.

I see that Nick already directly answered your question.

However, I wanted to point out that I think 'todo state' and 'priority'
are orthogonal.  For example, I also use 'SOMEDAY/MAYBE' as one of my
todo states.  However, within that subset, I still also use 'priority'.
In my case, I use it to differentiate between things I might actually
get to soon, vs. those I may truly never get to.

Anyway, just some food for thought.

-- 
Cheers,
TRS-80




Re: [BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)]

2023-02-08 Thread Thomas Worthington
Well, bloody hell.

I can't replicate now. It was about four weeks ago I tripped over 
this and I absolutely saw it in action repeatedly - I could see 
gnuplot loading the same file in its process buffer, and only one 
file being created on-disc too.

Maybe I updated org since then, but I didn't think so.

Sorry to have wasted your time. If it comes back I'll let you 
know.

Computers! Who'd have 'em?

Thomas


On Wed, Feb 08 2023, Ihor Radchenko wrote:

> Thomas Worthington  writes:
>
>> org-babel-gnuplot-process-vars in ob-gnuplot.el makes a 
>> temporary file to store a table imported from the current org 
>> file using :var
>>
>> However, the name of this file does not include the name of the
>> variable or any similar field unique to the data. This means 
>> that if
>> you want to plot data from two tables, they both get the same
>> filename and consequently the second overwrites the first and 
>> the
>> data is incorrect.
>
> May you provide an example of such problem?
>
> I just tried
>
> #+name: table1
> | 1 | 1 |
>
> | 2 | 2 |
> | 3 | 3 |
> | 4 | 4 |
> | 5 | 5 |
>
> #+name: table2
> | 1 | -1 |
>
> | 2 | -2 |
> | 3 | -3 |
> | 4 | -4 |
> | 5 | -5 |
>
> #+begin_src gnuplot :var x=table1 y=table2 :cache no
> plot x, y w l
> #+end_src
>
> And both the tables are correctly plotted.



Re: [TIP] Exporting Maxima results to LaTeX

2023-02-08 Thread Leo Butler
On Wed, Feb 08 2023, Max Nikulin  wrote:

> On 08/02/2023 04:40, Leo Butler wrote:
>> Generate @@latex:\LaTeX{}@@ code from Maxima code.
>
> You can write just LaTeX, ox-latex recognizes such pattern. The bonus
> is the it will be literally exported to HTML.

Thanks.

>
>> #+begin_example
>> ,#+begin_src maxima :tangle maxima-init.lisp :exports none
>>(defun $batchload (file) (mfuncall '$batch file))
>>($load "./maxima-init.mac")
>> ,#+end_src
>> #+end_example
>> On tangling, this produces the ~common-lisp~ output file
>> ~maxima-init.lisp~. It will be pre-loaded into Maxima.
>> #+begin_src maxima :tangle maxima-init.lisp :exports none
>>(defun $batchload (file) (mfuncall '$batch file))
>>($load "./maxima-init.mac")
>> #+end_src
>
> I am curious if it is possible to avoid duplication by e.g. using noweb.

I am not sure what you think is being duplicated. Do you mean the
duplication of the example and src blocks? I am not aware of how to
remove that duplication--all the examples I have found in the worg
source do what I have done above.

>
>> #+begin_src maxima :tangle maxima-init.mac :exports none
>
> At first glance :prologue header argument might be an alternative, but
> likely I have missed something obvious.

The prologue header is put into a temporary source file, along with the
body and epilogue and it is read by Maxima's `batchload' command. So
using a prologue is too late, because I need to overwrite `batchload' by
its more verbose companion `batch'. That is why `maxima-init.lisp' is
pre-loaded.

Leo


Re: [BUG] M-S- does not adjust clock timestamps as described in docs [9.5.5]

2023-02-08 Thread Mark Barton


> On Feb 8, 2023, at 6:11 AM, Robert Nikander  
> wrote:
> 
> I’m pretty much a beginner with the clock features, so I don’t have an 
> opinion yet on how it should work. But yes, it seems like clarifying the 
> manual there would be an improvement. 
> 
> I don’t know what agenda clock check is. Is that a certain function, or 
> agenda view? Searching the manual and functions for that term didn’t yield 
> anything obvious.

Here is an option that I have been using for a few years now, in case it helps 
you find your solution.

I use org agenda view with log mode on to show clocked entries. The "v c" keys 
bring up the view of clock check
C-c a a l v c

Now to adjust the gaps or overlaps in clocking, I found this package helpful 
versus doing it manually for the entries.
https://github.com/dfeich/org-clock-convenience

I can go to a clock entry that needs adjustment and run the 
org-clock-convenience-fill-gap command and it will adjust the time to be 
contiguous. 

Mark

Re: netspend table

2023-02-08 Thread Jude DaShiell
Yes, I'm using orgmode blind and no I don't have any good resources to
share.



Jude  "There are four boxes to be used in
defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)

.

On Wed, 8 Feb 2023, Dr. Arne Babenhauserheide wrote:

>
> Jude DaShiell  writes:
> > I think if I had known about orgmode when studying adjusted trial balance
> > sheets I would have used it since braille paper has a maximum of 42
> > characters in a line.
>
> Are you using orgmode blind?
>
> If so, do you have a good resource I could send a blind author?
>
> Best wishes,
> Arne
>



Re: [TIP] Exporting Maxima results to LaTeX

2023-02-08 Thread Fraga, Eric
On Wednesday,  8 Feb 2023 at 22:43, Max Nikulin wrote:
> At first glance :prologue header argument might be an alternative, but
> likely I have missed something obvious.

Indeed.  I use, for instance, the following

#+PROPERTY: header-args:maxima :prologue "fpprintprec: 2; linel: 50;"

for my teaching slides to ensure that Maxima output fits on my slides
(and only print relevant digits in the answers).

There's also an epilogue which I use to automatically format the
solution of my Maxima codes (all my examples have a particular form):

#+PROPERTY: header-args:maxima :epilogue "for j: 1 thru length(solution) do 
(print(\"\"), print(\"Solution\", j), print(\"\"), for i: 1 thru 
length(solution[j]) do grind(solution[j][i]))$"

All my Maxima blocks define a "solution" variable.

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


Re: [PATCH] org--batch-store-agenda-views: Fix treatment of lambda functions

2023-02-08 Thread Aaron Zeng
New patch looks good.  Thanks!

On Wed, Feb 8, 2023 at 05:09 Ihor Radchenko  wrote:

> "Aaron L. Zeng"  writes:
>
> > * org-agenda.el (org--batch-store-agenda-views): Fix treatment of
> > lambda functions used as custom agenda commands.
> > `org-agenda-custom-commands' entries may specify a custom function
> > instead of a symbol like `tags-todo'.  `org--batch-store-agenda-views'
> > behaved differently from `org-agenda' when that custom function was
> > defined as a lambda rather than a symbol, incorrectly treating the
> > lambda form as a list of agenda commands.  Instead, use the same test
> > as `org-agenda' does to determine whether the command is a series.
>
> Thanks for the updated patch!
> I am attaching amended version with the comment placed closer to where
> the custom command list is being used.
> I also added TINYCHANGE cookie because you are not listed as a
> contributor with FSF copyright assignment.
>
> Let me know if you have any objections.
>
>
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: [PATCH] worg/org-faq.org: Recommend cb_thunderlink Thunderbird add-on

2023-02-08 Thread Max Nikulin

On 08/02/2023 01:26, Bruno Barbier wrote:

Max Nikulin writes:

A have prepared an alternative patch. Let me know if have suggestions,
objections, or if you prefer to proceed with another revision of your
patch.


Looks good to me.


Thank you for your patience. Updated version:
https://orgmode.org/worg/org-faq.html#mid-url-handler




Re: [TIP] Exporting Maxima results to LaTeX

2023-02-08 Thread Max Nikulin




On 08/02/2023 04:40, Leo Butler wrote:

Generate @@latex:\LaTeX{}@@ code from Maxima code.


You can write just LaTeX, ox-latex recognizes such pattern. The bonus is 
the it will be literally exported to HTML.



#+begin_example
,#+begin_src maxima :tangle maxima-init.lisp :exports none
   (defun $batchload (file) (mfuncall '$batch file))
   ($load "./maxima-init.mac")
,#+end_src
#+end_example

On tangling, this produces the ~common-lisp~ output file ~maxima-init.lisp~. It 
will be pre-loaded into Maxima.

#+begin_src maxima :tangle maxima-init.lisp :exports none
   (defun $batchload (file) (mfuncall '$batch file))
   ($load "./maxima-init.mac")
#+end_src


I am curious if it is possible to avoid duplication by e.g. using noweb.


#+begin_src maxima :tangle maxima-init.mac :exports none


At first glance :prologue header argument might be an alternative, but 
likely I have missed something obvious.






Re: ob-sql dbconnection engine

2023-02-08 Thread Andreas Gerler
Hi Ihor,

I use only MySQL, PostgreSQL and Vertica.
However for me sql-product postgres in my sql-connection-alist works both in 
ob-sql as well as SQLi.
In the end you are still able to overwrite in your src block parameters via 
:engine

Andy

> On Feb 5, 2023, at 11:58 AM, Ihor Radchenko  wrote:
> 
> Andreas Gerler  writes:
> 
>> without the patch your org source block has to look like:
>> 
>> #+begin_src sql :engine mysql :dbconnection mysqldb1
>>  SELECT * FROM nodes;
>> #+end_src
>> 
>> with that patch you can just type
>> 
>> #+begin_src sql :dbconnection mysqldb1
>>  SELECT * FROM nodes;
>> #+end_src
>> 
>> because your engine is mapped to sql-product in your sql-connection-alist:
>> 
>> (setq sql-connection-alist
>>  '((mysqldb1 (sql-product 'mysql)
>>(sql-server "10.10.42.1")
>>(sql-user "dbadmin")
>>(sql-password "foo")
>>(sql-database "testdb"
> 
> Thanks for the explanation!
> This logic assumes that engine names in ob-sql are the same with
> products in `sql-product-alist'. Which is not true. For example, ob-sql
> has postgresql while `sql-product-alist' has postgres.
> 
> Further, some engines are in ob-sql but not in sql.el and vice versa.
> 
> In order to provide auto-detection of sql engine we should first
> synchronize the engine names.
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
> 




Re: [BUG] M-S- does not adjust clock timestamps as described in docs [9.5.5]

2023-02-08 Thread Robert Nikander



> On Feb 8, 2023, at 5:14 AM, Ihor Radchenko  wrote:
> 
> Robert Nikander  writes:
> 
>> […]
>> 
>> If I put point on the minutes of 12:30 (second line) and hit S-M-, it 
>> moves the time to 12:35, but nothing else moves. Based on the docs, I 
>> thought it would shift one of the other lines.
> 
> S-M- only considers clock history during current Emacs session. Will
> clarifying this in the manual suffice for your use-case?
> 
> If not limiting the command to current clock history, we would need to
> look across every single Org file searching for intersecting clocks -
> extremely resource-intensive procedure.
> 
> Note that you can use agenda clock check to catch clock inaccuracies.

I’m pretty much a beginner with the clock features, so I don’t have an opinion 
yet on how it should work. But yes, it seems like clarifying the manual there 
would be an improvement. 

I don’t know what agenda clock check is. Is that a certain function, or agenda 
view? Searching the manual and functions for that term didn’t yield anything 
obvious.





Re: [BUG] :safe predicate for org-link-abbrev-alist does not make sense

2023-02-08 Thread Ihor Radchenko
Qiantan Hong  writes:

> The predicate is currently
> (lambda (val)
> (pcase val
> (`(,(pred stringp) . ,(pred stringp)) t)
> (_ nil)))
>
> This returns true for pairs like ("wiki" . "Blabla"), but such values are 
> invalid.
> org-link-abbrev-alist need to be an ALIST. For any ALIST, the above predicate
> returns NIL.

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

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



Re: [BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)]

2023-02-08 Thread Ihor Radchenko
Thomas Worthington  writes:

> org-babel-gnuplot-process-vars in ob-gnuplot.el makes a temporary file to 
> store a table imported from the current org file using :var
>
> However, the name of this file does not include the name of the variable or 
> any similar field unique to the data. This means that if you want to plot 
> data from two tables, they both get the same filename and consequently the 
> second overwrites the first and the data is incorrect.

May you provide an example of such problem?

I just tried

#+name: table1
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
#+name: table2
| 1 | -1 |
| 2 | -2 |
| 3 | -3 |
| 4 | -4 |
| 5 | -5 |

#+begin_src gnuplot :var x=table1 y=table2 :cache no
plot x, y w l
#+end_src

And both the tables are correctly plotted.

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



[BUG] ob-gnuplot.el can't handle importing more than one table from the current file [9.6.1 ( @ /home/thomas/.emacs.d/elpa/org-9.6.1/)]

2023-02-08 Thread Thomas Worthington
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

https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.



Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, 
cairo version 1.16.0) of 2022-01-24, modified by Debian Package: Org mode 
version 9.6.1 ( @ home/thomas.emacs.d/elpa/org-9.6.1/)

current state:  (setq org-duration-format ’h:mm org-src-mode-hook 
’(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) 
org-after-todo-state-change-hook ’(org-clock-out-if-current) 
org-ctrl-c-ctrl-c-final-hook ’(org-msg-ctrl-c-ctrl-c) 
org-link-shell-confirm-function ’yes-or-no-p org-blank-before-new-entry 
’((heading) (plain-list-item)) org-babel-after-execute-hook 
’(org-display-inline-images) org-metadown-hook 
’(org-babel-pop-to-session-maybe) org-export-with-sub-superscripts nil 
org-refile-targets ’((org-agenda-files :maxlevel . 4)) 
org-html-format-inlinetask-function 
’org-html-format-inlinetask-default-function org-enforce-todo-dependencies t 
org-odt-format-headline-function ’org-odt-format-headline-default-function 
org-persist-before-write-hook ’(org-element–cache-persist-before-write) 
org-agenda-files ’(“home/thomas/orgfiles/worktime.org“ 
”/home/thomas/orgfiles/meetings.org“ ”/home/thomas/orgfiles/todo.org“ 
”/home/thomas/orgfiles/reminders.org“) org-ascii-format-inlinetask-function 
‘org-ascii-format-inlinetask-default org-odt-fontify-srcblocks nil 
org-plantuml-jar-path ”/usr/share/plantuml/plantuml.jar“ org-blocker-hook 
’(org-block-todo-from-children-or-siblings-or-parent 
org-block-todo-from-checkboxes) org-archive-location ”%s.archive::“ 
org-odt-preferred-output-format ”pdf“ org-mode-hook ’(#[0 ”\301\211.\207“ 
[imenu-create-index-function org-imenu-get-tree] 2] my-org-mode-config 
org-tempo-setup ws-butler-mode turn-on-visual-line-mode 
er/add-org-mode-expansions #[0 ”\300\301\302\303\304$\207“ [add-hook 
change-major-mode-hook org-show-block-all append local] 5 ”\n\n(fn)“] #[0 
”\300\301\302\303\304$\207“ [add-hook change-major-mode-hook 
org-babel-show-result-all append local] 5 ”\n\n(fn)“] 
org-babel-result-hide-spec org-babel-hide-all-hashes) 
org-export-with-smart-quotes t org-odt-format-drawer-function #[514 ”\207“ [] 3 
”\n\n(fn NAME CONTENTS)“] org-archive-hook ’(org-attach-archive-delete-maybe) 
org-persist-before-read-hook ’(org-element–cache-persist-before-read) 
org-confirm-elisp-link-function ‘yes-or-no-p org-agenda-before-write-hook 
’(org-agenda-add-entry-text) org-metaup-hook ’(org-babel-load-in-session-maybe) 
org-persist-after-read-hook ’(org-element–cache-persist-after-read) 
org-bibtex-headline-format-function #[257 ”\300.\236A\207“ [:title] 3 ”\n\n(fn 
ENTRY)“] org-latex-format-drawer-function #[514 ”\207“ [] 3 ”\n\n(fn _ 
CONTENTS)“] org-babel-pre-tangle-hook ’(save-buffer) org-tab-first-hook 
’(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) 
org-babel-load-languages ’((ditaa \.t) (dot . t) (forth \.t) (java . t) (js . 
t) (gnuplot . t) (octave . t) (perl . t) (php \.t) (plantuml . t) (R . t) (ruby 
. t) (sed . t) (shell . t) (sql . t) (sqlite . t)) org-log-done ‘time 
org-link-abbrev-alist ’((”piv“ . ”%(make-piv-link)“)) 
org-ascii-format-drawer-function #[771 ”.\207“ [] 4 ”\n\n(fn NAME CONTENTS 
WIDTH)“] org-msg-mode t org-cycle-tab-first-hook 
’(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) 
org-agenda-span ‘fortnight org-agenda-loop-over-headlines-in-active-region nil 
org-src-lang-modes ’((”php“ . php) (”ocaml“ . tuareg) (”elisp“ . emacs-lisp) 
(”ditaa“ . artist) (”asymptote“ . asy) (”dot“ . graphviz-dot) (”sqlite“ . sql) 
(”calc“ . fundamental) (”C“ . c) (”cpp“ . c++) (”C++“ . c++) (”screen“ . 
shell-script) (”shell“ . sh) (”bash“ . sh)) org-msg-greeting-fmt ”\nHi %s,\n\n“ 
org-agenda-prefix-format ’((agenda . ” %i %-12:c%?-12t% s %b“) (timeline . ” % 
s“) (todo . ” %i %-12:c %b“) (tags . ” %i %-12:c“) (search . ” %i %-12:c“)) 
org-fold-core-isearch-open-function ‘org-fold-core–isearch-reveal 
org-occur-hook ’(org-first-headline-recenter) org-cycle-separator-lines 1 
org-enforce-todo-checkbox-dependencies t org-agenda-include-diary t 
org-structure-template-alist ’((”n“ . ”notes“) (”a“ . ”export ascii“) (”c“ . 
”center“) (”C“ . ”comment“) (”e“ . ”example“) (”E“ . ”export“) (”h“ . ”export 
html“) (”l“ . ”export latex“) (”q“ . ”quote“) (”s“ . ”src“) (”v“ . ”verse“)) 
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-todo-keywords ’((sequence ”TODO(t)“ 
”STARTED“ ”|“ ”DONE(-!)“ ”|“ ”CANCELLED(x@)“)) org-speed-command-hook 
’(org-speed-command-activate org-babel-speed-command-activate) org-msg-startup 
”hidestars indent inlineimages“ org-odt-format-inlinetask-function 

[BUG] :safe predicate for org-link-abbrev-alist does not make sense

2023-02-08 Thread Qiantan Hong
The predicate is currently
(lambda (val)
(pcase val
(`(,(pred stringp) . ,(pred stringp)) t)
(_ nil)))

This returns true for pairs like ("wiki" . "Blabla"), but such values are 
invalid.
org-link-abbrev-alist need to be an ALIST. For any ALIST, the above predicate
returns NIL.


Best,
Qiantan






Re: new org mode, changed folding behavior could be improved / more consistent

2023-02-08 Thread Ihor Radchenko
Laurenz Wiskott  writes:

> There is one feature however that I really miss: It used to be that I could 
> add an entry
> with a certain number of stars in the first line, and then 'org-global-cycle' 
> using S-TAB
> would allow to make all the headlines visible only up to that many stars.  
> For instance,
> a file with
>
>
> *** -
> * 1
> ...
> after one or two S-TAB (depending on the initial folding state) would look 
> like
>
> *** -
> * 1
> ** 2
> *** 3
>
> without the 4-star headline visible.  If I remove one star in the first line 
> and type
> S-TAB once or twice, then it looks like
>
> ** -
> * 1
> ** 2
>
> I found that a convenient way of controlling the depth of the CONTENT view (I 
> believe it
> is called).  That does not work any more.  Typing S-TAB once or twice leads 
> to the
> CONTENTS view that shows all headlines, no matter how many stars and 
> independently of the
> first line.

This was not documented and caused by implementation detail.

> Here is an example for 'org-cycle'
>
> * 1
> *** -
> ** A
> *** Aa
> ...
> Typing TAB once or twice (depending on the initial folding state) on the main 
> headline (*
> 1) yields the view:
>
> * 1
> *** -
> ** A
> *** Aa
> ** B
> *** Ba

It is a bug in `org-fold-show-children'. The reason your example works
has nothing to do with what the function intends to do.

Fix is attached.
>From a5e8062b258fc7c4e4d4129278101a8d20bb43c4 Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Wed, 8 Feb 2023 14:29:30 +0300
Subject: [PATCH] org-fold-show-children: Only display direct children by
 default

* lisp/org-fold.el (org-fold-show-children): Clarify the docstring
emphasizing that direct children are always displayed.  Fix
grandchildren being displayed when the first child has deeper level
than the next children.
---
 lisp/org-fold.el | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/lisp/org-fold.el b/lisp/org-fold.el
index 1b7ca22b0..f9c604155 100644
--- a/lisp/org-fold.el
+++ b/lisp/org-fold.el
@@ -419,20 +419,21 @@ (defun org-fold-show-siblings ()
 
 (defun org-fold-show-children ( level)
   "Show all direct subheadings of this heading.
-Prefix arg LEVEL is how many levels below the current level
-should be shown.  Default is enough to cause the following
-heading to appear."
+Prefix arg LEVEL is how many levels below the current level should be
+shown.  If direct subheadings are deeper than LEVEL, they are still
+displayed."
   (interactive "p")
   (unless (org-before-first-heading-p)
 (save-excursion
   (org-with-limited-levels (org-back-to-heading t))
   (let* ((current-level (funcall outline-level))
+ (parent-level current-level)
  (max-level (org-get-valid-level
- current-level
+ parent-level
  (if level (prefix-numeric-value level) 1)))
+ (min-level-direct-child most-positive-fixnum)
  (end (save-excursion (org-end-of-subtree t t)))
  (regexp-fmt "^\\*\\{%d,%s\\}\\(?: \\|$\\)")
- (past-first-child nil)
  ;; Make sure to skip inlinetasks.
  (re (format regexp-fmt
  current-level
@@ -448,11 +449,12 @@ (defun org-fold-show-children ( level)
 ;; MAX-LEVEL.  Since we want to display it anyway, adjust
 ;; MAX-LEVEL accordingly.
 (while (re-search-forward re end t)
-  (unless past-first-child
-(setq re (format regexp-fmt
- current-level
- (max (funcall outline-level) max-level)))
-(setq past-first-child t))
+  (setq current-level (funcall outline-level))
+  (when (< current-level min-level-direct-child)
+(setq min-level-direct-child current-level
+  re (format regexp-fmt
+ parent-level
+ (max min-level-direct-child max-level
   (org-fold-heading nil))
 
 (defun org-fold-show-subtree ()
-- 
2.39.1



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


Re: [POLL] Proposed syntax for timestamps with time zone info (was: [FEATURE REQUEST] Timezone support in org-mode datestamps and org-agenda)

2023-02-08 Thread Ihor Radchenko
Jean Louis  writes:

>> It means "when I scheduled this item, I expected the UTC offset at the
>> time of the timestamp to be -08 and remain so. It was motivated by
>> America/Vancouver time zone, but if it changes in future, I do not care
>> - the scheduled time should remain at specific time point relative to
>> UTC".
>
> I read, though sorry, I do not understand who is expected to think
> that UTC offset is fixed?
>
> Is it Org as program?
>
> Or is it human?

Both.

The idea is to ensure exact point of time relative to UTC.
For example, when you want to schedule something exactly 10024 hours in
future, regardless of time zone changes.

The same can be done by specifying the timestamp in UTC directly.

> Another program in future, and human, must know did the organizer of
> event, had in mind:

I would like to remind you that timestamps are not necessarily used for
meetings. And not always shared with other people.

> I find such situations rather easy to solve with database:
>
> - I can have column like "timestamp" with UTC time or local time plus
>   UTC offset, and if I did not enter any other information, that UTC
>   offset is considered in future. Consider this column name
>   "timestamp".
>
> - I can have column "time" and when such is entered, then date is
>   extracted from "timestamp" column, and combined with time. In this
>   case UTC is only calculated in new time point but not used as period
>   from past to appointment time.
>
> - I can have time zone for the future, if I enter such in other
>   column, the future calculation must use that proper time zone. 

Sorry, I do not understand what you are trying to explain here. Would
you mind showing an example?

> You said "I do not care", that means you as human decide that 
> [2024-02-04 12:00 @-08,America/Vancouver] will use fixed -8 offset
>
> But from where in such timestamp does user or program understand that?

>From syntax we are now defining, XX takes priority in @XX,YY.

> Maybe this way (hypothetically):
>
> [2024-02-04 12:00 @-08, America/Vancouver/UTC-FIXED]
>
> as that way you would give signal to program that you want UTC fixed
> time in future, and not 12:00 o'clock necessary.

I am sorry, but I don't understand what you mean by UTC-FIXED.

>> > The UTC offset is the log what was the UTC offset at the time point
>> > when timestamp was created, as future UTC offset cannot be known.
>> 
>> Sure. -08 is expected offset.
>
> If you wish to specify UTC time in future, no need to specify even any
> offset, but you can. 
>
> Look here in first example how event is defined by using UTC time:
> https://icalendar.org/iCalendar-RFC-5545/4-icalendar-object-examples.html

It is sometimes easier to define UTC time +offset instead of doing an
extra conversion in your head.

>> > Making it "fixed" does not fix it in real time, you are then
>> > introducing something new than what other programs do with time.
>> 
>> I do not understand this statement.
>
> Well to understand that, you have to make practical examples and
> understand what would human think in periods of time A, B, C, D, from
> creation of appointment, through possible changes of DST, time zone,
> UTC offset, to final appointment.
>
> Look here the second example of group-scheduled meeting that begins at
> 8:30 AM EST on March 12, 1998 and ends at 9:30 AM EST on March 12,
> 1998
> https://icalendar.org/iCalendar-RFC-5545/4-icalendar-object-examples.html
>
> DTSTART;TZID=America/New_York:19980312T083000
> DTEND;TZID=America/New_York:19980312T093000
> LOCATION:1CP Conference Room 4350

> The stuff with iCalendar works for reason that it is structured. The
> timestamp such as: DTSTART:19960918T143000Z will clearly say that time
> is specified in UTC time. No need for confusion with time zone.

> But if DTSTART has this: TZID=America/New_York:19980312T083000
>
> Then it becomes clear that it will be the UTC offset in future with
> assumed mentiond time zone.
>
> But if you mix UTC offset, plus the time zone for future, that makes
> little sense, unless you introduce some tags that timestamp is
> recognizable as using UTC time, or that it uses date/time and time

The problem being addressed with @+08,!Asia/Singapore is possible future
change in time zone. Imagine a yearly meeting you attend at
[2024-01-02 19:00 @Asia/Singapore,!+08] while living in Europe/Athens
(UTC +2). Over the years, you are used to meeting being held 13:00
@Europe/Athens time, and you do not really follow Singapore government
politics on time zones. Then, one year Singapore government decides to
switch the time zone to UTC+7. Your TZDB will get updated, but you may
still miss the meeting even though Org agenda will display the correct
new local meeting time of 14:00 @Europe/Athens. It would be useful if
Org could notify the users about such changes.

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

Re: [BUG] M-S- does not adjust clock timestamps as described in docs [9.5.5]

2023-02-08 Thread Ihor Radchenko
Robert Nikander  writes:

> But it doesn't seem to work like that. For example
>
>* Testing it out
>:LOGBOOK:
>CLOCK: [2023-02-07 Tue 12:35]--[2023-02-07 Tue 12:45] =>  0:10
>CLOCK: [2023-02-07 Tue 12:20]--[2023-02-07 Tue 12:30] =>  0:10
>CLOCK: [2023-02-06 Mon 12:20]--[2023-02-06 Mon 13:20] =>  1:00
>:END:
>
> If I put point on the minutes of 12:30 (second line) and hit S-M-, it 
> moves the time to 12:35, but nothing else moves. Based on the docs, I thought 
> it would shift one of the other lines.

S-M- only considers clock history during current Emacs session. Will
clarifying this in the manual suffice for your use-case?

If not limiting the command to current clock history, we would need to
look across every single Org file searching for intersecting clocks -
extremely resource-intensive procedure.

Note that you can use agenda clock check to catch clock inaccuracies.

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



Re: [PATCH] org--batch-store-agenda-views: Fix treatment of lambda functions

2023-02-08 Thread Ihor Radchenko
"Aaron L. Zeng"  writes:

> * org-agenda.el (org--batch-store-agenda-views): Fix treatment of
> lambda functions used as custom agenda commands.
> `org-agenda-custom-commands' entries may specify a custom function
> instead of a symbol like `tags-todo'.  `org--batch-store-agenda-views'
> behaved differently from `org-agenda' when that custom function was
> defined as a lambda rather than a symbol, incorrectly treating the
> lambda form as a list of agenda commands.  Instead, use the same test
> as `org-agenda' does to determine whether the command is a series.

Thanks for the updated patch!
I am attaching amended version with the comment placed closer to where
the custom command list is being used.
I also added TINYCHANGE cookie because you are not listed as a
contributor with FSF copyright assignment.

Let me know if you have any objections.

>From 4f4693a5dd85e09737ecb27a68b04c7f8af014ad Mon Sep 17 00:00:00 2001
Message-Id: <4f4693a5dd85e09737ecb27a68b04c7f8af014ad.1675850882.git.yanta...@posteo.net>
From: "Aaron L. Zeng" 
Date: Tue, 7 Feb 2023 12:47:03 -0500
Subject: [PATCH v2] org--batch-store-agenda-views: Fix treatment of lambda
 functions

* org-agenda.el (org--batch-store-agenda-views): Fix treatment of
lambda functions used as custom agenda commands.
`org-agenda-custom-commands' entries may specify a custom function
instead of a symbol like `tags-todo'.  `org--batch-store-agenda-views'
behaved differently from `org-agenda' when that custom function was
defined as a lambda rather than a symbol, incorrectly treating the
lambda form as a list of agenda commands.  Instead, use the same test
as `org-agenda' does to determine whether the command is a series.

TINYCHANGE
---
 lisp/org-agenda.el | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 1d1f2271b..127503af0 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3525,7 +3525,8 @@ (defun org--batch-store-agenda-views (vars vals)
   (let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands))
 (pop-up-frames nil)
 (dir default-directory)
-cmd thiscmdkey thiscmdcmd match files opts cmd-or-set bufname)
+cmd thiscmdkey thiscmdcmd match files opts cmd-or-set
+seriesp bufname)
 (save-window-excursion
   (while cmds
 	(setq cmd (pop cmds)
@@ -3537,9 +3538,12 @@ (defun org--batch-store-agenda-views (vars vals)
    (format "*Org Agenda(%s:%s)*" thiscmdkey match))
 			  (format "*Org Agenda(%s)*" thiscmdkey))
 			org-agenda-buffer-name)
+  ;; series: (0:key 1:desc 2:(cmd1 cmd2 ...) 3:general-settings 4:files)
+  ;; non-series: (0:key 1:desc 2:type 3:match4:settings 5:files)
 	  cmd-or-set (nth 2 cmd)
-	  opts (nth (if (listp cmd-or-set) 3 4) cmd)
-	  files (nth (if (listp cmd-or-set) 4 5) cmd))
+	  seriesp (not (or (symbolp cmd-or-set) (functionp cmd-or-set)))
+	  opts (nth (if seriesp 3 4) cmd)
+	  files (nth (if seriesp 4 5) cmd))
 	(if (stringp files) (setq files (list files)))
 	(when files
 	  (let* ((opts (append org-agenda-exporter-settings opts))
-- 
2.39.1



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


Re: netspend table

2023-02-08 Thread Dr. Arne Babenhauserheide

Jude DaShiell  writes:
> I think if I had known about orgmode when studying adjusted trial balance
> sheets I would have used it since braille paper has a maximum of 42
> characters in a line.

Are you using orgmode blind?

If so, do you have a good resource I could send a blind author?

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature