top | item 29736366

On Emacs 28’ context menu and Unix mouse-usage in general

193 points| goranmoomin | 4 years ago |ruzkuku.com

157 comments

order
[+] daptaq|4 years ago|reply
I wrote this mess, and didn't expect this to end up here. To clarify, I wrote the first section because polemics are fun, not because I am claiming to have discovered something radical. My imagined addressee is the kind of person who thinks that mice were a mistake, and keyboard-oriented terminal usage is the one and only truth. Partially a straw man, but a good enough approximation of some people I have met.

The main intention is to demonstrate how context-menu-mode works, how to extend it yourself and call for people to test it before Emacs 28 is released. Having written a few forgettable articles, I ended up forgetting that intentional provocation attracts unintentional attention.

[+] usrbinbash|4 years ago|reply
If I may just say thank you for this section:

> The denunciation of the mouse usually involves invoking concepts such as the “home row”, or the cumbersome migration of the hand between keyboard and mouse. These might all be well and good, if I were a typist and as such all I did was to type. But this isn’t the case, I ponder and perceive, more than I write.

This resonated so much with me :-) I still cannot believe how many people seem to think that the ability to type really fast is important to be a good coder, when we spend the vast majority of our time reading, re-reading and podering code instead of writing it.

[+] BeFlatXIII|4 years ago|reply
The title, both here on HN and on the article is missing an s. Currently, it reads as "Emacs 28' context menu", which implies that the context menu is 28 feet tall. It is probably meant as "Emacs 28's context menu".
[+] MarcScott|4 years ago|reply
I don't really buy the home row argument very much. I get why if you can touch type, that this is important to some extent, but mostly I think that when you start having to find and click on icons, or navigate menus, there's an interrupt in your cognitive flow.

Watching the graphic and motion graphics designers at work, they're dominant hand rarely leaves their mouse, while the other hand hammers at shortcut keys to switch tools. They don't care about the home row, just using the fewest actions to complete a task.

When I'm using a piece software maybe a few times a month, I'm grateful for icons and menus to help me remember how to do anything. When I use a piece of software on a daily basis, then I learn the shortcuts until it's muscle memory, an keep my hand away from the mouse as much as possible.

[+] Stratoscope|4 years ago|reply
> the cumbersome migration of the hand between keyboard and mouse

This is one of the reasons I love the TrackPoint and use it exclusively. There is no physical context switching between mouse and keyboard. If you are a touch typist, it is always right there on the home row.

I am such a TrackPoint nut that on the rare occasions when I've had to work on a computer that is not a ThinkPad (a desktop or a different laptop), I use a ThinkPad wireless keyboard to give it a TrackPoint:

https://www.lenovo.com/us/en/p/accessories-and-software/keyb...

One job I had issued Dell laptops, and I found that I could put the ThinkPad keyboard right on top of the laptop keyboard. It even left the Dell's touchpad accessible. I do use two-finger touchpad scrolling once in a while.

Something I don't like about modern ThinkPad keyboards is that they took away the Menu key and replaced it with a PrtSc (screenshot) key. The Menu key is such a nice way to bring up a context menu based on the current keyboard cursor location (rather than the mouse position). These AutoHotkey rules fix that:

  ; Remap the PrtSc key:
  ; PrtSc -> Menu (like an old ThinkPad keyboard)
  ; Windows+PrtSc -> Screenshot of all monitors
  ; Windows+Alt+PrtSc -> Screenshot of current window
  PrintScreen:: AppsKey
  #PrintScreen:: PrintScreen
  #!PrintScreen:: Send {Alt Down}{PrintScreen}{Alt Up}
This is for Windows, of course. I imagine there must be a way to do something similar on Linux.

Another tip for Windows users: if you have a keyboard with a numeric pad that you don't use much, enable MouseKeys in the Windows accessibility settings. This lets you use the numpad as a "keyboard mouse" for precise mouse movement. Or if you have a ThinkPad keyboard, try my JKLmouse program (another AutoHotkey script) which gives you MouseKeys-style mouse control using the IJKL or HJKL keys (and neighboring keys for diagonal movement). It will work on other laptop keyboards too, but you really want physical mouse buttons like a ThinkPad for it to be useful.

https://www.jklmouse.com/

(There is an installer, but I recommend downloading AutoHotkey and the jklmouse.ahk script from GitHub for the most flexibility.)

[+] eddieh|4 years ago|reply
> I wrote this mess

On the contrary, the simplicity of the styling and layout is honestly beautiful.

[+] forgotmypw17|4 years ago|reply
I'm one of those people...

It's simply about pointing devices hurting my hand, wrist, and arm.

Keyboard use does not.

Is that so hard to understand?

This is what makes it an accessibility issue for me, not a preference.

[+] somat|4 years ago|reply
Disagree highly, the x11 select/middle click paste is the best way to copy/paste by far. To the point I start to get visibly upset when trying to copy and paste on windows. you would think ctrl+c ctrl+v is easy and simple, but it is infuriatingly slow compared to the x11 method.

To really throw gasoline on the mental fire, middle click on window usually puts you in some sort of stupid alternate scroll mode.

[+] yingbo|4 years ago|reply
I don't like the select = copy idea. When I browsing, I'd like to select a few words for no reason (well, more like a hight light, or reminds me to focus on them). I just want to select it, not copy them at all. And mid click paste? Little hard to control somehow: looks the mouse easily move a little when I do so.

I do like the context menu way.

[+] LightHugger|4 years ago|reply
Sharing middle click between paste functionality and it's other popular functions makes it error prone and impractical at least for me. Copy paste is faster in a vacuum but the overall experience is worse. I think using thumb mouse buttons is more practical, and auto copy is better just avoided altogether.

Autoscroll is great by the way.

[+] 5e92cb50239222b|4 years ago|reply
> middle click on window usually puts you in some sort of stupid alternate scroll mode

It's just badly implemented there. Internet Explorer had a completely brain-dead implementation, and every embedded webview inherited that.

Firefox always had a very nice implementation of middle-click scroll. It may sound silly, but this one of the major reasons I always hated chromium-based browsers — they do have it, but it's not nearly as nice (you can't, or at least couldn't easily scroll inside scrollable elements, the acceleration profile feels very weird, and other small things like that).

[+] JasonFruit|4 years ago|reply
I disagree when a trackpad enters the mix, because there are no clearly defined tap areas. I often copy a url, click in the navbar to select the current url, and paste in the copied url — and nothing happens! That's because I unintentionally middle-clicked the navbar, clobbering the clipboard with its contents.
[+] w4rh4wk5|4 years ago|reply
Are the commonly used file explorers also using this method to copy/paste files? If not, I wonder why.. </sarcasm>
[+] ReleaseCandidat|4 years ago|reply
> Disagree highly, the x11 select/middle click paste is the best way to copy/paste by far.

I prefer a right click. Mainly because middle click is _awkward_ using most laptops.

[+] thrower123|4 years ago|reply
I can't remember the last time I had a mouse where middle-click wasn't really awkward to use. Probably in the time before scroll-wheels, when there was an actual middle button that was just a button.

Trying to click the mouse scroll-wheel is on par with the "push the joystick straight down" click mode that some modern game controllers have in awfulness.

[+] alkonaut|4 years ago|reply
Originally in the 1990s when there were 3-button mice without scrollwheels, especially on Sparcs and whatnot, middle clicks were good.

But then mice standardised on scrollwheels and the middle button being the depression of the scrollwheel - and it's not so good anymore. It's way too easy to accidentally scroll when clicking a mouse wheel, and few people would disable the scroll wheel or get 90's type straight 3 button mouse.

The middle click in windows for "scroll mode" (or something) as you say, is useless. And I can only assume that's a mode that exists precisely because people without scrollwheels still need to scroll so it emulates the wheel. Poorly.

[+] daptaq|4 years ago|reply
FWIW I agree when it comes to copy/paste, because there select/middle click is established. The context menu comes in handy for those operations that are just used seldom enough that you don't want to waste a single click on them, but often enough that you'd like to have an easy way to use it. For me these are mainly stuff like calling occur on a word, jumping to a reference, opening a dictionary definition, etc.
[+] michael-ax|4 years ago|reply
I'm in the middle of redoing my 5 yo config from the ground up for emacs'29 to take advantage of byte code compilation* -- and there's a lot happening in that accessibility of features space!

there are new better completion frameworks and new better ways of handling, thinking about and using key-maps .. so it look as if we're just one breakthrough away from having keymaps and menus attain some kind of parity with what M-x and M-: can deliver.

my emacs, being more of a computing environment than an editor, had 11 k org'd loc. I'm dumping that for small elisp files editable with outshine so i can nimbly add customizations to these menus and the other three dozen breakthrough (for me) packages that have appeared over the last few years.

this is all very exciting!

[+] zbobet2012|4 years ago|reply
Can you give a bit more detail on the byte code compiler and autocompletes you're looking at? I've not redone my .emacs since 2011...
[+] taeric|4 years ago|reply
What are the new better completion frameworks? And in contrast to which older one? (Asking as a helm user.)
[+] pjmlp|4 years ago|reply
Which is kind of ironic given the UIs of traditional UNIXes like CDE, NEWS, OpenLook and NeXT, with keyboard shortcuts alongside three button mouse usage.

Somehow down the line the FOSS UNIX generation decided that the ways of twm were what one should aim for.

I guess there is some romanticism to work as on the early UNIX years.

[+] badsectoracula|4 years ago|reply
There are some exceptions to this though, e.g. Window Maker (which is what i use) feels like everything is made primarily to be used via the GUI and using a mouse (it even has a WYSIWYG global menu editor where you work with it by drag and dropping items on it instead of editing text files like you'd find in the vast majority of window managers or providing some barebones tree editor with add/remove/etc buttons like you'd find in most DEs - and AFAIK it is the only WM or DE to provide a WYSIWYG theme editor).

I find it amazing that Window Maker is both among the most powerful window managers i've used and the most convenient and graphical (FVWM is probably more powerful but it certainly isn't as convenient to configure/set up).

[+] HeckFeck|4 years ago|reply
Not to mention IRIX's 4dwm. There was a different path available indeed.
[+] chungus|4 years ago|reply
Used to be the dogmatist: "mouse is bad!" Now I'm a pragmatist, do 90% of my work on a Thinkpad using keyboard shortcuts, but use the little red trackpoint mouse whenever it's more convenient. As long as I don't have to move my arms.
[+] necrotic_comp|4 years ago|reply
Yep ! The mouse isn't a mouse if it's on the home row. :) Not enough people got behind the trackpoint in its day and it makes me sad that it's not the default mouse input for programmers.
[+] codesections|4 years ago|reply
> When debugging code or studying a program, it is quite comfortable to depend on only one hand, and have the other free to scribble or relax.

I wonder if the OP is ambidextrous? If using the mouse gave me a hand free to scribble some notes, I'd be a much more enthusiastic mouse user. Alas, both writing and mousing require my right hand, and there aren't many good uses for my left.

[+] BeetleB|4 years ago|reply
It's easier to train your non-dominant hand to mouse than to write.

It's awkward initially, but for most people takes only a few days to be comfortable with it. Then they switch back and forth easily (I do it several times a day).

As an analogy, a lot of people (including me) started writing on a keyboard with only one hand (or at least hitting most buttons with one hand). We had to train our brains to use both. That was a lot more challenging than learning to mouse with the other hand.

[+] throw10920|4 years ago|reply
I tried to train myself to become ambidextrous at one point.

I failed, but in the process, I learned a few interesting things - one of which was that it was far easier for me to train myself to competently use my left hand for mousing than for writing.

This might be the case for you, too - try using your left hand to mouse for a day or two and see if you can get the hang of it.

[+] wcarss|4 years ago|reply
I often find when I'm not actively writing code and am just scrolling up and down reading, it's nice to just pick the mouse up off the table and sit or stand with my arm and hand in a more neutral position, with my finger somewhere near the scroll-wheel/surface. I'll sometimes even switch it over to my left and give my right a break.

But also, as a left-handed person I still use my right for the mouse when using it more actively, so I could scribble thoughts simultaneously with my left if I wanted to. I think I might have only done that like, once.

[+] alipang|4 years ago|reply
I'd imagine you can use a keyboard shortcut as well to open this menu, but based on the text cursor, rather than the mouse one.

I do this a lot is vscode to auto-fix issues and automatically add imports for the identifier under the caret. It's however frustrating in that it sometimes uses the underlying platform's dropdown widget, which doesn't respect my key bindings (Emacs-like, using C-p, C-n for up, down etc).

[+] link0ff|4 years ago|reply
Indeed, you can use the keyboard shortcut Shift-F10 to open the context menu based on the cursor location.
[+] SAI_Peregrinus|4 years ago|reply
The best UIs IMO tend to be those that allow operation with the left hand on the keyboard home row, and the right hand on the mouse. Keyboard shortcuts should be preferentially towards the left side of the keyboard. Quite a bit of CAD & graphics software works this way.

Keyboard-only is decent for text, and particularly good for text where everything that needs to be edited will be on the screen at the same time.

[+] paulmooreparks|4 years ago|reply
I switched to using the mouse with my left hand because of this. One day in the middle of a long coding session I noticed I was moving my right hand back and forth a lot between the keyboard and the mouse, so I picked up the mouse, moved it to the other side of the keyboard, and started using it that way (still in right-hand configuration). I've been using it that way for over 30 years now.

Because I kept the mouse in right-hand configuration, I can use any mouse with my left hand without having to switch the buttons, and I can also still use the mouse right-handed.

[+] throw10920|4 years ago|reply
I was just about to write something like this.

I call this model the "MOBA interaction model", because in those games (which include League, Smite, and Dota) you must place do exactly this.

I, too, wish that more interfaces worked this way - but there's a fundamental problem, which is that many tools (including all Unix ones) are more efficient when you can input text, which necessitates the use of both hands on the keyboard.

[+] BeetleB|4 years ago|reply
> The best UIs IMO tend to be those that allow operation with the left hand on the keyboard home row, and the right hand on the mouse.

Which would suck for left handed people.

[+] twobitshifter|4 years ago|reply
Has anyone ever used blackbox or open/fluxbox? The context menu can be very amazing and minimalistic. I don’t use those DEs today, but they did change my mind in terms of what is needed in a desktop for effective interaction.
[+] fatbird|4 years ago|reply
A 28 foot context menu is obviously going to be a UX problem.
[+] Avshalom|4 years ago|reply
You say that but the 28 foot context menu with every possible action from every application in Windows' File Explorer (and in file selection dialogs) is the thing I miss in Linux.
[+] kfarr|4 years ago|reply
Also coming here for expectations of a "stadium UI" ;)
[+] sulam|4 years ago|reply
I was hoping someone had made a context menu that is 28 feet long when you scroll through all the options. Sadly, no such hilarity presented itself. :)
[+] tsuru|4 years ago|reply
If hands-on-keyboard-and-mouse (HOKAM?) is important, I would suggest looking at the digital content creation apps like Blender and Maya context menus and pie menus for inspiration.

I know with my use of Emacs, I'd probably use or configure it like a fancy which-key: use the mouse to navigate / filter the available choices but then use the keyboard for final selection.

[+] alkonaut|4 years ago|reply
The #1 reason to use a mouse for me is to do input you can't easily do any other way. The first is hover info for things that are't anywhere near the cursor. I don't want to move the cursor in order to hover an identifier 20 lines and 40 columns away. Because once I have hovered it for info, I still have the cursor in the right spot.

BUT, that I can also do with a trackpoint/ball/roller/whatever. The most important mouse thing is for freehand input like drawing. It's just not ergonomical to do that kind of thing with a trackball.

Using any kind of pointer to move a cursor in text or navigating to a different window or a different textbox isn't really a good idea. That's done better with a keyboard. But the thing most keyboard purists overlook is the thing they don't do at all (draw, hover), so they don't miss it.

[+] Kessler83|4 years ago|reply
Hahaha, like you are some sort of brave free-thinker for using the mouse! There are tons of reasons for preferring the keyboard, one of which is to alleviate the hand and shoulder pains resulting from pointing and clicking with a mouse for 35 years ... Go into any work place where people work with mouse-heavy applications all day, and count the number of employees who have had to resort to special solutions, like trackballs, trackpoints or roller-bars. I'm not saying you can't get pains from a keyboard---not least from Emacs unless you switch capslock and ctrl. But the intro to this article is kinda silly I think. It's not a statement to use the keyboard, and you certainly aren't a rebel if you don't.
[+] chrisfinazzo|4 years ago|reply
My god, a mouse click which actually does something in a Terminal prompt! What a concept.

/s

But seriously though, if I could just ask for two things in emacs:

1. Enable mouse mode by default (Yes -- I love UNIX too, but this is ridiculous)

2. Give up on "yanking" and "killing" with only the keyboard and allow for text selection with the mouse. OP touches on this a bit, but why anyone should have to write their own functions to accomplish it is a bad sign.

Because I know I will get yelled at for this - especially #2 - is this limitation due to the fact that emacs (and I guess, vi) act like a pager with distinct modes of operation? And, yes I know GUI versions exist, but I shouldn't have to switch to something else just because the canonical implementation is incomplete.

/rant

[+] tgbugs|4 years ago|reply
This is a useful practical introduction to the new context menu functionality. Since power users rarely use the mouse or right click at all, I have found that context menus are a great space for making custom functionality accessible to semi-technical users on a file by file basis. Yes, this breaks all sorts of usability guidelines related to consistency. On the other hand if used judiciously it can save the user an enormous amount of time by giving the a single place to look for functionality that is relevant to them in a given context.
[+] worik|4 years ago|reply
The thing I love about emacs is how extensible it is.

The thing I hate about emacs is how extensible it is

Emacs was invented in 1976. You think it would be stable by now?

I filed a bug report for a sub-system I will not name because I think the developers are horrid people and the software fabulous, and I was abused, shouted at and called names for using an emacs distribution three years old (out of date they called it). That is I was using software that was forty four years old.

I love you emacs - I hate you emacs -

[+] trabant00|4 years ago|reply
> irrational fear of the mouse dominates amongst Un*x dogmatists. Be it because their tools don’t integrate, or because it is a symbol or rebellion, a means to differentiate their prior ignorance from the enlightenment they have attained

Or maybe we've learned something in the decades we've been working, since before you were actually born. Get off my lawn know-it-all college kid!

[+] bitwize|4 years ago|reply
Maybe it's because rat wrestling isn't nearly as efficient as it's made out to be, and not as efficient as a good keyboard command set anyway. Mouse-driven UIs are great for beginners who are afraid of computers to find commands. They're terrible for efficient workflows in the hands of seasoned workers because they insert a multi-step process of "acquire mouse with hand, acquire pointer on-screen, move pointer to target, click, optionally drag pointer to alternate target, etc." between you and whatever you want to do.

Mice (or pointers in general) are absolutely essential in some applications: drawing and painting, CAD, 3D modelling, etc. There also hasn't been a better flow for web browsing than simply clicking on links. But making the mouse supreme has added friction to workflows in fields from programming to simple data entry.

It's why I never could really get behind the Acme text editor, as cool as it is on principle.