diff options
| author | Glenn Morris | 2010-06-22 01:10:26 -0700 |
|---|---|---|
| committer | Glenn Morris | 2010-06-22 01:10:26 -0700 |
| commit | 6555773f3fa4f997c58c85dc1160afee875ad31d (patch) | |
| tree | ff76542830fd6623469e70babcd9a72a04abfcc9 | |
| parent | e9b7ab963b49d6eaaa2359ac903a1fe80943ec95 (diff) | |
| download | emacs-6555773f3fa4f997c58c85dc1160afee875ad31d.tar.gz emacs-6555773f3fa4f997c58c85dc1160afee875ad31d.zip | |
Minor simplification.
* lisp/textmodes/texinfmt.el (texinfo-format-region)
(texinfo-raise-lower-sections, texinfo-format-separate-node)
(texinfo-itemize-item, texinfo-multitable-item, texinfo-alias)
(texinfo-format-option, texinfo-noindent):
Use line-beginning-position and line-end-position.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/textmodes/texinfmt.el | 38 |
2 files changed, 22 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ca0fed14b5e..8836a3866ff 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2010-06-22 Glenn Morris <rgm@gnu.org> | 1 | 2010-06-22 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * textmodes/texinfmt.el (texinfo-format-region) | ||
| 4 | (texinfo-raise-lower-sections, texinfo-format-separate-node) | ||
| 5 | (texinfo-itemize-item, texinfo-multitable-item, texinfo-alias) | ||
| 6 | (texinfo-format-option, texinfo-noindent): | ||
| 7 | Use line-beginning-position and line-end-position. | ||
| 8 | |||
| 3 | * calc/calc-aent.el, calc/calc-ext.el, calc/calc-lang.el: | 9 | * calc/calc-aent.el, calc/calc-ext.el, calc/calc-lang.el: |
| 4 | * calc/calc-store.el, calc/calc-units.el, calc/calc.el: | 10 | * calc/calc-store.el, calc/calc-units.el, calc/calc.el: |
| 5 | * calc/calccomp.el: Add explicit utf-8 coding cookies to files with | 11 | * calc/calccomp.el: Add explicit utf-8 coding cookies to files with |
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el index b735b446b81..577287c60bc 100644 --- a/lisp/textmodes/texinfmt.el +++ b/lisp/textmodes/texinfmt.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; texinfmt.el --- format Texinfo files into Info files | 1 | ;;; texinfmt.el --- format Texinfo files into Info files |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, | 3 | ;; Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, |
| 4 | ;; 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, | 4 | ;; 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
| 5 | ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 5 | ;; 2008, 2009, 2010 Free Software Foundation, Inc. |
| 6 | 6 | ||
| 7 | ;; Maintainer: Robert J. Chassell <bug-texinfo@gnu.org> | 7 | ;; Maintainer: Robert J. Chassell <bug-texinfo@gnu.org> |
| 8 | ;; Keywords: maint, tex, docs | 8 | ;; Keywords: maint, tex, docs |
| @@ -224,7 +224,7 @@ converted to Info is stored in a temporary buffer." | |||
| 224 | (save-restriction | 224 | (save-restriction |
| 225 | (widen) | 225 | (widen) |
| 226 | (goto-char (point-min)) | 226 | (goto-char (point-min)) |
| 227 | (let ((search-end (save-excursion (forward-line 100) (point)))) | 227 | (let ((search-end (line-beginning-position 101))) |
| 228 | (if (or | 228 | (if (or |
| 229 | ;; Either copy header text. | 229 | ;; Either copy header text. |
| 230 | (and | 230 | (and |
| @@ -285,7 +285,7 @@ converted to Info is stored in a temporary buffer." | |||
| 285 | (let ((filename (concat input-directory | 285 | (let ((filename (concat input-directory |
| 286 | (texinfo-parse-line-arg)))) | 286 | (texinfo-parse-line-arg)))) |
| 287 | (re-search-backward "^@include") | 287 | (re-search-backward "^@include") |
| 288 | (delete-region (point) (save-excursion (forward-line 1) (point))) | 288 | (delete-region (point) (line-beginning-position 2)) |
| 289 | (message "Reading included file: %s" filename) | 289 | (message "Reading included file: %s" filename) |
| 290 | (save-excursion | 290 | (save-excursion |
| 291 | (save-restriction | 291 | (save-restriction |
| @@ -323,8 +323,7 @@ converted to Info is stored in a temporary buffer." | |||
| 323 | 323 | ||
| 324 | ;; Insert Info region title text. | 324 | ;; Insert Info region title text. |
| 325 | (goto-char (point-min)) | 325 | (goto-char (point-min)) |
| 326 | (if (search-forward | 326 | (if (search-forward "@setfilename" (line-beginning-position 101) t) |
| 327 | "@setfilename" (save-excursion (forward-line 100) (point)) t) | ||
| 328 | (progn | 327 | (progn |
| 329 | (setq texinfo-command-end (point)) | 328 | (setq texinfo-command-end (point)) |
| 330 | (beginning-of-line) | 329 | (beginning-of-line) |
| @@ -772,13 +771,13 @@ commands." | |||
| 772 | ((eq type '@raisesections) | 771 | ((eq type '@raisesections) |
| 773 | (setq level (1+ level)) | 772 | (setq level (1+ level)) |
| 774 | (delete-region | 773 | (delete-region |
| 775 | (point) (save-excursion (forward-line 1) (point)))) | 774 | (point) (line-beginning-position 2))) |
| 776 | 775 | ||
| 777 | ;; 2. Decrement level | 776 | ;; 2. Decrement level |
| 778 | ((eq type '@lowersections) | 777 | ((eq type '@lowersections) |
| 779 | (setq level (1- level)) | 778 | (setq level (1- level)) |
| 780 | (delete-region | 779 | (delete-region |
| 781 | (point) (save-excursion (forward-line 1) (point)))) | 780 | (point) (line-beginning-position 2))) |
| 782 | 781 | ||
| 783 | ;; Now handle structuring commands | 782 | ;; Now handle structuring commands |
| 784 | ((cond | 783 | ((cond |
| @@ -1505,9 +1504,7 @@ The node is constructed automatically." | |||
| 1505 | (progn (goto-char node-name-beginning) ; skip over node command | 1504 | (progn (goto-char node-name-beginning) ; skip over node command |
| 1506 | (skip-chars-forward " \t") ; and over spaces | 1505 | (skip-chars-forward " \t") ; and over spaces |
| 1507 | (point)) | 1506 | (point)) |
| 1508 | (if (search-forward | 1507 | (if (search-forward "," (line-end-position) t) ; bound search |
| 1509 | "," | ||
| 1510 | (save-excursion (end-of-line) (point)) t) ; bound search | ||
| 1511 | (1- (point)) | 1508 | (1- (point)) |
| 1512 | (end-of-line) (point)))))) | 1509 | (end-of-line) (point)))))) |
| 1513 | (texinfo-discard-command) ; remove or insert whitespace, as needed | 1510 | (texinfo-discard-command) ; remove or insert whitespace, as needed |
| @@ -1692,7 +1689,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.") | |||
| 1692 | (put 'itemize 'texinfo-item 'texinfo-itemize-item) | 1689 | (put 'itemize 'texinfo-item 'texinfo-itemize-item) |
| 1693 | (defun texinfo-itemize-item () | 1690 | (defun texinfo-itemize-item () |
| 1694 | ;; (texinfo-discard-line) ; Did not handle text on same line as @item. | 1691 | ;; (texinfo-discard-line) ; Did not handle text on same line as @item. |
| 1695 | (delete-region (1+ (point)) (save-excursion (beginning-of-line) (point))) | 1692 | (delete-region (1+ (point)) (line-beginning-position)) |
| 1696 | (if (looking-at "[ \t]*[^ \t\n]+") | 1693 | (if (looking-at "[ \t]*[^ \t\n]+") |
| 1697 | ;; Text on same line as @item command. | 1694 | ;; Text on same line as @item command. |
| 1698 | (insert "\b " (nth 1 (car texinfo-stack)) " \n") | 1695 | (insert "\b " (nth 1 (car texinfo-stack)) " \n") |
| @@ -2132,10 +2129,10 @@ This command is executed when texinfmt sees @item inside @multitable." | |||
| 2132 | (narrow-to-region start end) | 2129 | (narrow-to-region start end) |
| 2133 | ;; Remove whitespace before and after entry. | 2130 | ;; Remove whitespace before and after entry. |
| 2134 | (skip-chars-forward " ") | 2131 | (skip-chars-forward " ") |
| 2135 | (delete-region (point) (save-excursion (beginning-of-line) (point))) | 2132 | (delete-region (point) (line-beginning-position)) |
| 2136 | (goto-char (point-max)) | 2133 | (goto-char (point-max)) |
| 2137 | (skip-chars-backward " ") | 2134 | (skip-chars-backward " ") |
| 2138 | (delete-region (point) (save-excursion (end-of-line) (point))) | 2135 | (delete-region (point) (line-end-position)) |
| 2139 | ;; Temporarily set texinfo-stack to nil so texinfo-format-scan | 2136 | ;; Temporarily set texinfo-stack to nil so texinfo-format-scan |
| 2140 | ;; does not see an unterminated @multitable. | 2137 | ;; does not see an unterminated @multitable. |
| 2141 | (let (texinfo-stack) ; nil | 2138 | (let (texinfo-stack) ; nil |
| @@ -2409,16 +2406,14 @@ Use only the FILENAME arg; for Info, ignore the other arguments to @image." | |||
| 2409 | (let ((start (1- (point))) | 2406 | (let ((start (1- (point))) |
| 2410 | args) | 2407 | args) |
| 2411 | (skip-chars-forward " ") | 2408 | (skip-chars-forward " ") |
| 2412 | (save-excursion (end-of-line) (setq texinfo-command-end (point))) | 2409 | (setq texinfo-command-end (line-end-position)) |
| 2413 | (if (not (looking-at "\\([^=]+\\)=\\(.*\\)")) | 2410 | (if (not (looking-at "\\([^=]+\\)=\\(.*\\)")) |
| 2414 | (error "Invalid alias command") | 2411 | (error "Invalid alias command") |
| 2415 | (push (cons | 2412 | (push (cons |
| 2416 | (match-string-no-properties 1) | 2413 | (match-string-no-properties 1) |
| 2417 | (match-string-no-properties 2)) | 2414 | (match-string-no-properties 2)) |
| 2418 | texinfo-alias-list) | 2415 | texinfo-alias-list) |
| 2419 | (texinfo-discard-command)) | 2416 | (texinfo-discard-command)))) |
| 2420 | ) | ||
| 2421 | ) | ||
| 2422 | 2417 | ||
| 2423 | 2418 | ||
| 2424 | ;;; @var, @code and the like | 2419 | ;;; @var, @code and the like |
| @@ -2455,7 +2450,7 @@ Use only the FILENAME arg; for Info, ignore the other arguments to @image." | |||
| 2455 | "Insert ` ... ' around arg unless inside a table; in that case, no quotes." | 2450 | "Insert ` ... ' around arg unless inside a table; in that case, no quotes." |
| 2456 | ;; `looking-at-backward' not available in v. 18.57, 20.2 | 2451 | ;; `looking-at-backward' not available in v. 18.57, 20.2 |
| 2457 | (if (not (search-backward "" ; searched-for character is a control-H | 2452 | (if (not (search-backward "" ; searched-for character is a control-H |
| 2458 | (save-excursion (beginning-of-line) (point)) | 2453 | (line-beginning-position) |
| 2459 | t)) | 2454 | t)) |
| 2460 | (insert "`" (texinfo-parse-arg-discard) "'") | 2455 | (insert "`" (texinfo-parse-arg-discard) "'") |
| 2461 | (insert (texinfo-parse-arg-discard))) | 2456 | (insert (texinfo-parse-arg-discard))) |
| @@ -2840,8 +2835,7 @@ Default is to leave paragraph indentation as is." | |||
| 2840 | (defun texinfo-noindent () | 2835 | (defun texinfo-noindent () |
| 2841 | (save-excursion | 2836 | (save-excursion |
| 2842 | (forward-paragraph 1) | 2837 | (forward-paragraph 1) |
| 2843 | (if (search-backward "@refill" | 2838 | (if (search-backward "@refill" (line-beginning-position 0) t) |
| 2844 | (save-excursion (forward-line -1) (point)) t) | ||
| 2845 | () ; leave @noindent command so @refill command knows not to indent | 2839 | () ; leave @noindent command so @refill command knows not to indent |
| 2846 | ;; else | 2840 | ;; else |
| 2847 | (texinfo-discard-line)))) | 2841 | (texinfo-discard-line)))) |