[ESS] Tracebug. ess-own-frame problem
Paul Johnson
pauljohn32 at gmail.com
Fri Jul 31 18:03:32 CEST 2015
I'm here again to confess my ignorance. I'm at your mercy, as ever.
(Emacs 24.4, ESS 15.03)
I used a machine that did not have my emacs init file yesterday and I
noticed Tracebug worked. Until now, I just thought Tracebug was an
annoying poison pill, but now that I've seen what it does, I am
interested to know how I can fix my init file.
When my init file is in use, Tracebug, causes this very unhappy
behavior. The window focus will not stay in the *R* session file when
I use browser() or debug().
In the session *R* frame, I type "n" <Ret> or just <Ret>, and the
window focus shifts over to an R code file with a brown stripe
rectangle at the point of execution. When I want to run the next line
in the debugger, I have to manually go back to *R* and <Ret>. Then
Emacs throws focus back at the place where the brown stripe is. I have
to re-focus the *R* frame after every line being executed. If I go
into the code file where the brown stripe is, I can send lines into
the *R* process in the usual ways. However, the brown stripe does not
advance, and sometimes the cursor jumps about, the pointer does not
step down through the code file in sequence, it sometimes seems stuck
in a loop, stepping back several lines and running things over. This
is not going through a for loop or such, its just stuck.
Since I don't think I gain much from Tracebug, I don't mind disabling
it, but then Emacs and ESS doesn't work well any more. Some work
becomes really slow. Highlight a region and send to R is super slow,
takes 1 minute to send code rather than 1 second. Eval-Function takes
30 seconds or more to respond. I watch the CPU, it does not appear to
be busy :0
Consequently, I don't want to disable Tracebug, I want to live in peace with it.
I tested my init file bit by bit and it appears to me here is the
problem-causing setting:
(setq inferior-ess-own-frame t)
Here's why I have that line in the init file. If you tell me some
other way to achieve my goal, I will do it.
Without that line, I see the following problem. Open an R file, I hit
the big blue R to start R, then the Emacs frame is taken over by the
*R* session entirely. That's disorienting. I don't want that to
happen. I want a new frame to pop up with *R* over there, I don't want
to lose sight of my R script file. Except for breaking tracebug, its a
good way to live :)
Here's the rest of the troublesome init file
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
;; Testing ess-smart-underscore
(require 'ess-smart-underscore)
;; JUSTIFICATION. The intention is to make Emacs work more like a
;; "modern" GUI editor. See my companion lecture
;; "Emacs Has No Learning Curve"
;; http://pj.freefaculty.org/guides/Rcourse
;; ;; Org-mode with R doesn't work without this
;; ;; http://orgmode.org/worg/org-contrib/babel/how-to-use-Org-Babel-for-R.html
(custom-set-variables
'(ansi-color-names-vector
["#2e3436" "#a40000" "#4e9a06" "#c4a000" "#204a87" "#5c3566"
"#729fcf" "#eeeeec"])
'(cua-auto-tabify-rectangles nil)
'(cua-mode t nil (cua-base))
'(custom-enabled-themes (quote (whiteboard)))
'(org-babel-load-languages (quote ((emacs-lisp . t) (R . t))))
'(org-confirm-babel-evaluate nil)
'(show-paren-mode t))
;; Section II. Keyboard and mouse customization
(delete-selection-mode t) ; delete seleted text when typing
(setq select-active-regions t)
(global-set-key [mouse-2] 'mouse-yank-primary)
;; highlight does not alter KILL ring
(setq mouse-drag-copy-region nil)
;; IIB: keyboard customization
;; CUA mode is helpful not only for copy and paste, column select
(cua-mode t) ; windows style binding C-x, C-v, C-c, C-z
(setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands
(show-paren-mode t) ; light-up matching parens
(global-font-lock-mode t) ; turn on syntax highlighting
(setq text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
;; Section IV. ESS Emacs Statistics
;; start R in current working directory, don't let R ask user
(setq ess-ask-for-ess-directory nil)
;; ESS 13.05 default C-Ret conflicts with CUA mode rectangular selection.
;; Change shortcut to use Shift-Return
;; Suggested by Vitalie Spinu ESS-help email 2013-05-15
(eval-after-load "ess-mode"
'(progn
(define-key ess-mode-map [(control return)] nil)
(define-key ess-mode-map [(shift return)] 'ess-eval-region-or-line-and-step))
)
;; create a new frame for each help instance
;; (setq ess-help-own-frame t)
;; If you want all help buffers to go into one frame do:
(setq ess-help-own-frame 'one)
;; I want the *R* process in its own frame
(setq inferior-ess-own-frame t)
;; PJ 2013-02-28
;; stops suggestions in R when tabbing. Quiets noise, but ruins feature
;; (setq completion-auto-help nil)
;; ;; ;; Section V. Customize the use of Frames. Try to make new content
;; ;; ;; appear in wholly new frames on screen.
;; ;; ;;
;; ;; ;; V.A: Discourage Emacs from splitting "frames", encourage it
to pop up new
;; ;; ;; frames for new content.
;; ;; ;; see: http://www.gnu.org/software/emacs/elisp/html_node/Choosing-Window.html
(setq split-window-preferred-function nil) ;discourage horizontal splits
;; V.C: Make files opened from the menu bar appear in their own
;; frames. This overrides the default menu bar settings. Opening an
;; existing file and creating new one in a new frame are the exact
;; same operations. adapted from Emacs menu-bar.el
(defun menu-find-existing ()
"Edit the existing file FILENAME."
(interactive)
(let* ((mustmatch (not (and (fboundp 'x-uses-old-gtk-dialog)
(x-uses-old-gtk-dialog))))
(filename (car (find-file-read-args "Find file: " mustmatch))))
(if mustmatch
(find-file-other-frame filename)
(find-file filename))))
(define-key menu-bar-file-menu [new-file]
'(menu-item "Open/Create" find-file-other-frame
:enable (menu-bar-non-minibuffer-window-p)
:help "Create a new file"))
(define-key menu-bar-file-menu [open-file]
'(menu-item ,(purecopy "Open File...") menu-find-existing
:enable (menu-bar-non-minibuffer-window-p)
:help ,(purecopy "Read an existing file into an Emacs buffer")))
;; V.D Open directory list in new frame.
(define-key menu-bar-file-menu [dired]
'(menu-item "Open Directory..." dired-other-frame
:help "Read a directory; operate on its files (Dired)"
:enable (not (window-minibuffer-p (frame-selected-window
menu-updating-frame)))))
;; Section VI: Miscellaneous convenience
;; Remove Emacs "splash screen"
;; http://fuhm.livejournal.com/
(defadvice command-line-normalize-file-name
(before kill-stupid-startup-screen activate)
(setq inhibit-startup-screen t))
(setq inhibit-splash-screen t)
;; Show file name in title bar
;; http://www.thetechrepo.com/main-articles/549
(setq frame-title-format "%b - Emacs")
;; Make Emacs scroll smoothly with down arrow key.
;; 2011-10-14
(setq scroll-conservatively most-positive-fixnum)
;; Remember password when connected to remote sites via Tramp
(setq password-cache-expiry nil)
--
Paul E. Johnson
Professor, Political Science Director
1541 Lilac Lane, Room 504 Center for Research Methods
University of Kansas University of Kansas
http://pj.freefaculty.org http://crmda.ku.edu
More information about the ESS-help
mailing list