code: def load_emacs_search_bindings() -> KeyBindingsBase:
      key_bindings = KeyBindings()
      handle = key_bindings.add
      from . import search
  
      # NOTE: We don't bind 'Escape' to 'abort_search'. The reason is that we
      #       want Alt+Enter to accept input directly in incremental search mode.
      #       Instead, we have double escape.
  
      handle("c-r")(search.start_reverse_incremental_search)
      handle("c-s")(search.start_forward_incremental_search)
  
      handle("c-c")(search.abort_search)
      handle("c-g")(search.abort_search)
      handle("c-r")(search.reverse_incremental_search)
      handle("c-s")(search.forward_incremental_search)
      handle("up")(search.reverse_incremental_search)
      handle("down")(search.forward_incremental_search)
      handle("enter")(search.accept_search)
  
      # Handling of escape.
      handle("escape", eager=True)(search.accept_search)
  
      # Like Readline, it's more natural to accept the search when escape has
      # been pressed, however instead the following two bindings could be used
      # instead.
      # #handle('escape', 'escape', eager=True)(search.abort_search)
      # #handle('escape', 'enter', eager=True)(search.accept_search_and_accept_input)
  
      # If Read-only: also include the following key bindings:
  
      # '/' and '?' key bindings for searching, just like Vi mode.
      handle("?", filter=is_read_only & ~vi_search_direction_reversed)(
          search.start_reverse_incremental_search
      )
      handle("/", filter=is_read_only & ~vi_search_direction_reversed)(
          search.start_forward_incremental_search
      )
      handle("?", filter=is_read_only & vi_search_direction_reversed)(
          search.start_forward_incremental_search
      )
      handle("/", filter=is_read_only & vi_search_direction_reversed)(
          search.start_reverse_incremental_search
      )
  
      @handle("n", filter=is_read_only)
      def _jump_next(event: E) -> None:
          "Jump to next match."
          event.current_buffer.apply_search(
              event.app.current_search_state,
              include_current_position=False,
              count=event.arg,
          )
  
      @handle("N", filter=is_read_only)
      def _jump_prev(event: E) -> None:
          "Jump to previous match."
          event.current_buffer.apply_search(
              ~event.app.current_search_state,
              include_current_position=False,
              count=event.arg,
          )
  
      return ConditionalKeyBindings(key_bindings, emacs_mode)
  
file_path: catboost/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/emacs.py
imports: from __future__ import annotations
  from prompt_toolkit.application.current import get_app
  from prompt_toolkit.buffer import Buffer, indent, unindent
  from prompt_toolkit.completion import CompleteEvent
  from prompt_toolkit.filters import Condition, emacs_insert_mode, emacs_mode, has_arg, has_selection, in_paste_mode, is_multiline, is_read_only, shift_selection_mode, vi_search_direction_reversed
  from prompt_toolkit.key_binding.key_bindings import Binding
  from prompt_toolkit.key_binding.key_processor import KeyPressEvent
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.selection import SelectionType
  from ..key_bindings import ConditionalKeyBindings, KeyBindings, KeyBindingsBase
  from .named_commands import get_by_name
label_desc: Use image node_id 2 for calling a global function with example usage: load_emacs_search_bindings() and returns: ConditionalKeyBindings