[sr] Remove old buggy emacs mode plugin for Qt Creator.

This commit is contained in:
Yury Melnichek 2013-08-28 01:53:47 +02:00 committed by Alex Zolotarev
parent 1ce0f2cde7
commit 80ee03742d
12 changed files with 0 additions and 4962 deletions

View file

@ -1,14 +0,0 @@
fakevim is based on eventFilters installed on a QTextEdit or a QPlainTextEdit.
It basically catches all keystrokes and modifies some internal state that
make the resulting text in the editor look like it was using vim.
There are only a few files in here:
fakevimplugin.{h,cpp} - interaction with the rest of Creator
fakevimactions.{h,cpp} - settings
fakevimhandler.{h,cpp} - the "real" event
There are some more hints for developers in fakevimhandler.cpp

View file

@ -1,86 +0,0 @@
#include "emacs_shortcut.h"
#include <QString>
#include <QStringList>
namespace Emacs
{
Shortcut::Shortcut(Qt::KeyboardModifiers mods, std::vector<int> const & keys, TFnList const & fnList)
: m_mods(mods), m_keys(keys), m_fnList(fnList)
{}
Shortcut::Shortcut(QString const & s)
{
QStringList l = s.split("|");
QString keys = l.at(l.size() - 1).toLower();
for (int i = 0; i < l.size(); ++i)
{
QString key = l.at(i).toUpper();
if (key == "<CONTROL>")
m_mods |= Qt::ControlModifier;
else if (key == "<META>")
m_mods |= Qt::MetaModifier;
else if (key == "<SHIFT>")
m_mods |= Qt::ShiftModifier;
else if (key == "<ALT>")
m_mods |= Qt::AltModifier;
else if (key == "<TAB>")
m_keys.push_back(Qt::Key_Tab);
else if (key == "<SPACE>")
m_keys.push_back(Qt::Key_Space);
else if (key == "<UNDERSCORE>")
m_keys.push_back(Qt::Key_Underscore);
else if (key == "<ESC>")
m_keys.push_back(Qt::Key_Escape);
else if (key == "<SLASH>")
m_keys.push_back(Qt::Key_Slash);
else
m_keys.push_back(key.at(0).toAscii() - 'A' + Qt::Key_A);
}
}
Shortcut::Shortcut()
{}
bool Shortcut::isEmpty() const
{
return m_keys.size() != 0;
}
bool Shortcut::isAccepted(QKeyEvent * kev) const
{
int key = kev->key();
Qt::KeyboardModifiers mods = kev->modifiers();
return ((mods == m_mods) && (key == m_keys.front()));
}
bool Shortcut::hasFollower(QKeyEvent * kev) const
{
return (isAccepted(kev) && (m_keys.size() > 1));
}
Shortcut const Shortcut::getFollower(QKeyEvent * kev) const
{
if (hasFollower(kev))
{
std::vector<int> keys;
std::copy(++m_keys.begin(), m_keys.end(), std::back_inserter(keys));
return Shortcut(m_mods, keys, m_fnList);
}
return Shortcut();
}
Shortcut & Shortcut::addFn(boost::function<void()> fn)
{
m_fnList.push_back(fn);
return *this;
}
void Shortcut::exec() const
{
for (TFnList::const_iterator it = m_fnList.begin(); it != m_fnList.end(); ++it)
(*it)();
}
}

View file

@ -1,39 +0,0 @@
#ifndef EMACS_SHORTCUT_H
#define EMACS_SHORTCUT_H
#include <boost/function.hpp>
#include <list>
#include <vector>
#include <Qt>
#include <QKeyEvent>
namespace Emacs
{
class Shortcut
{
private:
Qt::KeyboardModifiers m_mods;
std::vector<int> m_keys;
typedef std::list<boost::function<void ()> > TFnList;
TFnList m_fnList;
public:
Shortcut();
Shortcut(QString const & s);
Shortcut(Qt::KeyboardModifiers, std::vector<int> const & , TFnList const & );
Shortcut & addFn(boost::function<void ()> fn);
void exec() const;
bool isEmpty() const;
bool isAccepted(QKeyEvent * kev) const;
bool hasFollower(QKeyEvent * kev) const;
Shortcut const getFollower(QKeyEvent * kev) const;
};
}
#endif // EMACS_SHORTCUT_H

View file

@ -1,21 +0,0 @@
<plugin name="EmacsMode" version="0.0.1" compatVersion="1.3.0">
<vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license>
Commercial Usage
Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
GNU Lesser General Public License Usage
Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License version 2.1 requirements will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
</license>
<description>Emacs-style keyboard navigation.</description>
<url></url>
<dependencyList>
<dependency name="CppEditor" version="2.5.2"/><!-- Plugin adds items to the editor's context menu -->
<dependency name="TextEditor" version="2.5.2"/>
<dependency name="ProjectExplorer" version="2.5.2"/>
<dependency name="Core" version="2.5.2"/>
</dependencyList>
</plugin>

View file

@ -1,32 +0,0 @@
QTC_SOURCE = ../../../qt-creator-2.5.2-src
QTC_BUILD = ../../../qtcreator-build-release
TEMPLATE = lib
TARGET = EmacsMode
IDE_SOURCE_TREE = $$QTC_SOURCE
IDE_BUILD_TREE = $$QTC_BUILD
PROVIDER = MapsWithMe
DESTDIR = $$QTC_BUILD/lib/qtcreator/plugins/MapsWithMe
LIBS += -L$$QTC_BUILD/bin/Qt\ Creator.app/Contents/PlugIns/Nokia
include($$QTC_SOURCE/src/qtcreatorplugin.pri)
include($$QTC_SOURCE/src/plugins/coreplugin/coreplugin.pri)
include($$QTC_SOURCE/src/plugins/texteditor/texteditor.pri)
include($$QTC_SOURCE/src/plugins/find/find.pri)
# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
QT += gui
SOURCES += emacsmodehandler.cpp \
emacsmodeplugin.cpp \
emacsmodeactions.cpp \
emacs_shortcut.cpp
HEADERS += emacsmodehandler.h \
emacsmodeplugin.h \
emacsmodeactions.h \
emacs_shortcut.h
FORMS += emacsmodeoptions.ui
OTHER_FILES += EmacsMode.pluginspec
INCLUDEPATH *= ../../3party/boost

View file

@ -1,195 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "emacsmodeactions.h"
// Please do not add any direct dependencies to other Qt Creator code here.
// Instead emit signals and let the EmacsModePlugin channel the information to
// Qt Creator. The idea is to keep this file here in a "clean" state that
// allows easy reuse with any QTextEdit or QPlainTextEdit derived class.
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QFile>
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QProcess>
#include <QtCore/QRegExp>
#include <QtCore/QTextStream>
#include <QtCore/QtAlgorithms>
#include <QtCore/QCoreApplication>
#include <QtCore/QStack>
using namespace Utils;
///////////////////////////////////////////////////////////////////////
//
// EmacsModeSettings
//
///////////////////////////////////////////////////////////////////////
namespace EmacsMode {
namespace Internal {
EmacsModeSettings::EmacsModeSettings()
{}
EmacsModeSettings::~EmacsModeSettings()
{
qDeleteAll(m_items);
}
void EmacsModeSettings::insertItem(int code, SavedAction *item,
const QString &longName, const QString &shortName)
{
QTC_ASSERT(!m_items.contains(code), qDebug() << code << item->toString(); return);
m_items[code] = item;
if (!longName.isEmpty()) {
m_nameToCode[longName] = code;
m_codeToName[code] = longName;
}
if (!shortName.isEmpty()) {
m_nameToCode[shortName] = code;
}
}
void EmacsModeSettings::readSettings(QSettings *settings)
{
foreach (SavedAction *item, m_items)
item->readSettings(settings);
}
void EmacsModeSettings::writeSettings(QSettings *settings)
{
foreach (SavedAction *item, m_items)
item->writeSettings(settings);
}
SavedAction *EmacsModeSettings::item(int code)
{
QTC_ASSERT(m_items.value(code, 0), qDebug() << "CODE: " << code; return 0);
return m_items.value(code, 0);
}
SavedAction *EmacsModeSettings::item(const QString &name)
{
return m_items.value(m_nameToCode.value(name, -1), 0);
}
EmacsModeSettings *theEmacsModeSettings()
{
static EmacsModeSettings *instance = 0;
if (instance)
return instance;
instance = new EmacsModeSettings;
SavedAction *item = 0;
const QString group = QLatin1String("EmacsMode");
item = new SavedAction(instance);
item->setText(QCoreApplication::translate("EmacsMode::Internal", "Toggle vim-style editing"));
item->setSettingsKey(group, QLatin1String("UseEmacsMode"));
item->setCheckable(true);
item->setValue(true);
instance->insertItem(ConfigUseEmacsMode, item);
item = new SavedAction(instance);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(group, QLatin1String("StartOfLine"));
item->setCheckable(true);
instance->insertItem(ConfigStartOfLine, item, QLatin1String("startofline"), QLatin1String("sol"));
item = new SavedAction(instance);
item->setDefaultValue(8);
item->setSettingsKey(group, QLatin1String("TabStop"));
instance->insertItem(ConfigTabStop, item, QLatin1String("tabstop"), QLatin1String("ts"));
item = new SavedAction(instance);
item->setDefaultValue(false);
item->setValue(false);
item->setSettingsKey(group, QLatin1String("SmartTab"));
instance->insertItem(ConfigSmartTab, item, QLatin1String("smarttab"), QLatin1String("sta"));
item = new SavedAction(instance);
item->setDefaultValue(true);
item->setValue(true);
item->setSettingsKey(group, QLatin1String("HlSearch"));
item->setCheckable(true);
instance->insertItem(ConfigHlSearch, item, QLatin1String("hlsearch"), QLatin1String("hls"));
item = new SavedAction(instance);
item->setDefaultValue(8);
item->setSettingsKey(group, QLatin1String("ShiftWidth"));
instance->insertItem(ConfigShiftWidth, item, QLatin1String("shiftwidth"), QLatin1String("sw"));
item = new SavedAction(instance);
item->setDefaultValue(false);
item->setValue(false);
item->setSettingsKey(group, QLatin1String("ExpandTab"));
item->setCheckable(true);
instance->insertItem(ConfigExpandTab, item, QLatin1String("expandtab"), QLatin1String("et"));
item = new SavedAction(instance);
item->setDefaultValue(false);
item->setValue(false);
item->setSettingsKey(group, QLatin1String("AutoIndent"));
item->setValue(false);
item->setCheckable(true);
instance->insertItem(ConfigAutoIndent, item, QLatin1String("autoindent"), QLatin1String("ai"));
item = new SavedAction(instance);
item->setDefaultValue(true);
item->setValue(true);
item->setSettingsKey(group, QLatin1String("IncSearch"));
item->setCheckable(true);
instance->insertItem(ConfigIncSearch, item, QLatin1String("incsearch"), QLatin1String("is"));
item = new SavedAction(instance);
item->setDefaultValue(QLatin1String("indent,eol,start"));
item->setSettingsKey(group, QLatin1String("Backspace"));
instance->insertItem(ConfigBackspace, item, QLatin1String("backspace"), QLatin1String("bs"));
item = new SavedAction(instance);
item->setText(QCoreApplication::translate("EmacsMode::Internal", "EmacsMode properties..."));
instance->insertItem(SettingsDialog, item);
return instance;
}
SavedAction *theEmacsModeSetting(int code)
{
return theEmacsModeSettings()->item(code);
}
} // namespace Internal
} // namespace EmacsMode

View file

@ -1,91 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef EmacsMode_ACTIONS_H
#define EmacsMode_ACTIONS_H
#include <utils/savedaction.h>
#include <QtCore/QHash>
#include <QtCore/QObject>
#include <QtCore/QString>
namespace EmacsMode {
namespace Internal {
enum EmacsModeSettingsCode
{
ConfigUseEmacsMode,
ConfigStartOfLine,
ConfigHlSearch,
ConfigTabStop,
ConfigSmartTab,
ConfigShiftWidth,
ConfigExpandTab,
ConfigAutoIndent,
ConfigIncSearch,
// indent allow backspacing over autoindent
// eol allow backspacing over line breaks (join lines)
// start allow backspacing over the start of insert; CTRL-W and CTRL-U
// stop once at the start of insert.
ConfigBackspace,
// other actions
SettingsDialog,
};
class EmacsModeSettings : public QObject
{
public:
EmacsModeSettings();
~EmacsModeSettings();
void insertItem(int code, Utils::SavedAction *item,
const QString &longname = QString(),
const QString &shortname = QString());
Utils::SavedAction *item(int code);
Utils::SavedAction *item(const QString &name);
void readSettings(QSettings *settings);
void writeSettings(QSettings *settings);
private:
QHash<int, Utils::SavedAction *> m_items;
QHash<QString, int> m_nameToCode;
QHash<int, QString> m_codeToName;
};
EmacsModeSettings *theEmacsModeSettings();
Utils::SavedAction *theEmacsModeSetting(int code);
} // namespace Internal
} // namespace EmacsMode
#endif // EmacsMode_ACTTIONS_H

File diff suppressed because it is too large Load diff

View file

@ -1,101 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef EMACSMODE_HANDLER_H
#define EMACSMODE_HANDLER_H
#include "emacsmodeactions.h"
#include "emacs_shortcut.h"
#include <list>
#include <QtCore/QObject>
#include <QtGui/QTextEdit>
namespace EmacsMode {
namespace Internal {
class EmacsModeHandler : public QObject
{
Q_OBJECT
public:
EmacsModeHandler(QWidget *widget, QObject *parent = 0);
~EmacsModeHandler();
QWidget *widget();
public slots:
void setCurrentFileName(const QString &fileName);
void showBlackMessage(const QString &msg);
void showRedMessage(const QString &msg);
// This executes an "ex" style command taking context
// information from widget;
void handleCommand(const QString &cmd);
void installEventFilter();
// Convenience
void setupWidget();
void restoreWidget();
// Test only
int physicalIndentation(const QString &line) const;
int logicalIndentation(const QString &line) const;
QString tabExpand(int n) const;
signals:
void commandBufferChanged(const QString &msg);
void statusDataChanged(const QString &msg);
void extraInformationChanged(const QString &msg);
void selectionChanged(const QList<QTextEdit::ExtraSelection> &selection);
void writeFileRequested(bool *handled,
const QString &fileName, const QString &contents);
void writeAllRequested(QString *error);
void moveToMatchingParenthesis(bool *moved, bool *forward, QTextCursor *cursor);
void indentRegion(int *amount, int beginLine, int endLine, QChar typedChar);
void completionRequested();
void windowCommandRequested(int key);
void findRequested(bool reverse);
void findNextRequested(bool reverse);
void handleExCommandRequested(const QString &cmd);
public:
class Private;
private:
bool eventFilter(QObject *ob, QEvent *ev);
Private *d;
};
} // namespace Internal
} // namespace EmacsMode
#endif // EMACSMODE_H

View file

@ -1,208 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EmacsModeOptionPage</class>
<widget class="QWidget" name="EmacsModeOptionPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>386</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBoxUseEmacsMode">
<property name="text">
<string>Use EmacsMode</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Emacs style settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="labelExpandTab">
<property name="toolTip">
<string>vim's &quot;expandtab&quot; option</string>
</property>
<property name="text">
<string>Expand tabulators:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxExpandTab">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelHlSearch">
<property name="text">
<string>Highlight search results:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxHlSearch">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labelShiftWidth">
<property name="text">
<string>Shift width:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEditShiftWidth"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labelSmartTab">
<property name="text">
<string>Smart tabulators:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="checkBoxSmartTab">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="labelStartOfLine">
<property name="text">
<string>Start of line:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="checkBoxStartOfLine">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>vim's &quot;tabstop&quot; option</string>
</property>
<property name="text">
<string>Tabulator size:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="lineEditTabStop"/>
</item>
<item row="9" column="0">
<widget class="QLabel" name="labelBackspace">
<property name="text">
<string>Backspace:</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="lineEditBackspace"/>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBoxAutoIndent">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelAutoIndent">
<property name="toolTip">
<string>VIM's &quot;autoindent&quot; option</string>
</property>
<property name="text">
<string>Automatic indentation:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelIncSearch">
<property name="text">
<string>Incremental search:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="checkBoxIncSearch">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButtonCopyTextEditorSettings">
<property name="text">
<string>Copy text editor settings</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonSetQtStyle">
<property name="text">
<string>Set Qt style</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonSetPlainStyle">
<property name="text">
<string>Set plain style</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -1,590 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "emacsmodeplugin.h"
#include "emacsmodehandler.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/actionmanager/commandmappings.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/openeditorsmodel.h>
#include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/id.h>
#include <coreplugin/statusbarwidget.h>
#include <coreplugin/statusbarmanager.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <texteditor/basetextdocumentlayout.h>
#include <texteditor/basetexteditor.h>
#include <texteditor/basetextmark.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/typingsettings.h>
#include <texteditor/tabsettings.h>
#include <texteditor/icodestylepreferences.h>
#include <texteditor/texteditorsettings.h>
#include <texteditor/indenter.h>
#include <texteditor/codeassist/basicproposalitem.h>
#include <texteditor/codeassist/basicproposalitemlistmodel.h>
#include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/codeassist/iassistinterface.h>
#include <texteditor/codeassist/genericproposal.h>
#include <find/findplugin.h>
#include <find/textfindconstants.h>
#include <find/ifindsupport.h>
#include <utils/qtcassert.h>
#include <utils/savedaction.h>
#include <utils/treewidgetcolumnstretcher.h>
#include <utils/stylehelper.h>
#include <cpptools/cpptoolsconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QDebug>
#include <QtCore/QtPlugin>
#include <QtCore/QObject>
#include <QtCore/QPoint>
#include <QtCore/QSettings>
#include <QtGui/QMessageBox>
#include <QtGui/QPlainTextEdit>
#include <QtGui/QTextBlock>
#include <QtGui/QTextCursor>
#include <QtGui/QTextEdit>
using namespace EmacsMode::Internal;
using namespace TextEditor;
using namespace Core;
using namespace ProjectExplorer;
///////////////////////////////////////////////////////////////////////
//
// EmacsModeOptionPage
//
///////////////////////////////////////////////////////////////////////
namespace EmacsMode {
namespace Internal {
QWidget *EmacsModeOptionPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_ui.setupUi(w);
m_group.clear();
m_group.insert(theEmacsModeSetting(ConfigUseEmacsMode),
m_ui.checkBoxUseEmacsMode);
// m_group.insert(theEmacsModeSetting(ConfigReadEmacsRc)
// m_ui.checkBoxReadEmacsRc);
m_group.insert(theEmacsModeSetting(ConfigExpandTab),
m_ui.checkBoxExpandTab);
m_group.insert(theEmacsModeSetting(ConfigHlSearch),
m_ui.checkBoxHlSearch);
m_group.insert(theEmacsModeSetting(ConfigShiftWidth),
m_ui.lineEditShiftWidth);
m_group.insert(theEmacsModeSetting(ConfigSmartTab),
m_ui.checkBoxSmartTab);
m_group.insert(theEmacsModeSetting(ConfigStartOfLine),
m_ui.checkBoxStartOfLine);
m_group.insert(theEmacsModeSetting(ConfigTabStop),
m_ui.lineEditTabStop);
m_group.insert(theEmacsModeSetting(ConfigBackspace),
m_ui.lineEditBackspace);
m_group.insert(theEmacsModeSetting(ConfigAutoIndent),
m_ui.checkBoxAutoIndent);
m_group.insert(theEmacsModeSetting(ConfigIncSearch),
m_ui.checkBoxIncSearch);
connect(m_ui.pushButtonCopyTextEditorSettings, SIGNAL(clicked()),
this, SLOT(copyTextEditorSettings()));
connect(m_ui.pushButtonSetQtStyle, SIGNAL(clicked()),
this, SLOT(setQtStyle()));
connect(m_ui.pushButtonSetPlainStyle, SIGNAL(clicked()),
this, SLOT(setPlainStyle()));
return w;
}
void EmacsModeOptionPage::copyTextEditorSettings()
{
}
void EmacsModeOptionPage::setQtStyle()
{
m_ui.checkBoxExpandTab->setChecked(true);
m_ui.lineEditTabStop->setText("4");
m_ui.lineEditShiftWidth->setText("4");
m_ui.checkBoxSmartTab->setChecked(true);
m_ui.checkBoxAutoIndent->setChecked(true);
m_ui.checkBoxIncSearch->setChecked(true);
m_ui.lineEditBackspace->setText("indent,eol,start");
}
void EmacsModeOptionPage::setPlainStyle()
{
m_ui.checkBoxExpandTab->setChecked(false);
m_ui.lineEditTabStop->setText("8");
m_ui.lineEditShiftWidth->setText("8");
m_ui.checkBoxSmartTab->setChecked(false);
m_ui.checkBoxAutoIndent->setChecked(false);
m_ui.checkBoxIncSearch->setChecked(false);
m_ui.lineEditBackspace->setText(QString());
}
bool EmacsModeOptionPage::matches(QString const & s) const
{
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
}
} // namespace Internal
} // namespace EmacsMode
EmacsModePluginPrivate::EmacsModePluginPrivate(EmacsModePlugin *plugin)
{
q = plugin;
m_emacsModeOptionsPage = 0;
}
EmacsModePluginPrivate::~EmacsModePluginPrivate()
{
}
void EmacsModePluginPrivate::aboutToShutdown()
{
q->removeObject(m_emacsModeOptionsPage);
delete m_emacsModeOptionsPage;
m_emacsModeOptionsPage = 0;
theEmacsModeSettings()->writeSettings(Core::ICore::instance()->settings());
delete theEmacsModeSettings();
}
bool EmacsModePluginPrivate::initialize()
{
m_core = Core::ICore::instance();
m_editorManager = core()->editorManager();
m_actionManager = core()->actionManager();
QTC_ASSERT(actionManager(), return false);
Context globalcontext(Core::Constants::C_GLOBAL);
m_emacsModeOptionsPage = new EmacsModeOptionPage;
q->addObject(m_emacsModeOptionsPage);
readSettings();
Core::Command *cmd = 0;
cmd = actionManager()->registerAction(theEmacsModeSetting(ConfigUseEmacsMode),
Constants::INSTALL_HANDLER, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::INSTALL_KEY));
ActionContainer *advancedMenu =
actionManager()->actionContainer(Core::Constants::M_EDIT_ADVANCED);
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_EDITOR);
// EditorManager
connect(editorManager(), SIGNAL(editorAboutToClose(Core::IEditor*)),
this, SLOT(editorAboutToClose(Core::IEditor*)));
connect(editorManager(), SIGNAL(editorOpened(Core::IEditor*)),
this, SLOT(editorOpened(Core::IEditor*)));
connect(theEmacsModeSetting(ConfigUseEmacsMode), SIGNAL(valueChanged(QVariant)),
this, SLOT(setUseEmacsMode(QVariant)));
// Delayed operations.
connect(this, SIGNAL(delayedQuitRequested(bool,Core::IEditor*)),
this, SLOT(handleDelayedQuit(bool,Core::IEditor*)), Qt::QueuedConnection);
connect(this, SIGNAL(delayedQuitAllRequested(bool)),
this, SLOT(handleDelayedQuitAll(bool)), Qt::QueuedConnection);
}
void EmacsModePluginPrivate::readSettings()
{
QSettings *settings = ICore::instance()->settings();
theEmacsModeSettings()->readSettings(settings);
/*exCommandMap() = defaultExCommandMap();
int size = settings->beginReadArray(_(exCommandMapGroup));
for (int i = 0; i < size; ++i) {
settings->setArrayIndex(i);
const QString id = settings->value(_(idKey)).toString();
const QString re = settings->value(_(reKey)).toString();
exCommandMap()[id] = QRegExp(re);
}
settings->endArray();
}*/
}
void EmacsModePluginPrivate::showSettingsDialog()
{
Core::ICore::instance()->showOptionsDialog("EmacsMode", "General");
}
void EmacsModePluginPrivate::triggerAction(const QString& code)
{
/*Core::ActionManager *am = Core::ICore::instance()->actionManager();
QTC_ASSERT(am, return);
Core::Command *cmd = am->command(code);
QTC_ASSERT(cmd, return);
QAction *action = cmd->action();
QTC_ASSERT(action, return);
action->trigger();*/
}
void EmacsModePluginPrivate::windowCommand(int key)
{
#define control(n) (256 + n)
QString code;
switch (key) {
case 'c': case 'C': case control('c'):
code = Core::Constants::CLOSE;
break;
case 'n': case 'N': case control('n'):
code = Core::Constants::GOTONEXT;
break;
case 'o': case 'O': case control('o'):
code = Core::Constants::REMOVE_ALL_SPLITS;
code = Core::Constants::REMOVE_CURRENT_SPLIT;
break;
case 'p': case 'P': case control('p'):
code = Core::Constants::GOTOPREV;
break;
case 's': case 'S': case control('s'):
code = Core::Constants::SPLIT;
break;
case 'w': case 'W': case control('w'):
code = Core::Constants::GOTO_OTHER_SPLIT;
break;
}
#undef control
qDebug() << "RUNNING WINDOW COMMAND: " << key << code;
if (code.isEmpty()) {
qDebug() << "UNKNOWN WINDOWS COMMAND: " << key;
return;
}
triggerAction(code);
}
void EmacsModePluginPrivate::find(bool reverse)
{
Q_UNUSED(reverse) // TODO: Creator needs an action for find in reverse.
triggerAction(Find::Constants::FIND_IN_DOCUMENT);
}
void EmacsModePluginPrivate::findNext(bool reverse)
{
if (reverse)
triggerAction(Find::Constants::FIND_PREVIOUS);
else
triggerAction(Find::Constants::FIND_NEXT);
}
void EmacsModePluginPrivate::editorOpened(Core::IEditor *editor)
{
if (!editor)
return;
QWidget *widget = editor->widget();
if (!widget)
return;
// we can only handle QTextEdit and QPlainTextEdit
if (!qobject_cast<QTextEdit *>(widget) && !qobject_cast<QPlainTextEdit *>(widget))
return;
//qDebug() << "OPENING: " << editor << editor->widget()
// << "MODE: " << theEmacsModeSetting(ConfigUseEmacsMode)->value();
EmacsModeHandler *handler = new EmacsModeHandler(widget, widget);
m_editorToHandler[editor] = handler;
connect(handler, SIGNAL(extraInformationChanged(QString)),
this, SLOT(showExtraInformation(QString)));
connect(handler, SIGNAL(commandBufferChanged(QString)),
this, SLOT(showCommandBuffer(QString)));
connect(handler, SIGNAL(writeFileRequested(bool*,QString,QString)),
this, SLOT(writeFile(bool*,QString,QString)));
connect(handler, SIGNAL(selectionChanged(QList<QTextEdit::ExtraSelection>)),
this, SLOT(changeSelection(QList<QTextEdit::ExtraSelection>)));
connect(handler, SIGNAL(moveToMatchingParenthesis(bool*,bool*,QTextCursor*)),
this, SLOT(moveToMatchingParenthesis(bool*,bool*,QTextCursor*)));
connect(handler, SIGNAL(indentRegion(int*,int,int,QChar)),
this, SLOT(indentRegion(int*,int,int,QChar)));
connect(handler, SIGNAL(completionRequested()),
this, SLOT(triggerCompletions()));
connect(handler, SIGNAL(windowCommandRequested(int)),
this, SLOT(windowCommand(int)));
connect(handler, SIGNAL(findRequested(bool)),
this, SLOT(find(bool)));
connect(handler, SIGNAL(findNextRequested(bool)),
this, SLOT(findNext(bool)));
connect(handler, SIGNAL(handleExCommandRequested(QString)),
this, SLOT(handleExCommand(QString)));
handler->setCurrentFileName(editor->document()->fileName());
handler->installEventFilter();
// pop up the bar
if (theEmacsModeSetting(ConfigUseEmacsMode)->value().toBool())
showCommandBuffer("");
}
void EmacsModePluginPrivate::editorAboutToClose(Core::IEditor *editor)
{
//qDebug() << "CLOSING: " << editor << editor->widget();
m_editorToHandler.remove(editor);
}
void EmacsModePluginPrivate::setUseEmacsMode(const QVariant &value)
{
//qDebug() << "SET USE EmacsMode" << value;
bool on = value.toBool();
if (on) {
Core::EditorManager::instance()->showEditorStatusBar(
QLatin1String(Constants::MINI_BUFFER),
"vi emulation mode. Type :q to leave. Use , Ctrl-R to trigger run.",
tr("Quit EmacsMode"), this, SLOT(quitEmacsMode()));
foreach (Core::IEditor *editor, m_editorToHandler.keys())
m_editorToHandler[editor]->setupWidget();
} else {
Core::EditorManager::instance()->hideEditorStatusBar(
QLatin1String(Constants::MINI_BUFFER));
foreach (Core::IEditor *editor, m_editorToHandler.keys())
m_editorToHandler[editor]->restoreWidget();
}
}
void EmacsModePluginPrivate::triggerCompletions()
{
/* EmacsModeHandler *handler = qobject_cast<EmacsModeHandler *>(sender());
if (!handler)
return;
if (BaseTextEditorWidget *editor = qobject_cast<BaseTextEditorWidget *>(handler->widget()))
CompletionSupport::instance()->
autoComplete(editor->editor(), false);
// editor->triggerCompletions();
*/
}
void EmacsModePluginPrivate::writeFile(bool *handled,
const QString &fileName, const QString &contents)
{
Q_UNUSED(contents)
EmacsModeHandler *handler = qobject_cast<EmacsModeHandler *>(sender());
if (!handler)
return;
Core::IEditor *editor = m_editorToHandler.key(handler);
if (editor && editor->document()->fileName() == fileName) {
DocumentManager::saveDocument(editor->document());
*handled = true;
}
}
void EmacsModePluginPrivate::handleExCommand(const QString &cmd)
{
}
void EmacsModePluginPrivate::handleDelayedQuit(bool forced, Core::IEditor *editor)
{
QList<Core::IEditor *> editors;
editors.append(editor);
Core::EditorManager::instance()->closeEditors(editors, !forced);
}
void EmacsModePluginPrivate::handleDelayedQuitAll(bool forced)
{
Core::EditorManager::instance()->closeAllEditors(!forced);
}
void EmacsModePluginPrivate::moveToMatchingParenthesis(bool *moved, bool *forward,
QTextCursor *cursor)
{
*moved = false;
bool undoFakeEOL = false;
if (cursor->atBlockEnd() && cursor->block().length() > 1) {
cursor->movePosition(QTextCursor::Left, QTextCursor::KeepAnchor, 1);
undoFakeEOL = true;
}
TextEditor::TextBlockUserData::MatchType match
= TextEditor::TextBlockUserData::matchCursorForward(cursor);
if (match == TextEditor::TextBlockUserData::Match) {
*moved = true;
*forward = true;
} else {
if (undoFakeEOL)
cursor->movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 1);
if (match == TextEditor::TextBlockUserData::NoMatch) {
// backward matching is according to the character before the cursor
bool undoMove = false;
if (!cursor->atBlockEnd()) {
cursor->movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 1);
undoMove = true;
}
match = TextEditor::TextBlockUserData::matchCursorBackward(cursor);
if (match == TextEditor::TextBlockUserData::Match) {
*moved = true;
*forward = false;
} else if (undoMove) {
cursor->movePosition(QTextCursor::Left, QTextCursor::KeepAnchor, 1);
}
}
}
}
void EmacsModePluginPrivate::indentRegion(int *amount, int beginLine, int endLine,
QChar typedChar)
{
EmacsModeHandler *handler = qobject_cast<EmacsModeHandler *>(sender());
if (!handler)
return;
BaseTextEditorWidget *bt = qobject_cast<BaseTextEditorWidget *>(handler->widget());
if (!bt)
return;
const TabSettings oldTabSettings = bt->tabSettings();
TabSettings tabSettings;
tabSettings.m_indentSize = theEmacsModeSetting(ConfigShiftWidth)->value().toInt();
tabSettings.m_tabSize = theEmacsModeSetting(ConfigTabStop)->value().toInt();
bt->setTabSettings(tabSettings);
QTextDocument *doc = bt->document();
QTextBlock startBlock = doc->findBlockByNumber(beginLine);
// Record line lenghts for mark adjustments
QVector<int> lineLengths(endLine - beginLine + 1);
QTextBlock block = startBlock;
for (int i = beginLine; i <= endLine; ++i) {
lineLengths[i - beginLine] = block.text().length();
if (typedChar == 0 && block.text().simplified().isEmpty()) {
// clear empty lines
QTextCursor cursor(block);
while (!cursor.atBlockEnd())
cursor.deleteChar();
} else {
bt->indenter()->indentBlock(doc, block, typedChar, tabSettings);
}
block = block.next();
}
bt->setTabSettings(oldTabSettings);
}
void EmacsModePluginPrivate::quitEmacsMode()
{
theEmacsModeSetting(ConfigUseEmacsMode)->setValue(false);
}
void EmacsModePluginPrivate::showCommandBuffer(const QString &contents)
{
//qDebug() << "SHOW COMMAND BUFFER" << contents;
Core::EditorManager::instance()->showEditorStatusBar(
QLatin1String(Constants::MINI_BUFFER), contents,
tr("Quit EmacsMode"), this, SLOT(quitEmacsMode()));
}
void EmacsModePluginPrivate::showExtraInformation(const QString &text)
{
EmacsModeHandler *handler = qobject_cast<EmacsModeHandler *>(sender());
if (handler)
QMessageBox::information(handler->widget(), tr("EmacsMode Information"), text);
}
void EmacsModePluginPrivate::changeSelection
(const QList<QTextEdit::ExtraSelection> &selection)
{
if (EmacsModeHandler *handler = qobject_cast<EmacsModeHandler *>(sender()))
if (BaseTextEditorWidget *bt = qobject_cast<BaseTextEditorWidget *>(handler->widget()))
bt->setExtraSelections(BaseTextEditorWidget::FakeVimSelection, selection);
}
///////////////////////////////////////////////////////////////////////
//
// EmacsModePlugin
//
///////////////////////////////////////////////////////////////////////
EmacsModePlugin::EmacsModePlugin()
: d(new EmacsModePluginPrivate(this))
{}
EmacsModePlugin::~EmacsModePlugin()
{
delete d;
}
bool EmacsModePlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments)
Q_UNUSED(errorMessage)
return d->initialize();
}
ExtensionSystem::IPlugin::ShutdownFlag EmacsModePlugin::aboutToShutdown()
{
d->aboutToShutdown();
return SynchronousShutdown;
}
void EmacsModePlugin::extensionsInitialized()
{
}
#include "moc_emacsmodeplugin.cpp"
Q_EXPORT_PLUGIN(EmacsModePlugin)

View file

@ -1,190 +0,0 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef EMACSMODEPLUGIN_H
#define EMACSMODEPLUGIN_H
#include <extensionsystem/iplugin.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtGui/QTextEdit>
#include "ui_emacsmodeoptions.h"
#include <utils/savedaction.h>
#include <coreplugin/icore.h>
#include <QtCore/QPointer>
namespace EmacsMode {
namespace Internal {
class EmacsModeHandler;
class EmacsModePluginPrivate;
class EmacsModePlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
public:
EmacsModePlugin();
~EmacsModePlugin();
private:
// implementation of ExtensionSystem::IPlugin
bool initialize(const QStringList &arguments, QString *error_message);
ShutdownFlag aboutToShutdown();
void extensionsInitialized();
private:
friend class EmacsModePluginPrivate;
EmacsModePluginPrivate *d;
};
}
}
namespace EmacsMode {
namespace Constants {
const char * const INSTALL_HANDLER = "TextEditor.EmacsModeHandler";
const char * const MINI_BUFFER = "TextEditor.EmacsModeMiniBuffer";
const char * const INSTALL_KEY = "Alt+V,Alt+V";
const char * const SETTINGS_CATEGORY = "D.EmacsMode";
const char * const SETTINGS_CATEGORY_EMACSMODE_ICON = ":/core/images/category_emacsmode.png";
const char * const SETTINGS_ID = "A.General";
const char * const SETTINGS_EX_CMDS_ID = "B.ExCommands";
const char * const CMD_FILE_NEXT = "EmacsMode.SwitchFileNext";
const char * const CMD_FILE_PREV = "EmacsMode.SwitchFilePrev";
} // namespace Constants
} // namespace EmacsMode
namespace Core
{
class IEditor;
}
namespace EmacsMode {
namespace Internal {
class EmacsModeOptionPage : public Core::IOptionsPage
{
Q_OBJECT
public:
EmacsModeOptionPage() {}
// IOptionsPage
QString id() const { return QLatin1String(Constants::SETTINGS_ID); }
QString displayName() const { return tr("General"); }
QString category() const { return QLatin1String(Constants::SETTINGS_CATEGORY); }
QString displayCategory() const {return tr("EmacsMode");}
QIcon categoryIcon() const {return QIcon(QLatin1String(Constants::SETTINGS_CATEGORY_EMACSMODE_ICON));}
QWidget *createPage(QWidget *parent);
void apply() { m_group.apply(Core::ICore::instance()->settings()); }
void finish() { m_group.finish(); }
virtual bool matches(QString const & ) const;
private slots:
void copyTextEditorSettings();
void setQtStyle();
void setPlainStyle();
private:
friend class DebuggerPlugin;
Ui::EmacsModeOptionPage m_ui;
QString m_searchKeywords;
Utils::SavedActionSet m_group;
};
///////////////////////////////////////////////////////////////////////
//
// EmacsModePluginPrivate
//
///////////////////////////////////////////////////////////////////////
class EmacsModePluginPrivate : public QObject
{
Q_OBJECT
public:
EmacsModePluginPrivate(EmacsModePlugin *);
~EmacsModePluginPrivate();
friend class EmacsModePlugin;
bool initialize();
void aboutToShutdown();
void readSettings();
private slots:
void editorOpened(Core::IEditor *);
void editorAboutToClose(Core::IEditor *);
void setUseEmacsMode(const QVariant &value);
void quitEmacsMode();
void triggerCompletions();
void windowCommand(int key);
void find(bool reverse);
void findNext(bool reverse);
void showSettingsDialog();
void showCommandBuffer(const QString &contents);
void showExtraInformation(const QString &msg);
void changeSelection(const QList<QTextEdit::ExtraSelection> &selections);
void writeFile(bool *handled, const QString &fileName, const QString &contents);
void moveToMatchingParenthesis(bool *moved, bool *forward, QTextCursor *cursor);
void indentRegion(int *amount, int beginLine, int endLine, QChar typedChar);
void handleExCommand(const QString &cmd);
void handleDelayedQuitAll(bool forced);
void handleDelayedQuit(bool forced, Core::IEditor *editor);
signals:
void delayedQuitRequested(bool forced, Core::IEditor *editor);
void delayedQuitAllRequested(bool forced);
private:
EmacsModePlugin *q;
EmacsModeOptionPage *m_emacsModeOptionsPage;
QHash<Core::IEditor *, EmacsModeHandler *> m_editorToHandler;
QPointer<Core::ICore> m_core;
QPointer<Core::EditorManager> m_editorManager;
QPointer<Core::ActionManager> m_actionManager;
Core::ICore *core() const { return m_core; }
Core::EditorManager *editorManager() const { return m_editorManager; }
Core::ActionManager *actionManager() const { return m_actionManager; }
void triggerAction(const QString& code);
};
} // namespace Internal
} // namespace EmacsMode
#endif // EmacsModePLUGIN_H