bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-AUCTeX] Interactive mode is not really interactive


From: Konrad Podczeck
Subject: [Bug-AUCTeX] Interactive mode is not really interactive
Date: Thu, 6 Apr 2006 00:20:13 +0200

When, auctex's "Run interactive" is on, the window showing the tex-compiler output does not become active, i.e. does not get focus. So this window is not ready to receive keyboard input. This is counter to the very meaning of "interactive."

When Emacs is customized so that the tex-compiler output appears in its own frame and "Run interactive" is on, then the first tex run makes this frame active, but from the second run on, the frame showing the tex-compiler output does also not become active anymore.

However, with the customization of having the tex-compiler output appearing in its own frame, this misbehavior is only since Emacs CVS from about middle of February; before the tex-compiler output frame always became active.

The following solution for the problem is due to David Reitter, maintainer of the Aquamacs Emacs distribution.



(defun TeX-run-interactive (name command file)
  "Run TeX interactively.
Run command in a buffer (in comint-shell-mode) so that it accepts user
interaction. If you return to the file buffer after the TeX run,
Error parsing on C-x ` should work with a bit of luck."
  (TeX-run-set-command name command)
  (require 'comint)
  (let ((default TeX-command-default)
        (buffer (TeX-process-buffer-name file))
        (process nil)
        (dir (TeX-master-directory))
        (command-buff (current-buffer))
(sentinel-function TeX-sentinel-default-function)) ; inherit from major mode
    (TeX-process-check file)            ; Check that no process is running
    (setq-default TeX-command-buffer command-buff)
    (with-output-to-temp-buffer buffer)
    ;; ensure the window has input focus
    (let ((w (get-buffer-window buffer 'visible)))
      (select-frame-set-input-focus (window-frame w)) ;; set input focus
      (select-window w))
    ;;
    (set-buffer buffer)
    (set (make-local-variable 'TeX-command-buffer) command-buff)
    (setq buffer-read-only nil)
    (if dir (cd dir))
    (insert "Running `" name "' on `" file "' with ``" command "''\n")
    (comint-exec buffer name TeX-shell nil
                 (list TeX-shell-command-option command))
    (comint-mode)
(add-hook 'comint-output-filter-functions 'TeX-interactive-goto-prompt)
    (setq mode-name name)
    (setq TeX-command-default default)
    (setq process (get-buffer-process buffer))
    (if TeX-after-start-process-function
        (funcall TeX-after-start-process-function process))
    (TeX-command-mode-line process)
    (set-process-sentinel process 'TeX-command-sentinel)
    (set-marker (process-mark process) (point-max))
(setq compilation-in-progress (cons process compilation-in-progress))
    (TeX-parse-reset)
    (setq TeX-parse-function 'TeX-parse-TeX)
;; use the sentinel-function that the major mode sets, not the LaTeX one
    (setq TeX-sentinel-function sentinel-function)))



Cheers

Konrad Podczeck





reply via email to

[Prev in Thread] Current Thread [Next in Thread]