[ESS] In Stata mode, where do graphs display?

Paul Johnson p@u|john32 @end|ng |rom gm@||@com
Mon Feb 29 18:26:57 CET 2016

Thanks sincerely for the help. I feared the graph thing would turn out
that way. Am I just imagining a time 5 years ago where I could launch
an inferior xstata and I could use the stata graphics in the ordinary

I'm testing you do code.

I understood what Stata's doing about the do file. I see you have
implemented same.  I'm sure there is some reason they do it that way,
but it seems, well, indirect and wrong.  A program writing notes to
itself on hard disk. Who would have thunk :)


On Wed, Feb 24, 2016 at 12:23 PM, Brendan Halpin <brendan.halpin using ul.ie> wrote:
> First question:
> Console Stata doesn't show graphs. What I do is export it to EPS and
> view that:
> . graph export /tmp/x.eps, replace
> . !evince /tmp/x.eps &
> This is for Linux, the detail will differ according to OS.
> Second question: re line ends:
> What Stata does itself with its "do-file" editor is to write the region
> to a temporary file, issue a command within Stata to "do" the temporary
> file, and then delete it. I emulate this with a function with which I
> replace the usual eval-region command. This is largely based on
> ess-eval-region. See below.
> Regards,
> Brendan
> ;; Stata equivalent of ess-eval-region
> (defun delimit-do (start end toggle &optional clear message)
>   "Send the current region to the inferior ESS process, Stata do-editor style.
> Creates a temporary file, \"do\"-es it, deletes it.
> With prefix argument toggle the meaning of `ess-eval-visibly-p';
> this does not apply when using the S-plus GUI, see `ess-eval-region-ddeclient'."
>   (interactive "r\nP")
>   (ess-force-buffer-current "Process to use: ")
>   (message "Starting evaluation...")
>   (setq message (or message "Eval region"))
>   (save-excursion
>     ;; don't send new lines (avoid screwing the debugger)
>     (goto-char start)
>     (skip-chars-forward "\n\t ")
>     (setq start (point))
>     (unless mark-active
>       (ess-blink-region start end))
>     ;; don't send new lines at the end (avoid screwing the debugger)
>     (goto-char end)
>     (skip-chars-backward "\n\t ")
>     (setq end (point)))
>   (let* (delimit
>          (commands (buffer-substring-no-properties start end))
>          (delimit-do-file (make-temp-file "delimit-do" nil ".do"))
>          (proc (get-process ess-local-process-name))
>          (visibly (if toggle (not ess-eval-visibly-p) ess-eval-visibly-p))
>          (dev-p (process-get proc 'developer))
>          (tb-p  (process-get proc 'tracebug)))
>     ;; Go to the start of the section and look back for #delimit
>     ;; if found set delimit unless the delimiter is not ";"
>     (save-excursion
>       (goto-char start)
>       (setq delimit (re-search-backward "^#delimit +\\(.+\\)$" nil t))
>       (if delimit
>           (if (not (string-match ";" (match-string 1))) (setq delimit nil))))
>     (with-temp-buffer
>       (if clear (insert "clear\n"))
>       (if delimit (insert "#delimit ;\n"
>                           commands
>                           "\n#delimit cr\n")
>         (insert commands "\n"))
>       (write-file delimit-do-file nil)
>       (kill-buffer (current-buffer)))
>     (process-send-string
>      (get-ess-process ess-current-process-name)
>      (format "do %s\nrm %s\n" delimit-do-file delimit-do-file))
>     )
>   (if (and (fboundp 'deactivate-mark) ess-eval-deactivate-mark)
>       (deactivate-mark))
>   ;; return value
>   (list start end))
> --
> Brendan Halpin, Head, Department of Sociology, University of Limerick, Ireland
> Tel: w +353-61-213147          f +353-61-202569             Room F1-002 x 3147
> mailto:brendan.halpin using ul.ie    ULSociology on Facebook: http://on.fb.me/fjIK9t
> http://teaching.sociology.ul.ie/bhalpin/wordpress         twitter:@ULSociology

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