minput_get_command(3m17n)

πŸ“¦
version 1.8.4 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– minput_get_command β€” the m17n Library era πŸ’–

okay bestie, sit down, hydrate, because we're about to get cozy with minput_get_command from the m17n library (manual page minput_get_command(3m17n), iykyk). it's giving "let me tell you everything about your input method commands" and honestly? iconic.


✨ NAME ✨

minput_get_command β€” ...and that's literally it, the original left this one blank, no cap, the description slot is just vibes and empty space πŸ™ˆ


✨ SYNOPSIS ✨

MPlist* minput_get_command (MSymbol language, MSymbol name, MSymbol
       command)

✨ DESCRIPTION ✨

@brief</ppurple> Get information about input method command(s). periodt.

so like, the minput_get_command() function returns info about the command command of the input method that's specified by language and name. and what even is an input method command, you ask? bestie it's a pseudo key event β€” a fake little key moment β€” to which one or more actual input key sequences are assigned. it's giving ghost key, it's giving proxy πŸ’….

there are two kinds of commands, and you need to know both:

  • global β€” has a global definition, and its description + key assignment may be inherited by a local command.
  • local β€” every input method defines a local command with its own local key assignment. it may also declare a local command that inherits the definition of a global command of the same name. the way that's literally inheritance, we love a family tree 🧚.

now, the vibe check on which one you get back:

  • If language is #Mt and name is #Mnil, this function returns information about a global command. Otherwise, information about a local command is returned.
  • If command is #Mnil, information about all commands is returned. (yes, all of them. she's thorough. main character energy.)

The return value is a well-formed plist (m17nPlist) of this format:

((NAME DESCRIPTION STATUS [KEYSEQ ...]) ...)

let's break down every single piece, no skipping, because we don't do that here:

  • NAME is a symbol representing the command name.
  • DESCRIPTION is an M-text describing the command, or Mnil if the command has no description.
  • STATUS is a symbol representing how the key assignment is decided. The value is Mnil (the default key assignment), Mcustomized (the key assignment is customized by per-user customization file), or Mconfigured (the key assignment is set by the call of minput_config_command()). For a local command only, it may also be Minherited (the key assignment is inherited from the corresponding global command).
  • KEYSEQ is a plist of one or more symbols representing a key sequence assigned to the command. If there's no KEYSEQ, the command is currently disabled (i.e. no key sequence can trigger actions of the command).

and one more lil detail bestie: if command is not Mnil, the first element of the returned plist contains the information about command.


✨ RETURN VALUE ✨

  • If the requested information was found, a pointer to a non-empty plist is returned. As the plist is kept in the library, the caller must not modify nor free it. (do not touch. hands off. she's not yours 🫢)
  • Otherwise (the specified input method or the specified command does not exist), NULL is returned.

Example:

MText *
get_im_command_description (MSymbol language, MSymbol name, MSymbol command)
{
  /* Return a description of the command COMMAND of the input method
     specified by LANGUAGE and NAME.  */
  MPlist *cmd = minput_get_command (language, name, command);
  MPlist *plist;

  if (! cmds)
    return NULL;
  plist = mplist_value (cmds);  /* (NAME DESCRIPTION STATUS KEY-SEQ ...) */
  plist = mplist_next (plist);  /* (DESCRIPTION STATUS KEY-SEQ ...) */
  return  (mplist_key (plist) == Mtext
       ? (MText *) mplist_value (plist)
       : NULL);
}
as a note, this example is copied over exactly as it appears β€” variable names and all β€” because we keep every detail, fr fr. πŸ™ˆ

  • Copyright (C) 2001 Information-technology Promotion Agency (IPA)
  • Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.


and that's the whole page, bestie!! πŸŽ€ you now know minput_get_command better than it knows itself. go forth and slay your key sequences. πŸ’…βœ¨

Version 1.8.4 β€” Mon Sep 25 2023 β€” bye babes, mwah πŸ’–πŸ¦‹

πŸ“¦ where this page comes from