* bug#54905: Allow in tabulated lists to resize columns with the mouse
@ 2022-04-13 11:59 Kiss Dénes via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-14 14:04 ` Lars Ingebrigtsen
0 siblings, 1 reply; 17+ messages in thread
From: Kiss Dénes via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-04-13 11:59 UTC (permalink / raw)
To: 54905
[-- Attachment #1: Type: text/plain, Size: 483 bytes --]
I'm not a fan of using the mouse in general, but when during browsing tables you want to resize columns, it is more natural to grab some handle with the mouse at the edge of the column and drag to resize it, than doing it from the keyboard.
It is the norm in GUI table apps, so it would be great if emacs could also provide a way to do it, e.g. by putting some graphical handle character after the column name which could be grabbed and dragged with the mouse to change column size.
[-- Attachment #2: Type: text/html, Size: 729 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-13 11:59 bug#54905: Allow in tabulated lists to resize columns with the mouse Kiss Dénes via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-04-14 14:04 ` Lars Ingebrigtsen
2022-04-14 16:12 ` Eli Zaretskii
0 siblings, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-14 14:04 UTC (permalink / raw)
To: Kiss Dénes; +Cc: 54905
Kiss Dénes <laszlomail@protonmail.com> writes:
> I'm not a fan of using the mouse in general, but when during browsing
> tables you want to resize columns, it is more natural to grab some
> handle with the mouse at the edge of the column and drag to resize it,
> than doing it from the keyboard.
Yes, that would be very nice.
Does anybody know the state of Emacs' mouse dragging support for
something like this? Do we still need to... er... bind down-mouse-1
and then write all the code to do stuff outselves with track-mouse? Or
has Emacs grown some more high-level code to bind dragging events?
I tried looking around a bit, but didn't see anything obvious, but I may
well be missing something.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-14 14:04 ` Lars Ingebrigtsen
@ 2022-04-14 16:12 ` Eli Zaretskii
2022-04-14 16:29 ` Lars Ingebrigtsen
0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2022-04-14 16:12 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: laszlomail, 54905
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Thu, 14 Apr 2022 16:04:24 +0200
> Cc: 54905@debbugs.gnu.org
>
> Kiss Dénes <laszlomail@protonmail.com> writes:
>
> > I'm not a fan of using the mouse in general, but when during browsing
> > tables you want to resize columns, it is more natural to grab some
> > handle with the mouse at the edge of the column and drag to resize it,
> > than doing it from the keyboard.
>
> Yes, that would be very nice.
>
> Does anybody know the state of Emacs' mouse dragging support for
> something like this? Do we still need to... er... bind down-mouse-1
> and then write all the code to do stuff outselves with track-mouse? Or
> has Emacs grown some more high-level code to bind dragging events?
What's wrong with drag-mouse-1 etc.? Or am I misunderstanding the
question?
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-14 16:12 ` Eli Zaretskii
@ 2022-04-14 16:29 ` Lars Ingebrigtsen
2022-04-14 17:15 ` Eli Zaretskii
0 siblings, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-14 16:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: laszlomail, 54905
Eli Zaretskii <eliz@gnu.org> writes:
> What's wrong with drag-mouse-1 etc.? Or am I misunderstanding the
> question?
No, that was exactly what I was looking for. :-/ I was getting some
weird results when I tried using it, so I assumed that it didn't quite
work, but I tried it again now, and it seems to work fine. I may have
been getting confused by the binding(s) that already exists in
header-line -- there's a bunch of different bindings for down (etc.)
there...
Yes, this doesn't seem to work:
(keymap-local-set "<header-line> <drag-mouse-1>" #'foo)
(defun foo (e)
(interactive "e")
(message "Hello %S %S"
(posn-x-y (event-start e)) (posn-x-y (event-end e))))
Dragging something in the header line does not call this function.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-14 16:29 ` Lars Ingebrigtsen
@ 2022-04-14 17:15 ` Eli Zaretskii
2022-04-14 17:37 ` Lars Ingebrigtsen
0 siblings, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2022-04-14 17:15 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: laszlomail, 54905
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: laszlomail@protonmail.com, 54905@debbugs.gnu.org
> Date: Thu, 14 Apr 2022 18:29:32 +0200
>
> Yes, this doesn't seem to work:
>
> (keymap-local-set "<header-line> <drag-mouse-1>" #'foo)
> (defun foo (e)
> (interactive "e")
> (message "Hello %S %S"
> (posn-x-y (event-start e)) (posn-x-y (event-end e))))
>
> Dragging something in the header line does not call this function.
That's because we intervene, AFAICT. Type "C-h c", then drag the
mouse on the header-line, and see what Emacs tells you about that.
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-14 17:15 ` Eli Zaretskii
@ 2022-04-14 17:37 ` Lars Ingebrigtsen
2022-04-14 17:40 ` Lars Ingebrigtsen
0 siblings, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-14 17:37 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: laszlomail, 54905
Eli Zaretskii <eliz@gnu.org> writes:
> That's because we intervene, AFAICT. Type "C-h c", then drag the
> mouse on the header-line, and see what Emacs tells you about that.
By ignoring down-mouse-1 on the draggable elements in the header line,
drag-mouse-1 works just as you'd expect. Thanks for the help.
So I've now implemented this in vtable, and implementing it in
tabulated-list-mode should be easy enough as well, if somebody wants to
attempt that.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-14 17:37 ` Lars Ingebrigtsen
@ 2022-04-14 17:40 ` Lars Ingebrigtsen
2022-04-15 7:45 ` Robert Pluim
0 siblings, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-14 17:40 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: laszlomail, 54905
Lars Ingebrigtsen <larsi@gnus.org> writes:
> So I've now implemented this in vtable,
(Although I implemented this by dragging the name of the column after
the one you want to resize... which may not be logical, but I'm not
sure what else to drag, unless we put a drag glyph in each column in the
header line just to have something to drag, which would be logical but
ugly.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-14 17:40 ` Lars Ingebrigtsen
@ 2022-04-15 7:45 ` Robert Pluim
2022-04-15 8:27 ` Lars Ingebrigtsen
2022-04-15 16:46 ` Drew Adams
0 siblings, 2 replies; 17+ messages in thread
From: Robert Pluim @ 2022-04-15 7:45 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: laszlomail, 54905
>>>>> On Thu, 14 Apr 2022 19:40:41 +0200, Lars Ingebrigtsen <larsi@gnus.org> said:
Lars> Lars Ingebrigtsen <larsi@gnus.org> writes:
>> So I've now implemented this in vtable,
Lars> (Although I implemented this by dragging the name of the column after
Lars> the one you want to resize... which may not be logical, but I'm not
Lars> sure what else to drag, unless we put a drag glyph in each column in the
Lars> header line just to have something to drag, which would be logical but
Lars> ugly.)
How do you resize the last column then? Or does dragging the empty
space work?
Robert
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-15 7:45 ` Robert Pluim
@ 2022-04-15 8:27 ` Lars Ingebrigtsen
2022-04-15 10:06 ` Lars Ingebrigtsen
2022-04-15 16:46 ` Drew Adams
1 sibling, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-15 8:27 UTC (permalink / raw)
To: Robert Pluim; +Cc: laszlomail, 54905
Robert Pluim <rpluim@gmail.com> writes:
> How do you resize the last column then? Or does dragging the empty
> space work?
You can't resize the last column with the mouse (but then again, the
last column usually doesn't have a limited size).
In vtable, there's a separator and a divider, both after the column, and
those could be draggable. These aren't currently displayed after the
last column, but we could do that so that there'd be something to drag.
(But that will make the display uglier.)
However, the separator is currently just added to the padding, so it
can't be dragged... but we could alter the rendering so that it's a
separate entity allowing dragging. And the divider could definitely be
draggable (and I'll do that now), but in most setups the divider will
only be a couple of pixels wide, making dragging it very difficult.
We could also have some sort of resize action on the context menu, but
yuck.
We have a lot of options here. :-) But none of them are obviously,
like, good.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-15 8:27 ` Lars Ingebrigtsen
@ 2022-04-15 10:06 ` Lars Ingebrigtsen
2022-04-15 10:42 ` Robert Pluim
0 siblings, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-15 10:06 UTC (permalink / raw)
To: Robert Pluim; +Cc: laszlomail, 54905
Lars Ingebrigtsen <larsi@gnus.org> writes:
> And the divider could definitely be
> draggable (and I'll do that now), but in most setups the divider will
> only be a couple of pixels wide, making dragging it very difficult.
Here's the test vtable I'm twiddling now (you need an up-to-date trunk
to make it work). You can drag the divider, but it's so narrow that
it's very annoying to attempt to do so...
(defun test-vtable ()
(when (get-buffer "*vtable*")
(kill-buffer "*vtable*"))
(switch-to-buffer "*vtable*")
(setq truncate-lines t)
(special-mode)
(let ((inhibit-read-only t))
(make-vtable
:columns '((:name "Name" :width 20) "Size" "File")
:objects (buffer-list)
:row-colors '((:background "#303030" :foreground "#ffffff")
(:background "#505050" :foreground "#808080"))
:column-colors '((:background "#202020" :foreground "#00ffff")
(:background "#808080" :foreground "#008080"))
:divider-width 0.1
:getter (lambda (object column vtable)
(pcase (vtable-column vtable column)
("Name" (buffer-name object))
("Size" (buffer-size object))
("File" (or (buffer-file-name object) "")))))
nil))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-15 10:06 ` Lars Ingebrigtsen
@ 2022-04-15 10:42 ` Robert Pluim
2022-04-15 10:54 ` Lars Ingebrigtsen
2022-04-15 11:18 ` Lars Ingebrigtsen
0 siblings, 2 replies; 17+ messages in thread
From: Robert Pluim @ 2022-04-15 10:42 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: laszlomail, 54905
>>>>> On Fri, 15 Apr 2022 12:06:38 +0200, Lars Ingebrigtsen <larsi@gnus.org> said:
Lars> Lars Ingebrigtsen <larsi@gnus.org> writes:
>> And the divider could definitely be
>> draggable (and I'll do that now), but in most setups the divider will
>> only be a couple of pixels wide, making dragging it very difficult.
Lars> Here's the test vtable I'm twiddling now (you need an up-to-date trunk
Lars> to make it work). You can drag the divider, but it's so narrow that
Lars> it's very annoying to attempt to do so...
Debugger entered--Lisp error: (wrong-type-argument stringp (:background "#303030" :foreground "#ffffff"))
xw-color-values((:background "#303030" :foreground "#ffffff") nil)
color-values((:background "#303030" :foreground "#ffffff") nil)
color-name-to-rgb((:background "#303030" :foreground "#ffffff"))
vtable--color-blend((:background "#303030" :foreground "#ffffff") (:background "#202020" :foreground "#00ffff"))
vtable--compute-colors(((:background "#303030" :foreground "#ffffff") (:background "#505050" :foreground "#808080")) ((:background "#202020" :foreground "#00ffff") (:background "#808080" :foreground "#008080")))
make-vtable(:columns ((:name "Name" :width 20) "Size" "File") :objects (#<buffer *vtable*> #<buffer *scratch*> #<buffer *Minibuf-1*> #<buffer 1> #<buffer *info*> #<buffer *Help*> #<buffer *Minibuf-0*> #<buffer *Messages*> #<buffer *Echo Area 0*> #<buffer *Echo Area 1*> #<buffer *eldoc for test-vtable*> #<buffer *string-pixel-width*>) :row-colors ((:background "#303030" :foreground "#ffffff") (:background "#505050" :foreground "#808080")) :column-colors ((:background "#202020" :foreground "#00ffff") (:background "#808080" :foreground "#008080")) :divider-width 0.1 :getter (closure (t) (object column vtable) (let* ((val (vtable-column vtable column))) (cond ((equal val '"Name") (let nil (buffer-name object))) ((equal val '"Size") (let nil (buffer-size object))) ((equal val '"File") (let nil (or (buffer-file-name object) "")))))))
(let ((inhibit-read-only t)) (make-vtable :columns '((:name "Name" :width 20) "Size" "File") :objects (buffer-list) :row-colors '((:background "#303030" :foreground "#ffffff") (:background "#505050" :foreground "#808080")) :column-colors '((:background "#202020" :foreground "#00ffff") (:background "#808080" :foreground "#008080")) :divider-width 0.1 :getter #'(lambda (object column vtable) (let* ((val (vtable-column vtable column))) (cond ((equal val ...) (let nil ...)) ((equal val ...) (let nil ...)) ((equal val ...) (let nil ...)))))) nil)
test-vtable()
eval((test-vtable) t)
If I just ignrore the colours:
- I donʼt see a divider at all (this is a GTK build under
X). Increasing divider-width had no effect. Actually, thatʼs not
true: the divider is just the same colour as the header-line
- I can drag to resize the column, but I need to start the drag on the
name of the column, not the space next to it
- The little triangle indicating the sort order is right next to the
name of the column, Iʼd expect it be nearer the divider to the right
of the name
Robert
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-15 10:42 ` Robert Pluim
@ 2022-04-15 10:54 ` Lars Ingebrigtsen
2022-04-15 11:18 ` Lars Ingebrigtsen
1 sibling, 0 replies; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-15 10:54 UTC (permalink / raw)
To: Robert Pluim; +Cc: laszlomail, 54905
Robert Pluim <rpluim@gmail.com> writes:
> Debugger entered--Lisp error: (wrong-type-argument stringp
> (:background "#303030" :foreground "#ffffff"))
I'd forgotten to push. Try again.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-15 10:42 ` Robert Pluim
2022-04-15 10:54 ` Lars Ingebrigtsen
@ 2022-04-15 11:18 ` Lars Ingebrigtsen
2022-04-15 12:02 ` Lars Ingebrigtsen
1 sibling, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-15 11:18 UTC (permalink / raw)
To: Robert Pluim; +Cc: laszlomail, 54905
Robert Pluim <rpluim@gmail.com> writes:
> - I can drag to resize the column, but I need to start the drag on the
> name of the column, not the space next to it
Yes, that's by design... the header space has a different dragging
action on the non-text parts.
> - The little triangle indicating the sort order is right next to the
> name of the column, Iʼd expect it be nearer the divider to the right
> of the name
That indeed looks nicer, but if the final column is wider than the frame
(which is common), then it won't be displayed at all.
But I guess it could determine the width of the frame and clamp it to
that point...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-15 11:18 ` Lars Ingebrigtsen
@ 2022-04-15 12:02 ` Lars Ingebrigtsen
2022-04-15 12:23 ` Robert Pluim
0 siblings, 1 reply; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-15 12:02 UTC (permalink / raw)
To: Robert Pluim; +Cc: laszlomail, 54905
Lars Ingebrigtsen <larsi@gnus.org> writes:
> But I guess it could determine the width of the frame and clamp it to
> that point...
I've done that now, and I think it looks pretty good. 🤩
And adding mouse-face to the draggable divider lines makes it possible
to find them and drag them, even if they're really narrow.
So I guess I could just enable the divider after the final column, too,
so that that can also be resized.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-15 12:02 ` Lars Ingebrigtsen
@ 2022-04-15 12:23 ` Robert Pluim
2022-04-16 9:11 ` Lars Ingebrigtsen
0 siblings, 1 reply; 17+ messages in thread
From: Robert Pluim @ 2022-04-15 12:23 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: laszlomail, 54905
[-- Attachment #1: Type: text/plain, Size: 958 bytes --]
>>>>> On Fri, 15 Apr 2022 14:02:42 +0200, Lars Ingebrigtsen <larsi@gnus.org> said:
Lars> Lars Ingebrigtsen <larsi@gnus.org> writes:
>> But I guess it could determine the width of the frame and clamp it to
>> that point...
Lars> I've done that now, and I think it looks pretty good. 🤩
It does. Although you seem to be suffering from dark-modeitis 🙂
Lars> And adding mouse-face to the draggable divider lines makes it possible
Lars> to find them and drag them, even if they're really narrow.
Iʼd misunderstood: I thought they were in the header line, not in the
table. They are kind of narrow, but I can always drag the column name.
Lars> So I guess I could just enable the divider after the final column, too,
Lars> so that that can also be resized.
Yes. One other thing: the "Size" heading gets truncated to "Siz" for
me, so I guess you need to derive the minimum width from the heading:
[-- Attachment #2: Screenshot from 2022-04-15 14-20-52.png --]
[-- Type: image/png, Size: 29121 bytes --]
[-- Attachment #3: Type: text/plain, Size: 13 bytes --]
Robert
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-15 12:23 ` Robert Pluim
@ 2022-04-16 9:11 ` Lars Ingebrigtsen
0 siblings, 0 replies; 17+ messages in thread
From: Lars Ingebrigtsen @ 2022-04-16 9:11 UTC (permalink / raw)
To: Robert Pluim; +Cc: laszlomail, 54905
Robert Pluim <rpluim@gmail.com> writes:
> It does. Although you seem to be suffering from dark-modeitis 🙂
Hello darkmode my old friend.
> Yes. One other thing: the "Size" heading gets truncated to "Siz" for
> me, so I guess you need to derive the minimum width from the heading:
That's by design -- I don't think the width of the headings should
determine the column width (by default). But I guess there should be
some mouseover action to give the full text (as with all other truncated
strings in general).
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 17+ messages in thread
* bug#54905: Allow in tabulated lists to resize columns with the mouse
2022-04-15 7:45 ` Robert Pluim
2022-04-15 8:27 ` Lars Ingebrigtsen
@ 2022-04-15 16:46 ` Drew Adams
1 sibling, 0 replies; 17+ messages in thread
From: Drew Adams @ 2022-04-15 16:46 UTC (permalink / raw)
To: Robert Pluim, Lars Ingebrigtsen
Cc: laszlomail@protonmail.com, 54905@debbugs.gnu.org
> How do you resize the last column then?
> Or does dragging the empty space work?
See bug #41860.
Someone doesn't want you to be able to do it.
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41860
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2022-04-16 9:11 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-13 11:59 bug#54905: Allow in tabulated lists to resize columns with the mouse Kiss Dénes via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-04-14 14:04 ` Lars Ingebrigtsen
2022-04-14 16:12 ` Eli Zaretskii
2022-04-14 16:29 ` Lars Ingebrigtsen
2022-04-14 17:15 ` Eli Zaretskii
2022-04-14 17:37 ` Lars Ingebrigtsen
2022-04-14 17:40 ` Lars Ingebrigtsen
2022-04-15 7:45 ` Robert Pluim
2022-04-15 8:27 ` Lars Ingebrigtsen
2022-04-15 10:06 ` Lars Ingebrigtsen
2022-04-15 10:42 ` Robert Pluim
2022-04-15 10:54 ` Lars Ingebrigtsen
2022-04-15 11:18 ` Lars Ingebrigtsen
2022-04-15 12:02 ` Lars Ingebrigtsen
2022-04-15 12:23 ` Robert Pluim
2022-04-16 9:11 ` Lars Ingebrigtsen
2022-04-15 16:46 ` Drew Adams
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).