"_" ==> "<-" in all S dialects via ESS

Martin Maechler maechler at stat.math.ethz.ch
Wed Oct 4 19:17:55 CEST 2000

>>>>> "mikalzet" == mikalzet  <mikalzet at libero.it> writes:

    mikalzet> On Mon, 2 Oct 2000, Hans Ehrbar wrote:
    >> Pierre, the function bound to a key must be an interactive
    >> command.  Furthermore, I did not have success assigning
    >> anything to control-=, but I found that Ctrl-^ was
    >> unassigned in my version of ess-mode, therefore the
    >> following worked for me:
    >> (defun R-equals () (interactive) (insert " <- "))
    >> (define-key ess-mode-map "\C-^" 'R-equals)

    mikalzet> whereas Pierre wrote :

    >> >   (defun R-equals () (insert "<-"))
    >> >   (global-set-key [?\C-=] 'R-equals)

    mikalzet> Neither work for me ( xemacs on linux mandrake 7.1 ).

yes, Xemacs and GNU emacs differ in this key-setting syntax things...

    mikalzet> The first says that ess-mode-map doesn't exist or something
    mikalzet> like that, - gives an error message on startup and suggests I
    mikalzet> debug - the second says that the key is undefined.

    mikalzet> R on Xemacs seems to work OK for the rest.

On R-help, Ed Kademan <kademan at phz.com> posted
   {Date: 03 Oct 2000 11:07:15 -0400}

 EK> >   Could ESS indeed be programmed to insert "<-" when one typed "_" ?
 EK> I have something like the following in my .emacs file to do that:
 EK>   (add-hook
 EK>    'inferior-ess-mode-hook
 EK>    '(lambda ()
 EK>       (define-key inferior-ess-mode-map "_" "<-")))

where I think he should have used spaces around the "<-", too,
and do the definition also for ess-mode and its map.
The next version of ESS will have something like

(defvar ess-S-assign " <- "
  "*String to be used for left assignment in all S dialects.
 Currently only activated by \\[ess-add-MM-keys].")

;; and

(defun ess-add-MM-keys ()
  "Define \"C-c f\" and re-define \"_\", the latter to `ess-S-assign', typically \" <- \"."
  (require 'ess-mode)
  (require 'ess-inf)
  (define-key ess-mode-map "\C-cf" 'ess-insert-function-outline)
;;; FIXME: MM thinkgs the following should be on by default.
;;; -----  The user can always customize `ess-S-assign' ...
  ;; Now you must use "C-q _" if you really want "_"
  (define-key ess-mode-map          "_" ess-S-assign)
  (define-key inferior-ess-mode-map "_" ess-S-assign)

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at stat.math.ethz.ch

More information about the ESS-help mailing list