1

I followed this other post to set up some nomenclature command and ensure command afterwards etc. Everything works perfect except when I type C-c C-c Nomenclature, a compilation buffer will pop up and split the original buffer into two, as if I had turned on the compilation buffer by adding (setq TeX-show-compilation nil) (which I did not). If I type the usual stuff like C-c C-c latex or C-c C-c biber, everything is normal and the message stays inside the minibuffer without popup except, of course, when there is an error to report.

I tried to solve this issue by adding a (delete-other-windows) manually as follows,

(eval-after-load "tex"
 '(add-to-list 'TeX-command-list
            '("Nomenclature" "makeindex %s.nlo -s nomencl.ist -o %s.nls"
              (lambda (name command file)
                (TeX-run-compile name command file)
                (TeX-process-set-variable file 'TeX-command-next TeX-command-default)
                (delete-other-windows) %<-- manually delete other buffer
)
              nil t :help "Create nomenclature file")))

and it works, but does look unnatural and stupid. In addition, sometimes this will blindly close another buffer that is NOT a compilation buffer, which is troublesome.

My question is, is there a formal way to solve this? Many thanks!


Update

After some digging, I realized that this is not a AUCTeX or general TeX problem, but a emacs compile problem. Following this post by zdav, I managed to replace (delete-other-windows) above by

(delete-window (get-buffer-window (get-buffer "*compilation*"))))

which seems more targeted to me.

If i just add what zdav proposed, it still works, but i would literally see the window split and the lower buffer demolished. Not a pleasant view.


Update

After some further digging, I think I'll stick to the solution offered on stackoverflow copied as follows

(defun brian-compile-finish (buffer outstr)
  (unless (string-match "finished" outstr)
    (switch-to-buffer-other-window buffer))
  t)

(setq compilation-finish-functions 'brian-compile-finish)

(require 'cl)

(defadvice compilation-start
  (around inhibit-display
      (command &optional mode name-function highlight-regexp)) 
  (if (not (string-match "^\\(find\\|grep\\)" command))
      (flet ((display-buffer)
         (set-window-point)
         (goto-char)) 
    (fset 'display-buffer 'ignore)
    (fset 'goto-char 'ignore)
    (fset 'set-window-point 'ignore)
    (save-window-excursion 
      ad-do-it))
    ad-do-it))

(ad-activate 'compilation-start)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.