Browse Source

org,colview: Quit column-view with C-c C-c. manual,news: Update

* lisp/org-colview.el (org-columns-toggle-or-columns-quit): New
  function.  Takes the place of removed function
Marco Wahl 1 year ago
4 changed files with 41 additions and 13 deletions
  1. 9 5
  2. 16 0
  3. 14 8
  4. 2 0

+ 9 - 5

@@ -5469,7 +5469,7 @@ either for all clocks or just for today.
   ~org-columns-default-format~, and column view is established for the
   current entry and its subtree.
-- {{{kbd(r)}}} or {{{kbd(g)}}} (~org-columns-redo~) ::
+- {{{kbd(r)}}} or {{{kbd(g)}}} on a columns view line (~org-columns-redo~) ::
   #+kindex: r
   #+kindex: g
@@ -5477,9 +5477,10 @@ either for all clocks or just for today.
   Recreate the column view, to include recent changes made in the
-- {{{kbd(q)}}} (~org-columns-quit~) ::
+- {{{kbd(C-c C-c)}}} or {{{kbd(q)}}} on a columns view line (~org-columns-quit~) ::
   #+kindex: q
+  #+kindex: C-c C-c
   #+findex: org-columns-quit
   Exit column view.
@@ -5519,11 +5520,12 @@ either for all clocks or just for today.
   property.  For example, the tag completion or fast selection
   interface pops up when editing a =TAGS= property.
-- {{{kbd(C-c C-c)}}} (~org-columns-set-tags-or-toggle~) ::
+- {{{kbd(C-c C-c)}}} (~org-columns-toggle-or-columns-quit~) ::
   #+kindex: C-c C-c
-  #+findex: org-columns-set-tags-or-toggle
-  When there is a checkbox at point, toggle it.
+  #+findex: org-columns-toggle-or-columns-quit
+  When there is a checkbox at point, toggle it.  Else exit column
+  view.
 - {{{kbd(v)}}} (~org-columns-show-value~) ::
@@ -18590,6 +18592,8 @@ the context.  It is probably the most over-worked, multi-purpose key
 combination in Org.  Its uses are well documented throughout this
 manual, but here is a consolidated list for easy reference.
+- If column view (see [[*Column View]]) is on, exit column view.
 - If any highlights shown in the buffer from the creation of a sparse
   tree, or from clock display, remove such highlights.

+ 16 - 0

@@ -21,6 +21,22 @@ just as if it was at outline level 0.  Inheritance for properties will
 work also for this level.  In other words: defining things in a
 property drawer before the first headline will make them "inheritable"
 for all headlines.
+** New functions
+*** ~org-columns-toggle-or-columns-quit~
+=<C-c C-c>= bound to ~org-columns-toggle-or-columns-quit~ replaces the
+recent ~org-columns-set-tags-or-toggle~.  Tag setting is still
+possible via column view value edit or with =<C-c C-q>=.
+** Removed functions and variables
+*** ~org-columns-set-tags-or-toggle~
+See [[*~org-columns-toggle-or-columns-quit~]]
+** Miscellaneous
+*** Exit column view with =<C-c C-c>=
+=<C-c C-c>= (almost) everywhere in a buffer exits column view.  Before
+there was only key =<q>= to exit column view and only functional on lines
+which were affected by the column view.
 * Version 9.3

+ 14 - 8

@@ -164,7 +164,7 @@ See `org-columns-summary-types' for details.")
 (org-defkey org-columns-map "o" 'org-overview)
 (org-defkey org-columns-map "e" 'org-columns-edit-value)
 (org-defkey org-columns-map "\C-c\C-t" 'org-columns-todo)
-(org-defkey org-columns-map "\C-c\C-c" 'org-columns-set-tags-or-toggle)
+(org-defkey org-columns-map "\C-c\C-c" 'org-columns-toggle-or-columns-quit)
 (org-defkey org-columns-map "\C-c\C-o" 'org-columns-open-link)
 (org-defkey org-columns-map "v" 'org-columns-show-value)
 (org-defkey org-columns-map "q" 'org-columns-quit)
@@ -554,13 +554,19 @@ for the duration of the command.")
   (interactive "P")
   (org-columns-edit-value "TODO"))
-(defun org-columns-set-tags-or-toggle (&optional _arg)
-  "Toggle checkbox at point, or set tags for current headline."
-  (interactive "P")
-  (if (string-match "\\`\\[[ xX-]\\]\\'"
-		    (get-char-property (point) 'org-columns-value))
-      (org-columns-next-allowed-value)
-    (org-columns-edit-value "TAGS")))
+(defun org-columns-toggle-or-columns-quit ()
+  "Toggle checkbox at point, or quit column view."
+  (interactive)
+  (or (org-columns--toggle)
+      (org-columns-quit)))
+(defun org-columns--toggle ()
+  "Toggle checkbox at point.  Return non-nil if toggle happened, else nil.
+See info documentation about realizing a suitable checkbox."
+  (when (string-match "\\`\\[[ xX-]\\]\\'"
+		      (get-char-property (point) 'org-columns-value))
+    (org-columns-next-allowed-value)
+    t))
 (defvar org-overriding-columns-format nil
   "When set, overrides any other format definition for the agenda.

+ 2 - 0

@@ -141,6 +141,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-clock-update-time-maybe "org-clock" ())
 (declare-function org-clocking-buffer "org-clock" ())
 (declare-function org-clocktable-shift "org-clock" (dir n))
+(declare-function org-columns-quit "org-colview" ())
 (declare-function org-columns-insert-dblock "org-colview" ())
 (declare-function org-duration-from-minutes "org-duration" (minutes &optional fmt canonical))
 (declare-function org-element-at-point "org-element" ())
@@ -17816,6 +17817,7 @@ This command does many different things, depending on context:
   inhibited by setting `org-babel-no-eval-on-ctrl-c-ctrl-c'."
   (interactive "P")
+   ((bound-and-true-p org-columns-overlays) (org-columns-quit))
    ((or (bound-and-true-p org-clock-overlays) org-occur-highlights)
     (when (boundp 'org-clock-overlays) (org-clock-remove-overlays))