1995-10-30 17:35:01 +00:00
|
|
|
|
;;; makeinfo.el --- run makeinfo conveniently
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
2016-01-01 01:16:19 -08:00
|
|
|
|
;; Copyright (C) 1991, 1993, 2001-2016 Free Software Foundation, Inc.
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
2003-02-04 13:30:45 +00:00
|
|
|
|
;; Author: Robert J. Chassell
|
2014-02-09 17:34:22 -08:00
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
2001-08-06 10:12:17 +00:00
|
|
|
|
;; Keywords: docs convenience
|
1995-10-30 17:35:01 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
2008-05-06 04:34:22 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1993-06-21 06:45:33 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 04:34:22 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2008-05-06 04:34:22 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;;; The Texinfo mode `makeinfo' related commands are:
|
|
|
|
|
|
|
|
|
|
;; makeinfo-region to run makeinfo on the current region.
|
|
|
|
|
;; makeinfo-buffer to run makeinfo on the current buffer, or
|
|
|
|
|
;; with optional prefix arg, on current region
|
|
|
|
|
;; kill-compilation to kill currently running makeinfo job
|
|
|
|
|
;; makeinfo-recenter-makeinfo-buffer to redisplay *compilation* buffer
|
|
|
|
|
|
|
|
|
|
;;; Keybindings (defined in `texinfo.el')
|
|
|
|
|
|
|
|
|
|
;; makeinfo bindings
|
|
|
|
|
; (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
|
|
|
|
|
; (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
|
|
|
|
|
; (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
|
|
|
|
|
; (define-key texinfo-mode-map "\C-c\C-m\C-l"
|
|
|
|
|
; 'makeinfo-recenter-compilation-buffer)
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
;;; Variables used by `makeinfo'
|
|
|
|
|
|
|
|
|
|
(require 'compile)
|
2002-12-22 22:05:16 +00:00
|
|
|
|
(require 'info)
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
2005-08-31 10:26:53 +00:00
|
|
|
|
(defvar tex-end-of-header)
|
|
|
|
|
(defvar tex-start-of-header)
|
|
|
|
|
|
|
|
|
|
|
1997-04-12 03:18:33 +00:00
|
|
|
|
(defgroup makeinfo nil
|
2005-07-04 03:30:49 +00:00
|
|
|
|
"Run makeinfo conveniently."
|
1997-04-12 03:18:33 +00:00
|
|
|
|
:group 'docs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defcustom makeinfo-run-command "makeinfo"
|
Remove leading `*' from docs of some defcustoms etc.
* emulation/crisp.el, emulation/cua-base.el, emulation/edt.el:
* emulation/pc-select.el, emulation/vip.el, international/iso-ascii.el:
* international/kkc.el, international/ogonek.el, mail/feedmail.el:
* net/browse-url.el, net/eudc-vars.el, net/net-utils.el:
* net/rcompile.el, net/rlogin.el, textmodes/enriched.el:
* textmodes/makeinfo.el, textmodes/page-ext.el, textmodes/picture.el:
* textmodes/refer.el, textmodes/spell.el, textmodes/table.el:
* textmodes/tex-mode.el, textmodes/two-column.el:
Remove leading `*' from docs of defcustoms etc.
2010-09-22 23:42:45 -07:00
|
|
|
|
"Command used to run `makeinfo' subjob.
|
1997-04-12 03:18:33 +00:00
|
|
|
|
The name of the file is appended to this string, separated by a space."
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'makeinfo)
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
1997-04-12 03:18:33 +00:00
|
|
|
|
(defcustom makeinfo-options "--fill-column=70"
|
Remove leading `*' from docs of some defcustoms etc.
* emulation/crisp.el, emulation/cua-base.el, emulation/edt.el:
* emulation/pc-select.el, emulation/vip.el, international/iso-ascii.el:
* international/kkc.el, international/ogonek.el, mail/feedmail.el:
* net/browse-url.el, net/eudc-vars.el, net/net-utils.el:
* net/rcompile.el, net/rlogin.el, textmodes/enriched.el:
* textmodes/makeinfo.el, textmodes/page-ext.el, textmodes/picture.el:
* textmodes/refer.el, textmodes/spell.el, textmodes/table.el:
* textmodes/tex-mode.el, textmodes/two-column.el:
Remove leading `*' from docs of defcustoms etc.
2010-09-22 23:42:45 -07:00
|
|
|
|
"String containing options for running `makeinfo'.
|
1993-06-21 06:45:33 +00:00
|
|
|
|
Do not include `--footnote-style' or `--paragraph-indent';
|
|
|
|
|
the proper way to specify those is with the Texinfo commands
|
Fix minor quoting problems in doc strings
These were glitches regardless of how or whether we tackle the
problem of grave accent in doc strings.
* lisp/calc/calc-aent.el (math-restore-placeholders):
* lisp/ido.el (ido-ignore-buffers, ido-ignore-files):
* lisp/leim/quail/cyrillic.el ("bulgarian-alt-phonetic"):
* lisp/leim/quail/hebrew.el ("hebrew-new")
("hebrew-biblical-sil"):
* lisp/leim/quail/thai.el ("thai-kesmanee"):
* lisp/progmodes/idlw-shell.el (idlwave-shell-file-name-chars):
Used curved quotes to avoid ambiguities like ‘`''’ in doc strings.
* lisp/calendar/calendar.el (calendar-month-abbrev-array):
* lisp/cedet/semantic/mru-bookmark.el (semantic-mrub-cache-flush-fcn):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-copy)
(semantic-tag-components):
* lisp/cedet/srecode/cpp.el (srecode-semantic-handle-:cpp):
* lisp/cedet/srecode/texi.el (srecode-texi-texify-docstring):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-all-constp):
* lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-engine):
* lisp/emacs-lisp/generator.el (iter-next):
* lisp/gnus/gnus-art.el (gnus-treat-strip-list-identifiers)
(gnus-article-mode-syntax-table):
* lisp/net/rlogin.el (rlogin-directory-tracking-mode):
* lisp/net/soap-client.el (soap-wsdl-get):
* lisp/net/telnet.el (telnet-mode):
* lisp/org/org-compat.el (org-number-sequence):
* lisp/org/org.el (org-remove-highlights-with-change)
(org-structure-template-alist):
* lisp/org/ox-html.el (org-html-link-org-files-as-html):
* lisp/play/handwrite.el (handwrite-10pt, handwrite-11pt)
(handwrite-12pt, handwrite-13pt):
* lisp/progmodes/f90.el (f90-mode, f90-abbrev-start):
* lisp/progmodes/idlwave.el (idlwave-mode, idlwave-check-abbrev):
* lisp/progmodes/verilog-mode.el (verilog-tool)
(verilog-string-replace-matches, verilog-preprocess)
(verilog-auto-insert-lisp, verilog-auto-insert-last):
* lisp/textmodes/makeinfo.el (makeinfo-options):
* src/font.c (Ffont_spec):
Fix minor quoting problems in doc strings, e.g., missing quote,
``x'' where `x' was meant, etc.
* lisp/erc/erc-backend.el (erc-process-sentinel-2):
Fix minor quoting problem in other string.
* lisp/leim/quail/ethiopic.el ("ethiopic"):
* lisp/term/tvi970.el (tvi970-set-keypad-mode):
Omit unnecessary quotes.
* lisp/faces.el (set-face-attribute, set-face-underline)
(set-face-inverse-video, x-create-frame-with-faces):
* lisp/gnus/gnus-group.el (gnus-group-nnimap-edit-acl):
* lisp/mail/supercite.el (sc-attribs-%@-addresses)
(sc-attribs-!-addresses, sc-attribs-<>-addresses):
* lisp/net/tramp.el (tramp-methods):
* lisp/recentf.el (recentf-show-file-shortcuts-flag):
* lisp/textmodes/artist.el (artist-ellipse-right-char)
(artist-ellipse-left-char, artist-vaporize-fuzziness)
(artist-spray-chars, artist-mode, artist-replace-string)
(artist-put-pixel, artist-text-see-thru):
* lisp/vc/ediff-util.el (ediff-submit-report):
* lisp/vc/log-edit.el (log-edit-changelog-full-paragraphs):
Use double-quotes rather than TeX markup in doc strings.
* lisp/skeleton.el (skeleton-pair-insert-maybe):
Reword to avoid the need for grave accent and apostrophe.
* lisp/xt-mouse.el (xterm-mouse-tracking-enable-sequence):
Don't use grave and acute accents to quote.
2015-05-19 14:59:15 -07:00
|
|
|
|
`@footnotestyle' and `@paragraphindent'."
|
1997-04-12 03:18:33 +00:00
|
|
|
|
:type 'string
|
|
|
|
|
:group 'makeinfo)
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
|
|
|
|
(require 'texinfo)
|
|
|
|
|
|
|
|
|
|
(defvar makeinfo-compilation-process nil
|
|
|
|
|
"Process that runs `makeinfo'. Should start out nil.")
|
|
|
|
|
|
|
|
|
|
(defvar makeinfo-temp-file nil
|
|
|
|
|
"Temporary file name used for text being sent as input to `makeinfo'.")
|
|
|
|
|
|
|
|
|
|
(defvar makeinfo-output-file-name nil
|
|
|
|
|
"Info file name used for text output by `makeinfo'.")
|
|
|
|
|
|
2002-12-22 22:05:16 +00:00
|
|
|
|
(defvar makeinfo-output-node-name nil
|
|
|
|
|
"Node name to visit in output file, for `makeinfo-buffer'.")
|
|
|
|
|
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
|
|
|
|
;;; The `makeinfo' function definitions
|
|
|
|
|
|
|
|
|
|
(defun makeinfo-region (region-beginning region-end)
|
|
|
|
|
"Make Info file from region of current Texinfo file, and switch to it.
|
|
|
|
|
|
|
|
|
|
This command does not offer the `next-error' feature since it would
|
|
|
|
|
apply to a temporary file, not the original; use the `makeinfo-buffer'
|
|
|
|
|
command to gain use of `next-error'."
|
2003-02-04 13:30:45 +00:00
|
|
|
|
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(interactive "r")
|
|
|
|
|
(let (filename-or-header
|
|
|
|
|
filename-or-header-beginning
|
|
|
|
|
filename-or-header-end)
|
|
|
|
|
;; Cannot use `let' for makeinfo-temp-file or
|
|
|
|
|
;; makeinfo-output-file-name since `makeinfo-compilation-sentinel'
|
|
|
|
|
;; needs them.
|
|
|
|
|
|
|
|
|
|
(setq makeinfo-temp-file
|
|
|
|
|
(concat
|
1999-10-15 16:03:59 +00:00
|
|
|
|
(make-temp-file
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(substring (buffer-file-name)
|
2003-02-04 13:30:45 +00:00
|
|
|
|
0
|
|
|
|
|
(or (string-match "\\.tex" (buffer-file-name))
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(length (buffer-file-name)))))
|
|
|
|
|
".texinfo"))
|
2003-02-04 13:30:45 +00:00
|
|
|
|
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(let ((search-end (save-excursion (forward-line 100) (point))))
|
|
|
|
|
;; Find and record the Info filename,
|
|
|
|
|
;; or else explain that a filename is needed.
|
2003-02-04 13:30:45 +00:00
|
|
|
|
(if (re-search-forward
|
1993-06-21 06:45:33 +00:00
|
|
|
|
"^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
|
|
|
|
|
search-end t)
|
2003-02-04 13:30:45 +00:00
|
|
|
|
(setq makeinfo-output-file-name
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(buffer-substring (match-beginning 1) (match-end 1)))
|
|
|
|
|
(error
|
|
|
|
|
"The texinfo file needs a line saying: @setfilename <name>"))
|
|
|
|
|
|
|
|
|
|
;; Find header and specify its beginning and end.
|
|
|
|
|
(goto-char (point-min))
|
2003-02-04 13:30:45 +00:00
|
|
|
|
(if (and
|
|
|
|
|
(prog1
|
1994-04-12 14:58:14 +00:00
|
|
|
|
(search-forward tex-start-of-header search-end t)
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(beginning-of-line)
|
|
|
|
|
;; Mark beginning of header.
|
|
|
|
|
(setq filename-or-header-beginning (point)))
|
2003-02-04 13:30:45 +00:00
|
|
|
|
(prog1
|
1994-04-12 14:58:14 +00:00
|
|
|
|
(search-forward tex-end-of-header nil t)
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(beginning-of-line)
|
|
|
|
|
;; Mark end of header
|
|
|
|
|
(setq filename-or-header-end (point))))
|
2003-02-04 13:30:45 +00:00
|
|
|
|
|
1993-06-21 06:45:33 +00:00
|
|
|
|
;; Insert the header into the temporary file.
|
|
|
|
|
(write-region
|
|
|
|
|
(min filename-or-header-beginning region-beginning)
|
|
|
|
|
filename-or-header-end
|
|
|
|
|
makeinfo-temp-file nil nil)
|
2003-02-04 13:30:45 +00:00
|
|
|
|
|
1993-06-21 06:45:33 +00:00
|
|
|
|
;; Else no header; insert @filename line into temporary file.
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(search-forward "@setfilename" search-end t)
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(setq filename-or-header-beginning (point))
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(setq filename-or-header-end (point))
|
|
|
|
|
(write-region
|
|
|
|
|
(min filename-or-header-beginning region-beginning)
|
|
|
|
|
filename-or-header-end
|
|
|
|
|
makeinfo-temp-file nil nil))
|
2003-02-04 13:30:45 +00:00
|
|
|
|
|
1993-06-21 06:45:33 +00:00
|
|
|
|
;; Insert the region into the file.
|
|
|
|
|
(write-region
|
|
|
|
|
(max region-beginning filename-or-header-end)
|
|
|
|
|
region-end
|
|
|
|
|
makeinfo-temp-file t nil)
|
|
|
|
|
|
|
|
|
|
;; Run the `makeinfo-compile' command in the *compilation* buffer
|
|
|
|
|
(save-excursion
|
|
|
|
|
(makeinfo-compile
|
|
|
|
|
(concat makeinfo-run-command
|
|
|
|
|
" "
|
|
|
|
|
makeinfo-options
|
2003-02-04 13:30:45 +00:00
|
|
|
|
" "
|
1993-06-21 06:45:33 +00:00
|
|
|
|
makeinfo-temp-file)
|
2005-08-27 16:11:44 +00:00
|
|
|
|
t
|
2002-12-22 22:05:16 +00:00
|
|
|
|
'makeinfo-compilation-sentinel-region)))))))
|
1993-06-21 06:59:02 +00:00
|
|
|
|
|
2005-08-27 16:11:44 +00:00
|
|
|
|
(defun makeinfo-next-error (arg reset)
|
|
|
|
|
"This function is used to disable `next-error' if the user has
|
|
|
|
|
used `makeinfo-region'. Since the compilation process is used on
|
|
|
|
|
a temporary file in that case, calling `next-error' would give
|
|
|
|
|
nonsensical results."
|
|
|
|
|
(error "Use `makeinfo-buffer' to gain use of the `next-error' command"))
|
|
|
|
|
|
|
|
|
|
;; Actually run makeinfo. COMMAND is the command to run. If
|
|
|
|
|
;; DISABLE-ERRORS is non-nil, disable `next-error' by setting
|
|
|
|
|
;; `next-error-function' to `makeinfo-next-error' in the compilation
|
|
|
|
|
;; buffer.
|
|
|
|
|
(defun makeinfo-compile (command disable-errors sentinel)
|
|
|
|
|
(let ((buffer (compilation-start command)))
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(setq next-error-function
|
|
|
|
|
(if disable-errors
|
|
|
|
|
'makeinfo-next-error
|
|
|
|
|
'compilation-next-error-function)))
|
2002-12-22 22:05:16 +00:00
|
|
|
|
(set-process-sentinel (get-buffer-process buffer) sentinel)))
|
1993-06-21 06:59:02 +00:00
|
|
|
|
|
|
|
|
|
;; Delete makeinfo-temp-file after processing is finished,
|
1993-06-21 06:45:33 +00:00
|
|
|
|
;; and visit Info file.
|
|
|
|
|
;; This function is called when the compilation process changes state.
|
|
|
|
|
;; Based on `compilation-sentinel' in compile.el
|
2002-12-22 22:05:16 +00:00
|
|
|
|
(defun makeinfo-compilation-sentinel-region (proc msg)
|
|
|
|
|
"Sentinel for `makeinfo-compile' run from `makeinfo-region'."
|
1993-06-21 06:59:02 +00:00
|
|
|
|
(compilation-sentinel proc msg)
|
2002-12-22 22:05:16 +00:00
|
|
|
|
(when (memq (process-status proc) '(signal exit))
|
|
|
|
|
(if (file-exists-p makeinfo-temp-file)
|
|
|
|
|
(delete-file makeinfo-temp-file))
|
|
|
|
|
;; Always use the version on disk.
|
|
|
|
|
(let ((buffer (get-file-buffer makeinfo-output-file-name)))
|
|
|
|
|
(if buffer
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(revert-buffer t t))
|
|
|
|
|
(setq buffer (find-file-noselect makeinfo-output-file-name)))
|
Do not call to `selected-window' where it is assumed by default.
Affected functions are `window-minibuffer-p', `window-dedicated-p',
`window-hscroll', `window-width', `window-height', `window-buffer',
`window-frame', `window-start', `window-point', `next-window'
and `window-display-table'.
* abbrev.el (abbrev--default-expand):
* bs.el (bs--show-with-configuration):
* buff-menu.el (Buffer-menu-mouse-select):
* calc/calc.el (calc):
* calendar/calendar.el (calendar-generate-window):
* calendar/diary-lib.el (diary-simple-display, diary-show-all-entries)
(diary-make-entry):
* comint.el (send-invisible, comint-dynamic-complete-filename)
(comint-dynamic-simple-complete, comint-dynamic-list-completions):
* completion.el (complete):
* dabbrev.el (dabbrev-expand, dabbrev--make-friend-buffer-list):
* disp-table.el (describe-current-display-table):
* doc-view.el (doc-view-insert-image):
* ebuff-menu.el (Electric-buffer-menu-mouse-select):
* ehelp.el (with-electric-help):
* emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
* emacs-lisp/edebug.el (edebug-two-window-p, edebug-pop-to-buffer):
* emacs-lisp/helper.el (Helper-help-scroller):
* emulation/cua-base.el (cua--post-command-handler-1):
* eshell/esh-mode.el (eshell-output-filter):
* ffap.el (ffap-gnus-wrapper):
* help-macro.el (make-help-screen):
* hilit-chg.el (highlight-compare-buffers):
* hippie-exp.el (hippie-expand, try-expand-dabbrev-visible):
* hl-line.el (global-hl-line-highlight):
* icomplete.el (icomplete-simple-completing-p):
* isearch.el (isearch-done):
* jit-lock.el (jit-lock-stealth-fontify):
* mail/rmailsum.el (rmail-summary-scroll-msg-up):
* lisp/mouse-drag.el (mouse-drag-should-do-col-scrolling):
* mpc.el (mpc-tagbrowser, mpc):
* net/rcirc.el (rcirc-any-buffer):
* play/gomoku.el (gomoku-max-width, gomoku-max-height):
* play/landmark.el (landmark-max-width, landmark-max-height):
* play/zone.el (zone):
* progmodes/compile.el (compilation-goto-locus):
* progmodes/ebrowse.el (ebrowse-view/find-file-and-search-pattern):
* progmodes/etags.el (find-tag-other-window):
* progmodes/fortran.el (fortran-column-ruler):
* progmodes/gdb-mi.el (gdb-mouse-toggle-breakpoint-fringe):
* progmodes/verilog-mode.el (verilog-point-text):
* reposition.el (reposition-window):
* rot13.el (toggle-rot13-mode):
* server.el (server-switch-buffer):
* shell.el (shell-dynamic-complete-command)
(shell-dynamic-complete-environment-variable):
* simple.el (insert-buffer, set-selective-display)
(delete-completion-window):
* speedbar.el (speedbar-timer-fn, speedbar-center-buffer-smartly)
(speedbar-recenter):
* startup.el (fancy-splash-head):
* textmodes/ispell.el (ispell-command-loop):
* textmodes/makeinfo.el (makeinfo-compilation-sentinel-region):
* tutorial.el (help-with-tutorial):
* vc/add-log.el (add-change-log-entry):
* vc/compare-w.el (compare-windows):
* vc/ediff-help.el (ediff-indent-help-message):
* vc/ediff-util.el (ediff-setup-control-buffer, ediff-position-region):
* vc/ediff-wind.el (ediff-skip-unsuitable-frames)
(ediff-setup-control-frame):
* vc/emerge.el (emerge-position-region):
* vc/pcvs-util.el (cvs-bury-buffer):
* window.el (walk-windows, mouse-autoselect-window-select):
* winner.el (winner-set-conf, winner-undo): Related users changed.
2013-08-05 18:26:57 +04:00
|
|
|
|
(if (window-dedicated-p)
|
2002-12-22 22:05:16 +00:00
|
|
|
|
(switch-to-buffer-other-window buffer)
|
|
|
|
|
(switch-to-buffer buffer)))
|
|
|
|
|
(goto-char (point-min))))
|
|
|
|
|
|
|
|
|
|
(defun makeinfo-current-node ()
|
|
|
|
|
"Return the name of the node containing point, in a texinfo file."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(end-of-line) ; in case point is at the start of an @node line
|
|
|
|
|
(if (re-search-backward "^@node\\s-+\\([^,\n]+\\)" (point-min) t)
|
|
|
|
|
(match-string 1)
|
|
|
|
|
"Top")))
|
1993-06-21 06:59:02 +00:00
|
|
|
|
|
|
|
|
|
(defun makeinfo-buffer ()
|
1993-06-21 06:45:33 +00:00
|
|
|
|
"Make Info file from current buffer.
|
|
|
|
|
|
2003-02-04 13:30:45 +00:00
|
|
|
|
Use the \\[next-error] command to move to the next error
|
2015-09-17 16:08:20 -07:00
|
|
|
|
\(if there are errors)."
|
2003-02-04 13:30:45 +00:00
|
|
|
|
|
1993-06-21 06:59:02 +00:00
|
|
|
|
(interactive)
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(cond ((null buffer-file-name)
|
1993-06-21 06:59:02 +00:00
|
|
|
|
(error "Buffer not visiting any file"))
|
1993-06-21 06:45:33 +00:00
|
|
|
|
((buffer-modified-p)
|
|
|
|
|
(if (y-or-n-p "Buffer modified; do you want to save it? ")
|
|
|
|
|
(save-buffer))))
|
2003-02-04 13:30:45 +00:00
|
|
|
|
|
1993-06-21 06:45:33 +00:00
|
|
|
|
;; 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))))
|
2003-02-04 13:30:45 +00:00
|
|
|
|
(if (re-search-forward
|
1993-06-21 06:45:33 +00:00
|
|
|
|
"^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
|
|
|
|
|
search-end t)
|
2003-02-04 13:30:45 +00:00
|
|
|
|
(setq makeinfo-output-file-name
|
2002-12-22 22:05:16 +00:00
|
|
|
|
(expand-file-name
|
|
|
|
|
(buffer-substring (match-beginning 1) (match-end 1))))
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(error
|
|
|
|
|
"The texinfo file needs a line saying: @setfilename <name>"))))
|
2002-12-22 22:05:16 +00:00
|
|
|
|
(setq makeinfo-output-node-name (makeinfo-current-node))
|
2003-02-04 13:30:45 +00:00
|
|
|
|
|
1993-06-21 06:45:33 +00:00
|
|
|
|
(save-excursion
|
2014-11-23 11:49:31 +01:00
|
|
|
|
(let ((default-directory (file-name-directory buffer-file-name)))
|
|
|
|
|
(makeinfo-compile
|
|
|
|
|
(concat makeinfo-run-command " " makeinfo-options
|
|
|
|
|
" " (file-name-nondirectory buffer-file-name))
|
|
|
|
|
nil
|
|
|
|
|
'makeinfo-compilation-sentinel-buffer))))
|
2002-12-22 22:05:16 +00:00
|
|
|
|
|
|
|
|
|
(defun makeinfo-compilation-sentinel-buffer (proc msg)
|
|
|
|
|
"Sentinel for `makeinfo-compile' run from `makeinfo-buffer'."
|
|
|
|
|
(compilation-sentinel proc msg)
|
|
|
|
|
(when (memq (process-status proc) '(signal exit))
|
|
|
|
|
(when (file-exists-p makeinfo-output-file-name)
|
|
|
|
|
(Info-revert-find-node
|
|
|
|
|
makeinfo-output-file-name makeinfo-output-node-name))))
|
1993-06-21 06:45:33 +00:00
|
|
|
|
|
|
|
|
|
(defun makeinfo-recenter-compilation-buffer (linenum)
|
|
|
|
|
"Redisplay `*compilation*' buffer so most recent output can be seen.
|
|
|
|
|
The last line of the buffer is displayed on
|
|
|
|
|
line LINE of the window, or centered if LINE is nil."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(let ((makeinfo-buffer (get-buffer "*compilation*"))
|
|
|
|
|
(old-buffer (current-buffer)))
|
|
|
|
|
(if (null makeinfo-buffer)
|
|
|
|
|
(message "No *compilation* buffer")
|
|
|
|
|
(pop-to-buffer makeinfo-buffer)
|
|
|
|
|
(bury-buffer makeinfo-buffer)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(recenter (if linenum
|
|
|
|
|
(prefix-numeric-value linenum)
|
|
|
|
|
(/ (window-height) 2)))
|
|
|
|
|
(pop-to-buffer old-buffer)
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
;;; Place `provide' at end of file.
|
|
|
|
|
(provide 'makeinfo)
|
|
|
|
|
|
|
|
|
|
;;; makeinfo.el ends here
|