unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Robert J. Chassell" <bob@rattlesnake.com>
Subject: Re: INFO on add-ons
Date: Wed, 4 Sep 2002 17:12:53 +0000 (UTC)	[thread overview]
Message-ID: <m17mdi1-000IeGC@localhost> (raw)
In-Reply-To: <200209041549.g84FnQp19483@rum.cs.yale.edu> (monnier+gnu/emacs@rum.cs.yale.edu)

"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> 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 ;;;;;;;;;;;;;;;;

  reply	other threads:[~2002-09-04 17:12 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3D728E82.8000808@cox.net>
2002-09-01 22:16 ` INFO on add-ons Alex Schroeder
2002-09-02 23:49   ` David A. Cobb
     [not found]   ` <3D73F919.5010706@cox.net>
2002-09-03 22:56     ` Alex Schroeder
2002-09-04  0:48       ` Alex Schroeder
2002-09-04  1:39         ` Miles Bader
2002-09-04  4:47           ` Eli Zaretskii
2002-09-04  5:02             ` Miles Bader
2002-09-04  5:06               ` Eli Zaretskii
2002-09-04  5:14                 ` Miles Bader
2002-09-04 13:20                   ` Eli Zaretskii
2002-09-04 13:34                     ` Miles Bader
2002-09-05  4:46                       ` Eli Zaretskii
2002-09-05 12:09                         ` Valdis.Kletnieks
2002-09-05 14:52                         ` Robert J. Chassell
2002-09-04 22:40           ` Alex Schroeder
2002-09-05  2:46           ` Richard Stallman
2002-09-07  7:44           ` Pavel Janík
2002-09-04  4:44         ` Eli Zaretskii
2002-09-04 12:13         ` Robert J. Chassell
2002-09-04  4:42       ` Eli Zaretskii
2002-09-02  1:08 ` Stephen J. Turnbull
     [not found] ` <87ptvxxkoj.fsf@tleepslib.sk.tsukuba.ac.jp>
2002-09-02  1:36   ` Miles Bader
     [not found]   ` <buok7m5jhpm.fsf@mcspd15.ucom.lsi.nec.co.jp>
2002-09-02  4:51     ` Stephen J. Turnbull
     [not found]     ` <87fzwtxad9.fsf@tleepslib.sk.tsukuba.ac.jp>
2002-09-02  5:04       ` Miles Bader
     [not found]       ` <buoelcdj82q.fsf@mcspd15.ucom.lsi.nec.co.jp>
2002-09-02  6:03         ` Stephen J. Turnbull
2002-09-02 23:47           ` David A. Cobb
     [not found]           ` <3D73F89D.2070106@cox.net>
2002-09-03  4:16             ` "Extreme Documentation" [was: INFO on add-ons] Stephen J. Turnbull
2002-09-03 15:49               ` David A. Cobb
2002-09-03 19:05               ` Thien-Thi Nguyen
2002-09-04  3:51                 ` Stephen J. Turnbull
2002-09-04  5:58                   ` Thien-Thi Nguyen
2002-09-03 13:26           ` INFO on add-ons Richard Stallman
2002-09-03 15:43             ` Stephen J. Turnbull
2002-09-03 16:30               ` Robert J. Chassell
2002-09-03 17:33                 ` Henrik Enberg
2002-09-03 17:58                   ` Miles Bader
2002-09-03 20:54                     ` Kai Großjohann
2002-09-03 20:54                   ` Kai Großjohann
2002-09-02 23:40       ` David A. Cobb
     [not found]       ` <3D73F6D1.7010002@cox.net>
2002-09-03  4:42         ` Stephen J. Turnbull
2002-09-03 15:39           ` David A. Cobb
2002-09-03 16:23             ` Robert J. Chassell
2002-09-03 22:23               ` David A. Cobb
2002-09-04  1:18               ` Miles Bader
2002-09-04  3:39                 ` Stephen J. Turnbull
2002-09-04  3:46                   ` Miles Bader
2002-09-04  7:23                     ` Stephen J. Turnbull
2002-09-05  2:17                       ` Karl Eichwalder
2002-09-04 14:38                   ` Robert J. Chassell
2002-09-04 17:42                     ` Ville Skyttä
2002-09-04 22:14                       ` Robert J. Chassell
2002-09-05  2:53                     ` Stephen J. Turnbull
2002-09-05 13:37                       ` Robert J. Chassell
2002-09-06  2:40                         ` Stephen J. Turnbull
2002-09-06 12:18                           ` Robert J. Chassell
2002-09-06 13:30                             ` Miles Bader
2002-09-06 20:03                           ` Richard Stallman
2002-09-05 13:54                       ` Robert J. Chassell
2002-09-05 20:16                         ` Ville Skyttä
2002-09-04 15:49                   ` Stefan Monnier
2002-09-04 17:12                     ` Robert J. Chassell [this message]
2002-09-04 18:22                     ` Ville Skyttä
2002-09-05  1:48                       ` Miles Bader
2002-09-05  2:32                         ` Karl Eichwalder
2002-09-05  4:51                           ` Eli Zaretskii
2002-09-05  6:00                             ` Karl Eichwalder
2002-09-05 13:25                           ` Robert J. Chassell
2002-09-05  4:48                         ` Eli Zaretskii
2002-09-05  4:22                     ` Stephen J. Turnbull
2002-09-05 18:02                     ` Richard Stallman
2002-09-06  1:19                       ` Miles Bader
2002-09-06 20:03                         ` Richard Stallman
2002-09-04  4:44                 ` Eli Zaretskii
2002-09-04 12:29                 ` Robert J. Chassell
2002-09-05  2:46                 ` Richard Stallman
2002-09-02 23:22   ` David A. Cobb
2002-09-02 14:53 ` Richard Stallman
2002-09-02 23:59   ` David A. Cobb
2002-09-01 22:02 David A. Cobb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m17mdi1-000IeGC@localhost \
    --to=bob@rattlesnake.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).