org-columns-redo: Fix when `org-columns' is called with prefix arg

* lisp/org-colview.el (org-columns-global): New buffer-local variable
holding GLOBAL argument to `org-columns'.
(org-columns): Record the GLOBAL arg.
(org-columns-redo): Fix `org-columns' call, using
`funcall-interactively' and passing GLOBAL arg as well.  The previous
usage of `call-interactively' made no sense because
`org-column-current-fmt' would not be passed as an argument -
`call-interactively' does not allow passing arguments.

Link: https://orgmode.org/list/877culo1pb.fsf@localhost
This commit is contained in:
Ihor Radchenko 2023-08-20 13:33:26 +03:00
parent 650e42996e
commit e08d878314
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 1 deletions

View File

@ -118,6 +118,9 @@ in `org-columns-summary-types-default', which see."
"Holds the list of current column overlays.")
(put 'org-columns-overlays 'permanent-local t)
(defvar-local org-columns-global nil
"Local variable, holds non-nil when current columns are global.")
(defvar-local org-columns-current-fmt nil
"Local variable, holds the currently active column format.")
@ -870,6 +873,7 @@ turn on column view for the whole buffer unconditionally.
When COLUMNS-FMT-STRING is non-nil, use it as the column format."
(interactive "P")
(org-columns-remove-overlays)
(setq-local org-columns-global global)
(save-excursion
(when global (goto-char (point-min)))
(if (markerp org-columns-begin-marker)
@ -1113,7 +1117,7 @@ the current buffer."
(if (derived-mode-p 'org-mode)
;; Since we already know the columns format, provide it
;; instead of computing again.
(call-interactively #'org-columns org-columns-current-fmt)
(funcall-interactively #'org-columns org-columns-global org-columns-current-fmt)
(org-agenda-redo)
(call-interactively #'org-agenda-columns)))
(message "Recomputing columns...done")))