[gnome-builder] emacs: add ESC x 3 as exit command



commit 257b1cec7aeb3518493c5cbdf980c58dce9aced7
Author: Roberto Majadas <roberto majadas openshine com>
Date:   Sun Feb 8 23:57:49 2015 +0100

    emacs: add ESC x 3 as exit command

 src/emacs/gb-source-emacs.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/emacs/gb-source-emacs.c b/src/emacs/gb-source-emacs.c
index 93f1059..1387037 100644
--- a/src/emacs/gb-source-emacs.c
+++ b/src/emacs/gb-source-emacs.c
@@ -594,10 +594,17 @@ gb_source_emacs_key_press_event_cb (GtkTextView *text_view,
 
   if ((event->keyval >= GDK_KEY_A && event->keyval <= GDK_KEY_Z) ||
       (event->keyval >= GDK_KEY_a && event->keyval <= GDK_KEY_z) ||
-      (event->keyval == GDK_KEY_underscore)
+      (event->keyval == GDK_KEY_underscore) || (event->keyval == GDK_KEY_Escape )
      )
     {
-      if (event->state == (GDK_CONTROL_MASK | GDK_MOD1_MASK))
+      if (event->keyval == GDK_KEY_Escape)
+        {
+          if (priv->cmd->len != 0 )
+            g_string_append_printf(priv->cmd, " ");
+          g_string_append_printf(priv->cmd, "ESC");
+          eval_cmd = TRUE;
+        }
+      else if (event->state == (GDK_CONTROL_MASK | GDK_MOD1_MASK))
         {
           if (priv->cmd->len != 0 )
             g_string_append_printf(priv->cmd, " ");
@@ -910,6 +917,10 @@ gb_source_emacs_class_init (GbSourceEmacsClass *klass)
                                           GB_SOURCE_EMACS_COMMAND_FLAG_NONE,
                                           gb_source_emacs_cmd_exit_from_command_line);
   gb_source_emacs_class_register_command (klass,
+                                          g_regex_new("ESC ESC ESC$", 0, 0, NULL),
+                                          GB_SOURCE_EMACS_COMMAND_FLAG_NONE,
+                                          gb_source_emacs_cmd_exit_from_command_line);
+  gb_source_emacs_class_register_command (klass,
                                           g_regex_new("^C-x C-c$", 0, 0, NULL),
                                           GB_SOURCE_EMACS_COMMAND_FLAG_NONE,
                                           gb_source_emacs_cmd_exit);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]