unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* makeinfo-buffer master file
@ 2004-02-16  0:45 Kevin Ryde
  0 siblings, 0 replies; only message in thread
From: Kevin Ryde @ 2004-02-16  0:45 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

This is a further proposal for makeinfo-buffer,

	* textmodes/makeinfo.el (makeinfo-buffer): Look for TeX-master
	variable to indicate top-level texi file.

I've been using this with the Guile manual.  I know tex-main-file is
checked by tex-mode, I wasn't sure whether TeX-master or tex-main-file
or both should be used.  I went with TeX-master because that's what
Guile has currently.


[-- Attachment #2: makeinfo.el.master.diff --]
[-- Type: text/plain, Size: 3583 bytes --]

*** makeinfo.el.~1.16.~	Sat Sep  6 08:16:12 2003
--- makeinfo.el	Wed Jan 21 17:50:17 2004
*************** (defun makeinfo-current-node ()
*** 219,257 ****
  
  (defun makeinfo-buffer ()
    "Make Info file from current buffer.
! 
! Use the \\[next-error] command to move to the next error
! \(if there are errors\)."
  
    (interactive)
!   (cond ((null buffer-file-name)
           (error "Buffer not visiting any file"))
          ((buffer-modified-p)
           (if (y-or-n-p "Buffer modified; do you want to save it? ")
               (save-buffer))))
  
!   ;; Find and record the Info filename,
!   ;; or else explain that a filename is needed.
!   (save-excursion
!     (goto-char (point-min))
!     (let ((search-end (save-excursion (forward-line 100) (point))))
!       (if (re-search-forward
!            "^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
!            search-end t)
!           (setq makeinfo-output-file-name
!                 (expand-file-name
!                  (buffer-substring (match-beginning 1) (match-end 1))))
!         (error
!          "The texinfo file needs a line saying: @setfilename <name>"))))
!   (setq makeinfo-output-node-name (makeinfo-current-node))
! 
!   (save-excursion
!     (makeinfo-compile
!      (concat makeinfo-run-command " " makeinfo-options
!              " " buffer-file-name)
!      "No more errors."
!      t
!      'makeinfo-compilation-sentinel-buffer)))
  
  (defun makeinfo-compilation-sentinel-buffer (proc msg)
    "Sentinel for `makeinfo-compile' run from `makeinfo-buffer'."
--- 219,268 ----
  
  (defun makeinfo-buffer ()
    "Make Info file from current buffer.
! Use the \\[next-error] command to move through errors (if any).
! Set a `TeX-master' local variable to indicate the top-level file for a
! multi-file document."
  
    (interactive)
!   (cond ((boundp 'TeX-master)
!          (save-some-buffers))  ;; buffers might be holding sub-files
!         ((null buffer-file-name)
           (error "Buffer not visiting any file"))
          ((buffer-modified-p)
           (if (y-or-n-p "Buffer modified; do you want to save it? ")
               (save-buffer))))
  
!   (let ((master (if (boundp 'TeX-master) TeX-master buffer-file-name)))
! 
!     ;; Find and record the Info filename,
!     ;; or else explain that a filename is needed.
!     ;; If the master file is not in a buffer then it's only visited
!     ;; temporarily, so as not to junk up the user's buffer list.
!     (save-excursion
!       (let ((buf (get-file-buffer master)))
!         (if buf
!             (set-buffer buf)
!           (find-file master))
!         (goto-char (point-min))
!         (unwind-protect
!             (let ((search-end (save-excursion (forward-line 100) (point))))
!               (if (re-search-forward
!                    "^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
!                    search-end t)
!                   (setq makeinfo-output-file-name
!                         (expand-file-name
!                          (buffer-substring (match-beginning 1) (match-end 1))))
!                 (error "%s needs a line saying: @setfilename <name>" master)))
!           (unless buf (kill-buffer nil)))))
! 
!     (setq makeinfo-output-node-name (makeinfo-current-node))
! 
!     (save-excursion
!       (makeinfo-compile
!        (concat makeinfo-run-command " " makeinfo-options " " master)
!        "No more errors."
!        t
!        'makeinfo-compilation-sentinel-buffer))))
  
  (defun makeinfo-compilation-sentinel-buffer (proc msg)
    "Sentinel for `makeinfo-compile' run from `makeinfo-buffer'."

[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-02-16  0:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-16  0:45 makeinfo-buffer master file Kevin Ryde

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).