Setting up your editor for inverse search
Prev
Next

Setting up your editor for inverse search

While inverse search works generally very well with most editors, some of them require a bit of extra care. This section explains how to configure your editor.

Emacs

Emacs works well with KDVI. The actual behavior of Emacs depends largely on the configuration. As usual, you can customize Emacs completely, if you are willing to fight your way through Lisp code.

KDVI uses the program emacsclient to remote control Emacs.

Important

The program emacsclient requires that Emacs is running, and that the program Emacs Server is started inside Emacs. Inverse search will not work optimally unless you have started both Emacs and the Emacs Server.

To start the Emacs Server, you can do one of the following:

  • In Emacs, start the Emacs Server by typing M X server-start

  • Add the line

    (server-start)
    
    to your .emacs file. Restart Emacs

Tip

  • Make sure that Emacs is installed. Try to start emacs from the command line.

  • KDVI uses the command emacsclient to remote control Emacs. Make sure that emacsclient is available on the command line by trying the command emacsclient Name of a text file. This should open a new text in the Emacs editor.

  • If emacsclient fails with an error message like unable to connect to local, make sure that Emacs is running. Furthermore, make sure that the Emacs Server is started by typing M x server-start.

  • If you want the frame to be auto-raised, add the raise-frame function to “server-switch-hook” (do M x customize-variable RET server-switch-hook and enter the function name into the text field.

  • If you have changed the buffer since your last save, Emacs will ask you: Revert buffer from file ...? (yes or no). You will probably always want to say no here, since reverting means that the file is reread from disk, causing all your changes since the last save to be lost!

    gnuclient's behavior of silently reloading the changed buffer is probably preferable — add the following lines to your .emacs file to emulate gnuclient's behavior with emacsclient:

    (defadvice server-visit-files (around save-buffers last activate)
      "Try to emulate gnuclient behavior with emacsclient.
    Works only for visiting one buffer at a time."
      (let* ((filen (car (car (ad-get-arg 0))))
             (buf (get-file-buffer filen))
             (this-buf-modified-p nil))
        ;;; the following is copied from server-visit-files, with
        ;;; a modification for the `verify-visited-file-modtime' test
        (if (and buf (set-buffer buf))
            (if (file-exists-p filen)
                ;;; if the file has changed on disk, reload it
                ;;; using `find-file-noselect'
                (if (not (verify-visited-file-modtime buf))
                    (progn
                      (find-file-noselect filen)
                      ;;; if user answered `no', reset modtime anyway
                      ;;; so that server-visit-files doesn't realize the
                      ;;; difference:
                      (set -visited-file-modtime)))
              ;;; if file exists no longer, we let server-visit-files
              ;;; deal with that
              t)
          (set buf (find-file-noselect filen)))
        (set this-buf-modified-p (buffer-modified-p buf))
        (set-buffer buf)
        (set-buffer-modified-p nil)
        ad-do-it
        (set-buffer-modified-p this-buf-modified-p)))
    

Kate

KDE's editor Kate supports inverse search very well. No extra setup is required.

Kile

The LaTeX-editor system Kile, supports KDVI very well. No extra setup is necessary. Further information about Kile can be found at Kile's homepage.

NEdit

NEdit generally works very well indeed. Clicking into the DVI file should open a new window. If the TeX file is already used in another window of NEdit, the newly opened window displays another view of the buffer. Otherwise, the TeX file is loaded. After opening the window, NEdit highlights the first line of the appropriate paragraph.

Tip

KDVI uses the command ncl to remote control NEdit. Make sure that ncl is available on the command line by trying the command ncl -noask. This should open an instance of the NEdit editor. If ncl is not available, you might be using an older version of NEdit. In that case, you should either upgrade to a more recent version, or you have to use the option User defined editor from the Options dialog.

XEmacs

XEmacs works well with KDVI. The actual behavior of XEmacs depends largely on the configuration. As usual, you can customize XEmacs completely, if you are willing to fight your way through Lisp code.

KDVI uses the program gnuclient to remote control XEmacs.

Important

The program gnuclient requires that XEmacs is running, and that the program gnuserv is started inside XEmacs. Inverse search will not work unless you have started both XEmacs and gnuserv.

To start the gnuserv program, you can do one of the following:

  • In XEmacs, start gnuserv by typing M X gnuserv-start

  • Add the line

    (gnuserv-start)
    
    to your .xemacs file. If you use a more recent version of XEmacs, .xemacs will be a folder. In that case, you should append the line to the file .xemacs/init.el. Restart XEmacs

If you don't want to open a new frame for each editor call, and want the frame to be auto-raised, set “Gnuserv Frame” to “Use selected frame”, and add the raise-frame function to “Visit Hook”. Do M x customize-group RET gnuserv to make these settings.

Tip

  • Make sure that XEmacs is installed. Try to start xemacs from the command line.

  • KDVI uses the command gnuserv to remote control XEmacs. Make sure that gnuclient is available on the command line by trying the command gnuclient Name of a text file. This should open a new frame in the XEmacs editor.

  • If gnuserv fails with an error message like unable to connect to local, make sure that XEmacs is running. Furthermore, make sure that gnuserv is started by typing M X gnuserv-start.

  • If you don't want to open a new frame for each editor call, and want the frame to be auto-raised, set “Gnuserv Frame” to “Use selected frame”, and add the “raise-frame” function to “Visit Hook”. Do M+X customize-group RET gnuserv to make these settings.

VI iMproved / GUI

The gvim variant of the vi editor supports inverse search very well. No extra setup is required.

Prev
Next
Home


Would you like to comment or contribute an update to this page?
Send feedback to the TDE Development Team