Mercurial > hgrepos > hgweb.cgi > yatex
comparison yatexprc.el @ 328:d972598d233b dev
Prefix-arg for YaTeX-preview runs default previewer without inquiry
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Thu, 13 Nov 2014 09:00:50 +0900 |
parents | d989511a492a |
children | 91ba61bb536e |
comparison
equal
deleted
inserted
replaced
327:2bc5b59840d5 | 328:d972598d233b |
---|---|
1 ;;; yatexprc.el --- YaTeX process handler | 1 ;;; yatexprc.el --- YaTeX process handler |
2 ;;; | 2 ;;; |
3 ;;; (c)1993-2013 by HIROSE Yuuji.[yuuji@yatex.org] | 3 ;;; (c)1993-2013 by HIROSE Yuuji.[yuuji@yatex.org] |
4 ;;; Last modified Wed Nov 5 09:07:25 2014 on firestorm | 4 ;;; Last modified Thu Nov 13 08:49:02 2014 on firestorm |
5 ;;; $Id$ | 5 ;;; $Id$ |
6 | 6 |
7 ;;; Code: | 7 ;;; Code: |
8 ;(require 'yatex) | 8 ;(require 'yatex) |
9 (require 'yatexlib) | 9 (require 'yatexlib) |
600 "Holds minibuffer history of preview command.") | 600 "Holds minibuffer history of preview command.") |
601 (put 'YaTeX-preview-command-history 'no-default t) | 601 (put 'YaTeX-preview-command-history 'no-default t) |
602 (defvar YaTeX-preview-file-history nil | 602 (defvar YaTeX-preview-file-history nil |
603 "Holds minibuffer history of file to preview.") | 603 "Holds minibuffer history of file to preview.") |
604 (put 'YaTeX-preview-file-history 'no-default t) | 604 (put 'YaTeX-preview-file-history 'no-default t) |
605 (defun YaTeX-preview (preview-command preview-file) | 605 (defun YaTeX-preview-default-previewer () |
606 "Execute xdvi (or other) to tex-preview." | 606 "Return default previewer for this document" |
607 (interactive | 607 (YaTeX-replace-format |
608 (let* ((command (read-string-with-history | |
609 "Preview command: " | |
610 (YaTeX-replace-format | |
611 (or (YaTeX-get-builtin "PREVIEW") | 608 (or (YaTeX-get-builtin "PREVIEW") |
612 (if (eq (get 'dvi2-command 'format) 'pdf) | 609 (if (eq (get 'dvi2-command 'format) 'pdf) |
613 tex-pdfview-command | 610 tex-pdfview-command |
614 dvi2-command)) | 611 dvi2-command)) |
615 "p" (format (cond | 612 "p" (format (cond |
616 (YaTeX-dos "-y:%s") | 613 (YaTeX-dos "-y:%s") |
617 (t "-paper %s")) | 614 (t "-paper %s")) |
618 (YaTeX-get-paper-type))) | 615 (YaTeX-get-paper-type)))) |
619 'YaTeX-preview-command-history)) | 616 (defun YaTeX-preview-default-main (command) |
620 (file (read-string-with-history | 617 "Return default preview target file" |
621 "Preview file: " | 618 (if (get 'dvi2-command 'region) |
622 (if (get 'dvi2-command 'region) | |
623 (substring YaTeX-texput-file | 619 (substring YaTeX-texput-file |
624 0 (rindex YaTeX-texput-file ?.)) | 620 0 (rindex YaTeX-texput-file ?.)) |
625 (YaTeX-get-preview-file-name command)) | 621 (YaTeX-get-preview-file-name command))) |
626 'YaTeX-preview-file-history))) | 622 (defun YaTeX-preview (preview-command preview-file &optional as-default) |
623 "Execute xdvi (or other) to tex-preview." | |
624 (interactive | |
625 (let* ((previewer (YaTeX-preview-default-previewer)) | |
626 (as-default current-prefix-arg) | |
627 (command (if as-default | |
628 previewer | |
629 (read-string-with-history | |
630 "Preview command: " | |
631 previewer | |
632 'YaTeX-preview-command-history))) | |
633 (target (YaTeX-preview-default-main command)) | |
634 (file (if as-default | |
635 target | |
636 (read-string-with-history | |
637 "Preview file: " | |
638 target | |
639 'YaTeX-preview-file-history)))) | |
627 (list command file))) | 640 (list command file))) |
628 (setq dvi2-command preview-command) ;`dvi2command' is buffer local | 641 (setq dvi2-command preview-command) ;`dvi2-command' is buffer local |
629 (save-excursion | 642 (save-excursion |
630 (YaTeX-visit-main t) | 643 (YaTeX-visit-main t) |
631 (if YaTeX-dos (setq preview-file (expand-file-name preview-file))) | 644 (if YaTeX-dos (setq preview-file (expand-file-name preview-file))) |
632 (let ((pbuffer "*dvi-preview*") (dir default-directory)) | 645 (let ((pbuffer "*dvi-preview*") (dir default-directory)) |
633 (YaTeX-showup-buffer | 646 (YaTeX-showup-buffer |