merge trunk
This commit is contained in:
commit
2e58893d16
17 changed files with 164 additions and 170 deletions
|
@ -1,3 +1,7 @@
|
|||
2012-10-13 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* files.texi (File Conveniences): ImageMagick enabled by default.
|
||||
|
||||
2012-10-10 Dani Moncayo <dmoncayo@gmail.com>
|
||||
|
||||
* basic.texi (Arguments): Fix typos.
|
||||
|
|
|
@ -1931,15 +1931,22 @@ non-@code{nil}. Currently, Emacs only supports animation in GIF
|
|||
files.
|
||||
|
||||
@cindex ImageMagick support
|
||||
If your Emacs was compiled with ImageMagick support, it is possible
|
||||
to view a much wider variety of image types in Image mode, by
|
||||
rendering the images via ImageMagick. However, this feature is
|
||||
currently disabled by default. To enable it, add the following line
|
||||
to your init file:
|
||||
|
||||
@example
|
||||
(imagemagick-register-types)
|
||||
@end example
|
||||
@vindex imagemagick-enabled-types
|
||||
@vindex imagemagick-types-inhibit
|
||||
If Emacs was compiled with support for the ImageMagick library, it
|
||||
can use ImageMagick to render a wide variety of images. The variable
|
||||
@code{imagemagick-enabled-types} lists the image types that Emacs may
|
||||
render using ImageMagick; each element in the list should be an
|
||||
internal ImageMagick name for an image type, as a symbol or an
|
||||
equivalent string (e.g.@: @code{BMP} for @file{.bmp} images). To
|
||||
enable ImageMagick for all possible image types, change
|
||||
@code{imagemagick-enabled-types} to @code{t}. The variable
|
||||
@code{imagemagick-types-inhibit} lists the image types which should
|
||||
never be rendered using ImageMagick, regardless of the value of
|
||||
@code{imagemagick-enabled-types} (the default list includes types like
|
||||
@code{C} and @code{HTML}, which ImageMagick can render as an ``image''
|
||||
but Emacs should not). To disable ImageMagick entirely, change
|
||||
@code{imagemagick-types-inhibit} to @code{t}.
|
||||
|
||||
@findex thumbs-mode
|
||||
@findex mode, thumbs
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2012-10-13 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* display.texi (ImageMagick Images): ImageMagick enabled by default.
|
||||
|
||||
2012-10-05 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* minibuf.texi (Basic Completion): Clarify list form of completion
|
||||
|
|
|
@ -4579,56 +4579,34 @@ specifying the bounding box of the PostScript image, analogous to the
|
|||
@cindex images, support for more formats
|
||||
|
||||
If you build Emacs with ImageMagick support, you can use the
|
||||
ImageMagick library to load many image formats. The image type symbol
|
||||
ImageMagick library to load many image formats (@pxref{File
|
||||
Conveniences,,, emacs, The GNU Emacs Manual}). The image type symbol
|
||||
for images loaded via ImageMagick is @code{imagemagick}, regardless of
|
||||
the actual underlying image format.
|
||||
|
||||
@defun imagemagick-types
|
||||
This function returns a list of image file extensions supported by the
|
||||
current ImageMagick installation.
|
||||
current ImageMagick installation. Each list element is a symbol
|
||||
representing an internal ImageMagick name for an image type, such as
|
||||
@code{BMP} for @file{.bmp} images.
|
||||
@end defun
|
||||
|
||||
By default, Emacs does not use ImageMagick to display images in
|
||||
Image mode, e.g.@: when visiting such files with @kbd{C-x C-f}. This
|
||||
feature is enabled by calling @code{imagemagick-register-types}.
|
||||
|
||||
@defun imagemagick-register-types
|
||||
This function enables using Image mode to visit image files supported
|
||||
by ImageMagick. @xref{File Conveniences,,, emacs, The GNU Emacs
|
||||
Manual}. It also causes @code{create-image} and other helper
|
||||
functions to associate such file names with the @code{imagemagick}
|
||||
image type (@pxref{Defining Images}).
|
||||
|
||||
All image file extensions supported by ImageMagick are registered,
|
||||
except those specified in @code{imagemagick-types-inhibit}. If Emacs
|
||||
was not compiled with ImageMagick support, this function does nothing.
|
||||
@end defun
|
||||
|
||||
@defopt imagemagick-types-inhibit
|
||||
This variable specifies a list of image types that should @emph{not}
|
||||
be registered by @code{imagemagick-register-types}. Each entry in
|
||||
this list should be one of the symbols returned by
|
||||
@code{imagemagick-types}. The default value lists several file types
|
||||
that are considered ``images'' by ImageMagick, but which should not be
|
||||
considered as images by Emacs, including C files and HTML files.
|
||||
@defopt imagemagick-enabled-types
|
||||
The value of this variable is a list of ImageMagick image types which
|
||||
Emacs may attempt to render using ImageMagick. Each list element
|
||||
should be one of the symbols in the list returned by
|
||||
@code{imagemagick-types}, or an equivalent string. Alternatively, a
|
||||
value of @code{t} enables ImageMagick for all possible image types.
|
||||
Regardless of the value of this variable,
|
||||
@code{imagemagick-types-inhibit} (see below) takes precedence.
|
||||
@end defopt
|
||||
|
||||
@ignore
|
||||
@c I don't know what this means. I suspect it means eg loading jpg
|
||||
@c images via libjpeg or ImageMagick. But it doesn't work.
|
||||
@c If you don't have libjpeg support compiled in, you cannot
|
||||
@c view jpeg images, even if you have imagemagick support:
|
||||
@c http://debbugs.gnu.org/9045
|
||||
@c And if you have both compiled in, then you always get
|
||||
@c the libjpeg version:
|
||||
@c http://debbugs.gnu.org/10746
|
||||
There may be overlap between image loaders in your Emacs installation,
|
||||
and you may prefer to use a different one for a given image type
|
||||
(which loader will be used in practice depends on the priority of the
|
||||
loaders).
|
||||
For example, if you never want to use the ImageMagick loader to view
|
||||
JPEG files, add @code{JPG} to this list.
|
||||
@end ignore
|
||||
@defopt imagemagick-types-inhibit
|
||||
The value of this variable lists the ImageMagick image types which
|
||||
should never be rendered using ImageMagick, regardless of the value of
|
||||
@code{imagemagick-enabled-types}. A value of @code{t} disables
|
||||
ImageMagick entirely.
|
||||
@end defopt
|
||||
|
||||
Images loaded with ImageMagick support the following additional
|
||||
image descriptor properties:
|
||||
|
|
6
etc/NEWS
6
etc/NEWS
|
@ -137,16 +137,16 @@ It is no longer necessary to call `imagemagick-register-types'
|
|||
explicitly to install ImageMagick image types; that function is called
|
||||
automatically at startup, or when customizing a relevant imagemagick-
|
||||
option.
|
||||
|
||||
+++
|
||||
*** Setting `imagemagick-types-inhibit' to t now disables the use of
|
||||
ImageMagick to view images. You must call imagemagick-register-types
|
||||
afterwards if you do not use customize to change this.
|
||||
|
||||
+++
|
||||
*** The new variable `imagemagick-enabled-types' also affects which
|
||||
ImageMagick types are treated as images. The function
|
||||
`imagemagick-filter-types' returns the list of types that will be
|
||||
treated as images.
|
||||
|
||||
---
|
||||
*** Images displayed via ImageMagick now support transparency and the
|
||||
:background image spec property.
|
||||
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
2012-10-13 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* textmodes/ispell.el (ispell-pdict-save): If flyspell-mode is
|
||||
enabled, re-enable it (Bug#11963).
|
||||
|
||||
2012-10-13 Martin Rudalics <rudalics@gmx.at>
|
||||
|
||||
* emacs-lisp/debug.el (debug): When debugger-will-be-back is
|
||||
non-nil, restore window configuration (Bug#12623).
|
||||
|
||||
2012-10-12 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* help-fns.el (describe-variable, describe-function-1):
|
||||
|
|
|
@ -213,7 +213,8 @@ first will be printed into the backtrace buffer."
|
|||
(or enable-recursive-minibuffers (> (minibuffer-depth) 0)))
|
||||
(standard-input t) (standard-output t)
|
||||
inhibit-redisplay
|
||||
(cursor-in-echo-area nil))
|
||||
(cursor-in-echo-area nil)
|
||||
(window-configuration (current-window-configuration)))
|
||||
(unwind-protect
|
||||
(save-excursion
|
||||
(when (eq (car debugger-args) 'debug)
|
||||
|
@ -266,16 +267,19 @@ first will be printed into the backtrace buffer."
|
|||
;; Make sure we unbind buffer-read-only in the right buffer.
|
||||
(save-excursion
|
||||
(recursive-edit))))
|
||||
(when (and (not debugger-will-be-back)
|
||||
(window-live-p debugger-window)
|
||||
(eq (window-buffer debugger-window) debugger-buffer))
|
||||
;; Record height of debugger window.
|
||||
(setq debugger-previous-window-height
|
||||
(window-total-size debugger-window))
|
||||
;; Unshow debugger-buffer.
|
||||
(quit-restore-window debugger-window debugger-bury-or-kill)
|
||||
;; Restore current buffer (Bug#12502).
|
||||
(set-buffer debugger-old-buffer))
|
||||
(if debugger-will-be-back
|
||||
;; Restore previous window configuration (Bug#12623).
|
||||
(set-window-configuration window-configuration)
|
||||
(when (and (window-live-p debugger-window)
|
||||
(eq (window-buffer debugger-window) debugger-buffer))
|
||||
(progn
|
||||
;; Record height of debugger window.
|
||||
(setq debugger-previous-window-height
|
||||
(window-total-size debugger-window))
|
||||
;; Unshow debugger-buffer.
|
||||
(quit-restore-window debugger-window debugger-bury-or-kill)
|
||||
;; Restore current buffer (Bug#12502).
|
||||
(set-buffer debugger-old-buffer))))
|
||||
;; Restore previous state of debugger-buffer in case we were
|
||||
;; in a recursive invocation of the debugger, otherwise just
|
||||
;; erase the buffer and put it into fundamental mode.
|
||||
|
|
|
@ -1893,11 +1893,14 @@ If so, ask if it needs to be saved."
|
|||
(interactive (list ispell-silently-savep t))
|
||||
(if (and ispell-pdict-modified-p (listp ispell-pdict-modified-p))
|
||||
(setq ispell-pdict-modified-p (car ispell-pdict-modified-p)))
|
||||
(if (or ispell-pdict-modified-p force-save)
|
||||
(if (or no-query (y-or-n-p "Personal dictionary modified. Save? "))
|
||||
(progn
|
||||
(ispell-send-string "#\n") ; save dictionary
|
||||
(message "Personal dictionary saved."))))
|
||||
(when (and (or ispell-pdict-modified-p force-save)
|
||||
(or no-query
|
||||
(y-or-n-p "Personal dictionary modified. Save? ")))
|
||||
(ispell-send-string "#\n") ; save dictionary
|
||||
(message "Personal dictionary saved.")
|
||||
(when flyspell-mode
|
||||
(flyspell-mode 0)
|
||||
(flyspell-mode 1)))
|
||||
;; unassert variable, even if not saved to avoid questioning.
|
||||
(setq ispell-pdict-modified-p nil))
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
2012-10-13 Liam Stitt <stittl@cuug.ab.ca> (tiny change)
|
||||
|
||||
* url-vars.el (url-uncompressor-alist):
|
||||
* url-file.el (url-file-find-possibly-compressed-file, url-file):
|
||||
Recognize .xz compression (Bug#11839).
|
||||
|
||||
2012-10-13 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* url-http.el (url-http):
|
||||
* url.el (url-retrieve-internal): Doc fix (Bug#6407).
|
||||
|
||||
2012-10-08 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* url-methods.el (url-scheme-get-property): url-https.el was
|
||||
|
|
|
@ -40,7 +40,7 @@ can do automatic decompression for them, and won't find 'foo' if
|
|||
'foo.gz' exists, even though the FTP server would happily serve it up
|
||||
to them."
|
||||
(let ((scratch nil)
|
||||
(compressed-extensions '("" ".gz" ".z" ".Z" ".bz2"))
|
||||
(compressed-extensions '("" ".gz" ".z" ".Z" ".bz2" ".xz"))
|
||||
(found nil))
|
||||
(while (and compressed-extensions (not found))
|
||||
(if (file-exists-p (setq scratch (concat fname (pop compressed-extensions))))
|
||||
|
@ -177,6 +177,7 @@ to them."
|
|||
(".uue" "x-uuencoded")
|
||||
(".hqx" "x-hqx")
|
||||
(".bz2" "x-bzip2")
|
||||
(".xz" "x-xz")
|
||||
(_ nil)))
|
||||
|
||||
(if (file-directory-p filename)
|
||||
|
|
|
@ -1150,8 +1150,12 @@ the end of the document."
|
|||
(defun url-http (url callback cbargs &optional retry-buffer)
|
||||
"Retrieve URL via HTTP asynchronously.
|
||||
URL must be a parsed URL. See `url-generic-parse-url' for details.
|
||||
When retrieval is completed, the function CALLBACK is executed with
|
||||
CBARGS as the arguments.
|
||||
|
||||
When retrieval is completed, execute the function CALLBACK, using
|
||||
the arguments listed in CBARGS. The first element in CBARGS
|
||||
should be a plist describing what has happened so far during the
|
||||
request, as described in the docstring of `url-retrieve' (if in
|
||||
doubt, specify nil).
|
||||
|
||||
Optional arg RETRY-BUFFER, if non-nil, specifies the buffer of a
|
||||
previous `url-http' call, which is being re-attempted."
|
||||
|
|
|
@ -152,7 +152,8 @@ variable."
|
|||
(".uue" . "x-uuencoded")
|
||||
(".hqx" . "x-hqx")
|
||||
(".Z" . "x-compress")
|
||||
(".bz2" . "x-bzip2"))
|
||||
(".bz2" . "x-bzip2")
|
||||
(".xz" . "x-xz"))
|
||||
"An alist of file extensions and appropriate content-transfer-encodings."
|
||||
:type '(repeat (cons :format "%v"
|
||||
(string :tag "Extension")
|
||||
|
|
|
@ -131,9 +131,9 @@ characters are percent-encoded; see `url-encode-url'.
|
|||
CALLBACK is called when the object has been completely retrieved, with
|
||||
the current buffer containing the object, and any MIME headers associated
|
||||
with it. It is called as (apply CALLBACK STATUS CBARGS).
|
||||
STATUS is a list with an even number of elements representing
|
||||
what happened during the request, with most recent events first,
|
||||
or an empty list if no events have occurred. Each pair is one of:
|
||||
STATUS is a plist representing what happened during the request,
|
||||
with most recent events first, or an empty list if no events have
|
||||
occurred. Each pair is one of:
|
||||
|
||||
\(:redirect REDIRECTED-TO) - the request was redirected to this URL
|
||||
\(:error (ERROR-SYMBOL . DATA)) - an error occurred. The error can be
|
||||
|
@ -169,8 +169,10 @@ URL-encoded before it's used."
|
|||
(defun url-retrieve-internal (url callback cbargs &optional silent
|
||||
inhibit-cookies)
|
||||
"Internal function; external interface is `url-retrieve'.
|
||||
CBARGS is what the callback will actually receive - the first item is
|
||||
the list of events, as described in the docstring of `url-retrieve'.
|
||||
CBARGS is the list of arguments that the callback function will
|
||||
receive; its first element should be a plist specifying what has
|
||||
happened so far during the request, as described in the docstring
|
||||
of `url-retrieve' (if in doubt, specify nil).
|
||||
|
||||
If SILENT, don't message progress reports and the like.
|
||||
If INHIBIT-COOKIES, cookies will neither be stored nor sent to
|
||||
|
|
|
@ -3,6 +3,23 @@
|
|||
* coding.c (detect_coding): Set coding->id before calling
|
||||
this->detector.
|
||||
|
||||
2012-10-13 Andreas Schwab <schwab@linux-m68k.org>
|
||||
|
||||
* fileio.c: Formatting fixes.
|
||||
|
||||
2012-10-13 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Fix some stat-related races.
|
||||
* fileio.c (Fwrite_region): Avoid race condition if a file is
|
||||
removed or renamed by some other process immediately after Emacs
|
||||
writes it but before Emacs stats it. Do not assume that stat (or
|
||||
fstat) succeeds.
|
||||
* image.c (slurp_file): Resolve the file name with fopen + fstat
|
||||
rather than stat + fopen.
|
||||
(pbm_read_file) [0]: Remove unused code with stat race.
|
||||
* process.c (allocate_pty) [HAVE_PTYS && !PTY_ITERATION && !PTY_OPEN]:
|
||||
Remove ineffective code with stat race.
|
||||
|
||||
2012-10-12 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* doc.c (get_doc_string): Don't signal an error if the file is missing.
|
||||
|
|
71
src/fileio.c
71
src/fileio.c
|
@ -1370,8 +1370,7 @@ See also the function `substitute-in-file-name'.")
|
|||
p = nm;
|
||||
while (*p)
|
||||
{
|
||||
if (p[0] == '/' && p[1] == '/'
|
||||
)
|
||||
if (p[0] == '/' && p[1] == '/')
|
||||
nm = p + 1;
|
||||
if (p[0] == '/' && p[1] == '~')
|
||||
nm = p + 1, lose = 1;
|
||||
|
@ -1510,17 +1509,16 @@ search_embedded_absfilename (char *nm, char *endp)
|
|||
|
||||
for (p = nm + 1; p < endp; p++)
|
||||
{
|
||||
if ((0
|
||||
|| IS_DIRECTORY_SEP (p[-1]))
|
||||
if (IS_DIRECTORY_SEP (p[-1])
|
||||
&& file_name_absolute_p (p)
|
||||
#if defined (WINDOWSNT) || defined (CYGWIN)
|
||||
/* // at start of file name is meaningful in Apollo,
|
||||
WindowsNT and Cygwin systems. */
|
||||
&& !(IS_DIRECTORY_SEP (p[0]) && p - 1 == nm)
|
||||
#endif /* not (WINDOWSNT || CYGWIN) */
|
||||
)
|
||||
)
|
||||
{
|
||||
for (s = p; *s && (!IS_DIRECTORY_SEP (*s)); s++);
|
||||
for (s = p; *s && !IS_DIRECTORY_SEP (*s); s++);
|
||||
if (p[0] == '~' && s > p + 1) /* We've got "/~something/". */
|
||||
{
|
||||
char *o = alloca (s - p + 1);
|
||||
|
@ -1735,7 +1733,7 @@ those `/' is discarded. */)
|
|||
*x = 0;
|
||||
|
||||
/* If /~ or // appears, discard everything through first slash. */
|
||||
while ((p = search_embedded_absfilename (xnm, x)))
|
||||
while ((p = search_embedded_absfilename (xnm, x)) != NULL)
|
||||
/* This time we do not start over because we've already expanded envvars
|
||||
and replaced $$ with $. Maybe we should start over as well, but we'd
|
||||
need to quote some $ to $$ first. */
|
||||
|
@ -2169,7 +2167,7 @@ With a prefix argument, TRASH is nil. */)
|
|||
|
||||
encoded_file = ENCODE_FILE (filename);
|
||||
|
||||
if (0 > unlink (SSDATA (encoded_file)))
|
||||
if (unlink (SSDATA (encoded_file)) < 0)
|
||||
report_file_error ("Removing old name", list1 (filename));
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -2218,8 +2216,8 @@ This is what happens in interactive use with M-x. */)
|
|||
#endif
|
||||
)
|
||||
{
|
||||
Lisp_Object fname = NILP (Ffile_directory_p (file))
|
||||
? file : Fdirectory_file_name (file);
|
||||
Lisp_Object fname = (NILP (Ffile_directory_p (file))
|
||||
? file : Fdirectory_file_name (file));
|
||||
newname = Fexpand_file_name (Ffile_name_nondirectory (fname), newname);
|
||||
}
|
||||
else
|
||||
|
@ -2247,7 +2245,7 @@ This is what happens in interactive use with M-x. */)
|
|||
|| INTEGERP (ok_if_already_exists))
|
||||
barf_or_query_if_file_exists (newname, "rename to it",
|
||||
INTEGERP (ok_if_already_exists), 0, 0);
|
||||
if (0 > rename (SSDATA (encoded_file), SSDATA (encoded_newname)))
|
||||
if (rename (SSDATA (encoded_file), SSDATA (encoded_newname)) < 0)
|
||||
{
|
||||
if (errno == EXDEV)
|
||||
{
|
||||
|
@ -2328,7 +2326,7 @@ This is what happens in interactive use with M-x. */)
|
|||
INTEGERP (ok_if_already_exists), 0, 0);
|
||||
|
||||
unlink (SSDATA (newname));
|
||||
if (0 > link (SSDATA (encoded_file), SSDATA (encoded_newname)))
|
||||
if (link (SSDATA (encoded_file), SSDATA (encoded_newname)) < 0)
|
||||
report_file_error ("Adding new name", list2 (file, newname));
|
||||
|
||||
UNGCPRO;
|
||||
|
@ -2385,15 +2383,14 @@ This happens for interactive use with M-x. */)
|
|||
|| INTEGERP (ok_if_already_exists))
|
||||
barf_or_query_if_file_exists (linkname, "make it a link",
|
||||
INTEGERP (ok_if_already_exists), 0, 0);
|
||||
if (0 > symlink (SSDATA (encoded_filename),
|
||||
SSDATA (encoded_linkname)))
|
||||
if (symlink (SSDATA (encoded_filename), SSDATA (encoded_linkname)) < 0)
|
||||
{
|
||||
/* If we didn't complain already, silently delete existing file. */
|
||||
if (errno == EEXIST)
|
||||
{
|
||||
unlink (SSDATA (encoded_linkname));
|
||||
if (0 <= symlink (SSDATA (encoded_filename),
|
||||
SSDATA (encoded_linkname)))
|
||||
if (symlink (SSDATA (encoded_filename), SSDATA (encoded_linkname))
|
||||
>= 0)
|
||||
{
|
||||
UNGCPRO;
|
||||
return Qnil;
|
||||
|
@ -3203,7 +3200,7 @@ emacs_lseek (int fd, EMACS_INT offset, int whence)
|
|||
{
|
||||
/* Use "&" rather than "&&" to suppress a bogus GCC warning; see
|
||||
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772>. */
|
||||
if (! ((TYPE_MINIMUM (off_t) <= offset) & (offset <= TYPE_MAXIMUM (off_t))))
|
||||
if (! ((offset >= TYPE_MINIMUM (off_t)) & (offset <= TYPE_MAXIMUM (off_t))))
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
|
@ -3376,7 +3373,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
|
|||
|
||||
if (!NILP (beg))
|
||||
{
|
||||
if (! (RANGED_INTEGERP (0, beg, TYPE_MAXIMUM (off_t))))
|
||||
if (! RANGED_INTEGERP (0, beg, TYPE_MAXIMUM (off_t)))
|
||||
wrong_type_argument (intern ("file-offset"), beg);
|
||||
beg_offset = XFASTINT (beg);
|
||||
}
|
||||
|
@ -3385,7 +3382,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
|
|||
|
||||
if (!NILP (end))
|
||||
{
|
||||
if (! (RANGED_INTEGERP (0, end, TYPE_MAXIMUM (off_t))))
|
||||
if (! RANGED_INTEGERP (0, end, TYPE_MAXIMUM (off_t)))
|
||||
wrong_type_argument (intern ("file-offset"), end);
|
||||
end_offset = XFASTINT (end);
|
||||
}
|
||||
|
@ -3421,8 +3418,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
|
|||
|
||||
if (beg_offset < likely_end)
|
||||
{
|
||||
ptrdiff_t buf_bytes =
|
||||
Z_BYTE - (!NILP (replace) ? ZV_BYTE - BEGV_BYTE : 0);
|
||||
ptrdiff_t buf_bytes
|
||||
= Z_BYTE - (!NILP (replace) ? ZV_BYTE - BEGV_BYTE : 0);
|
||||
ptrdiff_t buf_growth_max = BUF_BYTES_MAX - buf_bytes;
|
||||
off_t likely_growth = likely_end - beg_offset;
|
||||
if (buf_growth_max < likely_growth)
|
||||
|
@ -4545,6 +4542,7 @@ This calls `write-region-annotate-functions' at the start, and
|
|||
int save_errno = 0;
|
||||
const char *fn;
|
||||
struct stat st;
|
||||
EMACS_TIME modtime;
|
||||
ptrdiff_t count = SPECPDL_INDEX ();
|
||||
int count1;
|
||||
Lisp_Object handler;
|
||||
|
@ -4757,12 +4755,19 @@ This calls `write-region-annotate-functions' at the start, and
|
|||
}
|
||||
#endif
|
||||
|
||||
modtime = invalid_emacs_time ();
|
||||
if (visiting)
|
||||
{
|
||||
if (fstat (desc, &st) == 0)
|
||||
modtime = get_stat_mtime (&st);
|
||||
else
|
||||
ok = 0, save_errno = errno;
|
||||
}
|
||||
|
||||
/* NFS can report a write failure now. */
|
||||
if (emacs_close (desc) < 0)
|
||||
ok = 0, save_errno = errno;
|
||||
|
||||
stat (fn, &st);
|
||||
|
||||
/* Discard the unwind protect for close_file_unwind. */
|
||||
specpdl_ptr = specpdl + count1;
|
||||
|
||||
|
@ -4790,9 +4795,9 @@ This calls `write-region-annotate-functions' at the start, and
|
|||
/* Do this before reporting IO error
|
||||
to avoid a "file has changed on disk" warning on
|
||||
next attempt to save. */
|
||||
if (visiting)
|
||||
if (EMACS_TIME_VALID_P (modtime))
|
||||
{
|
||||
current_buffer->modtime = get_stat_mtime (&st);
|
||||
current_buffer->modtime = modtime;
|
||||
current_buffer->modtime_size = st.st_size;
|
||||
}
|
||||
|
||||
|
@ -5042,12 +5047,12 @@ e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end,
|
|||
|
||||
if (coding->produced > 0)
|
||||
{
|
||||
coding->produced -=
|
||||
emacs_write (desc,
|
||||
STRINGP (coding->dst_object)
|
||||
? SSDATA (coding->dst_object)
|
||||
: (char *) BYTE_POS_ADDR (coding->dst_pos_byte),
|
||||
coding->produced);
|
||||
coding->produced
|
||||
-= emacs_write (desc,
|
||||
STRINGP (coding->dst_object)
|
||||
? SSDATA (coding->dst_object)
|
||||
: (char *) BYTE_POS_ADDR (coding->dst_pos_byte),
|
||||
coding->produced);
|
||||
|
||||
if (coding->produced)
|
||||
return 0;
|
||||
|
@ -5226,8 +5231,8 @@ auto_save_1 (void)
|
|||
if (stat (SSDATA (BVAR (current_buffer, filename)), &st) >= 0)
|
||||
/* But make sure we can overwrite it later! */
|
||||
auto_save_mode_bits = (st.st_mode | 0600) & 0777;
|
||||
else if ((modes = Ffile_modes (BVAR (current_buffer, filename)),
|
||||
INTEGERP (modes)))
|
||||
else if (modes = Ffile_modes (BVAR (current_buffer, filename)),
|
||||
INTEGERP (modes))
|
||||
/* Remote files don't cooperate with stat. */
|
||||
auto_save_mode_bits = (XINT (modes) | 0600) & 0777;
|
||||
}
|
||||
|
|
44
src/image.c
44
src/image.c
|
@ -2140,12 +2140,11 @@ x_find_image_file (Lisp_Object file)
|
|||
static unsigned char *
|
||||
slurp_file (char *file, ptrdiff_t *size)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
FILE *fp = fopen (file, "rb");
|
||||
unsigned char *buf = NULL;
|
||||
struct stat st;
|
||||
|
||||
if (stat (file, &st) == 0
|
||||
&& (fp = fopen (file, "rb")) != NULL
|
||||
if (fp && fstat (fileno (fp), &st) == 0
|
||||
&& 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX)
|
||||
&& (buf = xmalloc (st.st_size),
|
||||
fread (buf, 1, st.st_size, fp) == st.st_size))
|
||||
|
@ -5004,45 +5003,6 @@ pbm_scan_number (unsigned char **s, unsigned char *end)
|
|||
}
|
||||
|
||||
|
||||
#ifdef HAVE_NTGUI
|
||||
#if 0 /* Unused. ++kfs */
|
||||
|
||||
/* Read FILE into memory. Value is a pointer to a buffer allocated
|
||||
with xmalloc holding FILE's contents. Value is null if an error
|
||||
occurred. *SIZE is set to the size of the file. */
|
||||
|
||||
static char *
|
||||
pbm_read_file (Lisp_Object file, int *size)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
char *buf = NULL;
|
||||
struct stat st;
|
||||
|
||||
if (stat (SDATA (file), &st) == 0
|
||||
&& (fp = fopen (SDATA (file), "rb")) != NULL
|
||||
&& 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX)
|
||||
&& (buf = xmalloc (st.st_size),
|
||||
fread (buf, 1, st.st_size, fp) == st.st_size))
|
||||
{
|
||||
*size = st.st_size;
|
||||
fclose (fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fp)
|
||||
fclose (fp);
|
||||
if (buf)
|
||||
{
|
||||
xfree (buf);
|
||||
buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_NTGUI */
|
||||
|
||||
/* Load PBM image IMG for use on frame F. */
|
||||
|
||||
static bool
|
||||
|
|
|
@ -646,23 +646,6 @@ allocate_pty (void)
|
|||
PTY_OPEN;
|
||||
#else /* no PTY_OPEN */
|
||||
{
|
||||
{ /* Some systems name their pseudoterminals so that there are gaps in
|
||||
the usual sequence - for example, on HP9000/S700 systems, there
|
||||
are no pseudoterminals with names ending in 'f'. So we wait for
|
||||
three failures in a row before deciding that we've reached the
|
||||
end of the ptys. */
|
||||
int failed_count = 0;
|
||||
struct stat stb;
|
||||
|
||||
if (stat (pty_name, &stb) < 0)
|
||||
{
|
||||
failed_count++;
|
||||
if (failed_count >= 3)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
failed_count = 0;
|
||||
}
|
||||
# ifdef O_NONBLOCK
|
||||
fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0);
|
||||
# else
|
||||
|
|
Loading…
Add table
Reference in a new issue