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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  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
  2 siblings, 0 replies; 11+ messages in thread
From: Basil L. Contovounesios @ 2020-11-17 18:35 UTC (permalink / raw)
  To: Peter Feigl; +Cc: 44711

"Peter Feigl" <peter.feigl@nexoid.at> writes:

> The attached patch adds two movement commands,

Thanks, just some minor comments from me.

> +(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))
               ^
The names of unused lexical variables should start with (or consist only
of) an underscore, e.g. '_' or '_c'.  (The byte-compiler should
otherwise complain.)

> +    (let ((next (or (next-single-property-change (point) 'tabulated-list-column-name) (point-max))))

This line is a bit long; suggest breaking the function call across two
lines.  More importantly, why scan all the way to the end of the buffer
if we're only interested in the current line?

> +      (unless (>= next (line-end-position))
> +        (goto-char next)))))

Given my suggestion to limit the search to the current line, this could
be modified along the following lines:

  (dotimes (_ (or arg 1))
    (let* ((eol (line-end-position))
           (next (next-single-property-change
                  (point) 'tabulated-list-column-name nil (1+ eol))))
      (when (< next eol)
        (goto-char next))))

But there's a subtle issue here: some tabulated lists
(e.g. list-buffers) can have an empty final column (e.g. with
non-file-visiting buffers such as *scratch*), but the (< next eol) guard
will not allow point to reach this final empty column, because that
position is at the end of the line.

So I suggest either augmenting the guard to check whether the current
(last) column is empty, or unconditionally allowing point to reach the
end of the line, even if point was already originally in the final
column.

> +(defun tabulated-list-previous-column (&optional arg)

Ditto.

-- 
Basil





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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  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
  2 siblings, 0 replies; 11+ messages in thread
From: Juri Linkov @ 2020-11-17 19:48 UTC (permalink / raw)
  To: Peter Feigl; +Cc: 44711

> 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.

Many packages such as 'ses' and 'org-table' for moving to the next/previous
column use keys TAB and S-TAB.





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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  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
  2 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2020-11-24  8:08 UTC (permalink / raw)
  To: Peter Feigl; +Cc: 44711

"Peter Feigl" <peter.feigl@nexoid.at> writes:

> 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.

This looks useful, but the patch is indeed to big to apply without
paperwork.

Here's the form to get started:

-------

Please email the following information to assign@gnu.org, and we
will send you the assignment form for your past and future changes.

Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES

[What is the name of the program or package you're contributing to?]
Emacs

[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]

[Do you have an employer who might have a basis to claim to own
your changes?  Do you attend a school which might make such a claim?]

[For the copyright registration, what country are you a citizen of?]

[What year were you born?]

[Please write your email address here.]

[Please write your postal address here.]

[Which files have you changed so far, and which new files have you written
so far?]





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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  2020-11-24  8:08 ` Lars Ingebrigtsen
@ 2021-05-13 11:36   ` Lars Ingebrigtsen
  2021-05-13 18:08     ` Peter Feigl
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-13 11:36 UTC (permalink / raw)
  To: Peter Feigl; +Cc: 44711

Lars Ingebrigtsen <larsi@gnus.org> writes:

> This looks useful, but the patch is indeed to big to apply without
> paperwork.

Peter, has there been any progress with the copyright assignment
paperwork?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  2021-05-13 11:36   ` Lars Ingebrigtsen
@ 2021-05-13 18:08     ` Peter Feigl
  2021-06-12 12:12       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Feigl @ 2021-05-13 18:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 44711

> Peter, has there been any progress with the copyright assignment
> paperwork?

Sorry, I'll get to this on Monday, I've reworked the patch according to
the suggestions, but haven't had the papers signed yet.

Thanks for the patience,
Peter





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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  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
  0 siblings, 2 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-12 12:12 UTC (permalink / raw)
  To: Peter Feigl; +Cc: 44711

"Peter Feigl" <peter.feigl@nexoid.at> writes:

> Sorry, I'll get to this on Monday, I've reworked the patch according to
> the suggestions, but haven't had the papers signed yet.

(This was a month ago.)

As far as I can tell, the paperwork hasn't gone through yet?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  2021-06-12 12:12       ` Lars Ingebrigtsen
@ 2021-06-13  3:19         ` Richard Stallman
  2021-07-21 12:08         ` Lars Ingebrigtsen
  1 sibling, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2021-06-13  3:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: peter.feigl, 44711

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Talking with people at the employer, and with the FSF staff, and
encouraging them talk with each other, could enable them to unblock
it.  Some companies' lawyers look at the issue in a very narrow way,
and the FSF staff could help them see a solution.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)







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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  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
  1 sibling, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-21 12:08 UTC (permalink / raw)
  To: Peter Feigl; +Cc: copyright-clerk, 44711

Lars Ingebrigtsen <larsi@gnus.org> writes:

> "Peter Feigl" <peter.feigl@nexoid.at> writes:
>
>> Sorry, I'll get to this on Monday, I've reworked the patch according to
>> the suggestions, but haven't had the papers signed yet.
>
> (This was a month ago.)
>
> As far as I can tell, the paperwork hasn't gone through yet?

I see that the assignment is on file, but there's a note in the
copyright assignment file about awaiting further data.  Has there been
any movement on that?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  2021-07-21 12:08         ` Lars Ingebrigtsen
@ 2021-07-21 19:46           ` Peter Feigl
  2021-07-25  7:18             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Feigl @ 2021-07-21 19:46 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: copyright-clerk, 44711

> I see that the assignment is on file, but there's a note in the
> copyright assignment file about awaiting further data.  Has there been
> any movement on that?

I'm not sure what that is about, I've sent a clarification about the
name (which was hard to read), but I haven't heard anything since :-/

Thanks for looking into it!

Greetings, Peter





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

* bug#44711: [PATCH] Add movement commands `tabulated-list-next-column' and `tabulated-list-previous-column'
  2021-07-21 19:46           ` Peter Feigl
@ 2021-07-25  7:18             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-25  7:18 UTC (permalink / raw)
  To: Peter Feigl; +Cc: 44711

"Peter Feigl" <peter.feigl@nexoid.at> writes:

> I'm not sure what that is about, I've sent a clarification about the
> name (which was hard to read), but I haven't heard anything since :-/

It turned out to be a misunderstanding.  I've now applied your patch to
Emacs 28, taking the various comments into consideration.

I moved the bindings to M-left/right, though, since f/b were taken in
many modes that use tabulated-list-mode.  (And TAB, too.)  If somebody
has a better idea for key bindings, feel free to adjust.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[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).