* Title: Unable to create key binding.
@ 2014-07-06 14:23 Hoe-Phuan Ng
0 siblings, 0 replies; 2+ messages in thread
From: Hoe-Phuan Ng @ 2014-07-06 14:23 UTC (permalink / raw)
To: help-gnu-emacs
*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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Title: Unable to create key binding.
[not found] <mailman.4947.1404669331.1147.help-gnu-emacs@gnu.org>
@ 2014-07-06 18:30 ` Pascal J. Bourguignon
0 siblings, 0 replies; 2+ messages in thread
From: Pascal J. Bourguignon @ 2014-07-06 18:30 UTC (permalink / raw)
To: help-gnu-emacs
Hoe-Phuan Ng <avtinc2000@gmail.com> writes:
> *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 ?
For the former, you must press Control and type c, type &, press Control
and type s, while for the later, you just press Control and type c, and
press Control and type s.
> Q2: Are the existing key bindings conflict with the key bindings show in
> code below?
You should better ask this question to emacs itself!
For example, in this buffer:
(some (lambda (key) (key-binding key))
(list (kbd "\C-c\C-c") (kbd "\C-c\C-r")
(kbd "\C-c\C-s") (kbd "\C-c\C-z")))
--> message-send-and-exit
> Q3: What to do now?
Whatever you want. Key binding are up to the user to customize just
like she wants!
--
__Pascal Bourguignon__
http://www.informatimago.com/
"Le mercure monte ? C'est le moment d'acheter !"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-06 18:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-06 14:23 Title: Unable to create key binding Hoe-Phuan Ng
[not found] <mailman.4947.1404669331.1147.help-gnu-emacs@gnu.org>
2014-07-06 18:30 ` Pascal J. Bourguignon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).