[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Title: Unable to create key binding.
From: |
Hoe-Phuan Ng |
Subject: |
Title: Unable to create key binding. |
Date: |
Sun, 6 Jul 2014 08:23:16 -0600 |
*Title: Unable to create key binding.*
Hello All:
Below is the code for node.js REPL ( see below ).
I was not able to use the key bindings.
I got “Undefined … “ response from emacs.
However, I was able to run commands like this:
M-x run-js and M-x js-send-last-sexp
When I ran command, C-h b, I see these key bindings:
C-c & C-s yas-insert-snippet
C-c C-r comint-show-output
C-c C-s comint-write-output
Questions:
Q1: from command, C-h b, kkey bindings list as shown above, what is the
difference between
C-c & C-s and C-c C-s ?
Q2: Are the existing key bindings conflict with the key bindings show in
code below?
Q3: What to do now?
;;================= Node.js REPL ==============
; Lifted from
http://howardabrams.com/projects/dot-files/emacs-javascript.html
;Server JS with Node.js
;Use js-comint, but hook it up with node.js:
; Use require instead of autoload
(require 'js-comint)
;(autoload 'js-comint "js-comint"
; "Hooking JavaScript interpreter up to the JS Files." t nil)
(setenv "NODE_NO_READLINE" "1") ;; Turn off fancy node prompt
;; Use node as our repl
(setq inferior-js-program-command "node")
;According to these instructions ( iink to nodejs.org ), we set the
NODE_NO_READLINE variable.
;Need some prompt configuration for the REPL:
(setq inferior-js-mode-hook
(lambda ()
;; We like nice colors
(ansi-color-for-comint-mode-on)
;; Deal with some prompt nonsense
(add-to-list
'comint-preoutput-filter-functions
(lambda (output)
(replace-regexp-in-string "\033\\[[0-9]+[GK]" "" output)
(replace-regexp-in-string ".*1G.*3G" ">" output)
(replace-regexp-in-string ">" "> " output)))))
;Start the JavaScript node REPL with: run-js Set up some helpful keyboard
instructions:
;; Unable to make key binding work
(add-hook 'js2-mode-hook
(lambda ()
(local-set-key (kbd "\C-c\C-c") 'js-send-buffer)
(local-set-key (kbd "\C-c\C-r") 'js-send-region)
(local-set-key (kbd "\C-c\C-s") 'js-send-last-sexp)
(local-set-key (kbd "\C-c\C-z") 'run-js)))
;================ end of Node.js REPL setup =============
Thank you & Cheers,
HoePhuan
- Title: Unable to create key binding.,
Hoe-Phuan Ng <=