emacs-devel
[Top][All Lists]
Advanced

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

"C-c C-c" binding for "submission" in server edit buffers


From: Miles Bader
Subject: "C-c C-c" binding for "submission" in server edit buffers
Date: Tue, 14 Apr 2009 17:00:19 +0900

I'm so used to using "C-c C-c" to mean "submit" in many emacs modes,
that I find myself getting a bit flummoxed when it doesn't do that in
buffers created by emacsclient.

The following patch seems to make things work more or less as my fingers
expect them too (maybe it should automatically save the buffer first, as
most uses of C-c C-c seem to do that); what do people think (of the
idea anyway ... maybe the implementation has some problem)?

-Miles


diff --git a/lisp/server.el b/lisp/server.el
index 10b08ad..e977dfe 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -194,6 +194,16 @@ in this way."
 (or (assq 'server-buffer-clients minor-mode-alist)
     (push '(server-buffer-clients " Server") minor-mode-alist))
 
+(defvar server-buffer-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-c\C-c" 'server-done)
+    map)
+  "Local keymap for emacs-server created buffers")
+
+(or (assq 'server-buffer-clients minor-mode-map-alist)
+    (push (cons 'server-buffer-clients server-buffer-map)
+         minor-mode-map-alist))
+
 (defvar server-existing-buffer nil
   "Non-nil means the buffer existed before the server was asked to visit it.
 This means that the server should not kill the buffer when you say you
@@ -1228,6 +1238,7 @@ of the form (NEXT-BUFFER KILLED).  NEXT-BUFFER is another 
server buffer,
 as a suggestion for what to select next, or nil.
 KILLED is t if we killed BUFFER, which happens if it was created
 specifically for the clients and did not exist before their request for it."
+  (interactive)
   (when server-buffer-clients
     (if (server-temp-file-p)
        ;; For a temp file, save, and do make a non-numeric backup



-- 
My books focus on timeless truths.  -- Donald Knuth




reply via email to

[Prev in Thread] Current Thread [Next in Thread]