From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Robert J. Chassell" Newsgroups: gmane.emacs.devel Subject: Re: INFO on add-ons Date: Wed, 4 Sep 2002 17:12:53 +0000 (UTC) Sender: emacs-devel-admin@gnu.org Message-ID: References: <3D728E82.8000808@cox.net> <87ptvxxkoj.fsf@tleepslib.sk.tsukuba.ac.jp> <87fzwtxad9.fsf@tleepslib.sk.tsukuba.ac.jp> <3D73F6D1.7010002@cox.net> <874rd7wuos.fsf@tleepslib.sk.tsukuba.ac.jp> <3D74D797.7000707@cox.net> <87bs7etocv.fsf@tleepslib.sk.tsukuba.ac.jp> <200209041549.g84FnQp19483@rum.cs.yale.edu> Reply-To: bob@rattlesnake.com NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1031159550 22915 127.0.0.1 (4 Sep 2002 17:12:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 4 Sep 2002 17:12:30 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17mdha-0005xQ-00 for ; Wed, 04 Sep 2002 19:12:26 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17meGr-0004nc-00 for ; Wed, 04 Sep 2002 19:48:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17mdj6-0008Ml-00; Wed, 04 Sep 2002 13:14:00 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17mdi9-0008HR-00 for emacs-devel@gnu.org; Wed, 04 Sep 2002 13:13:01 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17mdi5-0008Fg-00 for emacs-devel@gnu.org; Wed, 04 Sep 2002 13:13:00 -0400 Original-Received: from megalith.rattlesnake.com ([140.186.114.245] helo=localhost) by monty-python.gnu.org with esmtp (Exim 4.10) id 17mdi3-0008FX-00 for emacs-devel@gnu.org; Wed, 04 Sep 2002 13:12:56 -0400 Original-Received: by rattlesnake.com via sendmail from stdin id (Debian Smail3.2.0.114) Wed, 4 Sep 2002 17:12:53 +0000 (UTC) Original-To: emacs-devel@gnu.org, In-Reply-To: <200209041549.g84FnQp19483@rum.cs.yale.edu> (monnier+gnu/emacs@rum.cs.yale.edu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:7475 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:7475 "Stefan Monnier" wrote: If you say WYSIWYG, you know that it is very difficult to reconcile with the purpose of TeXinfo which is to concentrate on the intent and allow many *different* output formats. Yes. One way to think about this is that the Texinfo source provides the `deep structure' of a document, while the various output formats provide `surface representations'. A while back, I wrote a little package, very brittle, that showed three of the output formats you could produce from a Texinfo file that you are working on: Info in GNU Emacs, HTML in a Web browser, and DVI in an xdvi window. I ended up not caring for it; I am happy enough copying the necessary shell commands to a xterm and generating the output that way. But it is an interesting idea. Here is the code, if anyone wants to try it or improve on it. As I said this is brittle and has a hard time with errors. Your Texinfo source must format without reported error. ;;;; texinfo-split-screen.el ;;;; 2002 Jun 5 ;;;; Robert J. Chassell, bob@gnu.org ;;;; low alpha quality at the moment. ;;;; Does NOT report errors well..... :-( ;; To use this, start GNU Emacs with two frames. Load this file. ;; Find the Texinfo file on which you are working in one frame. ;; Invoke `M-x texinfo-split-screen' on that Texinfo file. ;; The dvi file and the Web browser file will appear, but at the ;; beginning of the document. The Info file will appear in the other ;; window at the beginning of the node where you are located in the ;; Texinfo file. ;; At the moment, we need the ;; (sit-for 1) ;; (message "current-nodename --> %s and info-place --> %s" ;; current-nodename info-place) ;; (sleep-for 3) ;; so that the `makeinfo --no-split --paragraph-indent=0 --verbose' ;; process has an opportunity to complete before Info is run on the ;; resulting .info file. This should be changed so that Info is run ;; only after the `makeinfo' process completes. ;; The trouble with the following `add-hook' is that it runs ;; `texinfo-split-screen' after *every* save, not just after ;; saves for the Texinfo file.... :-) So it is no good. ;; (add-hook 'after-save-hook 'texinfo-split-screen) (defun texinfo-split-screen () "Update Info, HTML, and DVI outputs of current Texinfo buffer." (interactive) (widen) (let ((split-screen-current-buffer (buffer-name))) (set-buffer split-screen-current-buffer) (let ((current-process-list (process-list))) (while current-process-list (if (equal "texi2dvi" (substring (process-name (car current-process-list)) 0 8)) (kill-process (car current-process-list))) (setq current-process-list (cdr current-process-list)))) ;; remove following files first: ;; *.dvi *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr (apply 'start-process ;; NAME for the process (concat "rm " (file-name-sans-extension (buffer-file-name)) ".toc" " " (file-name-sans-extension (buffer-file-name)) ".aux") nil ; BUFFER "rm" ; PROGRAM ;; ARGs to PROGRAM (list (concat (file-name-sans-extension (buffer-file-name)) ".toc") (concat (file-name-sans-extension (buffer-file-name)) ".aux")) ) (apply 'start-process (concat "texi2dvi " (buffer-file-name)) ; NAME for the process nil ; BUFFER "texi2dvi" ; PROGRAM (list (buffer-file-name)) ; ARGs to PROGRAM ) (texinfo-split-screen-view-xdvi (concat (file-name-sans-extension (buffer-file-name)) ".dvi")) (set-buffer split-screen-current-buffer) (apply 'start-process ;; NAME for the process (concat "makeinfo --html --no-split --verbose " (buffer-file-name)) nil ; BUFFER "makeinfo" ; PROGRAM ;; ARGs to PROGRAM (list "--html" "--no-split" "--verbose" (buffer-file-name)) ) (let ((current-process-list (process-list))) (while current-process-list (if (equal "galeon" (substring (process-name (car (process-list))) 0 6)) (kill-process (car current-process-list))) (setq current-process-list (cdr current-process-list)))) (let ((browse-url-new-window-flag -1)) (texinfo-split-screen-view-HTML (concat (file-name-sans-extension (buffer-file-name)) ".html"))) (sit-for 1) (set-buffer split-screen-current-buffer) (let ((info-file-creation-process (apply 'start-process (concat ; NAME for the process "makeinfo --no-split --paragraph-indent=0 --verbose " (buffer-file-name)) nil ; BUFFER "makeinfo" ; PROGRAM (list ; ARGs to PROGRAM "--no-split" "--paragraph-indent=0" "--verbose" (buffer-file-name))))) (setq info-file-creation-process-name (process-name info-file-creation-process))) (message "sit-for 5") (sit-for 5) (if (eq (process-status info-file-creation-process-name) nil) ;; start Info reader (progn (or (functionp 'texinfo-copy-node-name) (require 'texnfo-upd)) (let* ((current-location (point)) (current-nodename (if (re-search-backward "^@node" (point-min) t) (texinfo-copy-node-name) "Top")) (current-filename (progn (goto-char (point-min)) (search-forward "@setfilename ") (expand-file-name (buffer-substring (point) (save-excursion (end-of-line) (point)))))) (info-place (concat "(" current-filename ")" current-nodename))) (goto-char current-location) (sit-for 1) (message "current-nodename --> %s and info-place --> %s" current-nodename info-place) (sleep-for 3) (texinfo-split-screen-info info-place)) )))) (defun texinfo-split-screen-view-xdvi (xdvifile) "Ask xdvi to view a .dvi file." (interactive "fxdvi file: ") ;; -sourceposition line[:col][ ]filename (defvar xdvi-process-name "xdvi-process-holder") (if (eq (process-status xdvi-process-name) nil) ;; start xdvi (let ((process (apply 'start-process (concat "xdvi " xdvifile) ; NAME for the process nil ; BUFFER "xdvi" ; PROGRAM (list xdvifile) ; ARGs to PROGRAM ))) (setq xdvi-process-name (process-name process))) ;; else (continue-process xdvi-process-name))) (defun texinfo-split-screen-view-HTML (htmlfile) "Ask Galeon to view an HTML file." (interactive "fHTML file: ") (defvar galeon-process-name "galeon-process-holder") (if (eq (process-status galeon-process-name) nil) ;; start galeon (let ((process (apply 'start-process (concat "galeon " htmlfile) ; NAME for the process nil ; BUFFER "galeon" ; PROGRAM (list htmlfile) ; ARGs to PROGRAM ))) (setq galeon-process-name (process-name process))) ;; else (continue-process galeon-process-name))) (defun texinfo-split-screen-info (file) "For texinfo-split-screen, enter Info in another window." (if (buffer-live-p (get-buffer "*info*")) (kill-buffer (get-buffer "*info*"))) ;; (message " sleep 2 then go to other frame") ;; (sleep-for 2) (other-frame 1) (get-buffer "*info*") (switch-to-buffer "*info*") (Info-goto-node file)) ;;;;;;;;;;;;;;;; end texinfo-split-screen.el ;;;;;;;;;;;;;;;;