[HN Gopher] An accentuated Emacs experiment (a la macOS)
___________________________________________________________________
An accentuated Emacs experiment (a la macOS)
Author : xenodium
Score : 109 points
Date : 2022-07-30 13:14 UTC (9 hours ago)
(HTM) web link (xenodium.com)
(TXT) w3m dump (xenodium.com)
| cardanome wrote:
| As one of the few people actually using the Colemak keyboard
| layout, I am very glad about it's excellent multi-language
| support. It allows me to type nearly any language reasonably
| well. https://colemak.com/Multilingual (Basically any latin-chars
| using language, Chinese and Japanese are also fine as they use
| IME-based inputs, only Cyrillic based langs and APL are a bit of
| problem but can't have everything)
|
| For the languages I use is it is mostly a matter of AltGr + key,
| which is quite ergonomic. It would suffer greatly if I had to
| make long presses as that would kill my typing speed.
|
| Not to distract from how awesome Emacs is though. Just wanted to
| add a solution for those who regularly type text in different
| languages.
| muro wrote:
| I like the macos input a lot, by some accents are missing. I
| filed feedback, but that's a black hole. Is there a a way to
| replace the characters it uses?
| herodotus wrote:
| Wow: all my years using MacOS, and I did not know this:
|
| > macOS has a wonderful input mechanism where you press and hold
| a key on your keyboard to display the accent menu.
|
| The depth of my ignorance may be unbounded....
|
| Anyhow, thanks! I'll use it!
| User23 wrote:
| Very cool! One fix for the magit navigation issue could be
| somehow checking that the key you're chording would otherwise
| call self-insert-command in the current mode.
| elias94 wrote:
| Hey, here is the author of the accent package. It was my first
| extension that wrote after 1 week on starting using Emacs. ELisp
| is really great!
|
| MacOS menu for accented characters is must have for me and I
| cannot understand why other OS are not adopting it.
|
| Thanks for the article, it's a nice trick
| xenodium wrote:
| Thanks for the package (handy!) and submitting to melpa. Well
| done.
| bradrn wrote:
| For a ~50-year-old program, Emacs's support for multilingual
| input -- and really, it's all-round flexibility -- continually
| amazes me! For myself I prefer my own custom keyboard layout [0],
| because it works outside Emacs too, but I'd happily use Emacs's
| own input methods if that would be sufficient.
|
| (In fairness, I have found one weak spot, namely font support...
| I've used 'unicode-fonts' [1] with some success, but reportedly
| it doesn't work with the latest Emacs. Ah well, it's at least
| fairly rare that this becomes a problem in practice.)
|
| [0] https://github.com/bradrn/Conkey
|
| [1] https://github.com/rolandwalker/unicode-fonts
| klodolph wrote:
| Emacs is a bit crazy about it... it has its own set of input
| modes which include modes you may not be familiar with. You can
| use various IMEs that plug directly into Emacs rather than
| relying on a systemwide IME (which was neat back when
| systemwide IMEs didn't work well), and there are systems like
| RFC 1345 (type &e' for e, &e* for e, &12 for 1/2, etc), or TeX
| (type \'e for e, \varepsilon for e, \frac12 for 1/2, etc).
|
| So many people have their own preferences for how to type these
| characters, write an input method for Emacs, and get it
| included.
| projektfu wrote:
| I remember the transition. They did handle it remarkably well,
| in the time of many different charsets.
| cassianoleal wrote:
| As a Portuguese speaker, I have a terrible dislike for this on
| macOS. It's usually one of the first things I disable. It's slow
| to activate, and slow to select, so it's disruptive to my
| thinking and expressing. Dead keys, on the other hand, allow me
| to type fluidly.
|
| I switch between a keymap with and one without dead keys with a
| single shortcut depending on whether I'm typing
| English/programming, or Portuguese/other accented languages.
| [deleted]
| misnome wrote:
| > As a Portuguese speaker, I have a terrible dislike for this
| on macOS. It's usually one of the first things I disable. It's
| slow to activate, and slow to select, so it's disruptive to my
| thinking and expressing. Dead keys, on the other hand, allow me
| to type fluidly.
|
| Isn't the entire point of this popup to give you a visual
| fallback option if you e.g. aren't a native speaker and don't
| know how to type it otherwise? For instance, assuming an
| english keyboard layout, typing a is a matter of "Alt-e a".
|
| I don't think it's meant to be the primary input method for
| native speakers?
| cassianoleal wrote:
| > I don't think it's meant to be the primary input method for
| native speakers?
|
| I'm assuming you meant that as an affirmation despite the use
| of the question mark.
|
| If that's the case, then I agree it makes sense! I find
| macOS's default to have this enabled pretty bad though. I
| understand it on iDevices where dead keys would be awkward
| but not on a computer with a full, physical keyboard.
| klodolph wrote:
| The question mark in this case doesn't indicate that the
| sentence is a question. This usage is common but not
| permitted in formal writing.
| cassianoleal wrote:
| Yes, I've come across this. It's very confusing for me.
| Not sure if it's because I'm not a native English speaker
| or some other reason but it always makes me pause and is
| not always clear which way it's meant.
| klodolph wrote:
| It's used to mark a rising declarative. Wikipedia has an
| article about what it means.
|
| https://en.wikipedia.org/wiki/Rising_declarative
|
| The older generations think that this is "wrong", so they
| don't teach you what it means or how to use it.
|
| Just an observation--foreign language education generally
| teaches a formal version of the language and neglects
| informal/casual usage. This is normal. The problem is
| that informal/casual usage today becomes formal usage in
| the future, as language changes.
|
| Just as an example, if you take a Japanese class, they'll
| probably teach you [ohayougozaimusu] but not [otsusu]
| (good morning), [arigatou] but not [sankiyu] (thank
| you), and teach you to say [Wu Li ] when you should say
| [Nan shii] (impossible).
| rjmorris wrote:
| I'm a native English speaker, and it's confusing for me
| sometimes, too. I've had to ask multiple times whether
| someone was expecting an answer from me when they used
| this construct.
| lelandfe wrote:
| If you hate it you hate it, but one tip to perhaps try:
|
| You can select the accented character with number keys (e.g. 1
| for the first option), and you can reduce the delay in the
| panel appearing by reducing the key delay:
| defaults write NSGlobalDomain InitialKeyRepeat -int 12
|
| Together, you can select accented letters in a few
| milliseconds. You can reset the delay to default with:
| defaults write NSGlobalDomain InitialKeyRepeat -int 25
| cassianoleal wrote:
| Thanks, but any amount of waiting will cause disruption.
|
| If I have to long-press (however short "long" might be), plus
| remember which number corresponds to which accent on each
| letter, that's a lot more than what I have now - accents make
| sense as you type the actual accent plus the letter. The only
| "exceptions" to this intuitiveness are 'c for c (not an issue
| on PT or BR keyboards which have a dedicated key for that)
| and arguably " for umlauts like u (I think only in pt_BR and
| even then it's not in use since the unification of the
| orthographies in the 90s).
| projektfu wrote:
| I've always wondered why accents are generally added before the
| letter in most systems. The old Mac way was option-e e for e,
| dead-key way is ' e, but you have to type ' ' or ' SPC for the
| actual quote character. There's some keyboards based on alt-gr
| and such, but when we write we usually do it afterwards.
|
| I could see that sending the wrong character initially to an
| online program is suboptimal, but we often do that anyway and
| have to hit delete.
|
| Another thought, why is there no clever autocorrect to try to add
| the ? in the right spot? Again, not the desired behavior always,
| but in many cases. It could be a suggestion that you must
| approve. Thankfully, texting has shown that Spanish users are not
| that keen on correct punctuation.
| masklinn wrote:
| > The old Mac way was option-e e for e
|
| It's still the mac way. The long press thing is only usable if
| you just need accents once in a while, and can be disabled.
| bradrn wrote:
| > I've always wondered why accents are generally added before
| the letter in most systems.
|
| As with many of these things, it's a holdover from typewriters.
| 'Dead keys' in typewriters were literally keys which did not
| move the carriage to the next position: thus to get accented
| characters you would type the dead key, then the letter, so
| that both would end up in the same position on the page.
| (Incidentally, this also explains why we so often use SPC after
| a dead key to get the base character.)
| db48x wrote:
| I should be possible to use the OS's IME, whatever that may be.
| If not, type `M-x report-emacs-bug` to send a bug report.
| theCodeStig wrote:
| This is great! Have you considered to make this into a package?
| peoplefromibiza wrote:
| MacOS way it's only half good if you don't use accents while
| typing and only need them that one time, while in all languages
| with accented letters it's the worst and slowest method you can
| use.
| klodolph wrote:
| Wouldn't you also change the keyboard layout in that situation?
| So if you're typing Spanish, there's a dedicated key for n, but
| you can also push and hold c to get c, for example.
| peoplefromibiza wrote:
| Changing keyboard layout it's tricky, when I'm writing code I
| want the most important keys (parenthesis, brackets, braces,
| semicolon etc) where I'm used to find them, but I often need
| to write comments in Italian for auto generated
| documentation.
|
| Constantly switching keyboard layout can be almost as
| disruptive as waiting for a dropdown to appear.
| klodolph wrote:
| I use a keyboard shortcut for swapping between the two most
| recently used layouts. Something like ctrl+space (or
| something else if I'm using Emacs a lot). Is this
| disruptive?
|
| The most common scenario is that I'm writing a mixture of
| English and Japanese, and I can't do that without switching
| layouts.
| peoplefromibiza wrote:
| > Is this disruptive?
|
| what's disruptive is that keys are in different places
|
| ; on IT keyboards needs SHIFT
|
| ~ is not present
|
| | is on the other side of the keyboard
|
| etc etc
| klodolph wrote:
| Is there a system you like to use?
|
| If I'm switching keyboard layouts, I'm not programming in
| both layouts. I'm programming in a variation of the US
| layout, and writing natural language text in a different
| layout. I'm sure it is disruptive at first, but I got
| used to it such a long time ago at this point.
|
| There are also a lot of games that don't work except in
| the QWERTY layout, so I am always switching if I play a
| game. I have gotten used to it.
|
| I've only ever figured out how to type accents for
| foreign languages on Macs. Windows has the ALT+1234
| gibberish that you have to memorize. I've been fighting
| against layouts and IMEs on Linux for at least two
| decades at this point and there are at least three
| different ways to set the keyboard layout, each of which
| affect different applications, and some applications seem
| to ignore the keyboard layout I set. As a result, I often
| just kind of give up on typing accented characters except
| on a Mac.
| peoplefromibiza wrote:
| > Is there a system you like to use?
|
| I use UK/US layout everywhere and dead keys for the
| occasional accented letters (on Linux), except for email
| and chats where I can copy/paste the code
| globuous wrote:
| True that. But I typed French on a qwerty for a while on Mac
| OS, and you << just >> alt+e-e to do e or something. You get
| used to it.
|
| And on iPhones, I never actually hold << e >> to show the
| accents, their system figures out the accents. Although it
| missed sometimes, it's pretty good. I can just type << je suis
| arrivee a la maison >> and it accentuates my letters properly.
| Actually, I had to manually remove the accents for this exemple
| ^^
|
| Edit: ok, that's kinda funny, it must be because I typed French
| in English and it messed it up, but << accentuates >> doesn't
| make any sense, same with << edit >> it just inferred for my.
| Leaving the message as is for the lols
| makapuf wrote:
| Accentuates and edit do make sense as French words. An Edit
| is an edict, and accentuates is simple past (passe simple)
| for accentuer (accentuate).
| larusso wrote:
| I'm typing German on a US keyboard layout and I'm very used
| to the alt +u-u chord etc to write the Inlauts. I still don't
| have a setup on Linux though because I'm used to type this
| sequence with the left Alt key not the right.
| peoplefromibiza wrote:
| AFAIK at least on GNOME and KDE you can assign any special
| key to be the compose key, including left Alt.
| peoplefromibiza wrote:
| That's what I used too on Mac and it also works on Linux
|
| AltGr+e for grave accent and AltGr+' for acute accent.
|
| Much better than auto completion boxes
|
| My language, as yours, contains a lot of accented letters and
| it would be absolutely impractical to chose them from a
| dropdown.
|
| p.s. I type on an Italian keyboard with UK layout because
| it's more comfortable for typing code
| makapuf wrote:
| I understand you so much. Typing code on a non US keyboard
| (French here) is much worse. I long for a French coder
| layout.
| pdpi wrote:
| I'm a Portuguese native speaker, and use a US keyboard with the
| US International layout (the pt keyboard layout is terrible for
| programming). Having dead keys for Portuguese diacritics is
| basically essential, but I do occasionally need to type things
| in other languages where I have no clue how to input the
| diacritics. The macOS input method makes it _possible_ to input
| those characters in a predictable, easy to remember way.
| twawaaay wrote:
| Completely unacceptable as an input method for anybody with any
| level of typing proficiency.
|
| I can type couple words during the time it would take to input
| one character...
|
| Also, while typing 10 characters per second visual elements stop
| working. When I make a mistake and visual signal has to reach my
| brain and be recognised I have typically already typed half a
| dozen characters.
| BlueTemplar wrote:
| Sounds more like a job for the keyboard layout itself ?
|
| https://norme-azerty.fr/en/
|
| (With good support for all(?) the Latin-based languages, and also
| Greek... I kind of wish they had managed to fit Cyrillic on
| another mode too !)
|
| P.S.: better than the old AZERTY for math & code too !
| codedokode wrote:
| > macOS has a wonderful input mechanism where you press and hold
| a key on your keyboard to display the accent menu.
|
| Is it really convenient? I don't like to wait and would rather
| prefer to press a sequence of "Compose", "a", "1", (or, which is
| faster, "a" and "1" simultaneously). And make a popup appear when
| "Compose" + "a" is pressed.
|
| Linux has Compose key, but it is implemented poorly, it doesn't
| provide an UI for selecting character and discovery of
| combinations, and in Gnome it has very small choice of
| characters.
|
| Another alternative would be to insert accented characters
| automatically.
| [deleted]
| tgv wrote:
| macOS offers three ways to input. One by holding the key (which
| it inherited from iOS), one through changing the keyboard to
| another locale, and one by language independent prefixes: alt-u
| for umlaut/dieresis, alt-e for accent aigu, etc.
| JadeNB wrote:
| Unfortunately, neither the first nor the last way is
| customiseable (and I consider changing the locale pretty
| brute-force ...), or at least not according to the Mac
| experts I asked when I did a deep dive (which, to be fair,
| was long ago, before iOS even existed). You can always use
| the Unicode picker, but, if you never use, say, Opt-Z for O
| and want to re-bind it to something else, or if you wish the
| 'o' long-press menu included o ... too bad!
|
| (I admit I am engaging in the rhetorical tactic of
| confidently asserting that something is impossible in the
| hopes that someone will be lured to come along and correct
| me, so that I can be happily wrong.)
| tgv wrote:
| There used to be a way to define your own keyboard
| decoding, but I don't know if you still can, nor how
| flexible it is. I'm guessing it won't be Turing complete.
| b3morales wrote:
| I'm not sure if it's the method you're referring to, but
| I believe custom keybinding dicts still work. For those
| interested, this should tell you all you need to know: ht
| tp://web.archive.org/web/20210130012801/http://www.hcs.ha
| r...
| dunham wrote:
| Yeah, I'm using this for l and [?]: /*
| -*- coding: utf-8 -*- */ { "~/" =
| ("insertText:", "l"); "~a" = ("insertText:", "[?]
| "); }
|
| It looks like you can actually send arbitrary objectiveC
| messages to the first responder with this, but I haven't
| played with it much.
|
| (I'm also now using the `fn` key to toggle between greek
| and US.)
| BlackFingolfin wrote:
| You can do so by defining a custom keyboard layout. This is
| quite convenient with Ukelele
| https://software.sil.org/ukelele/ : you can take any
| existing layout (e.g. the one that is currently active) and
| then change all key mappings, including which keys are dead
| keys etc. I used this to create a modified EN-US keymap
| where Alt-A/O/U produces the corresponding umlaut versions
| directly, and Alt-S produces German ss (so that when I have
| to write German text I can do so quickly and conveniently)
| [deleted]
| foobiekr wrote:
| The mac has multiple. The press-and-hold is for occasional
| usage and is a lot more discoverable to people coming from
| iphone.
___________________________________________________________________
(page generated 2022-07-30 23:01 UTC)