Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No viable mechanism for conditional evaluation in .inputrc #107

Open
camdez opened this issue Oct 17, 2014 · 0 comments
Open

No viable mechanism for conditional evaluation in .inputrc #107

camdez opened this issue Oct 17, 2014 · 0 comments

Comments

@camdez
Copy link
Contributor

camdez commented Oct 17, 2014

If I want to disable a piece of my .inputrc file from being evaluated under rb-readline (e.g. because it crashes rb-readline: #106), my only option is to use the $else clause of an $if construct. Relevant section from GNU Readline man page:

`$if'
     The `$if' construct allows bindings to be made based on the
     editing mode, the terminal being used, or the application using
     Readline.  The text of the test extends to the end of the line; no
     characters are required to isolate it.

    `mode'
          The `mode=' form of the `$if' directive is used to test
          whether Readline is in `emacs' or `vi' mode.  This may be
          used in conjunction with the `set keymap' command, for
          instance, to set bindings in the `emacs-standard' and
          `emacs-ctlx' keymaps only if Readline is starting out in
          `emacs' mode.

    `term'
          The `term=' form may be used to include terminal-specific key
          bindings, perhaps to bind the key sequences output by the
          terminal's function keys.  The word on the right side of the
          `=' is tested against both the full name of the terminal and
          the portion of the terminal name before the first `-'.  This
          allows `sun' to match both `sun' and `sun-cmd', for instance.

    `application'
          The APPLICATION construct is used to include
          application-specific settings.  Each program using the
          Readline library sets the APPLICATION NAME, and you can test
          for a particular value.  This could be used to bind key
          sequences to functions useful for a specific program.  For
          instance, the following command adds a key sequence that
          quotes the current or previous word in Bash:
               $if Bash
               # Quote the current or previous word
               "\C-xq": "\eb\"\ef\""
               $endif

For instance, like this:

$if Ruby
$else
"^[�n": next-history
$endif

This functionality is implemented in rb-readline but is completely unusable because the value from the $if clause is downcased and then compared against the capitalized string "Ruby" (set here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant