Adds a mode to the editor.

        :param mode: The mode instance to append.
186884
def append(self, mode):
        
        _logger().log(5, 'adding mode %r', mode.name)
        self._modes[mode.name] = mode
        mode.on_install(self.editor)
        return mode
266698
def _add_editor_buffer(self, editor_buffer, show_in_current_window=False):
        
        assert isinstance(editor_buffer, EditorBuffer) and editor_buffer not in self.editor_buffers

        # Add to list of EditorBuffers
        eb = self.active_editor_buffer
        if eb is None:
            self.editor_buffers.append(editor_buffer)
        else:
            # Append right after the currently active one.
            try:
                index = self.editor_buffers.index(self.active_editor_buffer)
            except ValueError:
                index = 0
            self.editor_buffers.insert(index, editor_buffer)

        # When there are no tabs/windows yet, create one for this buffer.
        if self.tab_pages == []:
            self.tab_pages.append(TabPage(Window(editor_buffer)))
            self.active_tab_index = 0

        # To be shown?
        if show_in_current_window and self.active_tab:
            self.active_tab.show_editor_buffer(editor_buffer)

        # Start reporter.
        editor_buffer.run_reporter()
1243668
def setMode(self, mode):
		""""""
		_baseDes.setMode(self, mode)
		for key in (self.__key1, self.__key2, self.__key3):
			key.setMode(mode)
303331
private void addOption(CliOptionContainer optionContainer) {

    CliOption cliOption = optionContainer.getOption();
    addOption(cliOption.name(), optionContainer);
    for (String alias : cliOption.aliases()) {
      addOption(alias, optionContainer);
    }
    this.optionList.add(optionContainer);
    String modeId = optionContainer.getOption().mode();
    requireMode(modeId, optionContainer);
  }
635299
def add(self, extension):
        
        logger.debug('adding extension {}'.format(extension.name))
        self._extensions[extension.name] = extension
        extension.on_install(self.editor)
        return extension
848721
def add_option(self, option):
        
        assert isinstance(option, Option)
        repeatable = defines.OptionRegistry.LIST[option.number].repeatable
        if not repeatable:
            ret = self._already_in(option)
            if ret:
                raise TypeError("Option : %s is not repeatable", option.name)
            else:
                self._options.append(option)
        else:
            self._options.append(option)
89477
def init_editing_mode(self, e): # (M-C-j)
        ''''''
        self.show_all_if_ambiguous = 'on'
        self.key_dispatch = {}
        self.__vi_insert_mode = None
        self._vi_command = None
        self._vi_command_edit = None
        self._vi_key_find_char = None
        self._vi_key_find_direction = True
        self._vi_yank_buffer = None
        self._vi_multiplier1 = ''
        self._vi_multiplier2 = ''
        self._vi_undo_stack = []
        self._vi_undo_cursor = -1
        self._vi_current = None
        self._vi_search_text = ''
        self.vi_save_line ()
        self.vi_set_insert_mode (True)
        # make ' ' to ~ self insert
        for c in range(ord(' '), 127):
            self._bind_key('%s' % chr(c), self.vi_key)
        self._bind_key('BackSpace', self.vi_backspace)
        self._bind_key('Escape', self.vi_escape)
        self._bind_key('Return', self.vi_accept_line)

        self._bind_key('Left', self.backward_char)
        self._bind_key('Right', self.forward_char)
        self._bind_key('Home', self.beginning_of_line)
        self._bind_key('End', self.end_of_line)
        self._bind_key('Delete', self.delete_char)

        self._bind_key('Control-d', self.vi_eof)
        self._bind_key('Control-z', self.vi_eof)
        self._bind_key('Control-r', self.vi_redo)
        self._bind_key('Up', self.vi_arrow_up)
        self._bind_key('Control-p', self.vi_up)
        self._bind_key('Down', self.vi_arrow_down)
        self._bind_key('Control-n', self.vi_down)
        self._bind_key('Tab', self.vi_complete)
1172356
def append(self, option):
        
        self._options.append(self._parse_option(option))
        self._refresh_options()
        self.resize(self._width, self._height)
1140384
def set_mode(self, mode):
        
        values = {"desired_state": {"mode": mode}}
        response = self.api_interface.set_device_state(self, values)
        self._update_state_from_response(response)
296387
protected void addMode(CliModeContainer mode) {

    CliModeObject old = this.id2ModeMap.put(mode.getId(), mode);
    if (old != null) {
      CliStyleHandling handling = this.cliStyle.modeDuplicated();
      DuplicateObjectException exception = new DuplicateObjectException(mode, mode.getMode().id());
      if (handling != CliStyleHandling.OK) {
        handling.handle(LOG, exception);
      }
    }
  }
1056502
public SM2 setMode(SM2Mode mode) {
		this.mode = mode;
		if (null != this.engine) {
			this.engine.setMode(mode);
		}
		return this;
	}
1304244
def mode(self, mode):
        
        modes = self.available_modes
        if (not modes) or (mode not in modes):
            return
        self.publish(
            action='set',
            resource='modes' if mode != 'schedule' else 'schedule',
            mode=mode,
            publish_response=True)
        self.update()
462102
def merge_modes modes
      addition = true

      modes.each_char do |char|
        case char
        when ?+
          addition = true
        when ?-
          addition = false
        else
          addition ? @modes.concat(char) : @modes.delete!(char)
        end
      end
    end
590869
public void setMode(int mode) {
        // check arg
        switch (mode) {
            case MODE_EXACT:
            case MODE_JCOMPOUNDMAPPER:
                break;
            default:
                throw new IllegalArgumentException("Invalid mode specified!");
        }
        this.mode = mode;

        // re-gen atom expressions
        int numAtoms = mol.getAtomCount();
        for (int atomIdx = 0; atomIdx < numAtoms; atomIdx++)
            this.aexpr[atomIdx] = encodeAtomExpr(atomIdx);
    }
384774
def setCurrentMode( self, mode ):
        
        if ( self._currentMode == mode ):
            return
        
        self._currentMode = mode
        self.updateModeSettings()
1228502
def open(self, mode=None):
        

        if mode is None:
            mode = self.mode
        elif mode not in ['r', 'w', 'a']:
            raise ValueError('Invalid mode! Modes: [\'a\', \'r\', \'w\']')

        if self._file is None:
            self._file = h5py.File(self.path, mode=mode)
773017
def update_config_mode(self, prompt):  # pylint: disable=no-self-use
        """"""
        mode = 'global'
        if prompt:
            if 'config' in prompt:
                mode = 'config'
            elif 'admin' in prompt:
                mode = 'admin'

        self.log("Mode: {}".format(mode))
        return mode