[ESS-bugs] ess-mode 5.3.6; inferior-R-input-sender modifies `current-buffer' when entering help(foo) at R prompt
Lawrence Mitchell
wence at gmx.li
Tue Mar 4 13:10:21 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.
inferior-R-input-sender can change the value of (current-buffer)
when the input is a help command. Specifically,
ess-display-help-on-object sets the current buffer to be the
newly displayed *help* buffer. This means that typing a help
command at the prompt gives an error
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
comint-send-input()
inferior-ess-send-input()
This is because the comint-last-input-start and other markers
have no value in the *help* buffer.
The following patch fixes this problem by ensuring that
inferior-R-input-sender restores the correct buffer on exit.
Cheers,
Lawrence
diff -u ess-inf.el.bak ess-inf.el
--- ess-inf.el.bak 2007-09-13 14:45:46.000000000 +0100
+++ ess-inf.el 2008-03-04 11:51:18.000000000 +0000
@@ -1635,31 +1635,32 @@
;; REALLY only for debugging: this S_L_O_W_S D_O_W_N [here AND below]
;;(ess-write-to-dribble-buffer (format "(inf..-R-..): string='%s'; " string))
;; rmh: 2002-01-12 catch page() in R
- (let ((help-string (or (string-match inferior-R-1-input-help string)
- (string-match inferior-R-2-input-help string)))
- (page-string (string-match inferior-R-page string)))
- (if (or help-string page-string)
- (let* ((string2 (match-string 2 string))
- (string2-rt (concat string2 ".rt")))
- ;; (ess-write-to-dribble-buffer (format " new string='%s'\n" string2))
- (beginning-of-line)
- (if (looking-at inferior-ess-primary-prompt)
- (progn
- (end-of-line)
- (insert-before-markers string)) ;; emacs 21.0.105 and older
- (delete-backward-char 1)) ;; emacs 21.0.106 and newer
- (if page-string
- (progn
- (ess-command (concat string2 "\n")
- (get-buffer-create (concat string2 ".rt")))
- (ess-eval-linewise "\n")
- (switch-to-buffer-other-window string2-rt)
- (R-transcript-mode))
- (ess-display-help-on-object
- (if (string= string2 "") "help" string2))
- (ess-eval-linewise "\n")))
- ;; else: normal command
- (inferior-ess-input-sender proc string))))
+ (save-current-buffer
+ (let ((help-string (or (string-match inferior-R-1-input-help string)
+ (string-match inferior-R-2-input-help string)))
+ (page-string (string-match inferior-R-page string)))
+ (if (or help-string page-string)
+ (let* ((string2 (match-string 2 string))
+ (string2-rt (concat string2 ".rt")))
+ ;; (ess-write-to-dribble-buffer (format " new string='%s'\n" string2))
+ (beginning-of-line)
+ (if (looking-at inferior-ess-primary-prompt)
+ (progn
+ (end-of-line)
+ (insert-before-markers string)) ;; emacs 21.0.105 and older
+ (delete-backward-char 1)) ;; emacs 21.0.106 and newer
+ (if page-string
+ (progn
+ (ess-command (concat string2 "\n")
+ (get-buffer-create (concat string2 ".rt")))
+ (ess-eval-linewise "\n")
+ (switch-to-buffer-other-window string2-rt)
+ (R-transcript-mode))
+ (ess-display-help-on-object
+ (if (string= string2 "") "help" string2))
+ (ess-eval-linewise "\n")))
+ ;; else: normal command
+ (inferior-ess-input-sender proc string)))))
(defun inferior-ess-send-input ()
Diff finished. Tue Mar 4 12:08:22 2008
Emacs : GNU Emacs 23.0.60.3 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2008-02-26 on lamacq.ph.ed.ac.uk
Package: ess-mode 5.3.6
current state:
==============
(setq
ess-language "S"
ess-dialect "R"
ess-ask-for-ess-directory t
ess-ask-about-transfile nil
ess-directory nil
ess-keep-dump-files "always"
ess-source-directory "/tmp/"
)
--
Lawrence Mitchell <wence at gmx.li>
More information about the ESS-bugs
mailing list