emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] lisp/org-colview.el: [refactor] [extract function] `org-columns-move-up' & `org-columns-move-down'
@ 2024-02-04 18:22 Sławomir Grochowski
  2024-02-04 18:29 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Sławomir Grochowski @ 2024-02-04 18:22 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 133 bytes --]

Dear All, 

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

Regards,
Sławomir Grochowski


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-colview-Extract-functions-org-columns-move-up-or.patch --]
[-- Type: text/x-diff, Size: 2645 bytes --]

From e12fe4e911c90b8f0fc587286937d4c76cac4b5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Grochowski?= <slawomir.grochowski@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-06 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-04 18:22 [PATCH] lisp/org-colview.el: [refactor] [extract function] `org-columns-move-up' & `org-columns-move-down' Sławomir Grochowski
2024-02-04 18:29 ` Ihor Radchenko
2024-02-06 19:33   ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).