Merge from mainline.
This commit is contained in:
commit
b5611f17a7
27 changed files with 239 additions and 74 deletions
|
@ -1,6 +1,7 @@
|
|||
2011-04-28 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* NEWS: Document `delayed-warnings-list' and `delayed-warnings-hook'.
|
||||
Document new "default HOME" warning.
|
||||
|
||||
2011-04-26 Daniel Colascione <dan.colascione@gmail.com>
|
||||
|
||||
|
|
3
etc/NEWS
3
etc/NEWS
|
@ -62,7 +62,8 @@ longer have any effect. (They were declared obsolete in Emacs 23.)
|
|||
** New command line option `--no-site-lisp' removes site-lisp directories
|
||||
from load-path. -Q now implies this.
|
||||
|
||||
** On Windows, Emacs now warns when the obsolete _emacs init file is used.
|
||||
** On Windows, Emacs now warns when the obsolete _emacs init file is used,
|
||||
and also when HOME is set to C:\ by default.
|
||||
|
||||
|
||||
* Changes in Emacs 24.1
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
2011-04-30 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
* faces.el (face-spec-set-match-display): Don't match toolkit
|
||||
options on terminal frames.
|
||||
|
||||
2011-04-29 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* progmodes/pascal.el: Use lexical binding.
|
||||
(pascal-mode-map): Remove author preferences.
|
||||
|
||||
* pcomplete.el (pcomplete-std-complete): Don't abuse
|
||||
completion-at-point.
|
||||
|
||||
2011-04-28 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* calc/calccomp.el (math-comp-to-string-flat-term): Simplify by
|
||||
removing code that has been dead since 1991 or so.
|
||||
|
||||
* startup.el (command-line): When warning about "_emacs", use a
|
||||
delayed warning to allow the user to filter it out.
|
||||
|
||||
2011-04-28 Deniz Dogan <deniz@dogan.se>
|
||||
|
||||
* net/rcirc.el (rcirc-handler-353): Fix bug for channels which the
|
||||
|
@ -469,6 +490,15 @@
|
|||
Use the longitude argument rather than `calendar-longitude'.
|
||||
(solar-date-next-longitude): Remove unused locals.
|
||||
|
||||
2011-04-20 Vinicius Jose Latorre <viniciusjl@ig.com.br>
|
||||
|
||||
* whitespace.el: New version 13.2.1.
|
||||
|
||||
2011-04-20 felix <EmacsWiki> (tiny change)
|
||||
|
||||
* whitespace.el (global-whitespace-mode): keep highlight when
|
||||
switching between major modes on a file.
|
||||
|
||||
2011-04-19 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* progmodes/octave-mod.el (octave-in-comment-p, octave-in-string-p)
|
||||
|
|
|
@ -1282,12 +1282,7 @@
|
|||
(let ((prefix "") mrg wid)
|
||||
(setq mrg (aref math-comp-buf-margin i))
|
||||
(if (> mrg 12) ; indenting too far, go back to far left
|
||||
(let ((j i) (new (if calc-line-numbering 5 1)))
|
||||
'(while (<= j math-comp-level)
|
||||
(aset math-comp-buf-margin j
|
||||
(+ (aref math-comp-buf-margin j) (- new mrg)))
|
||||
(setq j (1+ j)))
|
||||
(setq mrg new)))
|
||||
(setq mrg (if calc-line-numbering 5 1)))
|
||||
(setq wid (+ (length str) math-comp-margin))
|
||||
(and (> (length str) 0) (= (aref str 0) ? )
|
||||
(> (length math-comp-buf) 0)
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2011-04-29 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* erc-pcomplete.el (erc-pcomplete-nick-postfix): Remove the " " in the
|
||||
suffix that's added by pcomplete-termination-string anyway.
|
||||
(pcomplete-erc-setup): Remove pcomplete-suffix-list setting now that
|
||||
it's not needed any more.
|
||||
|
||||
2011-04-26 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* erc.el (erc-mode-map): Use completion-at-point.
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
"Programmable completion for ERC"
|
||||
:group 'erc)
|
||||
|
||||
(defcustom erc-pcomplete-nick-postfix ": "
|
||||
(defcustom erc-pcomplete-nick-postfix ":"
|
||||
"*When `pcomplete' is used in the first word after the prompt,
|
||||
add this string to nicks completed."
|
||||
:group 'erc-pcomplete
|
||||
|
@ -93,8 +93,6 @@ for use on `completion-at-point-function'."
|
|||
t)
|
||||
(set (make-local-variable 'pcomplete-use-paring)
|
||||
nil)
|
||||
(set (make-local-variable 'pcomplete-suffix-list)
|
||||
'(? ?:))
|
||||
(set (make-local-variable 'pcomplete-parse-arguments-function)
|
||||
'pcomplete-parse-erc-arguments)
|
||||
(set (make-local-variable 'pcomplete-command-completion-function)
|
||||
|
|
|
@ -1451,18 +1451,18 @@ If FRAME is nil, the current FRAME is used."
|
|||
;; of supported colors, and all defface's
|
||||
;; are changed to look at number of colors
|
||||
;; instead of (type graphic) etc.
|
||||
(and (null (window-system frame))
|
||||
(memq 'tty options))
|
||||
(and (memq 'motif options)
|
||||
(featurep 'motif))
|
||||
(and (memq 'gtk options)
|
||||
(featurep 'gtk))
|
||||
(and (memq 'lucid options)
|
||||
(featurep 'x-toolkit)
|
||||
(not (featurep 'motif))
|
||||
(not (featurep 'gtk)))
|
||||
(and (memq 'x-toolkit options)
|
||||
(featurep 'x-toolkit))))
|
||||
(if (null (window-system frame))
|
||||
(memq 'tty options)
|
||||
(or (and (memq 'motif options)
|
||||
(featurep 'motif))
|
||||
(and (memq 'gtk options)
|
||||
(featurep 'gtk))
|
||||
(and (memq 'lucid options)
|
||||
(featurep 'x-toolkit)
|
||||
(not (featurep 'motif))
|
||||
(not (featurep 'gtk)))
|
||||
(and (memq 'x-toolkit options)
|
||||
(featurep 'x-toolkit))))))
|
||||
((eq req 'min-colors)
|
||||
(>= (display-color-cells frame) (car options)))
|
||||
((eq req 'class)
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2011-04-29 Lars Magne Ingebrigtsen <larsi@gnus.org>
|
||||
|
||||
* shr.el (shr-strike-through): New face.
|
||||
(shr-tag-s): Use it to provide <s> support.
|
||||
(shr-tag-s): Remove duplicate definition.
|
||||
|
||||
2011-04-25 Teodor Zlatanov <tzz@lifelogs.com>
|
||||
|
||||
* gnus-registry.el (gnus-registry-ignore-group-p): Don't call
|
||||
|
|
|
@ -87,6 +87,10 @@ used."
|
|||
This is used for cid: URLs, and the function is called with the
|
||||
cid: URL as the argument.")
|
||||
|
||||
(defface shr-strike-through '((t (:strike-through t)))
|
||||
"Font for <s> elements."
|
||||
:group 'shr)
|
||||
|
||||
;;; Internal variables.
|
||||
|
||||
(defvar shr-folding-mode nil)
|
||||
|
@ -760,6 +764,9 @@ ones, in case fg and bg are nil."
|
|||
(shr-generic cont)
|
||||
(shr-ensure-newline))
|
||||
|
||||
(defun shr-tag-s (cont)
|
||||
(shr-fontize-cont cont 'shr-strike-through))
|
||||
|
||||
(defun shr-tag-b (cont)
|
||||
(shr-fontize-cont cont 'bold))
|
||||
|
||||
|
@ -775,9 +782,6 @@ ones, in case fg and bg are nil."
|
|||
(defun shr-tag-u (cont)
|
||||
(shr-fontize-cont cont 'underline))
|
||||
|
||||
(defun shr-tag-s (cont)
|
||||
(shr-fontize-cont cont 'strike-through))
|
||||
|
||||
(defun shr-parse-style (style)
|
||||
(when style
|
||||
(save-match-data
|
||||
|
|
|
@ -545,8 +545,9 @@ Same as `pcomplete' but using the standard completion UI."
|
|||
;; variables to parse args, so there's no point autoloading it.
|
||||
;; ;;;###autoload
|
||||
(defun pcomplete-std-complete ()
|
||||
(let ((completion-at-point-functions '(pcomplete-completions-at-point)))
|
||||
(completion-at-point)))
|
||||
(let ((data (pcomplete-completions-at-point)))
|
||||
(completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)
|
||||
(plist-get :predicate (nthcdr 3 data)))))
|
||||
|
||||
;;; Pcomplete's native UI.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; pascal.el --- major mode for editing pascal source in Emacs
|
||||
;;; pascal.el --- major mode for editing pascal source in Emacs -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 1993-2011 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -76,8 +76,9 @@
|
|||
(define-key map ":" 'electric-pascal-colon)
|
||||
(define-key map "=" 'electric-pascal-equal)
|
||||
(define-key map "#" 'electric-pascal-hash)
|
||||
(define-key map "\r" 'electric-pascal-terminate-line)
|
||||
(define-key map "\t" 'electric-pascal-tab)
|
||||
;; These are user preferences, so not to set by default.
|
||||
;;(define-key map "\r" 'electric-pascal-terminate-line)
|
||||
;;(define-key map "\t" 'electric-pascal-tab)
|
||||
(define-key map "\M-\t" 'pascal-complete-word)
|
||||
(define-key map "\M-?" 'pascal-show-completions)
|
||||
(define-key map "\177" 'backward-delete-char-untabify)
|
||||
|
|
|
@ -1027,10 +1027,9 @@ opening the first frame (e.g. open a connection to an X server).")
|
|||
"~/.emacs")
|
||||
((directory-files "~" nil "^_emacs\\(\\.elc?\\)?$")
|
||||
;; Also support _emacs for compatibility, but warn about it.
|
||||
(display-warning
|
||||
'initialization
|
||||
"`_emacs' init file is deprecated, please use `.emacs'"
|
||||
:warning)
|
||||
(push '(initialization
|
||||
"`_emacs' init file is deprecated, please use `.emacs'")
|
||||
delayed-warnings-list)
|
||||
"~/_emacs")
|
||||
(t ;; But default to .emacs if _emacs does not exist.
|
||||
"~/.emacs"))))
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
|
||||
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
|
||||
;; Keywords: data, wp
|
||||
;; Version: 13.2
|
||||
;; Version: 13.2.1
|
||||
;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
@ -312,6 +312,9 @@
|
|||
;; Acknowledgements
|
||||
;; ----------------
|
||||
;;
|
||||
;; Thanks to felix (EmacsWiki) for keeping highlight when switching between
|
||||
;; major modes on a file.
|
||||
;;
|
||||
;; Thanks to David Reitter <david.reitter@gmail.com> for suggesting a
|
||||
;; `whitespace-newline' initialization with low contrast relative to
|
||||
;; the background color.
|
||||
|
@ -1132,6 +1135,7 @@ See also `whitespace-style', `whitespace-newline' and
|
|||
(global-whitespace-mode ; global-whitespace-mode on
|
||||
(save-excursion
|
||||
(add-hook 'find-file-hook 'whitespace-turn-on-if-enabled)
|
||||
(add-hook 'after-change-major-mode-hook 'whitespace-turn-on-if-enabled)
|
||||
(dolist (buffer (buffer-list)) ; adjust all local mode
|
||||
(set-buffer buffer)
|
||||
(unless whitespace-mode
|
||||
|
@ -1139,6 +1143,7 @@ See also `whitespace-style', `whitespace-newline' and
|
|||
(t ; global-whitespace-mode off
|
||||
(save-excursion
|
||||
(remove-hook 'find-file-hook 'whitespace-turn-on-if-enabled)
|
||||
(remove-hook 'after-change-major-mode-hook 'whitespace-turn-on-if-enabled)
|
||||
(dolist (buffer (buffer-list)) ; adjust all local mode
|
||||
(set-buffer buffer)
|
||||
(unless whitespace-mode
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
2011-04-30 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* inttypes.h: New file.
|
||||
|
||||
* sed2v2.inp (HAVE_DECL_STRTOULL, HAVE_DECL_STRTOUMAX)
|
||||
(HAVE_STRTOULL, HAVE_STRTOULL): Define to 1.
|
||||
|
||||
* sedlibmk.inp (BUILT_SOURCES): Edit out inttypes.h.
|
||||
|
||||
* sed1v2.inp (CPPFLAGS): Edit to "-I../msdos".
|
||||
Add ../msdos/inttypes.h to prerequisites of lread.o.
|
||||
|
||||
2011-04-24 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* sedlibmk.inp (am_libgnu_a_OBJECTS): Edit out
|
||||
|
|
31
msdos/inttypes.h
Normal file
31
msdos/inttypes.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* Replacement inntypes.h file for building GNU Emacs on MS-DOS with DJGPP.
|
||||
|
||||
Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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
|
||||
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _REPL_INTTYPES_H
|
||||
#define _REPL_INTTYPES_H
|
||||
|
||||
#if __DJGPP__ > 2 || __DJGPP_MINOR__ >= 4
|
||||
#include_next <inttypes.h>
|
||||
#else /* __DJGPP__ < 2.04 */
|
||||
#include <stdlib.h>
|
||||
#define uintmax_t unsigned long long
|
||||
#define strtoumax strtoull
|
||||
#endif /* __DJGPP__ < 2.04 */
|
||||
|
||||
#endif
|
|
@ -28,7 +28,8 @@ s/\.h\.in/.h-in/
|
|||
/^CPP *=/s/@[^@\n]*@/gcc -e/
|
||||
/^CFLAGS *=/s/@[^@\n]*@/-O2 -gcoff/
|
||||
/^ALL_CFLAGS *=/s/@[^@\n]*@//g
|
||||
/^CPPFLAGS *=/s/@[^@\n]*@//
|
||||
/^ALL_CFLAGS *=/s/ -I\.//g
|
||||
/^CPPFLAGS *=/s|@[^@\n]*@|-I../msdos|
|
||||
/^LDFLAGS *=/s/@[^@\n]*@//
|
||||
/^LD_FIRSTFLAG *=/s/@[^@\n]*@//
|
||||
/^LIBS *=/s/@[^@\n]*@//
|
||||
|
@ -193,3 +194,5 @@ s/\$(LIBOTF_CFLAGS) \$(M17N_FLT_CFLAGS) \$(DEPFLAGS) //
|
|||
s/ \$(C_SWITCH_X_SITE)//
|
||||
s/ \$(DBUS_CFLAGS)//
|
||||
s| -I\$(srcdir)/../lib||
|
||||
# Add our local inttypes.h to prerequisites where needed
|
||||
/^lread\.o:/s|lread\.c|& ../msdos/inttypes.h|
|
||||
|
|
|
@ -100,6 +100,10 @@ s/^#undef POINTER_TYPE *$/#define POINTER_TYPE void/
|
|||
#else\
|
||||
#undef HAVE_STDINT_H\
|
||||
#endif
|
||||
s/^#undef HAVE_DECL_STRTOULL *$/#define HAVE_DECL_STRTOULL 1/
|
||||
s/^#undef HAVE_DECL_STRTOUMAX *$/#define HAVE_DECL_STRTOUMAX 1/
|
||||
s/^#undef HAVE_STRTOULL *$/#define HAVE_STRTOULL 1/
|
||||
s/^#undef HAVE_STRTOULL *$/#define HAVE_STRTOULL 1/
|
||||
|
||||
# Comment out any remaining undef directives, because some of them
|
||||
# might be defined in sys/config.h we include at the top of config.h.
|
||||
|
|
|
@ -515,8 +515,9 @@ am__cd = cd
|
|||
/^WCHAR_T_SUFFIX *=/s/@WCHAR_T_SUFFIX@/h/
|
||||
/^WINT_T_SUFFIX *=/s/@WINT_T_SUFFIX@//
|
||||
/^gl_LIBOBJS *=/s/@[^@\n]*@/getopt.o getopt1.o strftime.o time_r.o getloadavg.o md5.o filemode.o/
|
||||
/^am_libgnu_a_OBJECTS *=/s/careadlinkat.\$(OBJEXT)//
|
||||
/^am_libgnu_a_OBJECTS *=/s/allocator.\$(OBJEXT)//
|
||||
/^BUILT_SOURCES *=/s/ *inttypes\.h//
|
||||
/^am_libgnu_a_OBJECTS *=/s/careadlinkat\.\$(OBJEXT)//
|
||||
/^am_libgnu_a_OBJECTS *=/s/allocator\.\$(OBJEXT)//
|
||||
/^srcdir *=/s/@[^@\n]*@/./
|
||||
/^top_srcdir *=/s/@[^@\n]*@/../
|
||||
/^top_builddir *=/s/@[^@\n]*@/../
|
||||
|
|
12
nt/ChangeLog
12
nt/ChangeLog
|
@ -1,9 +1,13 @@
|
|||
2011-04-30 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* config.nt: Configure 64-bit integers.
|
||||
(BITS_PER_LONG_LONG): Define if C99-style long long and "%lld" work.
|
||||
(EMACS_INT, BITS_PER_EMACS_INT, pI): Otherwise, define these if
|
||||
__int64 and "%I64d" work.
|
||||
* config.nt: Configure 64-bit integers for older compilers.
|
||||
(EMACS_INT, BITS_PER_EMACS_INT, pI): Define these if __int64 and
|
||||
"%I64d" work but long long and "%lld" do not.
|
||||
|
||||
2011-04-30 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* config.nt (HAVE_LONG_LONG_INT, HAVE_UNSIGNED_LONG_LONG_INT):
|
||||
Define to 1 for MinGW of MSVC versions >= 1400.
|
||||
|
||||
2011-04-28 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
|
|
15
nt/config.nt
15
nt/config.nt
|
@ -470,14 +470,21 @@ extern char *getenv ();
|
|||
#define BITS_PER_LONG 32
|
||||
#endif
|
||||
|
||||
#if defined __MINGW32__ || 1400 <= _MSC_VER
|
||||
/* C99-style long long and "%lld" both work, so use them. */
|
||||
# define BITS_PER_LONG_LONG 64
|
||||
#elif 1200 <= _MSC_VER
|
||||
#if defined(__MINGW32__) || _MSC_VER >= 1400
|
||||
|
||||
/* Define to 1 if the system has the type `long long int'. */
|
||||
# define HAVE_LONG_LONG_INT 1
|
||||
|
||||
/* Define to 1 if the system has the type `unsigned long long int'. */
|
||||
# define HAVE_UNSIGNED_LONG_LONG_INT 1
|
||||
|
||||
#elif _MSC_VER >= 1200
|
||||
|
||||
/* Use pre-C99-style 64-bit integers. */
|
||||
# define EMACS_INT __int64
|
||||
# define BITS_PER_EMACS_INT 64
|
||||
# define pI "I64"
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef POINTER_TYPE
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
(xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages): Use
|
||||
SYMBOLP-guarded XSYMBOL, not XPNTR.
|
||||
|
||||
2011-04-29 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t.
|
||||
(EMACS_UINTPTR): Likewise, with uintptr_t.
|
||||
|
||||
|
@ -54,8 +52,6 @@
|
|||
Use a local to convert to proper width without a cast.
|
||||
* xmenu.c (dialog_selection_callback): Likewise.
|
||||
|
||||
2011-04-28 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* sysdep.c (get_random): Don't assume EMACS_INT is no wider than long.
|
||||
Also, don't assume VALBITS / RAND_BITS is less than 5,
|
||||
and don't rely on undefined behavior when shifting a 1 left into
|
||||
|
@ -79,6 +75,42 @@
|
|||
|
||||
* fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.
|
||||
|
||||
2011-04-30 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* dosfns.c (Fint86, Fdos_memget, Fdos_memput): Use `ASIZE (FOO)'
|
||||
rather than `XVECTOR (FOO)->size'.
|
||||
|
||||
* process.c: Remove HAVE_INTTYPES_H condition from inclusion of
|
||||
inttypes.h, as a gnulib replacement is used if it not available in
|
||||
system headers.
|
||||
|
||||
2011-04-21 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
Lift the MOST_POSITIVE_FIXNUM/4 limitation on visited files.
|
||||
* fileio.c (Finsert_file_contents): Don't limit file size to 1/4
|
||||
of MOST_POSITIVE_FIXNUM. (Bug#8528)
|
||||
|
||||
* coding.c (coding_alloc_by_realloc): Error out if destination
|
||||
will grow beyond MOST_POSITIVE_FIXNUM.
|
||||
(decode_coding_emacs_mule): Abort if there isn't enough place in
|
||||
charbuf for the composition carryover bytes. Reserve an extra
|
||||
space for up to 2 characters produced in a loop.
|
||||
(decode_coding_iso_2022): Abort if there isn't enough place in
|
||||
charbuf for the composition carryover bytes.
|
||||
|
||||
2011-04-21 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* doprnt.c (doprnt) [!HAVE_LONG_LONG_INT]: Error out instead of
|
||||
aborting when %lld or %lll format is passed.
|
||||
[!HAVE_UNSIGNED_LONG_LONG_INT]: Error out instead of aborting when
|
||||
%llo or %llx format is passed. (Bug#8545)
|
||||
|
||||
* window.c (window_scroll_line_based): Use a marker instead of
|
||||
simple variables to record original value of point. (Bug#7952)
|
||||
|
||||
* doprnt.c (doprnt): Fix the case where a multibyte sequence
|
||||
produced by %s or %c overflows available buffer space. (Bug#8545)
|
||||
|
||||
2011-04-28 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* doprnt.c (doprnt): Omit useless test; int overflow check (Bug#8545).
|
||||
|
|
10
src/coding.c
10
src/coding.c
|
@ -1071,6 +1071,8 @@ coding_set_destination (struct coding_system *coding)
|
|||
static void
|
||||
coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes)
|
||||
{
|
||||
if (coding->dst_bytes >= MOST_POSITIVE_FIXNUM - bytes)
|
||||
error ("Maximum size of buffer or string exceeded");
|
||||
coding->destination = (unsigned char *) xrealloc (coding->destination,
|
||||
coding->dst_bytes + bytes);
|
||||
coding->dst_bytes += bytes;
|
||||
|
@ -2333,7 +2335,9 @@ decode_coding_emacs_mule (struct coding_system *coding)
|
|||
/* We may produce two annotations (charset and composition) in one
|
||||
loop and one more charset annotation at the end. */
|
||||
int *charbuf_end
|
||||
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
|
||||
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3)
|
||||
/* We can produce up to 2 characters in a loop. */
|
||||
- 1;
|
||||
EMACS_INT consumed_chars = 0, consumed_chars_base;
|
||||
int multibytep = coding->src_multibyte;
|
||||
EMACS_INT char_offset = coding->produced_char;
|
||||
|
@ -2348,6 +2352,8 @@ decode_coding_emacs_mule (struct coding_system *coding)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (charbuf_end - charbuf < cmp_status->length)
|
||||
abort ();
|
||||
for (i = 0; i < cmp_status->length; i++)
|
||||
*charbuf++ = cmp_status->carryover[i];
|
||||
coding->annotated = 1;
|
||||
|
@ -3479,6 +3485,8 @@ decode_coding_iso_2022 (struct coding_system *coding)
|
|||
|
||||
if (cmp_status->state != COMPOSING_NO)
|
||||
{
|
||||
if (charbuf_end - charbuf < cmp_status->length)
|
||||
abort ();
|
||||
for (i = 0; i < cmp_status->length; i++)
|
||||
*charbuf++ = cmp_status->carryover[i];
|
||||
coding->annotated = 1;
|
||||
|
|
22
src/doprnt.c
22
src/doprnt.c
|
@ -269,7 +269,7 @@ doprnt (char *buffer, register size_t bufsize, const char *format,
|
|||
long long ll = va_arg (ap, long long);
|
||||
sprintf (sprintf_buffer, fmtcpy, ll);
|
||||
#else
|
||||
abort ();
|
||||
error ("Invalid format operation %%ll%c", fmt[-1]);
|
||||
#endif
|
||||
}
|
||||
else if (long_flag)
|
||||
|
@ -299,7 +299,7 @@ doprnt (char *buffer, register size_t bufsize, const char *format,
|
|||
unsigned long long ull = va_arg (ap, unsigned long long);
|
||||
sprintf (sprintf_buffer, fmtcpy, ull);
|
||||
#else
|
||||
abort ();
|
||||
error ("Invalid format operation %%ll%c", fmt[-1]);
|
||||
#endif
|
||||
}
|
||||
else if (long_flag)
|
||||
|
@ -367,9 +367,21 @@ doprnt (char *buffer, register size_t bufsize, const char *format,
|
|||
/* Truncate the string at character boundary. */
|
||||
tem = bufsize;
|
||||
while (!CHAR_HEAD_P (string[tem - 1])) tem--;
|
||||
memcpy (bufptr, string, tem);
|
||||
/* We must calculate WIDTH again. */
|
||||
width = strwidth (bufptr, tem);
|
||||
/* If the multibyte sequence of this character is
|
||||
too long for the space we have left in the
|
||||
buffer, truncate before it. */
|
||||
if (tem > 0
|
||||
&& BYTES_BY_CHAR_HEAD (string[tem - 1]) > bufsize)
|
||||
tem--;
|
||||
if (tem > 0)
|
||||
memcpy (bufptr, string, tem);
|
||||
bufptr[tem] = 0;
|
||||
/* Trigger exit from the loop, but make sure we
|
||||
return to the caller a value which will indicate
|
||||
that the buffer was too small. */
|
||||
bufptr += bufsize;
|
||||
bufsize = 0;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
memcpy (bufptr, string, tem);
|
||||
|
|
|
@ -62,7 +62,7 @@ REGISTERS should be a vector produced by `make-register' and
|
|||
CHECK_NUMBER (interrupt);
|
||||
no = (unsigned long) XINT (interrupt);
|
||||
CHECK_VECTOR (registers);
|
||||
if (no < 0 || no > 0xff || XVECTOR (registers)-> size != 8)
|
||||
if (no < 0 || no > 0xff || ASIZE (registers) != 8)
|
||||
return Qnil;
|
||||
for (i = 0; i < 8; i++)
|
||||
CHECK_NUMBER (XVECTOR (registers)->contents[i]);
|
||||
|
@ -102,7 +102,7 @@ Return the updated VECTOR. */)
|
|||
CHECK_NUMBER (address);
|
||||
offs = (unsigned long) XINT (address);
|
||||
CHECK_VECTOR (vector);
|
||||
len = XVECTOR (vector)-> size;
|
||||
len = ASIZE (vector);
|
||||
if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len)
|
||||
return Qnil;
|
||||
buf = alloca (len);
|
||||
|
@ -125,7 +125,7 @@ DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
|
|||
CHECK_NUMBER (address);
|
||||
offs = (unsigned long) XINT (address);
|
||||
CHECK_VECTOR (vector);
|
||||
len = XVECTOR (vector)-> size;
|
||||
len = ASIZE (vector);
|
||||
if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len)
|
||||
return Qnil;
|
||||
buf = alloca (len);
|
||||
|
|
|
@ -1994,7 +1994,7 @@ verror (const char *m, va_list ap)
|
|||
{
|
||||
char buf[4000];
|
||||
size_t size = sizeof buf;
|
||||
size_t size_max = min (MOST_POSITIVE_FIXNUM, SIZE_MAX);
|
||||
size_t size_max = min (MOST_POSITIVE_FIXNUM, SIZE_MAX);
|
||||
size_t mlen = strlen (m);
|
||||
char *buffer = buf;
|
||||
size_t used;
|
||||
|
|
11
src/fileio.c
11
src/fileio.c
|
@ -3245,15 +3245,10 @@ variable `last-coding-system-used' to the coding system actually used. */)
|
|||
record_unwind_protect (close_file_unwind, make_number (fd));
|
||||
|
||||
|
||||
/* Arithmetic overflow can occur if an Emacs integer cannot represent the
|
||||
file size, or if the calculations below overflow. The calculations below
|
||||
double the file size twice, so check that it can be multiplied by 4
|
||||
safely.
|
||||
|
||||
Also check whether the size is negative, which can happen on a platform
|
||||
that allows file sizes greater than the maximum off_t value. */
|
||||
/* Check whether the size is too large or negative, which can happen on a
|
||||
platform that allows file sizes greater than the maximum off_t value. */
|
||||
if (! not_regular
|
||||
&& ! (0 <= st.st_size && st.st_size <= MOST_POSITIVE_FIXNUM / 4))
|
||||
&& ! (0 <= st.st_size && st.st_size <= MOST_POSITIVE_FIXNUM))
|
||||
error ("Maximum buffer size exceeded");
|
||||
|
||||
/* Prevent redisplay optimizations. */
|
||||
|
|
20
src/window.c
20
src/window.c
|
@ -5076,7 +5076,12 @@ static void
|
|||
window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
|
||||
{
|
||||
register struct window *w = XWINDOW (window);
|
||||
register EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
|
||||
/* Fvertical_motion enters redisplay, which can trigger
|
||||
fontification, which in turn can modify buffer text (e.g., if the
|
||||
fontification functions replace escape sequences with faces, as
|
||||
in `grep-mode-font-lock-keywords'). So we use a marker to record
|
||||
the old point position, to prevent crashes in SET_PT_BOTH. */
|
||||
Lisp_Object opoint_marker = Fpoint_marker ();
|
||||
register EMACS_INT pos, pos_byte;
|
||||
register int ht = window_internal_height (w);
|
||||
register Lisp_Object tem;
|
||||
|
@ -5126,7 +5131,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
|
|||
pos = PT;
|
||||
pos_byte = PT_BYTE;
|
||||
bolp = Fbolp ();
|
||||
SET_PT_BOTH (opoint, opoint_byte);
|
||||
SET_PT_BOTH (marker_position (opoint_marker),
|
||||
marker_byte_position (opoint_marker));
|
||||
|
||||
if (lose)
|
||||
{
|
||||
|
@ -5177,8 +5183,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
|
|||
else
|
||||
top_margin = pos;
|
||||
|
||||
if (top_margin <= opoint)
|
||||
SET_PT_BOTH (opoint, opoint_byte);
|
||||
if (top_margin <= marker_position (opoint_marker))
|
||||
SET_PT_BOTH (marker_position (opoint_marker),
|
||||
marker_byte_position (opoint_marker));
|
||||
else if (!NILP (Vscroll_preserve_screen_position))
|
||||
{
|
||||
SET_PT_BOTH (pos, pos_byte);
|
||||
|
@ -5200,8 +5207,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
|
|||
else
|
||||
bottom_margin = PT + 1;
|
||||
|
||||
if (bottom_margin > opoint)
|
||||
SET_PT_BOTH (opoint, opoint_byte);
|
||||
if (bottom_margin > marker_position (opoint_marker))
|
||||
SET_PT_BOTH (marker_position (opoint_marker),
|
||||
marker_byte_position (opoint_marker));
|
||||
else
|
||||
{
|
||||
if (!NILP (Vscroll_preserve_screen_position))
|
||||
|
|
Loading…
Add table
Reference in a new issue