[ESS] ~ symbol
Stephen Eglen
S.J.Eglen at damtp.cam.ac.uk
Fri Jun 23 11:30:42 CEST 2006
> My guess is that Giovanni wants to keep the assignment key as is, and
> instead map a different non-used key to tilde.
Thanks Kasper, yes, that's a good point.
> This is in principle easy to do, I used to do it when I was on a
> danish keyboard writing latex where \, {, } are accessible but
> requires quite some arm twisting to get. You can do it two ways. One
> is a global remap where it works in all of Emacs and one is a mode
> remap where it depends on the mode you are in.
>
> Here are (some) of my code for LaTeX. And there are as far as I know
> several ways to do the code, this is just one of them
>
> (add-hook 'LaTeX-mode-hook
> '(lambda nil
> (define-key LaTeX-mode-map [?\'] '(lambda () (interactive)
> (insert "{")))
> ))
yes, that kind of approach works (although I find when testing it is
better to use a named function, rather than an anonymous (lambda)
function).
> The biggest problem is usually finding the "key-code" associated with
> the key you are pressing. Especially if you start to play with
> modifier keys. Most of the keys are straightforward, but in my
> experience I always wanted to remap less-used keys which sometimes
> made it a bit more challenging. There is a way to get Emacs to report
> which symbol corresponds to which key-press but again I forgot how
> (actually it may be a function I found somewhere on the internet, he
> details are hazy).
Yes, there are a few ways to help you here.
Try pressing the key and then do "C-h l" and you will see what keys
you have typed lately. Using the function
http://www.emacswiki.org/cgi-bin/wiki/KeyBindingDiscussion has a good
set of examples that may be relevant. In particular, the function
'kbd' is useful for convert a key stroke into emacs internal
representation.
Here is an example that I use:
(defun my-ess-hook ()
"Add my keybindings to ESS mode."
(local-set-key (kbd "<f6>") 'ess-eval-line-and-step)
(local-set-key (kbd "A-j") 'ess-eval-line-and-step)
;;(local-set-key (kbd "C-c C-a") 'ess-display-args-on-object)
(local-set-key (kbd "C-j") 'ess-eval-line-and-step))
(add-hook 'ess-mode-hook 'my-ess-hook)
Stephen
More information about the ESS-help
mailing list