summaryrefslogtreecommitdiff
path: root/lisp/informat.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-07-06 00:03:29 +0000
committerRichard M. Stallman <rms@gnu.org>1998-07-06 00:03:29 +0000
commit5a0122c03f5cce89f4fd4026f6fca7fe2f2804bd (patch)
treed67e96a2104f1817ee364adfa6167c74eb96988f /lisp/informat.el
parent048eac246d2a7756c2cd078693b70fafa3673ff6 (diff)
downloademacs-5a0122c03f5cce89f4fd4026f6fca7fe2f2804bd.tar.gz
(Info-tagify): Finish previous change.
Fix up some messages.
Diffstat (limited to 'lisp/informat.el')
-rw-r--r--lisp/informat.el38
1 files changed, 23 insertions, 15 deletions
diff --git a/lisp/informat.el b/lisp/informat.el
index e85af0875ec..f96852685f7 100644
--- a/lisp/informat.el
+++ b/lisp/informat.el
@@ -22,30 +22,37 @@
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
+;;; Commentary:
+
+;; Nowadays, the Texinfo formatting commands always tagify a buffer
+;; (as does `makeinfo') since @anchor commands need tag tables.
+
;;; Code:
(require 'info)
;;;###autoload
-(defun Info-tagify ()
- "Create or update Info file tag table in current buffer."
+(defun Info-tagify (&optional input-buffer-name)
+ "Create or update Info file tag table in current buffer or in a region."
(interactive)
;; Save and restore point and restrictions.
;; save-restrictions would not work
;; because it records the old max relative to the end.
;; We record it relative to the beginning.
- (message "Tagifying %s ..." (file-name-nondirectory (buffer-file-name)))
+ (if input-buffer-name
+ (message "Tagifying region in %s ..." input-buffer-name)
+ (message
+ "Tagifying %s ..." (file-name-nondirectory (buffer-file-name))))
(let ((omin (point-min))
(omax (point-max))
(nomax (= (point-max) (1+ (buffer-size))))
(opoint (point)))
(unwind-protect
(progn
- (widen)
(goto-char (point-min))
(if (search-forward "\^_\nIndirect:\n" nil t)
- (message "Cannot tagify split info file")
-
+ (message
+ "Cannot tagify split info file. Run this before splitting.")
(let (tag-list
refillp
(case-fold-search t)
@@ -122,21 +129,24 @@
(beginning-of-line)
(delete-region (point) end)))
(goto-char (point-max))
- (insert "\^_\f\nTag table:\n")
+ (insert "\n\^_\f\nTag table:\n")
(if (eq major-mode 'info-mode)
(move-marker Info-tag-table-marker (point)))
(setq tag-list (nreverse tag-list))
(while tag-list
(insert (car (car tag-list)) ?\177)
- (princ (position-bytes (car (cdr (car list))))
- (current-buffer))
+ (princ (car (cdr (car tag-list))) (current-buffer))
(insert ?\n)
(setq tag-list (cdr tag-list)))
(insert "\^_\nEnd tag table\n")))))
(goto-char opoint)
(narrow-to-region omin (if nomax (1+ (buffer-size))
(min omax (point-max))))))
- (message "Tagifying %s ... done" (file-name-nondirectory (buffer-file-name))))
+ (if input-buffer-name
+ (message "Tagifying region in %s ..." input-buffer-name)
+ (message
+ "Tagifying %s ..." (file-name-nondirectory (buffer-file-name)))))
+
;;;###autoload
(defun Info-split ()
@@ -159,8 +169,7 @@ contains just the tag table and a directory of subfiles."
(search-forward "\^_")
(forward-char -1)
(let ((start (point))
- (start-byte (position-bytes (point)))
- (bytes-deleted 0)
+ (chars-deleted 0)
subfiles
(subfile-number 1)
(case-fold-search t)
@@ -182,7 +191,7 @@ contains just the tag table and a directory of subfiles."
(goto-char (min (+ (point) 50000) (point-max)))
(search-forward "\^_" nil 'move)
(setq subfiles
- (cons (list (+ start-byte bytes-deleted)
+ (cons (list (+ start chars-deleted)
(concat (file-name-nondirectory filename)
(format "-%d" subfile-number)))
subfiles))
@@ -193,8 +202,7 @@ contains just the tag table and a directory of subfiles."
(delete-region (1- (point)) (point))
;; Back up over the final ^_.
(forward-char -1)
- (setq bytes-deleted (+ bytes-deleted (- (position-bytes (point))
- start-byte)))
+ (setq chars-deleted (+ chars-deleted (- (point) start)))
(delete-region start (point))
(setq subfile-number (1+ subfile-number))))
(while subfiles