comint history for ess
jeff at delphioutpost.com
Fri Oct 12 03:49:07 CEST 2001
From: Thomas Gerds <gerds at paracelsus.fdm.uni-freiburg.de>
Date: 10 Oct 2001 15:35:49 +0200
Jeff Mincy <jeff at delphioutpost.com> writes:
> 2. commands that were send by ess-eval from a different buffer,
> *.s, say, can not be retrieved. how can i force these to be added
> to the corresponding input-ring?
> For the most part, I would think that you would not want
> the ess-eval (buffer/region/function) being added to the history.
> What type of eval commands did you want added?
you are right, if the code is long, longer than 10 lines, say, it
would not be convenient to store it in the input-ring ... on the other
hand, very short commands (shorter than 2 characters) are (by default)
not added even if typed directly after the inferior-ess prompt.
thus it would be nice to have a variable that controls the maximum
length (characters or lines) of commands (code) that should be added
to the input-ring if send by ess-eval. such a variable would even be
usefull for code that is transported to the inferior-ess prompt on
a different way, e.g. by copy-and-paste.
I thought about it some, and I'm not really buying the idea. lines
that you type to a comint prompt, are likely to be needed again,
but things that you ess-eval, are things that you are likely to ess-eval
again, but not that you are going to explictly type want completion.
But, hey, if you really want it....
The function ess-eval-line-and-step (^c^n) calls
ess-eval-linewise with the line to evaluate.
You can add a defadvice for ess-eval-linewise that explicitly calls
comint-add-to-input-history with the command.
Something like (untested) should do what you want.
(defadvice ess-eval-linewise (after add-history first activate)
Also, you could explicitly 'seed' your comint history file - eg
add a bunch of splus commands to .S+6history
Your other idea of not adding long commands to the history can be
handled with comint-input-filter. For example, the default filter
rejects short commands.
(and (not (string-match "\\`\\s *\\'" str))
;; Ignore '!!' and kin
(> (length str) 2))))
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