[ESS-bugs] ess-mode 5.3.7; ess-transcript-send-command-and-move bug squashed?

tyler tyler.smith at mail.mcgill.ca
Thu Mar 20 18:08:33 CET 2008


This bug report will be sent to the ESS bugs email list
Press C-c C-c when you are ready to send your message.

Hi,

I think I've solved the bug regarding
ess-transcript-send-command-and-move.

Brief example:
Start R
enter several lines of code into the interpreter:
> 1+1
[1] 2
> 2+2
[1] 4
> 3+3
[1] 6
> 

move back to the first line entered and press M-<enter>

The result should be sending "1+1" to the R process, producing the
result:
[1] 2
>
at the bottom of the buffer, with point moving to the second line of
input:
> 2 + 2

This is not what happens. Point ends up at the last/newest prompt at
the bottom of the buffer. I believe this has something to do with the
interaction with the inferior process. I think that the ESS commands
finish, at least occasionally (always on my machine), ahead of the R
process. When the R process finishes it moves point to the bottom of
the buffer, which is not what we want.

I made the following changes in ess-trns.el (line 230 in the version I
have), which takes the relevant sections of
ess-transcript-send-command, and adds the optional argument to
ess-eval-linewise indicating we want to wait-last-prompt before
proceeding. I'm not sure I understand all the options to
ess-eval-linewise, but it makes sense that we wait until the R process
finishes it's evaluation before placing point where we want it to
ultimately stay. This appears to solve the original bug.

(defun ess-transcript-send-command-and-move ()
  "Send the command on this line, and move point to the next command."
  (interactive)
  ;;(ess-transcript-send-command) ;; This doesn't work properly
  ;; custom code follows:
  (let* ((proc (or ess-local-process-name
		   (ess-request-a-process "Evaluate into which process? " t)))
	 (ess-buf (get-ess-buffer proc)))
    (setq ess-local-process-name proc)
    (if (get-buffer-window ess-buf) nil
      (display-buffer ess-buf t))
    (let ((input (inferior-ess-get-old-input)))
      (save-excursion
	(set-buffer ess-buf)
	(goto-char (point-max))
	(ess-eval-linewise input nil nil nil 1)))) ;; end of custom code
  (goto-char ess-temp-point)
  (comint-next-prompt 1))

Cheers,

Tyler 


(R): ess-dialect=nil, buf=*scratch*, start-arg=nil
 current-prefix-arg=nil
(inferior-ess 0): ess-start-args=--no-readline --no-restore  
ess-setq-vars-default 0: ess-language=Initial, -dialect=nil, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
ess-setq-vars-default 1: ess-language=S, -dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
(inf-ess 1): lang=S, dialect=R, tmp-dialect=R, buf=*scratch*
(inf-ess 1.1): procname=R temp-dialect=R, buf-name=*R* 
(inferior-ess) Method #3 start=/home/tyler/rworkingdirectory/ buf=*R*
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
(inf-ess 2.1): ess-language=S, ess-dialect=R buf=*R* 
(inf-ess 2.2): start args = --no-readline --no-restore , inf-ess-start-args=--no-readline --no-restore  
(inf-ess finish [S(R), R(nil,nil)]
(ess-multi 0):  inf-ess-start-args=--no-readline --no-restore , comint-..echoes=nil
(i-ess 1): buf=*R*, lang=S, comint..echo=nil, comint..sender=comint-simple-send,
(i-ess 2): buf=*R*, lang=S, comint..echo=t, comint..sender=inferior-R-input-sender,
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t, comint..sender=inferior-R-input-sender
(i-ess 3): curr-buf=*R*, comint..echo=t, comint..sender=inferior-R-input-sender,
(ess-multi post inf-ess: start-args=--no-readline --no-restore , comint-echoes=t
(ess-multi 1):  start-args=--no-readline --no-restore  
Making Process...Buf *R*, Proc R, Prog R
 Start File=nil, Args= --no-readline --no-restore .
(R): inferior-ess-language-start=options(STERM='iESS', editor='emacsclient')
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
(ess-mode-1): ess-language=S, ess-dialect=R buf=prob.R 
(ess-mode-1.5): alist=((ess-local-customize-alist quote R-customize-alist) (ess-dialect . R) (ess-suffix . R) (ess-dump-filename-template ess-replace-regexp-in-string S$ ess-suffix ess-dump-filename-template-proto) (ess-mode-syntax-table . R-syntax-table) (ess-mode-editing-alist . R-editing-alist) (ess-change-sp-regexp . ess-R-change-sp-regexp) (ess-help-sec-regex . ess-help-R-sec-regex) (ess-help-sec-keys-alist . ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout) (ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern . ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el) (ess-imenu-mode-function quote ess-imenu-R) (inferior-ess-program . inferior-R-program-name) (inferior-ess-objects-command . inferior-R-objects-command) (inferior-ess-font-lock-keywords . inferior-ess-R-font-lock-keywords) (inferior-ess-search-list-command . search()
) (inferior-ess-help-command . help("%s", htmlhelp=FALSE)
) (inferior-ess-help-filetype) (inferior-ess-exit-command . q()) (inferior-ess-exit-prompt . Save workspace image? [y/n/c]: ) (inferior-ess-primary-prompt . \([A-Z][][A-Za-z0-9.]*\)?> ) (inferior-ess-secondary-prompt . + ?) (inferior-ess-start-file) (inferior-ess-start-args . ) (ess-STERM . iESS) (ess-editor . R-editor) (ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
) (inferior-ess-language-start eval inferior-S-language-start) (comint-use-prompt-regexp-instead-of-fields . t)) 
(ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\| page-delimiter) (paragraph-separate concat \s-*$\| page-delimiter) (paragraph-ignore-fill-prefix . t) (require-final-newline . t) (comment-start . #) (comment-add . 1) (comment-start-skip . #+ *) (comment-column . 40) (indent-line-function quote S-indent-line) (parse-sexp-ignore-comments . t) (ess-style . ess-default-style) (ess-local-process-name) (ess-mode-syntax-table . S-syntax-table) (add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[ 	
]*function) (font-lock-defaults quote (ess-R-mode-font-lock-keywords nil nil ((46 . w) (95 . w))))) 
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send

Finished setting up ESS-mode.
(get-object-list R) ..--> (ess-get-modtime-list)
 (ess-search-list: re-computing..) after 'search()
', point-max=189
(ess-object-names obj=.GlobalEnv): no directory - trying names
(ess-object-names obj=package:stats): no directory - trying names
(ess-object-names obj=package:graphics): no directory - trying names
(ess-object-names obj=package:grDevices): no directory - trying names
(ess-object-names obj=package:utils): no directory - trying names
(ess-object-names obj=package:datasets): no directory - trying names
(ess-object-names obj=package:methods): no directory - trying names
(ess-object-names obj=Autoloads): no directory - trying names
(ess-object-names obj=package:base): no directory - trying names
ess-get-modtime-list: new alist of length 9
 (length alist) : 9
(ess-object-names obj=.GlobalEnv): no directory - trying names
 have re-read pos=1: -> length 0
(get-object-list R) .. using existing ess-*-alist
 (length alist) : 9
(ess-object-names obj=.GlobalEnv): no directory - trying names
 have re-read pos=1: -> length 4
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
(ess-mode-1): ess-language=S, ess-dialect=R buf=prob.R 
(ess-mode-1.5): alist=((ess-local-customize-alist quote R-customize-alist) (ess-dialect . R) (ess-suffix . R) (ess-dump-filename-template ess-replace-regexp-in-string S$ ess-suffix ess-dump-filename-template-proto) (ess-mode-syntax-table . R-syntax-table) (ess-mode-editing-alist . R-editing-alist) (ess-change-sp-regexp . ess-R-change-sp-regexp) (ess-help-sec-regex . ess-help-R-sec-regex) (ess-help-sec-keys-alist . ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout) (ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern . ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el) (ess-imenu-mode-function quote ess-imenu-R) (inferior-ess-program . inferior-R-program-name) (inferior-ess-objects-command . inferior-R-objects-command) (inferior-ess-font-lock-keywords . inferior-ess-R-font-lock-keywords) (inferior-ess-search-list-command . search()
) (inferior-ess-help-command . help("%s", htmlhelp=FALSE)
) (inferior-ess-help-filetype) (inferior-ess-exit-command . q()) (inferior-ess-exit-prompt . Save workspace image? [y/n/c]: ) (inferior-ess-primary-prompt . \([A-Z][][A-Za-z0-9.]*\)?> ) (inferior-ess-secondary-prompt . + ?) (inferior-ess-start-file) (inferior-ess-start-args . ) (ess-STERM . iESS) (ess-editor . R-editor) (ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
) (inferior-ess-language-start eval inferior-S-language-start) (comint-use-prompt-regexp-instead-of-fields . t)) 
(ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\| page-delimiter) (paragraph-separate concat \s-*$\| page-delimiter) (paragraph-ignore-fill-prefix . t) (require-final-newline . t) (comment-start . #) (comment-add . 1) (comment-start-skip . #+ *) (comment-column . 40) (indent-line-function quote S-indent-line) (parse-sexp-ignore-comments . t) (ess-style . ess-default-style) (ess-local-process-name) (ess-mode-syntax-table . S-syntax-table) (add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[ 	
]*function) (font-lock-defaults quote (ess-R-mode-font-lock-keywords nil nil ((46 . w) (95 . w))))) 
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send

Finished setting up ESS-mode.
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
(ess-mode-1): ess-language=S, ess-dialect=R buf=prob.R 
(ess-mode-1.5): alist=((ess-local-customize-alist quote R-customize-alist) (ess-dialect . R) (ess-suffix . R) (ess-dump-filename-template ess-replace-regexp-in-string S$ ess-suffix ess-dump-filename-template-proto) (ess-mode-syntax-table . R-syntax-table) (ess-mode-editing-alist . R-editing-alist) (ess-change-sp-regexp . ess-R-change-sp-regexp) (ess-help-sec-regex . ess-help-R-sec-regex) (ess-help-sec-keys-alist . ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout) (ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern . ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el) (ess-imenu-mode-function quote ess-imenu-R) (inferior-ess-program . inferior-R-program-name) (inferior-ess-objects-command . inferior-R-objects-command) (inferior-ess-font-lock-keywords . inferior-ess-R-font-lock-keywords) (inferior-ess-search-list-command . search()
) (inferior-ess-help-command . help("%s", htmlhelp=FALSE)
) (inferior-ess-help-filetype) (inferior-ess-exit-command . q()) (inferior-ess-exit-prompt . Save workspace image? [y/n/c]: ) (inferior-ess-primary-prompt . \([A-Z][][A-Za-z0-9.]*\)?> ) (inferior-ess-secondary-prompt . + ?) (inferior-ess-start-file) (inferior-ess-start-args . ) (ess-STERM . iESS) (ess-editor . R-editor) (ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
) (inferior-ess-language-start eval inferior-S-language-start) (comint-use-prompt-regexp-instead-of-fields . t)) 
(ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\| page-delimiter) (paragraph-separate concat \s-*$\| page-delimiter) (paragraph-ignore-fill-prefix . t) (require-final-newline . t) (comment-start . #) (comment-add . 1) (comment-start-skip . #+ *) (comment-column . 40) (indent-line-function quote S-indent-line) (parse-sexp-ignore-comments . t) (ess-style . ess-default-style) (ess-local-process-name) (ess-mode-syntax-table . S-syntax-table) (add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[ 	
]*function) (font-lock-defaults quote (ess-R-mode-font-lock-keywords nil nil ((46 . w) (95 . w))))) 
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send

Finished setting up ESS-mode.
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
(ess-mode-1): ess-language=S, ess-dialect=R buf=prob.R 
(ess-mode-1.5): alist=((ess-local-customize-alist quote R-customize-alist) (ess-dialect . R) (ess-suffix . R) (ess-dump-filename-template ess-replace-regexp-in-string S$ ess-suffix ess-dump-filename-template-proto) (ess-mode-syntax-table . R-syntax-table) (ess-mode-editing-alist . R-editing-alist) (ess-change-sp-regexp . ess-R-change-sp-regexp) (ess-help-sec-regex . ess-help-R-sec-regex) (ess-help-sec-keys-alist . ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout) (ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern . ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el) (ess-imenu-mode-function quote ess-imenu-R) (inferior-ess-program . inferior-R-program-name) (inferior-ess-objects-command . inferior-R-objects-command) (inferior-ess-font-lock-keywords . inferior-ess-R-font-lock-keywords) (inferior-ess-search-list-command . search()
) (inferior-ess-help-command . help("%s", htmlhelp=FALSE)
) (inferior-ess-help-filetype) (inferior-ess-exit-command . q()) (inferior-ess-exit-prompt . Save workspace image? [y/n/c]: ) (inferior-ess-primary-prompt . \([A-Z][][A-Za-z0-9.]*\)?> ) (inferior-ess-secondary-prompt . + ?) (inferior-ess-start-file) (inferior-ess-start-args . ) (ess-STERM . iESS) (ess-editor . R-editor) (ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
) (inferior-ess-language-start eval inferior-S-language-start) (comint-use-prompt-regexp-instead-of-fields . t)) 
(ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\| page-delimiter) (paragraph-separate concat \s-*$\| page-delimiter) (paragraph-ignore-fill-prefix . t) (require-final-newline . t) (comment-start . #) (comment-add . 1) (comment-start-skip . #+ *) (comment-column . 40) (indent-line-function quote S-indent-line) (parse-sexp-ignore-comments . t) (ess-style . ess-default-style) (ess-local-process-name) (ess-mode-syntax-table . S-syntax-table) (add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[ 	
]*function) (font-lock-defaults quote (ess-R-mode-font-lock-keywords nil nil ((46 . w) (95 . w))))) 
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send

Finished setting up ESS-mode.
ess-BEG-of-fun after 'search-FWD (': Ini-pt 854, (p)-Ini-pt = 0
ELSE  not in setMethod() header ...
	Match,Pt:(383,406),383
ess-END-of-fun: S4=nil, beginning = 383
(get-object-list R) .. using existing ess-*-alist
 (length alist) : 9
(ess-object-names obj=.GlobalEnv): no directory - trying names
 have re-read pos=1: -> length 5
ess-BEG-of-fun after 'search-FWD (': Ini-pt 766, (p)-Ini-pt = 25
ELSE  not in setMethod() header ...
	Match,Pt:(383,406),383
ess-END-of-fun: S4=nil, beginning = 383
ess-BEG-of-fun after 'search-FWD (': Ini-pt 1267, (p)-Ini-pt = 10
ELSE  not in setMethod() header ...
	Match,Pt:(892,915),892
ess-END-of-fun: S4=nil, beginning = 892
(get-object-list R) .. using existing ess-*-alist
 (length alist) : 9
(ess-object-names obj=.GlobalEnv): no directory - trying names
 have re-read pos=1: -> length 6
(get-object-list R) .. using existing ess-*-alist
 (length alist) : 9
(ess-object-names obj=.GlobalEnv): no directory - trying names
ess-BEG-of-fun after 'search-FWD (': Ini-pt 1575, (p)-Ini-pt = 13
ELSE  not in setMethod() header ...
	Match,Pt:(1348,1368),1348
ess-END-of-fun: S4=nil, beginning = 1348
(get-object-list R) .. using existing ess-*-alist
 (length alist) : 9
(ess-object-names obj=.GlobalEnv): no directory - trying names
 have re-read pos=1: -> length 10
(get-object-list R) .. using existing ess-*-alist
 (length alist) : 9
(ess-object-names obj=.GlobalEnv): no directory - trying names
 have re-read pos=1: -> length 10
ess-BEG-of-fun after 'search-FWD (': Ini-pt 1735, (p)-Ini-pt = 9
ELSE  not in setMethod() header ...
	Match,Pt:(1619,1643),1619
ess-END-of-fun: S4=nil, beginning = 1619
ess-BEG-of-fun after 'search-FWD (': Ini-pt 1704, (p)-Ini-pt = 23
ELSE  not in setMethod() header ...
	Match,Pt:(1619,1643),1619
ess-END-of-fun: S4=nil, beginning = 1619
ess-BEG-of-fun after 'search-FWD (': Ini-pt 1687, (p)-Ini-pt = 40
ELSE  not in setMethod() header ...
	Match,Pt:(1619,1643),1619
ess-END-of-fun: S4=nil, beginning = 1619
ess-BEG-of-fun after 'search-FWD (': Ini-pt 1670, (p)-Ini-pt = 9
ELSE  not in setMethod() header ...
	Match,Pt:(1619,1643),1619
ess-END-of-fun: S4=nil, beginning = 1619
ess-BEG-of-fun after 'search-FWD (': Ini-pt 1934, (p)-Ini-pt = 11
ELSE  not in setMethod() header ...
	Match,Pt:(1748,1773),1748
ess-END-of-fun: S4=nil, beginning = 1748
ess-BEG-of-fun after 'search-FWD (': Ini-pt 2254, (p)-Ini-pt = 0
ELSE  not in setMethod() header ...
	Match,Pt:(1966,1991),1966
ess-END-of-fun: S4=nil, beginning = 1966
(get-object-list R) .. using existing ess-*-alist
 (length alist) : 9
(ess-object-names obj=.GlobalEnv): no directory - trying names
 have re-read pos=1: -> length 13

Emacs  : GNU Emacs 22.1.1 (i686-pc-linux-gnu, X toolkit)
 of 2007-12-11 on blackbart
Package: ess-mode 5.3.7

current state:
==============
(setq
 ess-language "S"
 ess-dialect "R"
 ess-ask-for-ess-directory nil
 ess-ask-about-transfile nil
 ess-directory "/home/tyler/rworkingdirectory/"
 ess-keep-dump-files "always"
 ess-source-directory "/tmp/"
 )



More information about the ESS-bugs mailing list