(save-restriction
(widen)
(goto-char (point-min))
- (let ((search-end (save-excursion (forward-line 100) (point))))
+ (let ((search-end (line-beginning-position 101)))
(if (or
;; Either copy header text.
(and
(let ((filename (concat input-directory
(texinfo-parse-line-arg))))
(re-search-backward "^@include")
- (delete-region (point) (save-excursion (forward-line 1) (point)))
+ (delete-region (point) (line-beginning-position 2))
(message "Reading included file: %s" filename)
(save-excursion
(save-restriction
;; Insert Info region title text.
(goto-char (point-min))
- (if (search-forward
- "@setfilename" (save-excursion (forward-line 100) (point)) t)
+ (if (search-forward "@setfilename" (line-beginning-position 101) t)
(progn
(setq texinfo-command-end (point))
(beginning-of-line)
;; Else
;; 3. Do not refill a paragraph containing @w or @*, or ending
;; with @<newline> followed by a newline.
- (if (or (>= (point) (point-max))
- (re-search-forward
- "@w{\\|@\\*\\|@\n\n"
- (save-excursion (forward-paragraph) (forward-line 1) (point))
- t))
+ (if (or (>= (point) (point-max))
+ (re-search-forward
+ "@w{\\|@\\*\\|@\n\n"
+ (save-excursion (forward-paragraph)
+ (line-beginning-position 2))
+ t))
;; Go to end of paragraph and do nothing.
(forward-paragraph)
;; 4. Else go to end of paragraph and insert @refill
((eq type '@raisesections)
(setq level (1+ level))
(delete-region
- (point) (save-excursion (forward-line 1) (point))))
+ (point) (line-beginning-position 2)))
;; 2. Decrement level
((eq type '@lowersections)
(setq level (1- level))
(delete-region
- (point) (save-excursion (forward-line 1) (point))))
+ (point) (line-beginning-position 2)))
;; Now handle structuring commands
((cond
(end (progn (re-search-forward "^@end copying[ \t]*\n") (point))))
(setq texinfo-copying-text
(buffer-substring-no-properties
- (save-excursion (goto-char beg) (forward-line 1) (point))
- (save-excursion (goto-char end) (forward-line -1) (point))))
+ (save-excursion (goto-char beg) (line-beginning-position 2))
+ (save-excursion (goto-char end) (line-beginning-position 0))))
(delete-region beg end)))
(defun texinfo-insertcopying ()
(progn (goto-char node-name-beginning) ; skip over node command
(skip-chars-forward " \t") ; and over spaces
(point))
- (if (search-forward
- ","
- (save-excursion (end-of-line) (point)) t) ; bound search
+ (if (search-forward "," (line-end-position) t) ; bound search
(1- (point))
(end-of-line) (point))))))
(texinfo-discard-command) ; remove or insert whitespace, as needed
(put 'itemize 'texinfo-item 'texinfo-itemize-item)
(defun texinfo-itemize-item ()
;; (texinfo-discard-line) ; Did not handle text on same line as @item.
- (delete-region (1+ (point)) (save-excursion (beginning-of-line) (point)))
+ (delete-region (1+ (point)) (line-beginning-position))
(if (looking-at "[ \t]*[^ \t\n]+")
;; Text on same line as @item command.
(insert "\b " (nth 1 (car texinfo-stack)) " \n")
(narrow-to-region start end)
;; Remove whitespace before and after entry.
(skip-chars-forward " ")
- (delete-region (point) (save-excursion (beginning-of-line) (point)))
+ (delete-region (point) (line-beginning-position))
(goto-char (point-max))
(skip-chars-backward " ")
- (delete-region (point) (save-excursion (end-of-line) (point)))
+ (delete-region (point) (line-end-position))
;; Temporarily set texinfo-stack to nil so texinfo-format-scan
;; does not see an unterminated @multitable.
(let (texinfo-stack) ; nil
(let ((start (1- (point)))
args)
(skip-chars-forward " ")
- (save-excursion (end-of-line) (setq texinfo-command-end (point)))
+ (setq texinfo-command-end (line-end-position))
(if (not (looking-at "\\([^=]+\\)=\\(.*\\)"))
(error "Invalid alias command")
(push (cons
(match-string-no-properties 1)
(match-string-no-properties 2))
texinfo-alias-list)
- (texinfo-discard-command))
- )
- )
+ (texinfo-discard-command))))
\f
;;; @var, @code and the like
"Insert ` ... ' around arg unless inside a table; in that case, no quotes."
;; `looking-at-backward' not available in v. 18.57, 20.2
(if (not (search-backward "\b" ; searched-for character is a control-H
- (save-excursion (beginning-of-line) (point))
+ (line-beginning-position)
t))
(insert "`" (texinfo-parse-arg-discard) "'")
(insert (texinfo-parse-arg-discard)))
(error "Not found: @verb start brace"))
(delete-region texinfo-command-start (+ 2 texinfo-command-end))
(search-forward delimiter))
- (delete-backward-char 1)
+ (delete-char -1)
(unless (looking-at "}")
(error "Not found: @verb end brace"))
(delete-char 1))
(defun texinfo-noindent ()
(save-excursion
(forward-paragraph 1)
- (if (search-backward "@refill"
- (save-excursion (forward-line -1) (point)) t)
+ (if (search-backward "@refill" (line-beginning-position 0) t)
() ; leave @noindent command so @refill command knows not to indent
;; else
(texinfo-discard-line))))
;;; Place `provide' at end of file.
(provide 'texinfmt)
-;; arch-tag: 1e8d9a2d-bca0-40a0-ac6c-dab01bc6f725
;;; texinfmt.el ends here