I'm sending the patch again as an attachment to ensure it has the correct formatting.
Best, -- Slawomir Grochowski
>From 34cc9789539edce111cb52da3c6d0032d2b64efa Mon Sep 17 00:00:00 2001 From: Slawomir Grochowski <[email protected]> Date: Sun, 3 May 2026 10:38:36 +0200 Subject: [PATCH] lisp/org-colview.el: Refactor conflicting minor modes management * lisp/org-colview.el (org-columns--suspend-conflicting-modes): New function. (org-columns--resume-conflicting-modes): New function. (org-columns): Use `org-columns--suspend-conflicting-modes'. (org-agenda-columns): Use `org-columns--suspend-conflicting-modes'. (org-columns-remove-overlays): Use `org-columns--resume-conflicting-modes'. This is a pure refactoring (Extract Function) that introduces no behavioral changes. It extracts the repeated logic for suspending and resuming minor modes that conflict with column view (e.g., flyspell-mode, org-num-mode) into dedicated helpers. --- lisp/org-colview.el | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 463962493..c28ab26c1 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -518,6 +518,22 @@ for the duration of the command.") (defvar header-line-format) (defvar org-columns-previous-hscroll 0) +(defun org-columns--suspend-conflicting-modes () + "Suspend minor modes that conflict with column view." + (when (setq-local org-columns-flyspell-was-active + (bound-and-true-p flyspell-mode)) + (flyspell-mode 0)) + (when (setq-local org-columns-org-num-was-active + (bound-and-true-p org-num-mode)) + (org-num-mode 0))) + +(defun org-columns--resume-conflicting-modes () + "Resume minor modes that were suspended by column view." + (when org-columns-flyspell-was-active + (flyspell-mode 1)) + (when org-columns-org-num-was-active + (org-num-mode 1))) + (defun org-columns--display-here-title () "Overlay the newline before the current line with the table title." (let ((title "") @@ -575,10 +591,7 @@ for the duration of the command.") (setq org-columns-overlays nil) (let ((inhibit-read-only t)) (remove-text-properties (point-min) (point-max) '(read-only t)))) - (when org-columns-flyspell-was-active - (flyspell-mode 1)) - (when org-columns-org-num-was-active - (org-num-mode 1)) + (org-columns--resume-conflicting-modes) (when (local-variable-p 'org-colview-initial-truncate-line-value) (setq truncate-lines org-colview-initial-truncate-line-value)))) @@ -921,12 +934,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column format." (when cache (org-columns--set-widths cache) (org-columns--display-here-title) - (when (setq-local org-columns-flyspell-was-active - (bound-and-true-p flyspell-mode)) - (flyspell-mode 0)) - (when (setq-local org-columns-org-num-was-active - (bound-and-true-p org-num-mode)) - (org-num-mode 0)) + (org-columns--suspend-conflicting-modes) (unless (local-variable-p 'org-colview-initial-truncate-line-value) (setq-local org-colview-initial-truncate-line-value truncate-lines)) @@ -1799,12 +1807,7 @@ definition." (when cache (org-columns--set-widths cache) (org-columns--display-here-title) - (when (setq-local org-columns-flyspell-was-active - (bound-and-true-p flyspell-mode)) - (flyspell-mode 0)) - (when (setq-local org-columns-org-num-was-active - (bound-and-true-p org-num-mode)) - (org-num-mode 0)) + (org-columns--suspend-conflicting-modes) (dolist (entry cache) (goto-char (car entry)) (org-columns--display-here (cdr entry))) -- 2.39.5
