diff options
| author | Paul Eggert | 2011-09-06 09:34:41 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-09-06 09:34:41 -0700 |
| commit | e39b275c8c4abe1e293d4336bb1cb13ad95e5491 (patch) | |
| tree | 22da66c2fe8e7b447e8872b481701bcb4b3e2a3a | |
| parent | 1c262cae409ec55a234c89b3b74a13a77c7f595a (diff) | |
| parent | b2db44d9c6b6895222e9de5ab58b3897fdb3c889 (diff) | |
| download | emacs-e39b275c8c4abe1e293d4336bb1cb13ad95e5491.tar.gz emacs-e39b275c8c4abe1e293d4336bb1cb13ad95e5491.zip | |
Merge from trunk.
| -rw-r--r-- | ChangeLog | 16 | ||||
| -rw-r--r-- | admin/ChangeLog | 2 | ||||
| -rw-r--r-- | autogen/config.in | 3 | ||||
| -rwxr-xr-x | autogen/configure | 12 | ||||
| -rw-r--r-- | etc/ChangeLog | 5 | ||||
| -rw-r--r-- | etc/grep.txt | 1 | ||||
| -rw-r--r-- | leim/ChangeLog | 2 | ||||
| -rw-r--r-- | lib-src/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/ChangeLog | 27 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 3 | ||||
| -rw-r--r-- | lisp/gnus/nnir.el | 13 | ||||
| -rw-r--r-- | lisp/isearch.el | 5 | ||||
| -rw-r--r-- | lisp/progmodes/grep.el | 19 | ||||
| -rw-r--r-- | lisp/subr.el | 2 | ||||
| -rw-r--r-- | msdos/ChangeLog | 2 | ||||
| -rw-r--r-- | src/ChangeLog | 25 | ||||
| -rw-r--r-- | src/buffer.h | 2 | ||||
| -rw-r--r-- | src/dbusbind.c | 12 | ||||
| -rw-r--r-- | src/fileio.c | 92 |
20 files changed, 199 insertions, 58 deletions
| @@ -1,6 +1,20 @@ | |||
| 1 | 2011-09-04 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-09-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Merge from gnulib, using build-aux to remove clutter (Bug#9169). | 3 | Merge from gnulib, using build-aux to remove clutter (Bug#9169). |
| 4 | This is to fix the following problems: | ||
| 5 | . On FreeBSD 6.4, HP-UX 11.31, and Solaris 9, and when Emacs is | ||
| 6 | configured not to use gtk or any other thread-using library, | ||
| 7 | signals aren't blocked correctly. | ||
| 8 | . On IRIX 6.5 it fixes an unwanted clash between Emacs's | ||
| 9 | and IRIX's signal handling. | ||
| 10 | . On Cygwin 1.7.5 it works around an incompatibility with | ||
| 11 | the system pthread_sigmask. | ||
| 12 | . On MacOS X 10.5 (32-bit), files whose inode numbers | ||
| 13 | exceed 2**31 cannot be read or manipulated. | ||
| 14 | . pthread_sigmask: Actually use results of gl_THREADLIB. | ||
| 15 | . strtoimax, strtoumax: Avoid link error on OSF/1 with DTK cc. | ||
| 16 | . find 'ar' program that fits with --host argument. | ||
| 17 | . Allow the user to override the choice of AR, ARFLAGS, RANLIB. | ||
| 4 | * autogen/README: Update destination list. | 18 | * autogen/README: Update destination list. |
| 5 | * autogen/copy_autogen, autogen/update_autogen, .bzrignore: | 19 | * autogen/copy_autogen, autogen/update_autogen, .bzrignore: |
| 6 | The autogenerated files compile, config.guess, | 20 | The autogenerated files compile, config.guess, |
diff --git a/admin/ChangeLog b/admin/ChangeLog index 40300fc8dcf..9856f38fabb 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | 2011-09-03 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-09-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Merge from gnulib (Bug#9169). | 3 | Merge from gnulib (Bug#9169). |
| 4 | * notes/copyright: The files compile, config.guess, config.sub, | 4 | * notes/copyright: The files compile, config.guess, config.sub, |
diff --git a/autogen/config.in b/autogen/config.in index 24dd54db43f..5a53b240ef8 100644 --- a/autogen/config.in +++ b/autogen/config.in | |||
| @@ -672,6 +672,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 672 | /* Define to 1 if the system has the type `sigset_t'. */ | 672 | /* Define to 1 if the system has the type `sigset_t'. */ |
| 673 | #undef HAVE_SIGSET_T | 673 | #undef HAVE_SIGSET_T |
| 674 | 674 | ||
| 675 | /* Define to 1 if you have the `snprintf' function. */ | ||
| 676 | #undef HAVE_SNPRINTF | ||
| 677 | |||
| 675 | /* Define to 1 if you have sound support. */ | 678 | /* Define to 1 if you have sound support. */ |
| 676 | #undef HAVE_SOUND | 679 | #undef HAVE_SOUND |
| 677 | 680 | ||
diff --git a/autogen/configure b/autogen/configure index bbd54f57153..8d010ddf7b7 100755 --- a/autogen/configure +++ b/autogen/configure | |||
| @@ -15312,6 +15312,18 @@ $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h | |||
| 15312 | fi | 15312 | fi |
| 15313 | 15313 | ||
| 15314 | 15314 | ||
| 15315 | for ac_func in snprintf | ||
| 15316 | do : | ||
| 15317 | ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" | ||
| 15318 | if test "x$ac_cv_func_snprintf" = x""yes; then : | ||
| 15319 | cat >>confdefs.h <<_ACEOF | ||
| 15320 | #define HAVE_SNPRINTF 1 | ||
| 15321 | _ACEOF | ||
| 15322 | |||
| 15323 | fi | ||
| 15324 | done | ||
| 15325 | |||
| 15326 | |||
| 15315 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5 | 15327 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5 |
| 15316 | $as_echo_n "checking for nl_langinfo and CODESET... " >&6; } | 15328 | $as_echo_n "checking for nl_langinfo and CODESET... " >&6; } |
| 15317 | if test "${emacs_cv_langinfo_codeset+set}" = set; then : | 15329 | if test "${emacs_cv_langinfo_codeset+set}" = set; then : |
diff --git a/etc/ChangeLog b/etc/ChangeLog index 24c0fd54422..0749862f676 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-09-05 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * grep.txt: Add `eval' to the Local Variables section that | ||
| 4 | emulates `grep-filter'. | ||
| 5 | |||
| 1 | 2011-08-30 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2011-08-30 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | * MACHINES: Remove obsolete info and update a bit (Bug#9404). | 8 | * MACHINES: Remove obsolete info and update a bit (Bug#9404). |
diff --git a/etc/grep.txt b/etc/grep.txt index 9a3159f6b08..01ffa9f3ef8 100644 --- a/etc/grep.txt +++ b/etc/grep.txt | |||
| @@ -103,5 +103,6 @@ COPYING PERMISSIONS: | |||
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | ;;; Local Variables: | 105 | ;;; Local Variables: |
| 106 | ;;; eval: (let ((inhibit-read-only t) (compilation-filter-start (point-min))) (save-excursion (goto-char (point-max)) (grep-filter) (set-buffer-modified-p nil))) | ||
| 106 | ;;; buffer-read-only: t | 107 | ;;; buffer-read-only: t |
| 107 | ;;; End: | 108 | ;;; End: |
diff --git a/leim/ChangeLog b/leim/ChangeLog index c28e9472625..23050bf791a 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | 2011-09-03 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-09-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * Makefile.in (install): install-sh is now in build-aux (Bug#9169). | 3 | * Makefile.in (install): install-sh is now in build-aux (Bug#9169). |
| 4 | 4 | ||
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 42073641cb9..65ca56b17a8 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | 2011-09-04 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-09-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * Makefile.in ($(DESTDIR)${archlibdir}): install-sh moved | 3 | * Makefile.in ($(DESTDIR)${archlibdir}): install-sh moved |
| 4 | to build-aux (Bug#9169). | 4 | to build-aux (Bug#9169). |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5e6a6d9108a..d82391d691a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,30 @@ | |||
| 1 | 2011-09-06 Alan Mackenzie <acm@muc.de> | ||
| 2 | |||
| 3 | * isearch.el (isearch-other-meta-char): Wherever a key list is | ||
| 4 | unread, "unread" the prefix arg, too. This fixes bug #8901. | ||
| 5 | |||
| 6 | 2011-09-05 Oleksandr Gavenko <gavenkoa@gmail.com> (tiny change) | ||
| 7 | |||
| 8 | * progmodes/grep.el (rgrep): Add "-type d" (bug#9414). | ||
| 9 | |||
| 10 | 2011-09-05 Juri Linkov <juri@jurta.org> | ||
| 11 | |||
| 12 | * progmodes/grep.el (grep-process-setup): Fix comments (bug#8084). | ||
| 13 | |||
| 14 | 2011-09-05 Juri Linkov <juri@jurta.org> | ||
| 15 | |||
| 16 | * progmodes/grep.el (grep-filter): Avoid incomplete processing by | ||
| 17 | keeping point where processing of grep matches begins, and | ||
| 18 | continue to delete remaining escape sequences from the same point. | ||
| 19 | (grep-filter): Make leading zero optional in "0?1;31m" because | ||
| 20 | git-grep emits "\033[1;31m" escape sequences unlike expected | ||
| 21 | "\033[01;31m" as GNU Grep does (bug#9408). | ||
| 22 | (grep-process-setup): Replace obsolete "ml=" with newer "sl=". | ||
| 23 | |||
| 24 | 2011-09-05 Juri Linkov <juri@jurta.org> | ||
| 25 | |||
| 26 | * subr.el (y-or-n-p): Capitalize "yes". | ||
| 27 | |||
| 1 | 2011-09-04 Michael Albinus <michael.albinus@gmx.de> | 28 | 2011-09-04 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 29 | ||
| 3 | * net/tramp.el (top): Require 'shell. Use `tramp-unload-hook' but | 30 | * net/tramp.el (top): Require 'shell. Use `tramp-unload-hook' but |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 9d719136cc1..2e0cc11279a 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2011-09-05 Andrew Cohen <cohen@andy.bu.edu> | ||
| 2 | |||
| 3 | * gnus-sum.el (gnus-summary-exit): Ensure we kill the proper | ||
| 4 | original-article-buffer. | ||
| 5 | |||
| 6 | 2011-09-05 Kan-Ru Chen <kanru@kanru.info> | ||
| 7 | |||
| 8 | * nnir.el (nnir-compose-result): Fix matching of server type. | ||
| 9 | (nnir-run-swish++): Ditto. | ||
| 10 | (nnir-run-namazu): Ditto. | ||
| 11 | (nnir-run-notmuch): Ditto. | ||
| 12 | |||
| 1 | 2011-09-04 Lars Magne Ingebrigtsen <larsi@gnus.org> | 13 | 2011-09-04 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 14 | ||
| 3 | * gnus.el (gnus-home-directory): Add warning about setting in .gnus.el | 15 | * gnus.el (gnus-home-directory): Add warning about setting in .gnus.el |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index fd441c46d17..bb8c719a4fd 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -7214,6 +7214,7 @@ If FORCE (the prefix), also save the .newsrc file(s)." | |||
| 7214 | (quit-config (gnus-group-quit-config gnus-newsgroup-name)) | 7214 | (quit-config (gnus-group-quit-config gnus-newsgroup-name)) |
| 7215 | (gnus-group-is-exiting-p t) | 7215 | (gnus-group-is-exiting-p t) |
| 7216 | (article-buffer gnus-article-buffer) | 7216 | (article-buffer gnus-article-buffer) |
| 7217 | (original-article-buffer gnus-original-article-buffer) | ||
| 7217 | (mode major-mode) | 7218 | (mode major-mode) |
| 7218 | (group-point nil) | 7219 | (group-point nil) |
| 7219 | (buf (current-buffer)) | 7220 | (buf (current-buffer)) |
| @@ -7290,7 +7291,7 @@ If FORCE (the prefix), also save the .newsrc file(s)." | |||
| 7290 | (unless (eq major-mode 'gnus-sticky-article-mode) | 7291 | (unless (eq major-mode 'gnus-sticky-article-mode) |
| 7291 | (gnus-kill-buffer article-buffer) | 7292 | (gnus-kill-buffer article-buffer) |
| 7292 | (setq gnus-article-current nil)))) | 7293 | (setq gnus-article-current nil)))) |
| 7293 | (gnus-kill-buffer gnus-original-article-buffer)) | 7294 | (gnus-kill-buffer original-article-buffer)) |
| 7294 | 7295 | ||
| 7295 | ;; Clear the current group name. | 7296 | ;; Clear the current group name. |
| 7296 | (unless quit-config | 7297 | (unless quit-config |
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 17fc3f3fe81..0be6a17d50e 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el | |||
| @@ -806,7 +806,7 @@ ready to be added to the list of search results." | |||
| 806 | ;; remove trailing slash and, for nnmaildir, cur/new/tmp | 806 | ;; remove trailing slash and, for nnmaildir, cur/new/tmp |
| 807 | (setq dirnam | 807 | (setq dirnam |
| 808 | (substring dirnam 0 | 808 | (substring dirnam 0 |
| 809 | (if (string= (gnus-group-server server) "nnmaildir") | 809 | (if (string-match "^nnmaildir:" (gnus-group-server server)) |
| 810 | -5 -1))) | 810 | -5 -1))) |
| 811 | 811 | ||
| 812 | ;; Set group to dirnam without any leading dots or slashes, | 812 | ;; Set group to dirnam without any leading dots or slashes, |
| @@ -816,7 +816,7 @@ ready to be added to the list of search results." | |||
| 816 | "[/\\]" "." t))) | 816 | "[/\\]" "." t))) |
| 817 | 817 | ||
| 818 | (vector (gnus-group-full-name group server) | 818 | (vector (gnus-group-full-name group server) |
| 819 | (if (string= (gnus-group-server server) "nnmaildir") | 819 | (if (string-match "^nnmaildir:" (gnus-group-server server)) |
| 820 | (nnmaildir-base-name-to-article-number | 820 | (nnmaildir-base-name-to-article-number |
| 821 | (substring article 0 (string-match ":" article)) | 821 | (substring article 0 (string-match ":" article)) |
| 822 | group nil) | 822 | group nil) |
| @@ -1073,7 +1073,8 @@ Windows NT 4.0." | |||
| 1073 | ;; is sufficient. Note that we can't only use the value of | 1073 | ;; is sufficient. Note that we can't only use the value of |
| 1074 | ;; nnml-use-compressed-files because old articles might have been | 1074 | ;; nnml-use-compressed-files because old articles might have been |
| 1075 | ;; saved with a different value. | 1075 | ;; saved with a different value. |
| 1076 | (article-pattern (if (string= (gnus-group-server server) "nnmaildir") | 1076 | (article-pattern (if (string-match "^nnmaildir:" |
| 1077 | (gnus-group-server server)) | ||
| 1077 | ":[0-9]+" | 1078 | ":[0-9]+" |
| 1078 | "^[0-9]+\\(\\.[a-z0-9]+\\)?$")) | 1079 | "^[0-9]+\\(\\.[a-z0-9]+\\)?$")) |
| 1079 | score artno dirnam filenam) | 1080 | score artno dirnam filenam) |
| @@ -1315,7 +1316,8 @@ Tested with Namazu 2.0.6 on a GNU/Linux system." | |||
| 1315 | ;; (when group | 1316 | ;; (when group |
| 1316 | ;; (error "The Namazu backend cannot search specific groups")) | 1317 | ;; (error "The Namazu backend cannot search specific groups")) |
| 1317 | (save-excursion | 1318 | (save-excursion |
| 1318 | (let ((article-pattern (if (string= (gnus-group-server server) "nnmaildir") | 1319 | (let ((article-pattern (if (string-match "^nnmaildir:" |
| 1320 | (gnus-group-server server)) | ||
| 1319 | ":[0-9]+" | 1321 | ":[0-9]+" |
| 1320 | "^[0-9]+$")) | 1322 | "^[0-9]+$")) |
| 1321 | artlist | 1323 | artlist |
| @@ -1388,7 +1390,8 @@ actually)." | |||
| 1388 | (groupspec (cdr (assq 'group query))) | 1390 | (groupspec (cdr (assq 'group query))) |
| 1389 | (prefix (nnir-read-server-parm 'nnir-notmuch-remove-prefix server)) | 1391 | (prefix (nnir-read-server-parm 'nnir-notmuch-remove-prefix server)) |
| 1390 | artlist | 1392 | artlist |
| 1391 | (article-pattern (if (string= (gnus-group-server server) "nnmaildir") | 1393 | (article-pattern (if (string-match "^nnmaildir:" |
| 1394 | (gnus-group-server server)) | ||
| 1392 | ":[0-9]+" | 1395 | ":[0-9]+" |
| 1393 | "^[0-9]+$")) | 1396 | "^[0-9]+$")) |
| 1394 | artno dirnam filenam) | 1397 | artno dirnam filenam) |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 6eab3dbcbc4..7f54067f9aa 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -1920,6 +1920,7 @@ Isearch mode." | |||
| 1920 | (if (lookup-key global-map key) | 1920 | (if (lookup-key global-map key) |
| 1921 | (progn | 1921 | (progn |
| 1922 | (isearch-done) | 1922 | (isearch-done) |
| 1923 | (setq prefix-arg arg) | ||
| 1923 | (apply 'isearch-unread keylist)) | 1924 | (apply 'isearch-unread keylist)) |
| 1924 | (setq keylist | 1925 | (setq keylist |
| 1925 | (listify-key-sequence (lookup-key local-function-key-map key))) | 1926 | (listify-key-sequence (lookup-key local-function-key-map key))) |
| @@ -1935,6 +1936,7 @@ Isearch mode." | |||
| 1935 | (setq keylist (cdr keylist))) | 1936 | (setq keylist (cdr keylist))) |
| 1936 | ;; As the remaining keys in KEYLIST can't be handled | 1937 | ;; As the remaining keys in KEYLIST can't be handled |
| 1937 | ;; here, we must reread them. | 1938 | ;; here, we must reread them. |
| 1939 | (setq prefix-arg arg) | ||
| 1938 | (apply 'isearch-unread keylist) | 1940 | (apply 'isearch-unread keylist) |
| 1939 | (setq keylist nil))))) | 1941 | (setq keylist nil))))) |
| 1940 | ( | 1942 | ( |
| @@ -1957,8 +1959,10 @@ Isearch mode." | |||
| 1957 | isearch-other-control-char))))) | 1959 | isearch-other-control-char))))) |
| 1958 | (setcar keylist (- main-event (- ?\C-\S-a ?\C-a))) | 1960 | (setcar keylist (- main-event (- ?\C-\S-a ?\C-a))) |
| 1959 | (cancel-kbd-macro-events) | 1961 | (cancel-kbd-macro-events) |
| 1962 | (setq prefix-arg arg) | ||
| 1960 | (apply 'isearch-unread keylist)) | 1963 | (apply 'isearch-unread keylist)) |
| 1961 | ((eq search-exit-option 'edit) | 1964 | ((eq search-exit-option 'edit) |
| 1965 | (setq prefix-arg arg) | ||
| 1962 | (apply 'isearch-unread keylist) | 1966 | (apply 'isearch-unread keylist) |
| 1963 | (isearch-edit-string)) | 1967 | (isearch-edit-string)) |
| 1964 | ;; Handle a scrolling function. | 1968 | ;; Handle a scrolling function. |
| @@ -1987,6 +1991,7 @@ Isearch mode." | |||
| 1987 | (isearch-edit-string)) | 1991 | (isearch-edit-string)) |
| 1988 | (search-exit-option | 1992 | (search-exit-option |
| 1989 | (let (window) | 1993 | (let (window) |
| 1994 | (setq prefix-arg arg) | ||
| 1990 | (isearch-unread-key-sequence keylist) | 1995 | (isearch-unread-key-sequence keylist) |
| 1991 | (setq main-event (car unread-command-events)) | 1996 | (setq main-event (car unread-command-events)) |
| 1992 | 1997 | ||
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 709f01444bf..de46dc19169 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -446,9 +446,10 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 446 | (when (eq grep-highlight-matches 'auto-detect) | 446 | (when (eq grep-highlight-matches 'auto-detect) |
| 447 | (grep-compute-defaults)) | 447 | (grep-compute-defaults)) |
| 448 | (unless (or (eq grep-highlight-matches 'auto-detect) | 448 | (unless (or (eq grep-highlight-matches 'auto-detect) |
| 449 | ;; Uses font-lock to parse color escapes. (Bug#8084) | 449 | (null grep-highlight-matches) |
| 450 | (null font-lock-mode) | 450 | ;; Don't output color escapes if they can't be |
| 451 | (null grep-highlight-matches)) | 451 | ;; highlighted with `font-lock-face' by `grep-filter'. |
| 452 | (null font-lock-mode)) | ||
| 452 | ;; `setenv' modifies `process-environment' let-bound in `compilation-start' | 453 | ;; `setenv' modifies `process-environment' let-bound in `compilation-start' |
| 453 | ;; Any TERM except "dumb" allows GNU grep to use `--color=auto' | 454 | ;; Any TERM except "dumb" allows GNU grep to use `--color=auto' |
| 454 | (setenv "TERM" "emacs-grep") | 455 | (setenv "TERM" "emacs-grep") |
| @@ -459,7 +460,7 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 459 | ;; GREP_COLOR is used in GNU grep 2.5.1, but deprecated in later versions | 460 | ;; GREP_COLOR is used in GNU grep 2.5.1, but deprecated in later versions |
| 460 | (setenv "GREP_COLOR" "01;31") | 461 | (setenv "GREP_COLOR" "01;31") |
| 461 | ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions | 462 | ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions |
| 462 | (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:ml=:cx=:ne")) | 463 | (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:sl=:cx=:ne")) |
| 463 | (set (make-local-variable 'compilation-exit-message-function) | 464 | (set (make-local-variable 'compilation-exit-message-function) |
| 464 | (lambda (status code msg) | 465 | (lambda (status code msg) |
| 465 | (if (eq status 'exit) | 466 | (if (eq status 'exit) |
| @@ -480,20 +481,21 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'." | |||
| 480 | This function is called from `compilation-filter-hook'." | 481 | This function is called from `compilation-filter-hook'." |
| 481 | (save-excursion | 482 | (save-excursion |
| 482 | (forward-line 0) | 483 | (forward-line 0) |
| 483 | (let ((end (point))) | 484 | (let ((end (point)) beg) |
| 484 | (goto-char compilation-filter-start) | 485 | (goto-char compilation-filter-start) |
| 485 | (forward-line 0) | 486 | (forward-line 0) |
| 487 | (setq beg (point)) | ||
| 486 | ;; Only operate on whole lines so we don't get caught with part of an | 488 | ;; Only operate on whole lines so we don't get caught with part of an |
| 487 | ;; escape sequence in one chunk and the rest in another. | 489 | ;; escape sequence in one chunk and the rest in another. |
| 488 | (when (< (point) end) | 490 | (when (< (point) end) |
| 489 | (setq end (copy-marker end)) | 491 | (setq end (copy-marker end)) |
| 490 | ;; Highlight grep matches and delete marking sequences. | 492 | ;; Highlight grep matches and delete marking sequences. |
| 491 | (while (re-search-forward "\033\\[01;31m\\(.*?\\)\033\\[[0-9]*m" end 1) | 493 | (while (re-search-forward "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m" end 1) |
| 492 | (replace-match (propertize (match-string 1) | 494 | (replace-match (propertize (match-string 1) |
| 493 | 'face nil 'font-lock-face grep-match-face) | 495 | 'face nil 'font-lock-face grep-match-face) |
| 494 | t t)) | 496 | t t)) |
| 495 | ;; Delete all remaining escape sequences | 497 | ;; Delete all remaining escape sequences |
| 496 | (goto-char compilation-filter-start) | 498 | (goto-char beg) |
| 497 | (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) | 499 | (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1) |
| 498 | (replace-match "" t t)))))) | 500 | (replace-match "" t t)))))) |
| 499 | 501 | ||
| @@ -987,7 +989,8 @@ This command shares argument histories with \\[lgrep] and \\[grep-find]." | |||
| 987 | dir | 989 | dir |
| 988 | (concat | 990 | (concat |
| 989 | (and grep-find-ignored-directories | 991 | (and grep-find-ignored-directories |
| 990 | (concat (shell-quote-argument "(") | 992 | (concat "-type d " |
| 993 | (shell-quote-argument "(") | ||
| 991 | ;; we should use shell-quote-argument here | 994 | ;; we should use shell-quote-argument here |
| 992 | " -path " | 995 | " -path " |
| 993 | (mapconcat | 996 | (mapconcat |
diff --git a/lisp/subr.el b/lisp/subr.el index b49a20e7f6e..a2676b1173d 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2254,7 +2254,7 @@ is nil and `use-dialog-box' is non-nil." | |||
| 2254 | (listp last-nonmenu-event) | 2254 | (listp last-nonmenu-event) |
| 2255 | use-dialog-box) | 2255 | use-dialog-box) |
| 2256 | (setq answer | 2256 | (setq answer |
| 2257 | (x-popup-dialog t `(,prompt ("yes" . act) ("No" . skip)))) | 2257 | (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip)))) |
| 2258 | (setq prompt (concat prompt | 2258 | (setq prompt (concat prompt |
| 2259 | (if (eq ?\s (aref prompt (1- (length prompt)))) | 2259 | (if (eq ?\s (aref prompt (1- (length prompt)))) |
| 2260 | "" " ") | 2260 | "" " ") |
diff --git a/msdos/ChangeLog b/msdos/ChangeLog index 9b8a96c117c..46a5b69cc16 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | 2011-07-25 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-09-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * sedlibmk.inp (CONFIG_CLEAN_VPATH_FILES): Adjust to snippet moves | 3 | * sedlibmk.inp (CONFIG_CLEAN_VPATH_FILES): Adjust to snippet moves |
| 4 | from top level to build-aux/snippet (Bug#9169). | 4 | from top level to build-aux/snippet (Bug#9169). |
diff --git a/src/ChangeLog b/src/ChangeLog index e730c79f65b..6131249beb9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,7 +1,30 @@ | |||
| 1 | 2011-09-04 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-09-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * Makefile.in (gl-stamp): move-if-change now in build-aux (Bug#9169). | 3 | * Makefile.in (gl-stamp): move-if-change now in build-aux (Bug#9169). |
| 4 | 4 | ||
| 5 | 2011-09-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 6 | |||
| 7 | * fileio.c: Fix bugs with large file offsets (Bug#9428). | ||
| 8 | The previous code assumed that file offsets (off_t values) fit in | ||
| 9 | EMACS_INT variables, which is not true on typical 32-bit hosts. | ||
| 10 | The code messed up by falsely reporting buffer overflow in cases | ||
| 11 | such as (insert-file-contents "big" nil 1 2) into an empty buffer | ||
| 12 | when "big" contains more than 2**29 bytes, even though this | ||
| 13 | inserts just one byte and does not overflow the buffer. | ||
| 14 | (Finsert_file_contents): Store file offsets as off_t | ||
| 15 | values, not as EMACS_INT values. Check for overflow when | ||
| 16 | converting between EMACS_INT and off_t. When checking for | ||
| 17 | buffer overflow or for overlap, take the offsets into account. | ||
| 18 | Don't use EMACS_INT for small values where int suffices. | ||
| 19 | When checking for overlap, fix a typo: ZV was used where | ||
| 20 | ZV_BYTE was intended. | ||
| 21 | (Fwrite_region): Don't assume off_t fits into 'long'. | ||
| 22 | * buffer.h (struct buffer.modtime_size): Now off_t, not EMACS_INT. | ||
| 23 | |||
| 24 | 2011-09-05 Michael Albinus <michael.albinus@gmx.de> | ||
| 25 | |||
| 26 | * dbusbind.c (xd_signature_cat): Rename from signature_cat. | ||
| 27 | |||
| 5 | 2011-09-04 Paul Eggert <eggert@cs.ucla.edu> | 28 | 2011-09-04 Paul Eggert <eggert@cs.ucla.edu> |
| 6 | 29 | ||
| 7 | sprintf-related integer and memory overflow issues (Bug#9412). | 30 | sprintf-related integer and memory overflow issues (Bug#9412). |
diff --git a/src/buffer.h b/src/buffer.h index 06864dd5789..c50cfe56c77 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -559,7 +559,7 @@ struct buffer | |||
| 559 | is still the same (since it's rounded up to seconds) but we're actually | 559 | is still the same (since it's rounded up to seconds) but we're actually |
| 560 | not up-to-date. -1 means the size is unknown. Only meaningful if | 560 | not up-to-date. -1 means the size is unknown. Only meaningful if |
| 561 | modtime is actually set. */ | 561 | modtime is actually set. */ |
| 562 | EMACS_INT modtime_size; | 562 | off_t modtime_size; |
| 563 | /* The value of text->modiff at the last auto-save. */ | 563 | /* The value of text->modiff at the last auto-save. */ |
| 564 | int auto_save_modified; | 564 | int auto_save_modified; |
| 565 | /* The value of text->modiff at the last display error. | 565 | /* The value of text->modiff at the last display error. |
diff --git a/src/dbusbind.c b/src/dbusbind.c index 8dac2a6249f..2a38d15873c 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -262,7 +262,7 @@ xd_symbol_to_dbus_type (Lisp_Object object) | |||
| 262 | /* Append to SIGNATURE a copy of X, making sure SIGNATURE does | 262 | /* Append to SIGNATURE a copy of X, making sure SIGNATURE does |
| 263 | not become too long. */ | 263 | not become too long. */ |
| 264 | static void | 264 | static void |
| 265 | signature_cat (char *signature, char const *x) | 265 | xd_signature_cat (char *signature, char const *x) |
| 266 | { | 266 | { |
| 267 | ptrdiff_t siglen = strlen (signature); | 267 | ptrdiff_t siglen = strlen (signature); |
| 268 | ptrdiff_t xlen = strlen (x); | 268 | ptrdiff_t xlen = strlen (x); |
| @@ -401,10 +401,10 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis | |||
| 401 | { | 401 | { |
| 402 | subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); | 402 | subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
| 403 | xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); | 403 | xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
| 404 | signature_cat (signature, x); | 404 | xd_signature_cat (signature, x); |
| 405 | elt = CDR_SAFE (XD_NEXT_VALUE (elt)); | 405 | elt = CDR_SAFE (XD_NEXT_VALUE (elt)); |
| 406 | } | 406 | } |
| 407 | signature_cat (signature, DBUS_STRUCT_END_CHAR_AS_STRING); | 407 | xd_signature_cat (signature, DBUS_STRUCT_END_CHAR_AS_STRING); |
| 408 | break; | 408 | break; |
| 409 | 409 | ||
| 410 | case DBUS_TYPE_DICT_ENTRY: | 410 | case DBUS_TYPE_DICT_ENTRY: |
| @@ -425,7 +425,7 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis | |||
| 425 | elt = XD_NEXT_VALUE (elt); | 425 | elt = XD_NEXT_VALUE (elt); |
| 426 | subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); | 426 | subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
| 427 | xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); | 427 | xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
| 428 | signature_cat (signature, x); | 428 | xd_signature_cat (signature, x); |
| 429 | 429 | ||
| 430 | if (!XD_BASIC_DBUS_TYPE (subtype)) | 430 | if (!XD_BASIC_DBUS_TYPE (subtype)) |
| 431 | wrong_type_argument (intern ("D-Bus"), CAR_SAFE (XD_NEXT_VALUE (elt))); | 431 | wrong_type_argument (intern ("D-Bus"), CAR_SAFE (XD_NEXT_VALUE (elt))); |
| @@ -434,14 +434,14 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis | |||
| 434 | elt = CDR_SAFE (XD_NEXT_VALUE (elt)); | 434 | elt = CDR_SAFE (XD_NEXT_VALUE (elt)); |
| 435 | subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); | 435 | subtype = XD_OBJECT_TO_DBUS_TYPE (CAR_SAFE (elt)); |
| 436 | xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); | 436 | xd_signature (x, subtype, dtype, CAR_SAFE (XD_NEXT_VALUE (elt))); |
| 437 | signature_cat (signature, x); | 437 | xd_signature_cat (signature, x); |
| 438 | 438 | ||
| 439 | if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) | 439 | if (!NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) |
| 440 | wrong_type_argument (intern ("D-Bus"), | 440 | wrong_type_argument (intern ("D-Bus"), |
| 441 | CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); | 441 | CAR_SAFE (CDR_SAFE (XD_NEXT_VALUE (elt)))); |
| 442 | 442 | ||
| 443 | /* Closing signature. */ | 443 | /* Closing signature. */ |
| 444 | signature_cat (signature, DBUS_DICT_ENTRY_END_CHAR_AS_STRING); | 444 | xd_signature_cat (signature, DBUS_DICT_ENTRY_END_CHAR_AS_STRING); |
| 445 | break; | 445 | break; |
| 446 | 446 | ||
| 447 | default: | 447 | default: |
diff --git a/src/fileio.c b/src/fileio.c index 60ee35bb399..fe0fb593208 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3179,6 +3179,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3179 | EMACS_INT inserted = 0; | 3179 | EMACS_INT inserted = 0; |
| 3180 | int nochange = 0; | 3180 | int nochange = 0; |
| 3181 | register EMACS_INT how_much; | 3181 | register EMACS_INT how_much; |
| 3182 | off_t beg_offset, end_offset; | ||
| 3182 | register EMACS_INT unprocessed; | 3183 | register EMACS_INT unprocessed; |
| 3183 | int count = SPECPDL_INDEX (); | 3184 | int count = SPECPDL_INDEX (); |
| 3184 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 3185 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| @@ -3284,15 +3285,6 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3284 | record_unwind_protect (close_file_unwind, make_number (fd)); | 3285 | record_unwind_protect (close_file_unwind, make_number (fd)); |
| 3285 | 3286 | ||
| 3286 | 3287 | ||
| 3287 | /* Check whether the size is too large or negative, which can happen on a | ||
| 3288 | platform that allows file sizes greater than the maximum off_t value. */ | ||
| 3289 | if (! not_regular | ||
| 3290 | && ! (0 <= st.st_size && st.st_size <= BUF_BYTES_MAX)) | ||
| 3291 | buffer_overflow (); | ||
| 3292 | |||
| 3293 | /* Prevent redisplay optimizations. */ | ||
| 3294 | current_buffer->clip_changed = 1; | ||
| 3295 | |||
| 3296 | if (!NILP (visit)) | 3288 | if (!NILP (visit)) |
| 3297 | { | 3289 | { |
| 3298 | if (!NILP (beg) || !NILP (end)) | 3290 | if (!NILP (beg) || !NILP (end)) |
| @@ -3302,26 +3294,64 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3302 | } | 3294 | } |
| 3303 | 3295 | ||
| 3304 | if (!NILP (beg)) | 3296 | if (!NILP (beg)) |
| 3305 | CHECK_NUMBER (beg); | 3297 | { |
| 3298 | if (! (RANGED_INTEGERP (0, beg, TYPE_MAXIMUM (off_t)))) | ||
| 3299 | wrong_type_argument (intern ("file-offset"), beg); | ||
| 3300 | beg_offset = XFASTINT (beg); | ||
| 3301 | } | ||
| 3306 | else | 3302 | else |
| 3307 | XSETFASTINT (beg, 0); | 3303 | beg_offset = 0; |
| 3308 | 3304 | ||
| 3309 | if (!NILP (end)) | 3305 | if (!NILP (end)) |
| 3310 | CHECK_NUMBER (end); | 3306 | { |
| 3307 | if (! (RANGED_INTEGERP (0, end, TYPE_MAXIMUM (off_t)))) | ||
| 3308 | wrong_type_argument (intern ("file-offset"), end); | ||
| 3309 | end_offset = XFASTINT (end); | ||
| 3310 | } | ||
| 3311 | else | 3311 | else |
| 3312 | { | 3312 | { |
| 3313 | if (! not_regular) | 3313 | if (not_regular) |
| 3314 | end_offset = TYPE_MAXIMUM (off_t); | ||
| 3315 | else | ||
| 3314 | { | 3316 | { |
| 3315 | XSETINT (end, st.st_size); | 3317 | end_offset = st.st_size; |
| 3318 | |||
| 3319 | /* A negative size can happen on a platform that allows file | ||
| 3320 | sizes greater than the maximum off_t value. */ | ||
| 3321 | if (end_offset < 0) | ||
| 3322 | buffer_overflow (); | ||
| 3316 | 3323 | ||
| 3317 | /* The file size returned from stat may be zero, but data | 3324 | /* The file size returned from stat may be zero, but data |
| 3318 | may be readable nonetheless, for example when this is a | 3325 | may be readable nonetheless, for example when this is a |
| 3319 | file in the /proc filesystem. */ | 3326 | file in the /proc filesystem. */ |
| 3320 | if (st.st_size == 0) | 3327 | if (end_offset == 0) |
| 3321 | XSETINT (end, READ_BUF_SIZE); | 3328 | end_offset = READ_BUF_SIZE; |
| 3322 | } | 3329 | } |
| 3323 | } | 3330 | } |
| 3324 | 3331 | ||
| 3332 | /* Check now whether the buffer will become too large, | ||
| 3333 | in the likely case where the file's length is not changing. | ||
| 3334 | This saves a lot of needless work before a buffer overflow. */ | ||
| 3335 | if (! not_regular) | ||
| 3336 | { | ||
| 3337 | /* The likely offset where we will stop reading. We could read | ||
| 3338 | more (or less), if the file grows (or shrinks) as we read it. */ | ||
| 3339 | off_t likely_end = min (end_offset, st.st_size); | ||
| 3340 | |||
| 3341 | if (beg_offset < likely_end) | ||
| 3342 | { | ||
| 3343 | ptrdiff_t buf_bytes = | ||
| 3344 | Z_BYTE - (!NILP (replace) ? ZV_BYTE - BEGV_BYTE : 0); | ||
| 3345 | ptrdiff_t buf_growth_max = BUF_BYTES_MAX - buf_bytes; | ||
| 3346 | off_t likely_growth = likely_end - beg_offset; | ||
| 3347 | if (buf_growth_max < likely_growth) | ||
| 3348 | buffer_overflow (); | ||
| 3349 | } | ||
| 3350 | } | ||
| 3351 | |||
| 3352 | /* Prevent redisplay optimizations. */ | ||
| 3353 | current_buffer->clip_changed = 1; | ||
| 3354 | |||
| 3325 | if (EQ (Vcoding_system_for_read, Qauto_save_coding)) | 3355 | if (EQ (Vcoding_system_for_read, Qauto_save_coding)) |
| 3326 | { | 3356 | { |
| 3327 | coding_system = coding_inherit_eol_type (Qutf_8_emacs, Qunix); | 3357 | coding_system = coding_inherit_eol_type (Qutf_8_emacs, Qunix); |
| @@ -3465,9 +3495,9 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3465 | give up on handling REPLACE in the optimized way. */ | 3495 | give up on handling REPLACE in the optimized way. */ |
| 3466 | int giveup_match_end = 0; | 3496 | int giveup_match_end = 0; |
| 3467 | 3497 | ||
| 3468 | if (XINT (beg) != 0) | 3498 | if (beg_offset != 0) |
| 3469 | { | 3499 | { |
| 3470 | if (emacs_lseek (fd, XINT (beg), SEEK_SET) < 0) | 3500 | if (lseek (fd, beg_offset, SEEK_SET) < 0) |
| 3471 | report_file_error ("Setting file position", | 3501 | report_file_error ("Setting file position", |
| 3472 | Fcons (orig_filename, Qnil)); | 3502 | Fcons (orig_filename, Qnil)); |
| 3473 | } | 3503 | } |
| @@ -3515,7 +3545,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3515 | immediate_quit = 0; | 3545 | immediate_quit = 0; |
| 3516 | /* If the file matches the buffer completely, | 3546 | /* If the file matches the buffer completely, |
| 3517 | there's no need to replace anything. */ | 3547 | there's no need to replace anything. */ |
| 3518 | if (same_at_start - BEGV_BYTE == XINT (end)) | 3548 | if (same_at_start - BEGV_BYTE == end_offset) |
| 3519 | { | 3549 | { |
| 3520 | emacs_close (fd); | 3550 | emacs_close (fd); |
| 3521 | specpdl_ptr--; | 3551 | specpdl_ptr--; |
| @@ -3530,16 +3560,17 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3530 | already found that decoding is necessary, don't waste time. */ | 3560 | already found that decoding is necessary, don't waste time. */ |
| 3531 | while (!giveup_match_end) | 3561 | while (!giveup_match_end) |
| 3532 | { | 3562 | { |
| 3533 | EMACS_INT total_read, nread, bufpos, curpos, trial; | 3563 | int total_read, nread, bufpos, trial; |
| 3564 | off_t curpos; | ||
| 3534 | 3565 | ||
| 3535 | /* At what file position are we now scanning? */ | 3566 | /* At what file position are we now scanning? */ |
| 3536 | curpos = XINT (end) - (ZV_BYTE - same_at_end); | 3567 | curpos = end_offset - (ZV_BYTE - same_at_end); |
| 3537 | /* If the entire file matches the buffer tail, stop the scan. */ | 3568 | /* If the entire file matches the buffer tail, stop the scan. */ |
| 3538 | if (curpos == 0) | 3569 | if (curpos == 0) |
| 3539 | break; | 3570 | break; |
| 3540 | /* How much can we scan in the next step? */ | 3571 | /* How much can we scan in the next step? */ |
| 3541 | trial = min (curpos, sizeof buffer); | 3572 | trial = min (curpos, sizeof buffer); |
| 3542 | if (emacs_lseek (fd, curpos - trial, SEEK_SET) < 0) | 3573 | if (lseek (fd, curpos - trial, SEEK_SET) < 0) |
| 3543 | report_file_error ("Setting file position", | 3574 | report_file_error ("Setting file position", |
| 3544 | Fcons (orig_filename, Qnil)); | 3575 | Fcons (orig_filename, Qnil)); |
| 3545 | 3576 | ||
| @@ -3606,13 +3637,14 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3606 | 3637 | ||
| 3607 | /* Don't try to reuse the same piece of text twice. */ | 3638 | /* Don't try to reuse the same piece of text twice. */ |
| 3608 | overlap = (same_at_start - BEGV_BYTE | 3639 | overlap = (same_at_start - BEGV_BYTE |
| 3609 | - (same_at_end + st.st_size - ZV)); | 3640 | - (same_at_end |
| 3641 | + (! NILP (end) ? end_offset : st.st_size) - ZV_BYTE)); | ||
| 3610 | if (overlap > 0) | 3642 | if (overlap > 0) |
| 3611 | same_at_end += overlap; | 3643 | same_at_end += overlap; |
| 3612 | 3644 | ||
| 3613 | /* Arrange to read only the nonmatching middle part of the file. */ | 3645 | /* Arrange to read only the nonmatching middle part of the file. */ |
| 3614 | XSETFASTINT (beg, XINT (beg) + (same_at_start - BEGV_BYTE)); | 3646 | beg_offset += same_at_start - BEGV_BYTE; |
| 3615 | XSETFASTINT (end, XINT (end) - (ZV_BYTE - same_at_end)); | 3647 | end_offset -= ZV_BYTE - same_at_end; |
| 3616 | 3648 | ||
| 3617 | del_range_byte (same_at_start, same_at_end, 0); | 3649 | del_range_byte (same_at_start, same_at_end, 0); |
| 3618 | /* Insert from the file at the proper position. */ | 3650 | /* Insert from the file at the proper position. */ |
| @@ -3657,7 +3689,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3657 | /* First read the whole file, performing code conversion into | 3689 | /* First read the whole file, performing code conversion into |
| 3658 | CONVERSION_BUFFER. */ | 3690 | CONVERSION_BUFFER. */ |
| 3659 | 3691 | ||
| 3660 | if (emacs_lseek (fd, XINT (beg), SEEK_SET) < 0) | 3692 | if (lseek (fd, beg_offset, SEEK_SET) < 0) |
| 3661 | report_file_error ("Setting file position", | 3693 | report_file_error ("Setting file position", |
| 3662 | Fcons (orig_filename, Qnil)); | 3694 | Fcons (orig_filename, Qnil)); |
| 3663 | 3695 | ||
| @@ -3824,7 +3856,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3824 | } | 3856 | } |
| 3825 | 3857 | ||
| 3826 | if (! not_regular) | 3858 | if (! not_regular) |
| 3827 | total = XINT (end) - XINT (beg); | 3859 | total = end_offset - beg_offset; |
| 3828 | else | 3860 | else |
| 3829 | /* For a special file, all we can do is guess. */ | 3861 | /* For a special file, all we can do is guess. */ |
| 3830 | total = READ_BUF_SIZE; | 3862 | total = READ_BUF_SIZE; |
| @@ -3845,9 +3877,9 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3845 | if (GAP_SIZE < total) | 3877 | if (GAP_SIZE < total) |
| 3846 | make_gap (total - GAP_SIZE); | 3878 | make_gap (total - GAP_SIZE); |
| 3847 | 3879 | ||
| 3848 | if (XINT (beg) != 0 || !NILP (replace)) | 3880 | if (beg_offset != 0 || !NILP (replace)) |
| 3849 | { | 3881 | { |
| 3850 | if (emacs_lseek (fd, XINT (beg), SEEK_SET) < 0) | 3882 | if (lseek (fd, beg_offset, SEEK_SET) < 0) |
| 3851 | report_file_error ("Setting file position", | 3883 | report_file_error ("Setting file position", |
| 3852 | Fcons (orig_filename, Qnil)); | 3884 | Fcons (orig_filename, Qnil)); |
| 3853 | } | 3885 | } |
| @@ -4576,7 +4608,7 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 4576 | 4608 | ||
| 4577 | if (!NILP (append) && !NILP (Ffile_regular_p (filename))) | 4609 | if (!NILP (append) && !NILP (Ffile_regular_p (filename))) |
| 4578 | { | 4610 | { |
| 4579 | long ret; | 4611 | off_t ret; |
| 4580 | 4612 | ||
| 4581 | if (NUMBERP (append)) | 4613 | if (NUMBERP (append)) |
| 4582 | ret = emacs_lseek (desc, XINT (append), SEEK_CUR); | 4614 | ret = emacs_lseek (desc, XINT (append), SEEK_CUR); |