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?= <slawomir.grochow...@gmail.com>
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 (&optional up)
   "Move the current table row down.
 With non-nil optional argument UP, move it up."
-- 
2.30.2

Reply via email to