Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-05-02 Thread Sławomir Grochowski
Hi Philip, 

what's your opinion about this change?
I understand it's a low-level hack, but maybe you can advise on how to do it 
better? 

Sławomir Grochowski  writes:
> That's great idea. I tried with this code:
>
> (message "Toggle display of quick-help buffer using %s."
>  (propertize (key-description (this-command-keys)) 'face 
> 'help-key-binding 'font-lock-face 'help-key-binding))
>
> And it works perfectly. 

> But I would like 'help-quick' for org-columns to be bind to other
> keybinding: "?" not "C-h C-q".
>
> Because now it's like this:
>
> 1. invoke the command using "?" keybinding:
>
> (defun org-columns-help-quick-toggle ()
>   (interactive)
>   (let ((help-quick-sections org-columns-help-quick-sections)
> (help-quick-use-map org-columns-map))
> (help-quick-toggle)))
>
> (org-defkey org-columns-map "?" #'org-columns-help-quick-toggle)
>
> 2. 'help-quick' for org-columns buffer will appear with the message:
> "Toggle display of quick-help buffer using C-h C-q."
>
> So this is misleading.
> Because pressing 'C-h C-q' will close the buffer but pressing it again
> will show 'help-quick' buffer and not 'help-quick' for org-columns buffer.
>
> Therefore, I think that to use a different keybinding we need to modify
> the code.
> Or am I missing something?

-- 
Slawomir Grochowski



Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-04-18 Thread Sławomir Grochowski
Philip Kaludercic  writes:

> Sławomir Grochowski  writes:
>
>> Philip Kaludercic  writes:
>>> I have pushed the changes to master.
>>
>> Thank you Philip for your help.  It works.
>>
>> But there is one more small thing. 
>> A message that is displayed in the minibuffer. 
>> It contains two pieces of information:
>>
>> (1) command name
>> Right now it's hardcoded. 
>> We need to change the it from `help-quick-toggle' to
>> `org-columns-help-quick-toggle'.
>> How to do it? 
>> Add another variable like `help-quick-use-map'?
>> Maybe 'help-quick-command-name'?
>
> Instead of using substitute-command-keys, we could just use
> this-command, but that assumes that help-quick can always be toggled by
> the command that invokes it.

That's great idea. I tried with this code:

(message "Toggle display of quick-help buffer using %s."
 (propertize (key-description (this-command-keys)) 'face 
'help-key-binding 'font-lock-face 'help-key-binding))

And it works perfectly. 

>> (2) keybinding to the command name
>> Just to modify message string. Add '\\'.
>> To use other keymap.
>> Change is in the diff below. 
>
> I don't see how this would work in general, at the very least it breaks
> the regular usage.
>
> Furthermore, I am not convinced we have to change anything here, since
> C-h C-q (the default binding for `help-quick-toggle') should also hide
> the buffer if one uses your command, or am I mistaken?

But I would like 'help-quick' for org-columns to be bind to other
keybinding: "?" not "C-h C-q".

Because now it's like this:

1. invoke the command using "?" keybinding:

(defun org-columns-help-quick-toggle ()
  (interactive)
  (let ((help-quick-sections org-columns-help-quick-sections)
(help-quick-use-map org-columns-map))
(help-quick-toggle)))

(org-defkey org-columns-map "?" #'org-columns-help-quick-toggle)

2. 'help-quick' for org-columns buffer will appear with the message:
"Toggle display of quick-help buffer using C-h C-q."

So this is misleading.
Because pressing 'C-h C-q' will close the buffer but pressing it again
will show 'help-quick' buffer and not 'help-quick' for org-columns buffer.

Therefore, I think that to use a different keybinding we need to modify
the code.
Or am I missing something?

-- 
Slawomir Grochowski



Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-04-15 Thread Sławomir Grochowski
Philip Kaludercic  writes:
> I have pushed the changes to master.

Thank you Philip for your help.  It works.

But there is one more small thing. 
A message that is displayed in the minibuffer. 
It contains two pieces of information:

(1) command name
Right now it's hardcoded. 
We need to change the it from `help-quick-toggle' to
`org-columns-help-quick-toggle'.
How to do it? 
Add another variable like `help-quick-use-map'?
Maybe 'help-quick-command-name'?

(2) keybinding to the command name
Just to modify message string. Add '\\'.
To use other keymap.
Change is in the diff below. 
  
diff --git a/lisp/help.el b/lisp/help.el
index d4e39f04e53..35412b9d2fe 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -263,7 +263,9 @@ help-quick
   ;; ... and shrink it immediately.
   (fit-window-to-buffer))
 (message
- (substitute-command-keys "Toggle display of quick-help buffer using 
\\[help-quick-toggle]."
+ (substitute-command-keys "Toggle display of quick-help buffer 
using\\ \\[org-columns-help-quick-toggle]."
+
+
 
 (defun help-quick-toggle ()
   "Toggle display of a window showing popular commands and their bindings.
-- 
2.30.2


Regards,
-- 
Slawomir Grochowski



Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-04-11 Thread Sławomir Grochowski
Philip Kaludercic  writes:

> I tried out using your `org-columns-help-quick-sections' variable, but
> it seems that `where-is' didn't find all the commands you wanted:

> Are commands like `org-columns-move-up' part of the next release of Org?
> I am using whatever is currently on master.

Yes this function was added recently. It's on Org master 
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-colview.el#n997
But not on Emacs repo. 

-- 
Slawomir Grochowski



Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-04-10 Thread Sławomir Grochowski
Thank you Philip for the explanation and preparing the code snippet. 

So what are the next steps?
Can you merge your patch?

-- 
Slawomir Grochowski



Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-04-08 Thread Sławomir Grochowski
Philip Kaludercic  writes:

> We could add a `help-quick-use-map' variable and bind it to `global-map'
> by default.  You can then re-bind it in your command.

I'm sorry, but I don't quite understand it. 

It seems to me that the simplest way is to add a parameter to the
function, like this:

(defun help-quick ( keymap)

Because it will not change the behavior for previous calls to this
function.  And it will allow to pass specific keymap, not need to pass
and search in whole global-map. 

What do you think?

-- 
Slawomir Grochowski



Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-04-08 Thread Sławomir Grochowski
chad  writes:

> If you don't mind me asking:

Thank you for sharing your views. 

> What are your high-level goals and immediate needs for changing
> help-quick?

I want to reuse quick-help for functionality in org-mode - column view
package. See first email in this thread - there is even a screenshot.

> It looks like you may be trying to have multiple
> simultaneous quick-help buffers active at once?

Philip Kaludercic  writes:

> Is there a reason not to re-use the same buffer?  I am not sure if we
> need multiple quick-help buffer to co-exist at the same time.

Yes you are right. There is no need to create multiple quick-help
buffers. 

> The idea here was that some other function could rebind
> `help-quick-sections' dynamically.  That way you avoid the redundant
> arguments (which would all have to be documented).

Is this really a good practice?
Relying on global variables instead of passing variables as a parameters?

I tried like this:

+(defun org-columns-help-quick-toggle ()
+  (interactive)
+  (let ((help-quick-sections org-columns-help-quick-sections))
+(help-quick-toggle)))

So passing a 'sections' data works.
But it doesn't read keymaps from `org-columns-map'.
Because as I understand it read keymaps available only in the created buffer
"*Quick Help*" not from the buffer with org-colview.

This is the line from function: `help-quick' where it happens:
+ (let* ((bind (where-is-internal (car ent) nil t))
Signature:
(where-is-internal DEFINITION  KEYMAP FIRSTONLY NOINDIRECT NO-REMAP)

So previously I was passing a keymap `org-columns-map' to function 
'where-is-internal'.

Eli Zaretskii  writes:
> In any case, we cannot change the signature of help-quick, since it's a
> public function.

If I can't modify the function `help-quick' how can I make it work?

I'm attaching the whole patch:
>From dcc5172c87f9f7acfc9ab3a72f7de8b363a05447 Mon Sep 17 00:00:00 2001
From: Slawomir Grochowski 
Date: Sun, 7 Apr 2024 01:13:27 +0200
Subject: [PATCH] lisp/org-colview.el: add help-quick sections for org-colview

---
 lisp/org-colview.el | 41 +
 1 file changed, 41 insertions(+)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d71c84a76..547f50df8 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -169,6 +169,7 @@ See `org-columns-summary-types' for details.")
   (org-cycle-overview)
   (org-cycle-content))
 
+(org-defkey org-columns-map "?"#'org-columns-help-quick-toggle)
 (org-defkey org-columns-map "c"#'org-columns-content)
 (org-defkey org-columns-map "o"#'org-overview)
 (org-defkey org-columns-map "e"#'org-columns-edit-value)
@@ -231,6 +232,46 @@ See `org-columns-summary-types' for details.")
 "--"
 ["Quit" org-columns-quit t]))
 
+(defvar org-columns-help-quick-sections
+  '(("Move"
+ (org-columns-move-up . "up")
+ (org-columns-move-down . "down")
+ (org-columns-move-cursor-left . "left")
+ (org-columns-move-cursor-right . "right"))
+("Move column & row"
+ (org-columns-move-row-up . "move row up")
+ (org-columns-move-row-down . "move row down")
+ (org-columns-move-left . "move column left")
+ (org-columns-move-right . "move column right"))
+("Add & delete column"
+ (org-columns-new . "add column")
+ (org-columns-delete . "delete column"))
+("Edit column"
+ (org-columns-narrow . "narrow")
+ (org-columns-widen . "widen")
+ (org-columns-edit-attributes . "attributes"))
+("Edit values"
+ (org-columns-edit-value . "edit value")
+ (org-columns-edit-allowed . "edit allowed value")
+ (org-columns-next-allowed-value . "next allowed value")
+ (org-columns-previous-allowed-value . "previous allowed value")
+ (org-columns-toggle-or-columns-quit . "toggle checkbox or quit")
+ (org-columns-todo . "change TODO state"))
+("View"
+ (org-columns-content . "show content")
+ (org-overview . "show overview")
+ (org-columns-show-value . "show value"))
+("Misc."
+ (org-columns-open-link . "open link")
+ (org-columns-redo . "redo")
+ (org-columns-help-quick-toggle . "toggle this help")
+ (org-columns-quit . "quit"
+
+(defun org-columns-help-quick-toggle ()
+  (interactive)
+  (let ((help-quick-sections org-columns-help-quick-sections))
+(help-quick-toggle)))
+
 (defun org-columns--displayed-value (spec value  no-star)
   "Return displayed value for specification SPEC in current entry.
 
-- 
2.30.2


Regards,

-- 
Slawomir Grochowski


Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-04-06 Thread Sławomir Grochowski
Ihor Radchenko  writes:

> I see no downside supporting `help-quick' command in Org mode's column
> view. Generally, better integration with Emacs built-in functionality is
> welcome.

Great. I'll be happy to take care of it.

But first, we need to modify `help-quick' to be more reusable.
I tried to do it, but I'm not experienced in elisp.
I wanted to remove references to global variables, so I did a wrapper
function to pass arguments to `help-quick'. I understand it's not a lispy way.
I would be grateful for your comment. 

Patch in attachment.
>From 5f343fd15c53f5bc5e7515ef0cd3049b4e0ec388 Mon Sep 17 00:00:00 2001
From: Slawomir Grochowski 
Date: Sat, 6 Apr 2024 22:11:01 +0200
Subject: [PATCH] lisp/help: make `help-quick-toggle' reusable for other
 keymaps

---
 lisp/help.el | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/lisp/help.el b/lisp/help.el
index 1ef46e394f3..c32d1a2e943 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -76,7 +76,7 @@ help-map
   "C-n"  #'view-emacs-news
   "C-o"  #'describe-distribution
   "C-p"  #'view-emacs-problems
-  "C-q"  #'help-quick-toggle
+  "C-q"  #'help-quick-toggle-wrapper
   "C-s"  #'search-forward-help-for-help
   "C-t"  #'view-emacs-todo
   "C-w"  #'describe-no-warranty
@@ -178,22 +178,22 @@ help-quick-sections
 (declare-function prop-match-value "text-property-search" (match))
 
 ;; Inspired by a mg fork (https://github.com/troglobit/mg)
-(defun help-quick ()
+(defun help-quick (name-for-buffer sections  keymap)
   "Display a quick-help buffer showing popular commands and their bindings.
 The window showing quick-help can be toggled using \\[help-quick-toggle].
 You can click on a key binding shown in the quick-help buffer to display
 the documentation of the command bound to that key sequence."
   (interactive)
-  (with-current-buffer (get-buffer-create "*Quick Help*")
+  (with-current-buffer (get-buffer-create name-for-buffer)
 (let ((inhibit-read-only t) (padding 2) blocks)
 
   ;; Go through every section and prepare a text-rectangle to be
   ;; inserted later.
-  (dolist (section help-quick-sections)
+  (dolist (section sections)
 (let ((max-key-len 0) (max-cmd-len 0) keys)
   (dolist (ent (reverse (cdr section)))
 (catch 'skip
-  (let* ((bind (where-is-internal (car ent) nil t))
+  (let* ((bind (where-is-internal (car ent) keymap t))
  (key (if bind
   (propertize
(key-description bind)
@@ -259,21 +259,25 @@ help-quick
 (message
  (substitute-command-keys "Toggle display of quick-help buffer using \\[help-quick-toggle]."
 
-(defun help-quick-toggle ()
+(defun help-quick-toggle-wrapper ()
+  (interactive)
+  (help-quick-toggle "*Quick Help*" help-quick-sections))
+
+(defun help-quick-toggle (name-for-buffer sections  keymap)
   "Toggle display of a window showing popular commands and their bindings.
 This toggles on and off the display of the quick-help buffer, which shows
 popular commands and their bindings as produced by `help-quick'.
 You can click on a key binding shown in the quick-help buffer to display
 the documentation of the command bound to that key sequence."
   (interactive)
-  (if (and-let* ((window (get-buffer-window "*Quick Help*")))
+  (if (and-let* ((window (get-buffer-window name-for-buffer)))
 (quit-window t window))
   ;; Clear the message we may have gotten from `C-h' and then
   ;; waiting before hitting `q'.
   (message "")
-(help-quick)))
+(help-quick name-for-buffer sections keymap)))
 
-(defalias 'cheat-sheet #'help-quick)
+(defalias 'cheat-sheet #'help-quick-wrapper)
 
 (defun help-quit ()
   "Just exit from the Help command's command loop."
-- 
2.30.2


JD Smith  writes: 

> Also recall we had a discussion in bug#68236 
>  
> about expanding quick-help to include mode-local
> personalized binding shortcuts (with org as a particular target of interest).

Thank you for the link I haven't seen that topic.
 
Regards,
-- 
Slawomir Grochowski


Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2024-04-06 Thread Sławomir Grochowski
Ihor Radchenko  writes:

> Thanks!
> I improved the patch a bit, with minor changes to the commit message and
> adding more to the docstring and type spec of the defcustom. I also
> changed the custom group (:group 'checkbox does not exist).

Great. Thank you. It looks much better.

But I think it's better for "[-]" to be described as
'Intermediate state' not 'In progress'.

> (const :tag "Unchecked [ ]" "[ ]")  
> (const :tag "Checked [X]" "[X]")
> (const :tag "No checkbox" "")   
> (const :tag "In progress [-]" "[-]")

Because it's described as 'Intermediate state' in org-mode manual.
In e.g https://orgmode.org/org.html#index-C_002dc-C_002dc-6

C-c C-c (org-toggle-checkbox) ¶ Toggle checkbox status or—with prefix
argument—checkbox presence at point. With a single prefix argument, add
an empty checkbox or remove the current one49. With a double prefix
argument, set it to ‘[-]’, which is considered to be an intermediate
state.

What do you think?

-- 
Slawomir Grochowski



Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2024-04-04 Thread Sławomir Grochowski
Ihor Radchenko  writes:

> Do not forget to add :package-version. 

Thank you for bringing it to my attention.

Patch in attachment.

>From eb71166693065534be9effdc28aea54bb24e64d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Sat, 16 Mar 2024 13:29:53 +0100
Subject: [PATCH] lisp/org-colview.el: Add defcustom
 `org-columns-checkbox-allowed-values'

* lisp/org-colview.el Add defcustom `org-columns-checkbox-allowed-values'.
(org-columns-next-allowed-value): Introduce variable `org-columns-checkbox-allowed-values'.

This would allow to use more than two states ("[ ]", "[X]") in
columns with SUMMARY-TYPE that use checkbox ("X", "X/", "X%").
For example you can add an intermediate state ("[-]").
Or empty state ("") to remove checkbox.

* etc/ORG-NEWS New option ~org-columns-checkbox-states~
---
 etc/ORG-NEWS| 7 +++
 lisp/org-colview.el | 8 +++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ca73f06e7..72caf073a 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1753,6 +1753,13 @@ following properties: ~:hook~, ~:prepare-finalize~,
 prior to their global counterparts for the selected template.
 
 ** New options
+*** New option ~org-columns-checkbox-allowed-values~
+
+This would allow to use more than two states ("[ ]", "[X]") in
+columns with SUMMARY-TYPE that use checkbox ("X", "X/", "X%").
+For example you can add an intermediate state ("[-]").
+Or empty state ("") to remove checkbox.
+
 *** A new option for custom setting ~org-refile-use-outline-path~ to show document title in refile targets
 
 Setting ~org-refile-use-outline-path~ to ~'title~ will show title
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d71c84a76..5545c5691 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -59,6 +59,12 @@
 
 ;;; Configuration
 
+(defcustom org-columns-checkbox-allowed-values '("[ ]" "[X]")
+  "Allowed values for columns with SUMMARY-TYPE that use checkbox."
+  :group 'checkbox
+  :package-version '(Org . "9.6")
+  :type '(repeat string))
+
 (defcustom org-columns-modify-value-for-display-function nil
   "Function that modifies values for display in column view.
 For example, it can be used to cut out a certain part from a time stamp.
@@ -737,7 +743,7 @@ an integer, select that value."
 	  (let ((all
 		 (or (org-property-get-allowed-values pom key)
 		 (pcase (nth column org-columns-current-fmt-compiled)
-		   (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
+		   (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) org-columns-checkbox-allowed-values))
 		 (org-colview-construct-allowed-dates value
 	(if previous (reverse all) all
 (when (equal key "ITEM") (error "Cannot edit item headline from here"))
-- 
2.30.2



Regards,
-- 
Slawomir Grochowski


Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2024-04-03 Thread Sławomir Grochowski
Ihor Radchenko  writes:

> It is not very clear when this feature is useful. May you provide a
> small example as a part of the news entry and also
> `org-columns-checkbox-states' docstring?

Yes. You are right. Thank you.
After thinking about I have found a better name:

(defcustom org-columns-checkbox-allowed-values '("[ ]" "[X]")
  "Allowed values for column with SUMMARY-TYPE that use checkbox."
  :group 'checkbox
  :type '(repeat string))

NEWS:
This would allow to use more than two states ("[ ]", "[X]") in
column with SUMMARY-TYPE that use checkbox ("X", "X/", "X%"). 
For example you can add an intermediate state ("[-]").
Or empty state ("") to remove checkbox.

What do you think? 

-- 
Slawomir Grochowski



Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2024-04-02 Thread Sławomir Grochowski
After careful consideration, I believe it is most prudent to only
introduce a defcustom variable. This will allow for modification while
simultaneously preserving the current behavior.

Currently we can change the value of "org-columns-checkbox" with the
following keybindings:

(1)C-c C-c (org-columns-toggle-or-columns-quit)

   Same behavior to toggle checkbox as 'C-c C-c (org-toggle-checkbox)' on
   "org-checkbox".

   It's a great idea that keybinding works in the same way as in the
   case of a regular checkbox. This provides a consistent interface
   for the "org-checkbox" and "org-columns-checkbox".
   
   So every user who starts using "org-columns" will try to use the same
   keybinding they used for "org-checkbox". That's how I used it too.

   But I would not implement other keybindings from "org-checkbox":
   C-u C-c C-c (org-toggle-checkbox) - add or remove checkboxes.
   C-u C-u C-c C-c (org-toggle-checkbox) - set the checkbox to "[-]".
   Because there are too complicated and uncomfortable.
   And this functionality can be easily replaced by adding defcustom
   variable and using keybinding describe in point (3) of this mail.  

(2)n or S-RIGHT (org-columns-next-allowed-value)
   p or S-LEFT (org-columns-previous-allowed-value)

   Later on, I started using S-RIGHT & S-LEFT. It's simply more
   convenient than 'C-c C-c' because in "org-columns" we navigate
   with arrow keys. So, the right hand is always on the arrow keys, making
   it easier now to press just one SHIFT key with the left hand to
   change the value.

   When we have the default two states "[X]" and "[ ]", behavior is
   same as 'C-c C-c' - toggle within these two states. 

   But if we add the third state "[-]", it might not be
   well-received by users who use these keybindings, because now they
   would have to additionally cycle between those three states, not
   just two. And unfortunately, they wouldn't be able to change
   it. That's why I believe it's worth introducing a defcustom
   variable.

(3)1..9,0 

   "Directly select the Nth allowed value, 0 selects the 10th
   value." 

   Now that's how I change the values in the "org-columns-checkbox".
   Because it's by far the fastest, simplest, and most convenient
   way. Only one key and I immediately have the state I want.

   Right now I'm using 4 states for "org-columns-checkbox":
   (setq org-columns-checkbox-states '("[X]" "[-]" "[ ]" "" ))

   So empty state "" at digit '4' I have option to remove checkbox.
   Digit '2' is "[-]".
   Super easy and convenient in comparison to:
   C-u C-c C-c (org-toggle-checkbox) - add or remove checkboxes.
   C-u C-u C-c C-c (org-toggle-checkbox) - set the checkbox to
   "[-]".

What do you think?
Patch in attachment.

>From 6f8e56cb3d20977e0f4c77c1be913dfb61480cfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Sat, 16 Mar 2024 13:29:53 +0100
Subject: [PATCH] lisp/org-colview.el: Add defcustom
 `org-columns-checkbox-states'

* lisp/org-colview.el Add defcustom `org-columns-checkbox-states'.
(org-columns-next-allowed-value): Introduce variable `org-columns-checkbox-states'.

This would allow to use more than two states ("[ ]", "[X]") in "org-columns-checkbox".
In e.g to add an intermediate state ("[-]") which is also present in "org-checkbox".

* etc/ORG-NEWS New option ~org-columns-checkbox-states~
---
 etc/ORG-NEWS| 5 +
 lisp/org-colview.el | 7 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ca73f06e7..1cb4b0c8e 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1753,6 +1753,11 @@ following properties: ~:hook~, ~:prepare-finalize~,
 prior to their global counterparts for the selected template.
 
 ** New options
+*** New option ~org-columns-checkbox-states~
+
+This would allow to use more than two states ("[ ]", "[X]") in "org-columns-checkbox".
+In e.g to add an intermediate state ("[-]") which is also present in "org-checkbox".
+
 *** A new option for custom setting ~org-refile-use-outline-path~ to show document title in refile targets
 
 Setting ~org-refile-use-outline-path~ to ~'title~ will show title
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d71c84a76..eac85d3d6 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -59,6 +59,11 @@
 
 ;;; Configuration
 
+(defcustom org-columns-checkbox-states '("[ ]" "[X]")
+  "Checkbox states to cycle between."
+  :group 'checkbox
+  :type '(repeat string))
+
 (defcustom org-columns-modify-value-for-display-function nil
   "Function that modifies values for display in column view.
 For example, it can be used to cut out a certain part from a time stamp.
@@ -737,7 +742,7 @@ an integer, select that value."
 	  (let ((all
 		 (or (org-property-get-allowed-values pom key)
 		 (pcase (nth column 

Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2024-03-20 Thread Sławomir Grochowski
Ihor Radchenko  writes:
> I think that we can do the following:
>
> (1) modify org-columns-next-allowed-value (S-/) to use the
> three states.
>
> (2) modify org-columns-toggle-or-columns-quit and org-columns--toggle to
> follow what C-c C-c does:
>
> (5.6 Checkboxes section of the manual)
> 
> ‘C-c C-c’ (‘org-toggle-checkbox’)
>  Toggle checkbox status or--with prefix argument--checkbox presence
>  at point.  With a single prefix argument, add an empty checkbox or
>  remove the current one(3).  With a double prefix argument, set it
>  to ‘[-]’, which is considered to be an intermediate state.
>

Thank you for advice. 
I'm surprised I didn't think of it myself.
It's a good idea to ensure consistency between 'org-checkbox' and 
'org-columns-checkbox'.

>  Except that we should not allow removing checkboxes and instead
>  force empty checkbox with single prefix argument.

And why do you want to avoid this?
When using 'org-column' I sometimes remove an empty checkbox.
So I see use in it, and most importantly, it would provide same
compatible interface for 'org-checkbox' and 'org-columns-checkbox'


In my previously message I didn't reply to all.
So now I'm fixing it CCing emacs-orgmode@gnu.org now.   

Regards,
-- 
Slawomir Grochowski



Re: [PATCH] doc/org-manual.org (Checkboxes): move section 'Checkboxes' from 'TODO Items' to 'Plain Lists'

2024-02-27 Thread Sławomir Grochowski
Matt  writes:

That's good point. Thank you Matt for links. 
> However, before moving the section we'd need to find a way to introduce 
> properties before the checkboxes section.
>
> The Checkboxes section is written assuming the reader knows what Properties 
> are.  The GNU documentation guidelines suggest writing as though readers have 
> read from the beginning [fn:1] [fn:2].  That is, unless introducing a 
> concept, only use concepts that have already been explained.  Properties are 
> introduced in Section 2.7 and Checkboxes is currently 5.6.   The proposal is 
> to move Checkboxes to 2.6.1 *before* properties are introduced.  This is a 
> problem.
>
> [fn:1] https://www.gnu.org/prep/standards/standards.html#Documentation
> [fn:2] https://www.fsf.org/licensing/gnu-press/GNU-Press-styleguide.pdf

Let's close this thread for now. Because in the patch I uploaded, it's too
much of changes + relocation. 

I think that first we need to simplify a bit, improve section '5.6
Checkboxes' - because currently it starts with a very complicated
example and its description. 
And checkbox is quite simple feature.

So in a new thread I will post the changes regarding '5.6 Checkboxes'. 
And then later we could consider relocating.

-- 
Sławomir Grochowski



Re: [FR] Add a way to mark an item in a checklist as failed

2024-02-26 Thread Sławomir Grochowski
Rudi C  writes:

> I also use the partial tick for partial completion of tasks, so I cannot
> abuse it for marking failed tasks. :wry_smile:

That's interesting. Can you show some examples?

So 4 state checkbox?
Search the net. e.g.
https://ux.stackexchange.com/questions/144576/how-to-visually-represent-4-state-checkbox

"Checkboxes have long-been established to have 3 states: checked,
unchecked, and mixed (with the horizontal line). Changing this
behavior is confusing and should be avoided." 

I also miss this failed state a bit. But indeed it's getting a little
too complicated.

What others think?

-- 
Sławomir Grochowski



Re: [FR] Add a way to mark an item in a checklist as failed

2024-02-26 Thread Sławomir Grochowski
Hi Rudy,

Rudi C  writes:

> The use case is that I use checklists to remember and track doing some
> important stuff at the start of the day; all the items are at first in a
> neutral/todo state. Some of them get done (`[X]`), but some of them fail
> during the day. For example, I have an item `- [ ] No sugar` which tracks
> whether I have consumed artificial sugar during the day. I like to be able
> to mark this as failed.

It's nice to hear that someone is having the same need for a failed state in 
the checkbox.

Currently, the case looks like this:

A checkbox can be in one of the three states:
1. not checked =[ ]=
2. partially checked =[-]=
3. checked =[X]=

So I use this partially checked =[-]= state to mark it as failed.
But this 'partially checked' is for checkboxes that are in parent-child
relation.
For example:

If some but not all child checkboxes are checked, the parent checkbox is 
partially checked.
#+begin_example
- [-] call people
  - [X] Peter
  - [ ] Sarah
#+end_example

And this 'partially checked' is set automatically. 

But you can set it manually for checkbox that is not in parent-child
relation. Just insert '-' manually or press 'C-c C-c (org-toggle-checkbox)'
with a double prefix argument 'C-u C-u'.

Statics cookie works as expected. 

#+begin_example
- call people [1/2]
  - [X] Peter
  - [-] Sarah
#+end_example

> I know this can be simulated using headings, but checklists are visually
> nicer and have cookies `[/]` etc.

You can also use statistics cookie '[/]' in checkbox items list. 

For example:
#+begin_example
- [ ] call people [1/2]
  - [X] Peter
  - [ ] Sarah
#+end_example

-- 
Sławomir Grochowski



RE: [External] : Re: [DISCUSSION] "quick-help" popup for org-columns (column view)

2024-02-14 Thread Sławomir Grochowski


I have been using the https://github.com/justbur/emacs-which-key for a long 
time.
However, today I took a closer look at this package to see if it has
two features that I've found in 'quick-help' which I really like.

Those two features are:

1. option for popup to be persistent, sticky
It's a lifesaver for every new user to see permanently
available keybindings, as well as for every user who starts
use an unknown package.
'which-key' already has this feature implemented,
variable `which-key-persistent-popup'.

2. option to divide keybindings into groups
For example, with 'which-key' when I press 'C-h',
popup with 50 keybindings will appear on the screen.  
I'm completely overwhelmed by the amount of information.
Making any decision is very tiring and difficult.
Grouping will make it much easier to read and make a decision.
I don't see this functionality in 'which-key' but I found a topic on
Reddit 
https://www.reddit.com/r/emacs/comments/kxd9z4/grouped_bindings_in_whichkey
with repo link
https://github.com/loafofpiecrust/dotfiles/blob/main/emacs/.config/doom/custom/pretty-which-key.el
where this feature has been implemented.

Based on this information, I think it's worth waiting until 'which-key' is 
integrated.
And then implement the 'divide keybindings into groups' feature.

I'm not familiar with https://www.emacswiki.org/emacs/download/keysee.el
But I could try to answer some questions about 'which-key'.

Drew Adams  writes:

> 1. Doesn't which-key also provide the
> possibility (e.g., on-demand instead of
> by timer) to show all currently available
> bindings at top level, i.e., not on a
> prefix key)?  I thought it had added that
> feature at some point.
>
> If it doesn't, then that's another big
> difference ("critical", you say) from
> KeySee.

Yes, it's available with command `which-key-show-top-level'.

> 2. As for getting the completions in a
> buffer that you can access "persistently"
> (and, e.g., to search or edit):
>
> There should be a separate, more general
> feature for that: be able to "save" the
> current contents of `*Completions* (or
> another buffer displaying completions) to
> another buffer, regardless of what that
> completions buffer is showing.
>
> IOW, this shouldn't be only about _key_
> completions and descriptions as help.
>
> Icicles provides such a feature (as does
> Embark, IIUC).  Emacs should have it.  Hit
> a key, enter a destination buffer name (or
> just hit RET for a default name).

Yes, you can copy or even edit 'which-key' 'popup'.

> 3. Icicles can also show you complete help
> for key completions shown in *Completions*,
> in *Help*.  And likewise for any other
> kind of completions for which there's a
> help description.
>
> Showing help for completions is another
> general feature that Emacs should have.

I don't know if 'which-key' has this option.

-- 
Sławomir Grochowski



[PATCH] lisp/org-colview.el: [refactor] [extract function] `org-columns-move-up' & `org-columns-move-down'

2024-02-04 Thread Sławomir Grochowski
Dear All, 

It's a small refactoring - extract function - and the patch is
self-explanatory.

Regards,
Sławomir Grochowski

>From e12fe4e911c90b8f0fc587286937d4c76cac4b5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Sat, 3 Feb 2024 20:50:08 +0100
Subject: [PATCH] org-colview: Extract functions `org-columns-move-up' &
 `org-columns-move-down'

* lisp/org-colview.el (org-defkey): Do not use anonymous function as a
binding.
---
 lisp/org-colview.el | 40 ++--
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 81254c483..d0eed4838 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -190,24 +190,8 @@ See `org-columns-summary-types' for details.")
 (org-defkey org-columns-map "s"#'org-columns-edit-attributes)
 (org-defkey org-columns-map "\M-f" #'forward-char)
 (org-defkey org-columns-map [right]#'forward-char)
-(org-defkey org-columns-map [down]
-	(lambda () (interactive)
-	  (let ((col (current-column)))
-		(forward-line 1)
-		(while (and (org-invisible-p2) (not (eobp)))
-		  (forward-line 1))
-		(move-to-column col)
-		(if (derived-mode-p 'org-agenda-mode)
-		(org-agenda-do-context-action)
-(org-defkey org-columns-map [up]
-	(lambda () (interactive)
-	  (let ((col (current-column)))
-		(forward-line -1)
-		(while (and (org-invisible-p2) (not (bobp)))
-		  (forward-line -1))
-		(move-to-column col)
-		(if (eq major-mode 'org-agenda-mode)
-		(org-agenda-do-context-action)
+(org-defkey org-columns-map [up]   #'org-columns-move-up)
+(org-defkey org-columns-map [down] #'org-columns-move-down)
 (org-defkey org-columns-map [(shift right)] #'org-columns-next-allowed-value)
 (org-defkey org-columns-map "n" #'org-columns-next-allowed-value)
 (org-defkey org-columns-map [(shift left)] #'org-columns-previous-allowed-value)
@@ -1033,6 +1017,26 @@ details."
 (org-columns-move-right)
 (backward-char 1)))
 
+(defun org-columns-move-up ()
+  (interactive)
+  (let ((col (current-column)))
+(forward-line -1)
+(while (and (org-invisible-p2) (not (bobp)))
+  (forward-line -1))
+(move-to-column col)
+(if (eq major-mode 'org-agenda-mode)
+	(org-agenda-do-context-action
+
+(defun org-columns-move-down ()
+  (interactive)
+  (let ((col (current-column)))
+(forward-line 1)
+(while (and (org-invisible-p2) (not (eobp)))
+  (forward-line 1))
+(move-to-column col)
+(if (derived-mode-p 'org-agenda-mode)
+	(org-agenda-do-context-action
+
 (defun org-columns--move-row ( up)
   "Move the current table row down.
 With non-nil optional argument UP, move it up."
-- 
2.30.2



[PATCH] lisp/org-colview.el: [refactor] replace anonymouse function with `forward-char

2024-02-04 Thread Sławomir Grochowski
Dear All,

It's a TINYCHANGE and the patch is self-explanatory.

Regards,
Sławomir Grochowski
From 884e57101de6baf92d6d4e6c2c3476c7c3498185 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Sat, 3 Feb 2024 19:30:03 +0100
Subject: [PATCH] lisp/org-colview.el: [refactor] replace anonym. function with
 `forward-char

* org-colview.el: [refactor] Replace an anonymous function with
a named function `forward-char'.

TINYCHANGE
---
 lisp/org-colview.el | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index d0af89b61..81254c483 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -188,10 +188,8 @@ See `org-columns-summary-types' for details.")
 (org-defkey org-columns-map "\M-b" #'backward-char)
 (org-defkey org-columns-map "a"#'org-columns-edit-allowed)
 (org-defkey org-columns-map "s"#'org-columns-edit-attributes)
-(org-defkey org-columns-map "\M-f"
-	(lambda () (interactive) (goto-char (1+ (point)
-(org-defkey org-columns-map [right]
-	(lambda () (interactive) (goto-char (1+ (point)
+(org-defkey org-columns-map "\M-f" #'forward-char)
+(org-defkey org-columns-map [right]#'forward-char)
 (org-defkey org-columns-map [down]
 	(lambda () (interactive)
 	  (let ((col (current-column)))
-- 
2.30.2



Re: [PATCH] doc/org-manual.org: Checkboxes, add checkbox states examples

2024-01-27 Thread Sławomir Grochowski
Dear All,

I noticed in my patch that I moved the description ("The ‘[2/4]’ and
‘[1/3]’ in") of an example.
And it should be just below the example.

So I'm sending a fixup! patch to fix this.
It's my first fixup! patch so I hope this is the right procedure ;)

Regards,
Sławomir Grochowski


On Mon, Nov 6, 2023 at 5:49 PM Bastien  wrote:

> Hi Sławomir,
>
> Sławomir Grochowski  writes:
>
> > I have added some examples to the org-manual.
> > Patch in attachment and also a screenshot of generated html.
>
> Applied, with a minor modification, using 1. instead of 1) for the
> list items.
>
> I added you as a contributor on
> https://orgmode.org/worg/contributors.html
>
> Thanks!
>
> --
>  Bastien
>
From 01bbdca4a5b8a7445f8b9dceef4481ea7b4c5c75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Sat, 27 Jan 2024 21:16:36 +0100
Subject: [PATCH] fixup! doc/org-manual.org: Checkboxes, add checkbox states
 examples
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Description of example of a checkbox list ("The ‘[2/4]’ and ‘[1/3]’...")
should be right below the example.
---
 doc/org-manual.org | 60 +++---
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index d8c7fd737..2064e1e68 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -4685,6 +4685,36 @@ Here is an example of a checkbox list.
   - [X] talk to the neighbors
 #+end_example
 
+#+cindex: statistics, for checkboxes
+#+cindex: checkbox statistics
+#+cindex: @samp{COOKIE_DATA}, property
+#+vindex: org-checkbox-hierarchical-statistics
+The =[2/4]= and =[1/3]= in the first and second line are cookies
+indicating how many checkboxes present in this entry have been checked
+off, and the total number of checkboxes present.  This can give you an
+idea on how many checkboxes remain, even without opening a folded
+entry.  The cookies can be placed into a headline or into (the first
+line of) a plain list item.  Each cookie covers checkboxes of direct
+children structurally below the headline/item on which the cookie
+appears[fn:: Set the variable ~org-checkbox-hierarchical-statistics~
+if you want such cookies to count all checkboxes below the cookie, not
+just those belonging to direct children.].  You have to insert the
+cookie yourself by typing either =[/]= or =[%]=.  With =[/]= you get
+an =n out of m= result, as in the examples above.  With =[%]= you get
+information about the percentage of checkboxes checked (in the above
+example, this would be =[50%]= and =[33%]=, respectively).  In a
+headline, a cookie can count either checkboxes below the heading or
+TODO states of children, and it displays whatever was changed last.
+Set the property =COOKIE_DATA= to either =checkbox= or =todo= to
+resolve this issue.
+
+#+cindex: blocking, of checkboxes
+#+cindex: checkbox blocking
+#+cindex: @samp{ORDERED}, property
+If the current outline node has an =ORDERED= property, checkboxes must
+be checked off in sequence, and an error is thrown if you try to check
+off a box while there are unchecked boxes above it.
+
 A checkbox can be in one of the three states:
 1. not checked =[ ]=
 2. partially checked =[-]=
@@ -4716,36 +4746,6 @@ If all child checkboxes are checked, the parent checkbox is also checked.
   - [X] Sarah
 #+end_example
 
-#+cindex: statistics, for checkboxes
-#+cindex: checkbox statistics
-#+cindex: @samp{COOKIE_DATA}, property
-#+vindex: org-checkbox-hierarchical-statistics
-The =[2/4]= and =[1/3]= in the first and second line are cookies
-indicating how many checkboxes present in this entry have been checked
-off, and the total number of checkboxes present.  This can give you an
-idea on how many checkboxes remain, even without opening a folded
-entry.  The cookies can be placed into a headline or into (the first
-line of) a plain list item.  Each cookie covers checkboxes of direct
-children structurally below the headline/item on which the cookie
-appears[fn:: Set the variable ~org-checkbox-hierarchical-statistics~
-if you want such cookies to count all checkboxes below the cookie, not
-just those belonging to direct children.].  You have to insert the
-cookie yourself by typing either =[/]= or =[%]=.  With =[/]= you get
-an =n out of m= result, as in the examples above.  With =[%]= you get
-information about the percentage of checkboxes checked (in the above
-example, this would be =[50%]= and =[33%]=, respectively).  In a
-headline, a cookie can count either checkboxes below the heading or
-TODO states of children, and it displays whatever was changed last.
-Set the property =COOKIE_DATA= to either =checkbox= or =todo= to
-resolve this issue.
-
-#+cindex: blocking, of checkboxes
-#+cindex: checkbox blocking
-#+cindex: @samp{ORDERED}, property
-If the current outline node has an =ORDERED= property, checkbo

[PATCH] doc/org-manual.org (Checkboxes): move section 'Checkboxes' from 'TODO Items' to 'Plain Lists'

2024-01-25 Thread Sławomir Grochowski
Dear All,

Dear All,

I propose to move the section "Checkboxes".
>From "5 TODO Items -> 5.6 Checkboxes"
To: "2 Document Structure -> 2.6 Plain Lists -> 2.6.1 Checkboxes"

Because checkbox can only exist in a plain list, as a plain list feature.
So the section should be under 'Plain Lists' heading not under 'TODO Items'.

Link https://orgmode.org/org.html#Checkboxes would stay the same.
So it's just a move section to a more suitable place.
Without changing the content.

What do you think?
Patch in the attachment.

Regards,
Sławomir Grochowski
From ff2c4be8188a5faed6dfb91b2315e58573f91fa8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Thu, 25 Jan 2024 10:03:09 +0100
Subject: [PATCH] doc/org-manual.org (Checkboxes): move section to 'Plain
 Lists'

* doc/org-manual.org (Checkboxes): move section 'Checkboxes' from
'TODO Items' to 'Plain Lists'.  Because checkbox can only exist in a
plain list, as a plain list feature.  So section should be under
'Plain Lists' heading not under 'TODO Items'.
---
 doc/org-manual.org | 330 ++---
 1 file changed, 165 insertions(+), 165 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index d8c7fd737..71e72ddd8 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -1308,6 +1308,171 @@ to disable them individually.
   Sort the plain list.  Prompt for the sorting method: numerically,
   alphabetically, by time, or by custom function.
 
+*** Checkboxes
+:PROPERTIES:
+:DESCRIPTION: Tick-off lists.
+:END:
+#+cindex: checkboxes
+
+#+vindex: org-list-automatic-rules
+Every item in a plain list[fn:17] (see [[*Plain Lists]]) can be made into
+a checkbox by starting it with the string =[ ]=.  This feature is
+similar to TODO items (see [[*TODO Items]]), but is more lightweight.
+Checkboxes are not included into the global TODO list, so they are
+often great to split a task into a number of simple steps.  Or you can
+use them in a shopping list.
+
+Here is an example of a checkbox list.
+
+#+begin_example
+,* TODO Organize party [2/4]
+  - [-] call people [1/3]
+- [ ] Peter
+- [X] Sarah
+- [ ] Sam
+  - [X] order food
+  - [ ] think about what music to play
+  - [X] talk to the neighbors
+#+end_example
+
+A checkbox can be in one of the three states:
+1. not checked =[ ]=
+2. partially checked =[-]=
+3. checked =[X]=
+
+Checkboxes work hierarchically, so if a checkbox item has children
+that are checkboxes, toggling one of the children checkboxes makes the
+parent checkbox reflect if none, some, or all of the children are
+checked.
+
+If all child checkboxes are not checked, the parent checkbox is also not checked.
+#+begin_example
+- [ ] call people
+  - [ ] Peter
+  - [ ] Sarah
+#+end_example
+
+If some but not all child checkboxes are checked, the parent checkbox is partially checked.
+#+begin_example
+- [-] call people
+  - [X] Peter
+  - [ ] Sarah
+#+end_example
+
+If all child checkboxes are checked, the parent checkbox is also checked.
+#+begin_example
+- [X] call people
+  - [X] Peter
+  - [X] Sarah
+#+end_example
+
+#+cindex: statistics, for checkboxes
+#+cindex: checkbox statistics
+#+cindex: @samp{COOKIE_DATA}, property
+#+vindex: org-checkbox-hierarchical-statistics
+The =[2/4]= and =[1/3]= in the first and second line are cookies
+indicating how many checkboxes present in this entry have been checked
+off, and the total number of checkboxes present.  This can give you an
+idea on how many checkboxes remain, even without opening a folded
+entry.  The cookies can be placed into a headline or into (the first
+line of) a plain list item.  Each cookie covers checkboxes of direct
+children structurally below the headline/item on which the cookie
+appears[fn:: Set the variable ~org-checkbox-hierarchical-statistics~
+if you want such cookies to count all checkboxes below the cookie, not
+just those belonging to direct children.].  You have to insert the
+cookie yourself by typing either =[/]= or =[%]=.  With =[/]= you get
+an =n out of m= result, as in the examples above.  With =[%]= you get
+information about the percentage of checkboxes checked (in the above
+example, this would be =[50%]= and =[33%]=, respectively).  In a
+headline, a cookie can count either checkboxes below the heading or
+TODO states of children, and it displays whatever was changed last.
+Set the property =COOKIE_DATA= to either =checkbox= or =todo= to
+resolve this issue.
+
+#+cindex: blocking, of checkboxes
+#+cindex: checkbox blocking
+#+cindex: @samp{ORDERED}, property
+If the current outline node has an =ORDERED= property, checkboxes must
+be checked off in sequence, and an error is thrown if you try to check
+off a box while there are unchecked boxes above it.
+
+The following commands work with checkboxes:
+
+- {{{kbd(C-c C-c)}}} (~org-toggle-checkbox~) ::
+
+  #+kindex: C-c C-c
+  #+findex: org-toggle-checkbox
+  Toggle checkbox status or---with prefi

Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2024-01-23 Thread Sławomir Grochowski
Thank you for asking.
Yes, I would be interested.
I will prepare a patch.

Regards,
Sławomir Grochowski

On Tue, Jan 16, 2024 at 4:47 PM Ihor Radchenko  wrote:

> Ihor Radchenko  writes:
>
> >> What do you think?
> >
> > I think that your use-case is not necessarily common enough to change
> > the defaults. But we can introduce a defcustom here. Patches welcome!
>
> Sławomir, would you be interested to submit a patch here?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


[PATCH] doc/org-manual.org: update Checkboxes and TODO items cookie statistics

2024-01-23 Thread Sławomir Grochowski
Dear All,

I'm sending you some updates to the ORG manual.
I'm sorry there's a lot of changes in this one patch.
If it's too much, I think I could break the changes into two commits:

First, move the 'Checkboxes' section under 'TODO Items' to '2 Document
Structure' -> '2.6 Plain Lists' -> '2.6.2 Checkboxes' because 'Checkbox'
can only exist in plain list items.
Second, all other updates -> about Checkboxes and TODO items cookie
statistics.

What do you think?

Patch in the attachment.
Thank you for the code review.
Now please help me find everything that can be improved in this patch.

Regards,
Sławomir Grochowski
From 0e7f14b7dc8474510993d1d9a4dd75bef7d7c12e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Sun, 14 Jan 2024 21:25:32 +0100
Subject: [PATCH] doc/org-manual.org: update Checkboxes and TODO items cookie
 statistics

* doc/org-manual.org: move Checkboxes to Plain Lists, create separate
entries about Statics Cookie for TODO items and Checkboxes
---
 doc/org-manual.org | 483 +
 1 file changed, 311 insertions(+), 172 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index c332f90f1..9949236ee 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -1105,6 +1105,11 @@ additional structure.  They also provide a way to create lists of
 checkboxes (see [[*Checkboxes]]).  Org supports editing such lists, and
 every exporter (see [[*Exporting]]) can parse and format them.
 
+*** Plain Lists types
+:PROPERTIES:
+:DESCRIPTION: Ordered lists, unordered lists, and description lists.
+:END:
+
 Org knows ordered lists, unordered lists, and description lists.
 
 #+attr_texinfo: :indic @bullet
@@ -1308,6 +1313,259 @@ to disable them individually.
   Sort the plain list.  Prompt for the sorting method: numerically,
   alphabetically, by time, or by custom function.
 
+*** Checkboxes
+:PROPERTIES:
+:DESCRIPTION: Add checkbox to plain list item.
+:END:
+#+cindex: checkboxes
+
+#+vindex: org-list-automatic-rules
+Every item in a plain list[fn:17] (see [[*Plain Lists]]) can be made into
+a checkbox by starting it with the string =[ ]=.  This feature is
+similar to TODO items (see [[*TODO Items]]), but is more lightweight.
+Checkboxes are not included into the global TODO list, so they are
+often great to split a task into a number of simple steps.  Or you can
+use them in a shopping list.
+
+Here is an example of a checkbox list:
+
+#+begin_example
+  - [-] call people
+- [ ] Peter
+- [X] Sarah
+- [ ] Sam
+  - [X] order food
+  - [ ] think about what music to play
+  - [X] talk to the neighbors
+#+end_example
+
+ Checkboxes states
+:PROPERTIES:
+:DESCRIPTION: Not checked, partially checked and checked.
+:END:
+
+A checkbox can be in one of the three states:
+1. not checked =[ ]=
+2. partially checked =[-]=
+3. checked =[X]=
+
+Checkboxes work hierarchically, so if a checkbox item has children
+that are checkboxes, toggling one of the children checkboxes makes the
+parent checkbox reflect if none, some, or all of the children are
+checked.
+
+If all child checkboxes are not checked, the parent checkbox is also not checked.
+#+begin_example
+- [ ] call people
+  - [ ] Peter
+  - [ ] Sarah
+#+end_example
+
+If some but not all child checkboxes are checked, the parent checkbox is partially checked.
+#+begin_example
+- [-] call people
+  - [X] Peter
+  - [ ] Sarah
+#+end_example
+
+If all child checkboxes are checked, the parent checkbox is also checked.
+#+begin_example
+- [X] call people
+  - [X] Peter
+  - [X] Sarah
+#+end_example
+
+#+cindex: blocking, of checkboxes
+#+cindex: checkbox blocking
+#+cindex: @samp{ORDERED}, property
+If the current outline node has an =ORDERED= property, checkboxes must
+be checked off in sequence, and an error is thrown if you try to check
+off a box while there are unchecked boxes above it.
+
+ Checkboxes commands
+- {{{kbd(C-c C-c)}}} (~org-toggle-checkbox~) ::
+
+  #+kindex: C-c C-c
+  #+findex: org-toggle-checkbox
+  Toggle checkbox status or---with prefix argument---checkbox presence
+  at point.  With a single prefix argument, add an empty checkbox or
+  remove the current one[fn:: {{{kbd(C-u C-c C-c)}}} on the /first/
+  item of a list with no checkbox adds checkboxes to the rest of the
+  list.].  With a double prefix argument, set it to =[-]=, which is
+  considered to be an intermediate state.
+
+- {{{kbd(C-c C-x C-b)}}} (~org-toggle-checkbox~) ::
+
+  #+kindex: C-c C-x C-b
+  Toggle checkbox status or---with prefix argument---checkbox presence
+  at point.  With double prefix argument, set it to =[-]=, which is
+  considered to be an intermediate state.
+
+  - If there is an active region, toggle the first checkbox in the
+region and set all remaining boxes to the same status as the
+first.  With a prefix argument, add or remove the checkbox for all
+items in the region.
+
+  - If point is in a headline, toggle checkboxes in the regio

Re: [PATCH] doc/org-manual.org: Checkboxes, add checkbox states examples

2023-11-07 Thread Sławomir Grochowski
Awesome!
Thank you Bastien.
I'm planning to add some examples with checkbox cookie data.

Regards,
Sławomir Grochowski

On Wed, Nov 8, 2023 at 12:37 AM Bastien Guerry  wrote:

> Sławomir Grochowski  writes:
>
> >> Applied, with a minor modification, using 1. instead of 1) for the
> >> list items.
> >
> > When will you merge the patch? https://git.savannah.gnu.org/cgit/
> > emacs/org-mode.git/
>
> Done now.
>
> > And when update will be visible on site https://orgmode.org/org.html#
> > Checkboxes ?
>
> When we release the main branch as a new stable version of Org, so not
> so soon.
>
> Best,
>
> --
>  Bastien Guerry
>


Re: [PATCH] doc/org-manual.org: Checkboxes, add checkbox states examples

2023-11-07 Thread Sławomir Grochowski
> Applied, with a minor modification, using 1. instead of 1) for the
> list items.

When will you merge the patch?
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/
And when update will be visible on site
https://orgmode.org/org.html#Checkboxes ?

Regards,
Sławomir Grochowski


On Mon, Nov 6, 2023 at 5:49 PM Bastien  wrote:

> Hi Sławomir,
>
> Sławomir Grochowski  writes:
>
> > I have added some examples to the org-manual.
> > Patch in attachment and also a screenshot of generated html.
>
> Applied, with a minor modification, using 1. instead of 1) for the
> list items.
>
> I added you as a contributor on
> https://orgmode.org/worg/contributors.html
>
> Thanks!
>
> --
>  Bastien
>


Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2023-11-05 Thread Sławomir Grochowski
Yes. You are right.
After thinking about it I think the same.

But why is it allowed in '(org-toggle-checkbox  TOGGLE-PRESENCE)'.
To set a normal checkbox to 'partial state'?
Description from function: 'With a double prefix argument, set the checkbox
to "[-]".'

Probably it should not be allowed for normal checkbox only for parent
checkbox, which have children.

What do you think?

Regards,
Sławomir Grochowski






On Sun, Nov 5, 2023 at 1:25 PM Ihor Radchenko  wrote:

> Sławomir Grochowski  writes:
>
> > I was wondering how many states a checkbox has.
> > Based on https://orgmode.org/manual/Checkboxes.html I conclude that
> there
> > are 3 states:
> > 1. [   ] - not done
> > 2. [ - ] - an intermediate state
> > 3. [X] - done
> >
> > So I think all 3 states should be available to choose from in the
> function
> > 'org-columns-next-allowed-value''
> > for functions that use checkboxes.
> > In code this is a line
> >
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-colview.el#n754
> >
> > So I would change it from this:
> > -  (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
> > to that:
> > + (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[-]" "[X]")))
> >
> > What do you think?
>
> I think that your use-case is not necessarily common enough to change
> the defaults. But we can introduce a defcustom here. Patches welcome!
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


Re: [FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2023-11-01 Thread Sławomir Grochowski
I have found good explanation of 'tristate checkbox':
https://dequeuniversity.com/library/aria/checkbox-tri#:~:text=A%20tri%2Dstate%20checkbox%20can,parent%20checkbox%20is%20partially%20checked
.

"A tristate checkbox can be checked, not checked, or partially
checked. The condition of being partially checked is based on the
selection of child elements. If all child elements are selected, the
parent checkbox is checked. If some child elements are selected, the
parent checkbox is partially checked."

So as I understand it this is the same approach in org-mode.
But I'm using 'an intermediate state' to mark a checkbox that can't be
'done'.

Like, I planned to go to gym:
- [  ]  go to gym on 01.11.2023

But the time has passed and I didn't go to the gym on this precise day.
So I can't mark the checkbox as done, I can only leave it as it is.
But after a couple of days I'm not sure if I was at the gym that day and
maybe I just forgot to mark it as done.
So for this purpose I'm marking it as [ - ] that explicitly I can't do this
checkbox.
Maybe others use it the same way?
What do you think?

Regards,
Sławomir Grochowski



On Wed, Nov 1, 2023 at 5:39 PM Sławomir Grochowski <
slawomir.grochow...@gmail.com> wrote:

> Dear All,
>
> I was wondering how many states a checkbox has.
> Based on https://orgmode.org/manual/Checkboxes.html I conclude that there
> are 3 states:
> 1. [   ] - not done
> 2. [ - ] - an intermediate state
> 3. [X] - done
>
> So I think all 3 states should be available to choose from in the function
> 'org-columns-next-allowed-value''
> for functions that use checkboxes.
> In code this is a line
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-colview.el#n754
>
> So I would change it from this:
> -  (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
> to that:
> + (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[-]" "[X]")))
>
> What do you think?
>
> Regards,
> Sławomir Grochowski
>
>


[FR] 'org-columns-next-allowed-value' for 'summary-checkbox'es functions should have 'intermediate state' '[-]'

2023-11-01 Thread Sławomir Grochowski
Dear All,

I was wondering how many states a checkbox has.
Based on https://orgmode.org/manual/Checkboxes.html I conclude that there
are 3 states:
1. [   ] - not done
2. [ - ] - an intermediate state
3. [X] - done

So I think all 3 states should be available to choose from in the function
'org-columns-next-allowed-value''
for functions that use checkboxes.
In code this is a line
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org-colview.el#n754

So I would change it from this:
-  (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[X]")))
to that:
+ (`(,_ ,_ ,_ ,(or "X" "X/" "X%") ,_) '("[ ]" "[-]" "[X]")))

What do you think?

Regards,
Sławomir Grochowski


Re: org-columns--summary-mean-time [BUG]

2023-10-14 Thread Sławomir Grochowski
Now I get it. Thank you for explanation.


On Sat, Oct 14, 2023 at 9:39 PM Ihor Radchenko  wrote:

> Sławomir Grochowski  writes:
>
> > But I'm talking about:
> > (":mean" . org-columns--summary-mean-time)
> > not  ("@mean" . org-columns--summary-mean-age).
> >
> > So this is the right function (":mean" . org-columns--summary-mean-time)?
> > Or do I need to write a new one?
>
> I think you still need to write a new one.
>
> @mean works on (1) timestamps; (2) durations, while :mean works only on
> durations.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


Re: org-columns--summary-mean-time [BUG]

2023-10-14 Thread Sławomir Grochowski
But I'm talking about:
(":mean" . org-columns--summary-mean-time)
not  ("@mean" . org-columns--summary-mean-age).

So this is the right function (":mean" . org-columns--summary-mean-time)?
Or do I need to write a new one?

On Sat, Oct 14, 2023 at 9:19 PM Ihor Radchenko  wrote:

> Sławomir Grochowski  writes:
>
> > In ex. I want to have an average time when I go to bed.
> > So on Monday I went to bed at 22:00 and on Tuesday at 02:00.
> > So the average time would be midnight 00:00.
> > But it returns 12:00 which is noon.
>
> As I said, it is because it does not calculate an average time of the
> day, but an average duration:
>
>  ‘@mean’Arithmetic mean of ages (in days/hours/mins/seconds).
>
> You can customize `org-columns-summary-types' to have a column summary
> you need for your purposes.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


Re: org-columns--summary-mean-time [BUG]

2023-10-14 Thread Sławomir Grochowski
In ex. I want to have an average time when I go to bed.
So on Monday I went to bed at 22:00 and on Tuesday at 02:00.
So the average time would be midnight 00:00.
But it returns 12:00 which is noon.





On Sat, Oct 14, 2023 at 8:50 PM Ihor Radchenko  wrote:

> Sławomir Grochowski  writes:
>
> > I'm not sure if this is a bug or I need to change something?
> >
> > (org-columns--summary-mean-time '("17:00" "18:00") nil) ;=> "17:30" ; ok
> > (org-columns--summary-mean-time '("22:00" "02:00") nil) ;=> "12:00" ;
> > should be 00:00
> > (org-columns--summary-mean-time '("22:00" "03:00") nil) ;=> "12:30" ;
> > should be 00:30
>
> The function computes mean duration. I see nothing wrong.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


org-columns--summary-mean-time [BUG]

2023-10-14 Thread Sławomir Grochowski
Dear All,

I'm not sure if this is a bug or I need to change something?

(org-columns--summary-mean-time '("17:00" "18:00") nil) ;=> "17:30" ; ok
(org-columns--summary-mean-time '("22:00" "02:00") nil) ;=> "12:00" ;
should be 00:00
(org-columns--summary-mean-time '("22:00" "03:00") nil) ;=> "12:30" ;
should be 00:30

What do you think?

Regards,
Sławomir Grochowski


Re: [RFC] [feat] org-colview/org-columns: 'column view' moving rows up/down

2023-08-20 Thread Sławomir Grochowski
I thought it would get lost in the many thousands of other TODOs you have
on your plate.
Thank you.

But to my another surprise you have fixed the bug that was killing me
everyday 'org-insert-heading: Fix when folded text is kept right at the new
heading'.
Thank you very much.

Regards,
Sławomir Grochowski


On Sun, Aug 20, 2023 at 12:43 PM Ihor Radchenko  wrote:

> Ihor Radchenko  writes:
>
> > I suspect that it is something with overlay boundaries. AFAIR, some org
> > subtree motion functions use `insert-before-markers', which may be
> > tricky when we insert right at the beginning/end of an overlay.
>
> It was totally unrelated bug on Org side.
> Applied, onto main, with minor amendments to function docstring and
> changelog format.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=650e42996
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e08d87831
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


Re: [BUG?] org-babel eval src block with :dir parameter

2023-08-06 Thread Sławomir Grochowski
Yes I just simplified the example. The case is if I add :dir param it
result will be wrapped it #+begin_example #+end_example block.

On Sun, Aug 6, 2023 at 9:02 PM Ihor Radchenko  wrote:

> Sławomir Grochowski  writes:
>
> > I'm surprised by this behaviour.
> >
> > #+begin_src sh :results replace output
> > ls
> > #+end_src
> >
> > #+RESULTS:
> > : file1.txt
> > : file2.txt
> >
> > Adding :dir parameter changes output RESULTS. It's now wrapped in
> > #+begin_example #+end_example block.
>
> I am pretty sure that your example is not the whole output. The variant
> with :dir has many more files, right? If so, check out
> `org-babel-min-lines-for-block-output'.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


[BUG?] org-babel eval src block with :dir parameter

2023-08-06 Thread Sławomir Grochowski
Dear All,

I'm surprised by this behaviour.

#+begin_src sh :results replace output
ls
#+end_src

#+RESULTS:
: file1.txt
: file2.txt

Adding :dir parameter changes output RESULTS. It's now wrapped in
#+begin_example #+end_example block.

#+begin_src sh :dir ~/ :results replace output
ls
#+end_src

#+RESULTS:
#+begin_example
file1.txt
file2.txt
#+end_example

Is it a bug?

Org mode version 9.6.7 (9.6.7-gc74c4a @
/home/slk/.emacs.d/straight/build/org/)
GNU Emacs 29.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24,
cairo version 1.16.0) of 2023-07-30

Regards,
Sławomir Grochowski


[test] org-colview/org-columns

2023-04-17 Thread Sławomir Grochowski
Dear All,

I'm trying to better understand 'org-colview/org-columns'.
So I wrote some tests. File in attachment.
I hope the commit message is correct.

I will be very grateful for your comments & feedback on what can be done
better.

Regards,
Sławomir Grochowski
From 2768ecfd896d2dd950b23f0134a3779523479d35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= 
Date: Mon, 17 Apr 2023 19:18:16 +0200
Subject: [PATCH] testing/lisp/test-org-colview.el: Add tests

* test-org-colview.el (test-org-colview/uncompile-format,
test-org-colview/compile-format): Add tests for functions:
org-columns-uncompile-format & org-columns-compile-format
---
 testing/lisp/test-org-colview.el | 66 
 1 file changed, 66 insertions(+)

diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index 9daec18e2..a80763622 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -26,6 +26,72 @@
 (require 'org-duration)
 (require 'org-inlinetask)
 
+(ert-deftest test-org-colview/uncompile-format ()
+  "Test `org-columns-uncompile-format' specifications."
+  ;; With minimum data, one element
+  (should
+   (equal "%ITEM"
+  (org-columns-uncompile-format '(("ITEM" "ITEM" nil nil nil)
+  ;; With minimum data, two element
+  (should
+   (equal "%ITEM %TODO"
+  (org-columns-uncompile-format
+   `(("ITEM" "ITEM" nil nil nil) ("TODO" "TODO" nil nil nil)
+  ;; Read width
+  (should
+   (equal "%10ITEM"
+  (org-columns-uncompile-format `(("ITEM" "ITEM" 10 nil nil)
+  ;; Read title
+  (should
+   (equal "%ITEM(some title)"
+  (org-columns-uncompile-format `(("ITEM" "some title" nil nil nil)
+  ;; Read operator
+  (should
+   (equal "%ITEM{+}"
+  (org-columns-uncompile-format `(("ITEM" "ITEM" nil "+" nil)
+  ;; Read operator printf
+  (should
+   (equal "%ITEM{+;%.1f}"
+  (org-columns-uncompile-format  `(("ITEM" "ITEM" nil "+" "%.1f"))
+
+(ert-deftest test-org-colview/compile-format ()
+  "Test `org-columns-compile-format' specifications."
+  ;; With minimum data, one element
+  (should
+   (equal `(("ITEM" "ITEM" nil nil nil))
+  (org-columns-compile-format
+   "%ITEM")))
+  ;; With minimum data, two element
+  (should
+   (equal `(("ITEM" "ITEM" nil nil nil) ("TODO" "TODO" nil nil nil))
+  (org-columns-compile-format
+   "%ITEM %TODO")))
+  ;; Read width
+  (should
+   (equal `(("ITEM" "ITEM" 10 nil nil))
+  (org-columns-compile-format
+   "%10ITEM")))
+  ;; Upcase property name
+  (should
+   (equal `(("ITEM" "item" nil nil nil))
+  (org-columns-compile-format
+   "%item")))
+  ;; Read title
+  (should
+   (equal `(("ITEM" "some title" nil nil nil))
+  (org-columns-compile-format
+   "%ITEM(some title)")))
+  ;; Read operator
+  (should
+   (equal `(("ITEM" "ITEM" nil "+" nil))
+  (org-columns-compile-format
+   "%ITEM{+}")))
+  ;; Read operator printf
+  (should
+   (equal `(("ITEM" "ITEM" nil "+" "%.1f"))
+  (org-columns-compile-format
+   "%ITEM{+;%.1f}"
+
 (ert-deftest test-org-colview/get-format ()
   "Test `org-columns-get-format' specifications."
   ;; Without any clue, use `org-columns-default-format'.
-- 
2.30.2



Re: [RFC] [feat] org-colview/org-columns: 'column view' moving rows up/down

2023-04-11 Thread Sławomir Grochowski
Thank you Ihor for finding such an important bug.

I've tried to pinpoint it.
I think it happens only when: first heading (row) is the first line of the
buffer.
To reproduce it:
* a
* b
* c

C-u C-c C-x C-c => runs `org-columns' with global argument.
Using a keyboard. Press M-, M-, M-.
Heading 'a' will disappear.

I've tried to create a test based on that behaviour, but can't reproduce
this bug in test env.
Also I can't reproduce this when I'm invoking the commands directly from
M-x.
As I understand it something with overlay. Which try to jump before the
first line of the buffer.
And that makes some kind of overflow?
I will try to simplify the example and create a simple overlay without
org-columns.
If anyone has some ideas how to debug it I will be grateful for the hints.


On Sun, Apr 9, 2023 at 11:13 AM Ihor Radchenko  wrote:

> Sławomir Grochowski  writes:
>
> > Thank you Ihor for the code review.
> > Now please help me find everything that can be improved in this patch.
>
> I just tried to use the patch using the following test case:
>
> 1. Create a new Org file containing
>
> * A
> * B
> * C
> ** C1
> * D
>
> 2. C-u C-c C-x C-c
> 3. M-<
> 4. M- M- M- M- M- M- M- M- C-c C-c
> 5. Observe text disappearing and columns being unhighlighted. At the
>end, the buffer is left with
>
> * B
>
> >> Finally, I see no records about you copyright assignment status.
> >> Please take a look at
> >> https://orgmode.org/worg/org-contribute.html#copyright
> >>
> >
> >  Yes, it's my first time. I sent an email to ass...@gnu.org, yesterday.
>
> Note that they should reply within 5 working days.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


Re: [RFC] [feat] org-colview/org-columns: 'column view' moving rows up/down

2023-04-08 Thread Sławomir Grochowski
Thank you Ihor for the code review.
Now please help me find everything that can be improved in this patch.


> The patch looks good in general, but you need to add proper commit
> message. See https://orgmode.org/worg/
> <https://orgmode.org/worg/org-contribute.html#commit-messages>
> org-contribute.html#commit-messages
> <https://orgmode.org/worg/org-contribute.html#commit-messages>


Fixed.

Also, you need to add etc/ORG-NEWS entry about the new functionality and
> also modify the manual.
>

I added description to the manual and missing description of two
other commands: org-columns-move-left, org-columns-move-right that were
missing.


> Finally, I see no records about you copyright assignment status.
> Please take a look at
> https://orgmode.org/worg/org-contribute.html#copyright
>

 Yes, it's my first time. I sent an email to ass...@gnu.org, yesterday.

Does this test have anything to do with the new feature?
>

 Yes, you are right. This test has nothing in common with the feature. I
have removed it.

On Fri, Apr 7, 2023 at 1:01 PM Ihor Radchenko  wrote:

> Sławomir Grochowski  writes:
>
> > Recently I often use 'column view' feature.
> > To my suprise in 'column view' user can't move rows up & down.
> > So I wrote a little code snippet to be able to do it, and I'm sharing it
> with you.
> >
> > Questions:
> > 1. Why user can't move rows up & down in 'column view'?
> > 2. Is this was intentional design decision?
>
> I do not see any particular reason.
> The current design dates back to 15 years ago - the initial commit in
> our current git repo.
>
> > I think 'column view' is missing one the core feel & functionality of
> org-mode - moving rows (headings) up & down.
> > In my experiance with 'column view' & tables I shuffle a lot of columns
> & rows order.
>
> Sounds reasonable.
>
> > From 1f0f2052b8dddf4982ab35267ed1564f2250784b Mon Sep 17 00:00:00 2001
> > From: Sławomir Grochowski 
> > Date: Mon, 3 Apr 2023 19:23:09 +0200
> > Subject: [PATCH] org-columns: add feat to move row up/down
>
> The patch looks good in general, but you need to add proper commit
> message. See https://orgmode.org/worg/org-contribute.html#commit-messages
>
> Also, you need to add etc/ORG-NEWS entry about the new functionality and
> also modify the manual.
>
> Finally, I see no records about you copyright assignment status.
> Please take a look at
> https://orgmode.org/worg/org-contribute.html#copyright
>
> > +(defun org-columns--move-row ( up)
> > +"Move table row. Calls `org-move-subtree-down' or
> `org-move-subtree-up'."
>
> *Move column view table row.
>
> We generally prefer single sentence as the first line of the docstring.
> Also, please describe UP argument in the docstring.
>
> > +;; Each column is an overlay on top of a character.  So there has
> > +;; to be at least as many characters available on the line as
> > +;; columns to display.
> > +;; 'org-columns--display-here'
> > +(ert-deftest test-org-colview/bug-add-whitespace ()
> > +  "Insert space characters if number of characters on the line
> > +  is lower then number of columns."
> > +  :expected-result :failed
>
> Does this test have anything to do with the new feature?
>
> > +(ert-deftest test-org-colview/columns-move-row-down ()
> > +  "Test `org-columns-move-row-down' specifications."
> > +  (should
> > +   (equal "* H
> > +** B
> > +** A
> > +"
> > +  (org-test-with-temp-text "* H
> > +** A
> > +** B
> > +"
> > +(let ((org-columns-default-format "%ITEM")) (org-columns)
> > + (next-line 1)
> > + (org-columns-move-row-down)
> > + (buffer-substring-no-properties (point-min)
> (point-max)))
>
> One special case we may want to consider is when columns are from
> different heading levels, like
>
> * H
> ** A
> *** A1
> ** B
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>
From c5cc24607306399d1b1ca583e63a2fe7b71dbf89 Mon Sep 17 00:00:00 2001
From: Sławomir Grochowski 
Date: Mon, 3 Apr 2023 19:23:09 +0200
Subject: [PATCH] lisp/org-colview.el: add new commands to move column view
 table row

* doc/org-manual.org (org-columns-move-row-up,
org-columns-move-row-down) and also (org-columns-move-left,
org-columns-move-right): Document two new and two old commands.
* etc/ORG-N

[RFC] [feat] org-colview/org-columns: 'column view' moving rows up/down

2023-04-06 Thread Sławomir Grochowski
Dear All,

This is my first proposal & code submit. 
I will be very gratefull for you comments & feedback what can be done better.  

Recently I often use 'column view' feature. 
To my suprise in 'column view' user can't move rows up & down.
So I wrote a little code snippet to be able to do it, and I'm sharing it with 
you.

Questions:
1. Why user can't move rows up & down in 'column view'?
2. Is this was intentional design decision?

I think 'column view' is missing one the core feel & functionality of org-mode 
- moving rows (headings) up & down.
In my experiance with 'column view' & tables I shuffle a lot of columns & rows 
order.

In my point of view 'core fuctionalities of org-mode' are: 
1. moving 'things' headings, rows, columns
   1. horizontally (left-right)
   2. vertically (up-down)
2. cyclic visibility

Let's compare this functionality in 3 areas:  

|   | heading | table | column view |
|---+-+---+-|
| moving left-right | [X] | [X]   | [X] |
| moving up-down| [X] | [X]   | [ ] |
| cyclic visibility | [X] | NA| [X] |

Cyclic visibility does not apply to 'table' because it operate on simple data, 
which is not structured, nested.

'Column view' transform 'headings' into rows, and their properties into 
columns, creating a table.

'Column view' is a combination of 'table' & 'heading':
'Heading' gives a 'table' properties for columns and cyclic visibilty feature, 
because it provide nested structure.
'Table' gives a 'heading' a 'column view' on heading properties.

'Column view' is similar to 'table'. They operate on same actions & keybindings.

| | column view  | table|
|-+--+--|
| move column left-right  | [X]  | [X]  |
| move column left-right keys | meta left-right  | meta left-right  |
| move row up-down| [ ]  | [X]  |
| move row up-down keys   |  | meta up-down |
| add column  | [X]  | [X]  |
| add column keys | shift-meta right | shift-meta right |
| remove column   | [X]  | [X]  |
| remove column keys  | shift-meta left  | shift-meta left  |

I thnik it would be beneficial to have consistance interface in 'column view' 
and 'table'.

Based on that, I propose to add functionality to 'move row up/down' in 'column 
view' and set keybinding the same as in table above -> meta up/down.
Patch is in the attachment.

What others think about it? 

Regards,
Sławomir Grochowski
>From 1f0f2052b8dddf4982ab35267ed1564f2250784b Mon Sep 17 00:00:00 2001
From: Sławomir Grochowski 
Date: Mon, 3 Apr 2023 19:23:09 +0200
Subject: [PATCH] org-columns: add feat to move row up/down

---
 lisp/org-colview.el  | 22 +++
 testing/lisp/test-org-colview.el | 66 
 2 files changed, 88 insertions(+)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 92a3b473d..0971d5eef 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -209,6 +209,8 @@ See `org-columns-summary-types' for details.")
 (org-defkey org-columns-map ">" #'org-columns-widen)
 (org-defkey org-columns-map [(meta right)] #'org-columns-move-right)
 (org-defkey org-columns-map [(meta left)]  #'org-columns-move-left)
+(org-defkey org-columns-map [(meta down)]  #'org-columns-move-row-down)
+(org-defkey org-columns-map [(meta up)]  #'org-columns-move-row-up)
 (org-defkey org-columns-map [(shift meta right)] #'org-columns-new)
 (org-defkey org-columns-map [(shift meta left)]  #'org-columns-delete)
 (dotimes (i 10)
@@ -1003,6 +1005,26 @@ details."
 (org-columns-move-right)
 (backward-char 1)))
 
+(defun org-columns--move-row ( up)
+"Move table row. Calls `org-move-subtree-down' or `org-move-subtree-up'."
+(let ((inhibit-read-only t)
+  (col (current-column)))
+  (if up (org-move-subtree-up)
+(org-move-subtree-down))
+  (let ((org-columns-inhibit-recalculation t))
+(org-columns-redo)
+(move-to-column col
+
+(defun org-columns-move-row-down ()
+  "Move table row (subtree) down."
+  (interactive)
+  (org-columns--move-row))
+
+(defun org-columns-move-row-up ()
+  "Move table row (subtree) up."
+  (interactive)
+  (org-columns--move-row 'up))
+
 (defun org-columns-store-format ()
   "Store the text version of the current columns format.
 The format is stored either in the COLUMNS property of the node
diff --git a/testing/lisp/test-org-colview.el b/testing/lisp/test-org-colview.el
index 9daec18e2..fd02f054c 100644
--- a/testing/lisp/test-org-colview.el
+++ b/testing/lisp/test-org-colview.el
@@ -1010,6 +1010,72 @@
 	(list (get-char-property 1 'org-columns-val

Re: [bug] org-columns-edit-value will capitalize property

2023-03-26 Thread Sławomir Grochowski
My apologies, I've made a mistake. There is not such a bug. Everythings
works correctly.

On Wed, 22 Mar 2023 at 13:18, Sławomir Grochowski <
slawomir.grochow...@gmail.com> wrote:

> Ok. I will try to send my first patch.
> Desired behavior is: by using command 'org-columns-edit-value' do not
> change 'property' name, just its value.
>
> On Wed, 22 Mar 2023 at 12:52, Ihor Radchenko  wrote:
>
>> Sławomir Grochowski  writes:
>>
>> > After updating the value of property using command
>> 'org-columns-edit-value'
>> > it will capitalize the property name.
>> >
>> > As I understand, "Org is standardized on lower case"
>> > https://list.orgmode.org/87tuuw3n15@nicolasgoaziou.fr/.
>> >
>> > Is this a bug?
>>
>> This is for historical reasons.
>> Org supports (and will support) both, and we are slowly converting to
>> lower case.
>>
>> Patches welcome to change org-columns-edit-value.
>>
>> --
>> Ihor Radchenko // yantar92,
>> Org mode contributor,
>> Learn more about Org mode at <https://orgmode.org/>.
>> Support Org development at <https://liberapay.com/org-mode>,
>> or support my work at <https://liberapay.com/yantar92>
>>
>


Re: [bug] org-columns-edit-value will capitalize property

2023-03-22 Thread Sławomir Grochowski
Ok. I will try to send my first patch.
Desired behavior is: by using command 'org-columns-edit-value' do not
change 'property' name, just its value.

On Wed, 22 Mar 2023 at 12:52, Ihor Radchenko  wrote:

> Sławomir Grochowski  writes:
>
> > After updating the value of property using command
> 'org-columns-edit-value'
> > it will capitalize the property name.
> >
> > As I understand, "Org is standardized on lower case"
> > https://list.orgmode.org/87tuuw3n15@nicolasgoaziou.fr/.
> >
> > Is this a bug?
>
> This is for historical reasons.
> Org supports (and will support) both, and we are slowly converting to
> lower case.
>
> Patches welcome to change org-columns-edit-value.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


[bug] org-columns-edit-value will capitalize property

2023-03-22 Thread Sławomir Grochowski
Hello,

After updating the value of property using command 'org-columns-edit-value'
it will capitalize the property name.

As I understand, "Org is standardized on lower case"
https://list.orgmode.org/87tuuw3n15@nicolasgoaziou.fr/.

Is this a bug?

Btw. interesting article about using upper case.
https://www.psychnewsdaily.com/new-study-shows-all-caps-harder-to-read/

GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24,
cairo version 1.16.0) of 2023-02-26
org release_9.6.1-34

Regards,
Sławomir Grochowski


[BUG] org-catch-invisible-edits has stopped working [9.5.5 (9.5.5-geb5ef0 @ /home/slk/.emacs.default/straight/build/org/)]

2022-09-09 Thread Sławomir Grochowski
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.

functionality provided by this variable:

(setq-default org-catch-invisible-edits 'error) ;; prevent deleting
invisible text

has stopped working,


Emacs  : GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.5, cairo version 1.16.0)
 of 2022-08-25
Package: Org mode version 9.5.5 (9.5.5-geb5ef0 @
/home/slk/.emacs.default/straight/build/org/)

current state:
==
(setq
 org-log-note-headings '((note . "%t") (done . "CLOSING NOTE %t") (state .
"State %-12s from %-12S %t")
(note . "Note taken on %t") (reschedule . "Rescheduled from %S on %t")
(delschedule . "Not scheduled, was %S on %t") (redeadline . "New deadline
from %S on %t")
(deldeadline . "Removed deadline, was %S on %t") (refile . "Refiled on %t")
(clock-out . ""))
 org-link-elisp-confirm-function 'yes-or-no-p
 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-log-done 'time
 org-agenda-custom-commands '(("w" "Weekly review" agenda ""
  ((org-agenda-start-day "-14d") (org-agenda-span 14)
(org-agenda-start-on-weekday 1)
(org-agenda-start-with-log-mode '(closed)) (org-agenda-archives-mode t)
(org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp "^\\*\\*
DONE ")))
  )
 ("n" "Agenda and all TODOs" agenda "" ((alltodo ""
 org-log-into-drawer t
 org-startup-folded t
 org-agenda-files '("~/aamystuff/mystuff/index.org"
"~/aamystuff/life/life.org.gpg"
   "~/aamystuff/phprefactor/phprefactor.org")
 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-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
 org-ascii-format-drawer-function #[771 " \207" [] 4 "\n\n(fn NAME CONTENTS
WIDTH)"]
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
 org-cycle-optimize-window-after-visibility-change)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-font-lock-set-keywords-hook '(doom-themes-enable-org-fontification)
 org-mode-hook '(#[0 "\301\211 \207" [imenu-create-index-function
org-imenu-get-tree] 2] org-tempo-setup
org-eldoc-load visual-line-mode org-indent-mode org-bullets-mode
#[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-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-latex-format-headline-function
'org-latex-format-headline-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 outline-isearch-open-invisible-function 'outline-isearch-open-invisible
 org-agenda-sorting-strategy '((todo todo-state-up priority-down))
 org-fold-catch-invisible-edits 'error
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 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-hide-leading-stars t
 org-todo-keywords '((sequence "REPEAT" "DOING" "TODO" "NEXT" "WAITING"
"SOMEDAY" "LOOKING-FOR" "DONE")
(sequence "|" "CANCELED(c)" "RECONSIDER(@)"))
 org-structure-template-alist '(("e" . "src elisp") ("a" . "export ascii")
("c" . "center") ("C" . "comment")
("E" . "export") ("h" . "export html") ("l" . "export latex") ("q" .
"quote")
("s" . "src") ("v" . "verse"))
 org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
 org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-confirm-babel-evaluate nil
 org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal
 org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
 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-agenda-finalize-hook '((lambda nil
(save-excursion (goto-char (point-min))
 (if (re-search-forward "Global list of TODO items of type:
[[:upper:]]*" nil t)
  (progn
(insert
(propertize (format " (%s