From: "Sławomir Grochowski" <slawomir.grochowski@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] lisp/org-colview.el: [refactor] [extract function] `org-columns-move-up' & `org-columns-move-down'
Date: Sun, 04 Feb 2024 19:22:04 +0100 [thread overview]
Message-ID: <8734u82ipf.fsf@gmail.com> (raw)
[-- 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
next reply other threads:[~2024-02-04 18:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-04 18:22 Sławomir Grochowski [this message]
2024-02-04 18:29 ` [PATCH] lisp/org-colview.el: [refactor] [extract function] `org-columns-move-up' & `org-columns-move-down' Ihor Radchenko
2024-02-06 19:33 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8734u82ipf.fsf@gmail.com \
--to=slawomir.grochowski@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.