aboutsummaryrefslogtreecommitdiffhomepage
path: root/qbuffers.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-19 15:42:33 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-20 06:07:32 +0100
commit39cb3b36cbac59c938acf6b71cbb3087f0fca5b4 (patch)
treebd362fd25dcf3ce954c4af877a05fcb5d8ef1d73 /qbuffers.cpp
parent9d8b90f654b5777f5c9d402fda445088f9fe374f (diff)
downloadsciteco-39cb3b36cbac59c938acf6b71cbb3087f0fca5b4.tar.gz
ED flags making 0-Register hook execution configurable
* teco.ini updated as well
Diffstat (limited to 'qbuffers.cpp')
-rw-r--r--qbuffers.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/qbuffers.cpp b/qbuffers.cpp
index 61eacd3..0711438 100644
--- a/qbuffers.cpp
+++ b/qbuffers.cpp
@@ -227,6 +227,16 @@ QRegisterTable::edit(QRegister *reg)
current = reg;
}
+void
+execute_hook(Hook type)
+{
+ if (!(Flags::ed & Flags::ED_HOOKS))
+ return;
+
+ expressions.push(type);
+ qregisters["0"]->execute();
+}
+
bool
Buffer::load(const gchar *filename)
{
@@ -338,6 +348,8 @@ Ring::edit(const gchar *filename)
if (buffer) {
current = buffer;
buffer->edit();
+
+ execute_hook(HOOK_EDIT);
} else {
new_in_ring = true;
@@ -363,13 +375,9 @@ Ring::edit(const gchar *filename)
interface.msg(Interface::MSG_INFO,
"Added new unnamed file to ring.");
}
- }
- /*
- * Execute file load hook
- * FIXME: should be configurable whether it is executed or not
- */
- qregisters["0"]->execute();
+ execute_hook(HOOK_ADD);
+ }
return new_in_ring;
}
@@ -519,7 +527,7 @@ Ring::close(void)
if (current) {
current->edit();
- qregisters["0"]->execute();
+ execute_hook(HOOK_EDIT);
} else {
edit(NULL);
undo_close();