unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
@ 2020-11-17 17:52 Peter Feigl
  2020-11-17 18:35 ` Basil L. Contovounesios
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Peter Feigl @ 2020-11-17 17:52 UTC (permalink / raw)
  To: 44711

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

The attached patch adds two movement commands,
`tabulated-list-next-column' and `tabulated-list-previous-column', by
default bound to "f" and "b" in `tabulated-list-mode'. They move to the
next/previous column respectively, and honour a numeric prefix argument.

I'd be happy to try to get my employer to sign the papers, please send
me the forms (in German, if that is relevant).

If possible, feel free to use this patch without papers signed.

Thanks and greetings,

Peter

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-commands-to-move-to-next-previous-column-in-tabu.patch --]
[-- Type: text/x-patch, Size: 2302 bytes --]

From 92cdba70401663f3765571472af3623db8c7c304 Mon Sep 17 00:00:00 2001
From: Peter Feigl <peter.feigl@nexoid.at>
Date: Tue, 17 Nov 2020 18:42:03 +0100
Subject: [PATCH] Add commands to move to next/previous column in
 tabulated-list-mode.

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode-map): Add
keybindings "b" and "f"
(tabulated-list-previous-column tabulated-list-next-column): Implement
commands.
---
 lisp/emacs-lisp/tabulated-list.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 30577679f2..a19ab00838 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -212,6 +212,8 @@ If ADVANCE is non-nil, move forward by one line afterwards."
                             special-mode-map))
     (define-key map "n" 'next-line)
     (define-key map "p" 'previous-line)
+    (define-key map "b" 'tabulated-list-previous-column)
+    (define-key map "f" 'tabulated-list-next-column)
     (define-key map "S" 'tabulated-list-sort)
     (define-key map "}" 'tabulated-list-widen-current-column)
     (define-key map "{" 'tabulated-list-narrow-current-column)
@@ -726,6 +728,24 @@ Interactively, N is the prefix numeric argument, and defaults to
           (setq-local tabulated-list--current-lnum-width lnum-width)
           (tabulated-list-init-header)))))
 
+(defun tabulated-list-next-column (&optional arg)
+  "Go to the start of the next column after point on the current line.
+If ARG is provided, move that many columns."
+  (interactive "p")
+  (dotimes (c (or arg 1))
+    (let ((next (or (next-single-property-change (point) 'tabulated-list-column-name) (point-max))))
+      (unless (>= next (line-end-position))
+        (goto-char next)))))
+
+(defun tabulated-list-previous-column (&optional arg)
+  "Go to the start of the column point is in on the current line.
+If ARG is provided, move that many columns."
+  (interactive "p")
+  (dotimes (c (or arg 1))
+    (let ((prev (or (previous-single-property-change (point) 'tabulated-list-column-name) 1)))
+      (unless (< prev (line-beginning-position))
+        (goto-char prev)))))
+
 ;;; The mode definition:
 
 (define-derived-mode tabulated-list-mode special-mode "Tabulated"
-- 
2.28.0


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

end of thread, other threads:[~2021-07-25  7:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-17 17:52 bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column' Peter Feigl
2020-11-17 18:35 ` Basil L. Contovounesios
2020-11-17 19:48 ` Juri Linkov
2020-11-24  8:08 ` Lars Ingebrigtsen
2021-05-13 11:36   ` Lars Ingebrigtsen
2021-05-13 18:08     ` Peter Feigl
2021-06-12 12:12       ` Lars Ingebrigtsen
2021-06-13  3:19         ` Richard Stallman
2021-07-21 12:08         ` Lars Ingebrigtsen
2021-07-21 19:46           ` Peter Feigl
2021-07-25  7:18             ` Lars Ingebrigtsen

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

	https://git.savannah.gnu.org/cgit/emacs.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).