Function: idlwave-shell-examine-display
idlwave-shell-examine-display is a byte-compiled function defined in
idlw-shell.el.gz.
Signature
(idlwave-shell-examine-display)
Documentation
View the examine command output in a separate buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/idlw-shell.el.gz
(defun idlwave-shell-examine-display ()
"View the examine command output in a separate buffer."
(let (win cur-beg cur-end)
(with-current-buffer (get-buffer-create "*Examine*")
(use-local-map idlwave-shell-examine-map)
(setq buffer-read-only nil)
(goto-char (point-max))
(save-restriction
(narrow-to-region (point) (point))
(if (string-match "^% Syntax error." idlwave-shell-command-output)
(insert "% Syntax error.\n")
(insert idlwave-shell-command-output)
;; Just take the last bit between the prompts (if more than one).
(let* ((end (or
(re-search-backward idlwave-shell-prompt-pattern nil t)
(point-max)))
(beg (progn
(goto-char
(or (progn (if (re-search-backward
idlwave-shell-prompt-pattern nil t)
(match-end 0)))
(point-min)))
(re-search-forward "\n")))
(str (buffer-substring beg end)))
(delete-region (point-min) (point-max))
(insert str)
(if idlwave-shell-examine-label
(progn (goto-char (point-min))
(insert idlwave-shell-examine-label)
(setq idlwave-shell-examine-label nil)))))
(setq cur-beg (point-min)
cur-end (point-max))
(setq buffer-read-only t)
(move-overlay idlwave-shell-output-overlay cur-beg cur-end
(current-buffer))
;; Look for the examine buffer in all windows. If one is
;; found in a frame all by itself, use that, otherwise, switch
;; to or create an examine window in this frame, and resize if
;; it's a newly created window
(let* ((winlist (get-buffer-window-list "*Examine*" nil 'visible)))
(setq win (idlwave-display-buffer
"*Examine*"
nil
(let ((list winlist) thiswin)
(catch 'exit
(save-selected-window
(while (setq thiswin (pop list))
(select-window thiswin)
(if (one-window-p)
(throw 'exit (window-frame thiswin)))))))))
(set-window-start win (point-min)) ; Ensure the point is visible.
(save-selected-window
(select-window win)
(let ((elt (assoc win idlwave-shell-examine-window-alist)))
(when (and (not (one-window-p))
(or (not (memq win winlist)) ;a newly created window
(eq (window-height) (cdr elt))))
;; Autosize it.
(enlarge-window (- (/ (frame-height) 2)
(window-height)))
(shrink-window-if-larger-than-buffer)
;; Clean the window list of dead windows
(setq idlwave-shell-examine-window-alist
(delq nil
(mapcar (lambda (x) (if (window-live-p (car x)) x))
idlwave-shell-examine-window-alist)))
;; And add the new value.
(if (setq elt (assoc win idlwave-shell-examine-window-alist))
(setcdr elt (window-height))
(add-to-list 'idlwave-shell-examine-window-alist
(cons win (window-height)))))))))
;; Recenter for maximum output, after widened
(save-selected-window
(select-window win)
(goto-char (point-max))
(skip-chars-backward "\n")
(recenter -1)))))