diff -urb --exclude=CVS xdvik-22.40j/texk/xdvik/README.src-specials xdvik-22.40k/texk/xdvik/README.src-specials --- xdvik-22.40j/texk/xdvik/README.src-specials Sun May 20 14:33:02 2001 +++ xdvik-22.40k/texk/xdvik/README.src-specials Wed May 22 06:57:43 2002 @@ -26,7 +26,7 @@ corresponding place in the .tex source and back (also called `reverse search' and `forward search'). - Use Control-Mouse1 to jump to the nearest special, + With xdvik, use Control-Mouse1 to jump to the nearest special, Control-V to show all specials on the page. See man xdvi(1) for more information on the command-line options @@ -38,17 +38,16 @@ Use one of the packages srcltx.sty (for LaTeX2e) or stctex.tex (for Plain TeX), or a TeX executable that can insert the specials into the .dvi file. The (La)TeX packages are available from - CTAN:macros/latex/contrib/supported/srcltx/; there's a patch for - teTeX-beta-20001218 in the texk/xdvik/ subdirectory (adapted from - MikTeX by Fabrice Popineau). - - WARNING: You shoud have some experience with compiling teTeX - before using this patch! + CTAN:macros/latex/contrib/supported/srcltx/. + Also, the current teTeX-beta has a command line switch `-src' to + activate source specials. 3. Editor setup 3.1 (X)Emacs/gnuclient + 3.1.1 Reverse search: + - with With Emacs >= 19.34 and <= 20.3, it might be neccessary to use (autoload 'gnuserv-start "gnuserv-comp") @@ -74,13 +73,17 @@ '(gnuserv-visit-hook (lambda () (raise-frame) (recenter)))) - For forward search, use xdvi-search.el in combination with the - startxdvi shell script; both are contained in the texk/xdvik/ - subdirectory of the xdvik distribution. + 3.1.2 Forward Search: + + Use xdvi-search.el in combination with the startxdvi shell script; + both are contained in the texk/xdvik/ subdirectory of the xdvik + distribution. 3.2 Emacs/emacsclient + 3.2.1 Reverse search: + * with Emacs >= 20.3: - put "(server-start)" into your .emacs file @@ -139,11 +142,30 @@ ad-do-it (set-buffer-modified-p this-buf-modified-p))) - For forward search, use xdvi-search.el in combination with the - startxdvi shell script; both are contained in the texk/xdvik/ - subdirectory of the xdvik distribution. + 3.2.2 Forward search: -3.3. Nedit/nc + Use xdvi-search.el in combination with the startxdvi shell script; + both are contained in the texk/xdvik/ subdirectory of the xdvik + distribution. + +3.3 vim v6.0+ + + 3.3.1 Reverse search: + + - Use the command line option + + xdvi -editor "gvim --servername xdvi --remote +%l %f" + + (The option `--servername xdvi' will cause gvim to run a + dedicated instance for the files opened by xdvi.) + + 3.3.2 Forward search: + Not possible(?) + + +3.4. Nedit/nc + + 3.4.1 Reverse search: - start nedit with the `-server' option @@ -155,13 +177,16 @@ xdvi.editor: nc -noask +%l %f + 3.4.2 Forward search: + Not possible(?) + -3.4. Other editors +3.5. Other editors You can use the reverse search feature with any editor that you can pass a file name/line number via the command line. Just make sure that console-mode editors are started in a separate window, - e.g. with vi: + e.g. with classic vi: xdvi -editor "xterm -e vi +%u %s" @@ -169,8 +194,8 @@ invoke the command. If you know about other editor/server combinations, please email me - about them (ulrich@cis.uni-muenchen.de) so that I can add them to this - list. + so that I can add them + to this list. diff -urb --exclude=CVS xdvik-22.40j/texk/xdvik/dvi-draw.c xdvik-22.40k/texk/xdvik/dvi-draw.c --- xdvik-22.40j/texk/xdvik/dvi-draw.c Tue Apr 30 14:50:17 2002 +++ xdvik-22.40k/texk/xdvik/dvi-draw.c Wed May 22 17:25:51 2002 @@ -645,11 +645,7 @@ image->data = bitmap->bits; image->bytes_per_line = bitmap->bytes_wide; XPutImage(DISP, currwin.win, -#ifdef HTEX - HTeXreflevel > 0 ? highGC : foreGC, -#else foreGC, -#endif image, 0, 0, x - currwin.base_x, y - currwin.base_y, bitmap->w, bitmap->h); @@ -1958,7 +1954,7 @@ draw_page P1C(void,) { if (dvi_file_changed() || page_offset == NULL) { - dvi_time--; +/* dvi_time--; */ return; } @@ -3833,13 +3829,12 @@ if (strcmp(tfminfo[i].texname, texname) == 0) return i; - if (wlidx == maxw) { + wlidx++; + while (wlidx >= maxw) { maxw += TEXWGROW; tfminfo = xrealloc(tfminfo, sizeof(*tfminfo) * maxw); } - wlidx++; - tfminfo[wlidx].texname = texname; if (!tfmload(texname, &tfminfo[wlidx].designsize, tfminfo[wlidx].widths)) { @@ -3883,17 +3878,14 @@ /* Insert and set up new t1 font */ - if (t1lidx == maxt1) { - /* Make room */ + t1lidx++; + while (t1lidx >= maxt1) { maxt1 += T1GROW; t1fonts = xrealloc(t1fonts, sizeof(*t1fonts) * maxt1); - TRACE_T1((stderr, "Enlarged t1 table from %d to %d entries", t1lidx, maxt1)); } - t1lidx++; - if (filename == NULL) { /* We don't know the full path name yet, find it */ path = kpse_find_file(fontname, kpse_type1_format, 0); @@ -3999,17 +3991,15 @@ /* Not set up. Do it. */ TRACE_T1((stderr, "setting up font |%s|", texname)); - if (maplidx == maxmap) { + maplidx++; + while (maplidx >= maxmap) { maxmap += FNTMAPGROW; - /* Hope realloc isn't destructive anywhere :-) */ fontmaps = xrealloc(fontmaps, sizeof(*fontmaps) * maxmap); TRACE_T1((stderr, "Enlarged the fontmap from %d to %d entries", maplidx, maxmap)); } - maplidx++; - if (alias == NULL) alias = texname; @@ -4223,17 +4213,14 @@ } /* Bonafide new encoding */ - - /* Any space left? */ - if (enclidx == maxenc) { + enclidx++; + while (enclidx >= maxenc) { maxenc += ENCGROW; encodings = xrealloc(encodings, sizeof(*encodings) * maxenc); - TRACE_T1((stderr, "Enlarged encoding map from %d to %d entries\n", enclidx, maxenc)); } - enclidx++; TRACE_T1((stderr, "New encoding #%d: '%s' -> '%s'", enclidx, enc, file)); /* The encoding name is optional */ diff -urb --exclude=CVS xdvik-22.40j/texk/xdvik/hypertex.c xdvik-22.40k/texk/xdvik/hypertex.c --- xdvik-22.40j/texk/xdvik/hypertex.c Mon Apr 29 16:24:19 2002 +++ xdvik-22.40k/texk/xdvik/hypertex.c Sun May 12 15:26:10 2002 @@ -933,6 +933,8 @@ HTeX_Anchor *HTeXAp; int i; int x, y, w, h; + /* put_rule will replace values of 0 by 1 */ + int rule_height = (page_h / 1000.0); if (!underline_link) return; @@ -944,16 +946,9 @@ y = pixel_conv(HTeXAp->lly) - 1; w = pixel_conv(HTeXAp->urx) - x + 2; h = pixel_conv(HTeXAp->ury) - y + 2; - /* The last arg of put_rule is whether or not to + /* The first arg of put_rule is whether or not to use the "highlight" graphics context. */ -#ifdef HTEX - put_rule(True, x + 1, y + h, w, 1); -#else - /* put_rule(x, y, w, 1, True); - put_rule(x+w, y, 1, h, True); */ - put_rule(True, x + 1, y + h, w, 1, True); - /* put_rule(x, y+1, 1, h, True); */ -#endif + put_rule(True, x + 1, y + h, w, rule_height); } } @@ -1569,7 +1564,8 @@ if (debug & DBG_HYPER) { fprintf(stderr, "dvi_name for figure_mime_type: %s\n", dvi_name); } - if (strcmp(figure_mime_type(dvi_name), "application/x-dvi") != 0) { + if (strcmp(figure_mime_type(dvi_name), "application/x-dvi") != 0 + && strcmp(figure_mime_type(dvi_name), "application/dvi") != 0) { /* Try other standard extensions: */ if (!invokeviewer(dvi_name)) { /* Set the WWW browser on it: */ diff -urb --exclude=CVS xdvik-22.40j/texk/xdvik/version.h xdvik-22.40k/texk/xdvik/version.h --- xdvik-22.40j/texk/xdvik/version.h Mon Apr 29 16:24:32 2002 +++ xdvik-22.40k/texk/xdvik/version.h Wed May 22 06:57:51 2002 @@ -1,4 +1,4 @@ -#define XDVERSION "22.40j" +#define XDVERSION "22.40k" #ifdef Omega #define TVERSION XDVERSION" for Omega" #else diff -urb --exclude=CVS xdvik-22.40j/texk/xdvik/wwwfetch.c xdvik-22.40k/texk/xdvik/wwwfetch.c --- xdvik-22.40j/texk/xdvik/wwwfetch.c Sat Apr 13 13:37:44 2002 +++ xdvik-22.40k/texk/xdvik/wwwfetch.c Sun May 12 15:26:10 2002 @@ -304,6 +304,10 @@ fprintf(stderr, "fetch_relative_url called: |%s|%s|!\n", base_url ? base_url : "NULL", rel_url); } + + /* SU: to disable all the WWW fetching stuff, activate the following line: */ + /* return -1; */ + /* Step 1: make the relative URL absolute: */ strncpy(buf, rel_url, LINE); /* Put it in buf */ make_absolute(buf, base_url, LINE); diff -urb --exclude=CVS xdvik-22.40j/texk/xdvik/xdvi-search.el xdvik-22.40k/texk/xdvik/xdvi-search.el --- xdvik-22.40j/texk/xdvik/xdvi-search.el Sun Jul 15 10:07:19 2001 +++ xdvik-22.40k/texk/xdvik/xdvi-search.el Wed May 22 06:57:54 2002 @@ -1,9 +1,10 @@ ;;; (X)Emacs frontend to forward search with xdvi(k). +;;; Requires xdvi(k) >= 22.38. ;;; See the section on FORWARD SEARCH in the xdvi man page for more ;;; information on forward and reverse search. ;;; -;;; Preliminary test version by Stefan Ulrich , -;;; 2000/03/13. Tested with Emacs 20.4 and Xemacs 21.1. +;;; Preliminary test version, tested with Emacs 20.4 to 21.2 and Xemacs 21.1 +;;; $Id: xdvi-search.el,v 1.2.4.2 2002/05/22 10:57:54 stefanulrich Exp $ ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License @@ -41,18 +42,17 @@ ;;; a binding to tex-mode-hook: ;;; ;;; (add-hook 'tex-mode-hook (lambda () -;;; (local-set-key "\C-x\C-j" 'xdvi-jump-to-line))) +;;; (local-set-key "\C-c\C-j" 'xdvi-jump-to-line))) ;;; -;;; (without AucTeX, or: -;;; -;;; (add-hook 'LaTeX-mode-hook (lambda () -;;; (local-set-key "\C-x\C-j" 'xdvi-jump-to-line))) -;;; -;;; with AucTeX). +;;; (without AucTeX; use LaTeX-mode-hook instead of tex-mode-hook with AucTeX. +;;; Note that with AucTeX, C-c C-j is already bound to LaTeX-insert-item, so +;;; you might want to use a different key combination instead.) ;;; ;;; - This mode also requires a shell script for starting xdvi (see the variable ;;; "xdvi-script" below); this shellscript is passed 2 arguments: -;;; the argument to `-sourceposition', and the name of the master .dvi file. +;;; the argument to `-sourceposition' (line number and current input file name, +;;; eventually separated by a space, but as one argument), and the name of the +;;; master .dvi file. ;;; Here's a minimal example for such a script: ;;; ;;; #---------- startxdvi begin @@ -67,8 +67,9 @@ ;;; ### ;;; ### customizable variables end ;;; -;;; #XDVI_CALL="$XDVI_EXEC -name xdvi -debug 32768 -sourceposition" ;;; XDVI_CALL="$XDVI_EXEC -name xdvi -sourceposition" +;;; # or, to turn on debugging for inverse search: +;;; # XDVI_CALL="$XDVI_EXEC -name xdvi -debug 32768 -sourceposition" ;;; echo "calling $XDVI_CALL \"$1\" $2" > $XDVI_LOG ;;; $XDVI_CALL "$1" $2 >> $XDVI_LOG 2>&1 & ;;; exit 0 @@ -80,23 +81,86 @@ ;;; on the display). ;;; When using `start-process' instead of `call-process', the child ;;; process seems to get killed by emacs as soon as the parent -;;; exits. Maybe there's an error in how xdvi forks its child. -;;; Suggestions on this are welcome!) +;;; exits. This seems an inevitable consequence of the way how xdvi +;;; forks its child; suggestions on a better workaround are welcome!) ;;; ;;; Please send bug reports, improvements etc. to -;;; . +;;; . ;;; -(defvar xdvi-script "~/shellscripts/startxdvi" +(defvar xdvi-script "startxdvi" "*Name of start script for xdvi.") -(defun xdvi-jump-to-line () - "Call xdvi-script to perform a `forward search' for current file and line number. -See contents of xdvi-script for details. -If AucTeX is used, the value of TeX-master-file is used as filename -for the master .dvi file; else, the return value of xdvi-master-file-name -is used (which see)." +(defun xdvi-jump-to-line-fullpath () + (interactive) + "See `xdvi-jump-to-line' for documentation." + (xdvi-jump-to-line 3)) + +(defun xdvi-jump-to-line-relpath () (interactive) + "See `xdvi-jump-to-line' for documentation." + (xdvi-jump-to-line 2)) + +(defun xdvi-jump-to-line (prefix) + "Call xdvi-script to perform a `forward search' for current file and line number. +The script (and thus xdvi) obtains three pieces of information: + +- the current line number +- the name of the current input file +- the name of the `master' .tex file. + +The last item is used to obtain the name of the .dvi file itself, +which is always derived from TeX's jobname, what we call master +file, following AucTeX's terminology. This filename is either +obtained by using AucTeX's variable `TeX-master-file' or, in case +AucTeX is not being used, by calling `xdvi-master-file-name', a +function which tries to mimick AucTeX's behaviour. + +The line number and current input file is the information +contained in the source specials of the main .dvi file. While the +line number information is straightforward, the input file name +poses a problem: There are several variants of specifying the +input file name in the \\input{...} or \\include{...} commands of +the `parent' .tex file. + +For example, assume that the parent file is in path +`/home/user/tex/diss/' and the file `chapter1' is in the subdirectory +`chapters/'; then the following three variants are all valid ways +of including `chapter1': + + (1) Filename only: \\input{chapter1} + (2) Relative path name: \\input{chapters/chapter1} + (3) Full path name: \\input{/home/user/tex/diss/chapters/chapter1} + +\(The example uses \\input, but \\include would work as well for the +purpose of this example.) + +Note that variant (1) only works if the file `chapter1' is in TeX's +search path; however it's probably the most convenient way of +specifying input files, since there's no need to change the \\input +commands if you move around files or change the directory structure. + +However it's generally quite hard to find out which of these variants +has actually been used in the `parent' .tex file; therefore +`xdvi-jump-to-line' comes in three variants: + +- `xdvi-jump-to-line' for variant (1) above; +- `xdvi-jump-to-line-relpath' for variant (2), and +- `xdvi-jump-to-line-fullpath' for variant (3). + +The second command tries to guess the path component by using the +difference between the current path and the path of the master +.tex file, and the third command uses the full path to the current +file. You'll need to use whichever command matches your favorite +way of specifying additional input files. + +Actually the `fullpath' and `relpath' variants just invoke +`xdvi-jump-to-line' with various prefix arguments, and one could +obtain the same effect by using `xdvi-jump-to-line' interactively with +prefix argument 3 (full path) or 2 (relative path). Without a prefix +argument or with a prefix argument of 1, the default (filename only) +is used." + (interactive "p") (save-excursion (save-restriction (widen) @@ -106,28 +170,36 @@ ;;; middle of a line, so we normalize by going to BOL first and ;;; then adding 1 (curr-line (+ 1 (count-lines (point-min) (point)))) - ;;; name of the `main' .tex file, which is also used as .dvi basename: + ;;; name of master .tex file, to be used as .dvi basename: (master-file (expand-file-name (if (fboundp 'TeX-master-file) (TeX-master-file t) (xdvi-get-masterfile (xdvi-master-file-name))))) ;;; .dvi file name: (dvi-file (concat (file-name-sans-extension master-file) ".dvi")) - ;;; current source file name. - ;;; for use with TeX patch, which always uses full path names: -;;; (filename (expand-file-name (buffer-file-name))) - ;;; for use with srcltx.sty, which uses relative path names or filenames only - ;;; (fix for relative path names by frisk@isy.liu.se): - ;;; if path in master file is shorter than path in buffer file name, use - ;;; the remaining path component of buffer file name; else, use buffer file - ;;; name: - (filename (if (string-match (concat "^" (regexp-quote (file-name-directory master-file))) + ;;; current source file name, depending on how much we want of the path: + (filename + (if (> prefix 1) + (if (> prefix 2) + ;;; full path name, for use with TeX patch and when using the + ;;; full path in \input or \include with srcltx.sty: + (expand-file-name (buffer-file-name)) + ;;; relative path name: if current path and path of master file match partly, + ;;; use the rest of this path; else use buffer name. This can treat both the + ;;; cases when a relative path is used in \input{}, or when just the filename + ;;; is used and the file is located in the current directory (suggested by + ;;; frisk@isy.liu.se). + (if (string-match (concat "^" (regexp-quote (file-name-directory master-file))) (buffer-file-name)) (substring (buffer-file-name) (match-end 0)) - (buffer-file-name)))) + (buffer-file-name))) + ;;; buffer file name without path: + (file-name-nondirectory (buffer-file-name))))) (call-process xdvi-script - nil t nil ;;; src-args + nil t nil ;;; args for -sourceposition: - (concat curr-line " " filename) + ;;; Bug fix by Hans Fredrik Nordhaug , 2001/08/08: + ;;; use `int-to-string curr-line' instead of 'curr-line' + (concat (int-to-string curr-line) " " filename) dvi-file))))) (defun xdvi-get-masterfile (file) diff -urb --exclude=CVS xdvik-22.40j/texk/xdvik/xdvi.c xdvik-22.40k/texk/xdvik/xdvi.c --- xdvik-22.40j/texk/xdvik/xdvi.c Tue Apr 30 13:35:57 2002 +++ xdvik-22.40k/texk/xdvik/xdvi.c Wed May 22 06:57:57 2002 @@ -2268,9 +2268,8 @@ )) { extern char *kpse_bug_address; Printf("xdvi(k) version %s\n", TVERSION); - Printf("Preview a DVI file under the X window system.\n%s\n", - kpse_bug_address); - /* FIXME: add a pointer to the sourceforge bugs page here! */ + Printf("Preview a DVI file under the X window system.\nPlease submit bug reports to:\n\ +http://sourceforge.net/tracker/?group_id=23164&atid=377580\n\n"); usage(); /* Unfortunately this exits with status 1. */ }