Commit c7367d2d authored by Glenn Morris's avatar Glenn Morris

Merge from emacs-24; up to 2014-06-28T23:35:17Z!rgm@gnu.org

parents 6b7d0775 f314e84f
2014-08-11 Paul Eggert <eggert@cs.ucla.edu>
Don't prevent random file systems from being unmounted (Bug#18232).
This fix relies on having the 'fchdir' function, and on having
"." be searchable (or at least readable, on platforms lacking O_SEARCH),
but that's good enough to handle the vast majority of cases and the
remaining folks can just live with the annoyance of file systems
that occasionally can't be unmounted.
* configure.ac (fchdir): New function to check for.
* lib/save-cwd.c: Copy from gnulib, except omit the part that
allocates memory, since that can cause problems in Emacs.
* lib/save-cwd.h: Copy from gnulib.
2014-08-10 Eli Zaretskii <eliz@gnu.org> 2014-08-10 Eli Zaretskii <eliz@gnu.org>
* config.bat: Fix some confusing wording. * config.bat: Fix some confusing wording.
......
...@@ -3547,7 +3547,7 @@ AC_SUBST(BLESSMAIL_TARGET) ...@@ -3547,7 +3547,7 @@ AC_SUBST(BLESSMAIL_TARGET)
OLD_LIBS=$LIBS OLD_LIBS=$LIBS
LIBS="$LIB_PTHREAD $LIB_MATH $LIBS" LIBS="$LIB_PTHREAD $LIB_MATH $LIBS"
AC_CHECK_FUNCS(accept4 gethostname \ AC_CHECK_FUNCS(accept4 fchdir gethostname \
getrusage get_current_dir_name \ getrusage get_current_dir_name \
lrand48 random rint \ lrand48 random rint \
select getpagesize setlocale \ select getpagesize setlocale \
......
...@@ -698,7 +698,7 @@ inquiétez pour les modifications que vous avez faites, C-x C-c vous ...@@ -698,7 +698,7 @@ inquiétez pour les modifications que vous avez faites, C-x C-c vous
proposera de sauvegarder tous les fichiers modifiés avant de quitter proposera de sauvegarder tous les fichiers modifiés avant de quitter
Emacs). Emacs).
Si vous utiliser un affichage graphique, vous n'avez pas besoin de Si vous utilisez un affichage graphique, vous n'avez pas besoin de
commande spéciale pour vous déplacer d'Emacs à une autre application. commande spéciale pour vous déplacer d'Emacs à une autre application.
Vous pouvez le faire à l'aide de la souris ou avec les commandes du Vous pouvez le faire à l'aide de la souris ou avec les commandes du
gestionnaire de fenêtres. Cependant, si vous utilisez un terminal gestionnaire de fenêtres. Cependant, si vous utilisez un terminal
...@@ -1143,7 +1143,7 @@ C-x C-f à côté de find-file). ...@@ -1143,7 +1143,7 @@ C-x C-f à côté de find-file).
>> Faites C-x 1 pour supprimer la fenêtre d'aide. >> Faites C-x 1 pour supprimer la fenêtre d'aide.
C-h i Manuels en ligne (alias Info). Cette commande vous place dans C-h i Manuels en ligne (alias Info). Cette commande vous place dans
un tampon spéciale, appelé « *info* », où vous pouvez un tampon spécial, appelé « *info* », où vous pouvez
lire les manuels en ligne des paquetages installés sur lire les manuels en ligne des paquetages installés sur
votre système. Faites m emacs <Entrée> pour lire le votre système. Faites m emacs <Entrée> pour lire le
manuel d'Emacs. Si vous n'avez jamais utilisé Info manuel d'Emacs. Si vous n'avez jamais utilisé Info
......
/* save-cwd.c -- Save and restore current working directory.
Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
/* Gnulib needs to save and restore the current working directory to
fully emulate functions like fstatat. But Emacs doesn't care what
the current working directory is; it always uses absolute file
names. This module replaces the Gnulib module by omitting the code
that Emacs does not need. */
#include <config.h> #include <config.h>
#define SAVE_CWD_INLINE _GL_EXTERN_INLINE
#include "save-cwd.h" #include "save-cwd.h"
#include <fcntl.h>
#include <unistd.h>
/* Record the location of the current working directory in CWD so that
the program may change to other directories and later use restore_cwd
to return to the recorded location. This function may allocate
space using malloc (via getcwd) or leave a file descriptor open;
use free_cwd to perform the necessary free or close. Upon failure,
no memory is allocated, any locally opened file descriptors are
closed; return non-zero -- in that case, free_cwd need not be
called, but doing so is ok. Otherwise, return zero.
The _raison d'etre_ for this interface is that the working directory
is sometimes inaccessible, and getcwd is not robust or as efficient.
So, we prefer to use the open/fchdir approach, but fall back on
getcwd if necessary. This module works for most cases with just
the getcwd-lgpl module, but to be truly robust, use the getcwd module.
Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin,
SCO Xenix. Also, SunOS 4 and Irix 5.3 provide the function, yet it
doesn't work for partitions on which auditing is enabled. If
you're still using an obsolete system with these problems, please
send email to the maintainer of this code. */
#if !defined HAVE_FCHDIR && !defined fchdir
# define fchdir(fd) (-1)
#endif
int
save_cwd (struct saved_cwd *cwd)
{
cwd->desc = open (".", O_SEARCH | O_CLOEXEC);
/* The 'name' member is present only to minimize differences from
gnulib. Initialize it to zero, if only to simplify debugging. */
cwd->name = 0;
return 0;
}
/* Change to recorded location, CWD, in directory hierarchy.
Upon failure, return -1 (errno is set by chdir or fchdir).
Upon success, return zero. */
int
restore_cwd (const struct saved_cwd *cwd)
{
/* Restore the previous directory if possible, to avoid tying down
the file system of the new directory (Bug#18232).
Don't worry if fchdir fails, as Emacs doesn't care what the
working directory is. The fchdir call is inside an 'if' merely to
pacify compilers that complain if fchdir's return value is ignored. */
if (fchdir (cwd->desc) == 0)
return 0;
return 0;
}
void
free_cwd (struct saved_cwd *cwd)
{
close (cwd->desc);
}
/* Do not save and restore the current working directory. /* Save and restore current working directory.
Copyright 2013-2014 Free Software Foundation, Inc. Copyright (C) 1995, 1997-1998, 2003, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -15,32 +16,19 @@ ...@@ -15,32 +16,19 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Gnulib needs to save and restore the current working directory to /* Written by Jim Meyering. */
fully emulate functions like fstatat. But Emacs doesn't care what
the current working directory is; it always uses absolute file
names. This module replaces the Gnulib module by omitting the code
that Emacs does not need. */
#ifndef SAVE_CWD_H #ifndef SAVE_CWD_H
#define SAVE_CWD_H 1 # define SAVE_CWD_H 1
_GL_INLINE_HEADER_BEGIN struct saved_cwd
#ifndef SAVE_CWD_INLINE {
# define SAVE_CWD_INLINE _GL_INLINE int desc;
#endif char *name;
};
struct saved_cwd { int desc; }; int save_cwd (struct saved_cwd *cwd);
int restore_cwd (const struct saved_cwd *cwd);
void free_cwd (struct saved_cwd *cwd);
SAVE_CWD_INLINE int #endif /* SAVE_CWD_H */
save_cwd (struct saved_cwd *cwd)
{
cwd->desc = -1;
return 0;
}
SAVE_CWD_INLINE int restore_cwd (struct saved_cwd const *cwd) { return 0; }
SAVE_CWD_INLINE void free_cwd (struct saved_cwd *cwd) { }
_GL_INLINE_HEADER_END
#endif
2014-08-11 Glenn Morris <rgm@gnu.org>
* files.el (basic-save-buffer-2): Revert 2013-01-31 change, which
chose coding system for writing before backing up, since it causes
a more serious problem than the one it solves. (Closes Bug#18141,
reopens Bug#13522.)
2014-08-11 Martin Rudalics <rudalics@gmx.at>
* window.el (window-total-size): Make doc-string more self-contained.
* window.el (display-buffer-below-selected): Restore original
behavior if buffer is already displayed in the window below the
selected one (Bug#18181).
2014-08-11 Stefan Monnier <monnier@iro.umontreal.ca>
* mouse.el (mouse--down-1-maybe-follows-link): Don't convert the down
event (bug#18212).
2014-08-11 Eli Zaretskii <eliz@gnu.org>
* info.el (info): Doc fix.
2014-08-11 Stefan Monnier <monnier@iro.umontreal.ca>
* info.el (Info-mode-map): Override a global down-mouse-2 binding
(bug#18212).
2014-08-11 Eli Zaretskii <eliz@gnu.org>
* simple.el (default-line-height): A floating-point value of
line-spacing means a fraction of the default frame font's height,
not of the font currently used by the 'default' face.
Truncate the pixel value, like the display engine does.
(window-screen-lines): Use window-inside-pixel-edges for
determining the window height in pixels. (Bug#18195)
2014-08-11 Grégoire Jadi <daimrod@gmail.com> 2014-08-11 Grégoire Jadi <daimrod@gmail.com>
* leim/quail/latin-post.el: Transform " __" into " _". (Bug#18023) * leim/quail/latin-post.el: Transform " __" into " _". (Bug#18023)
...@@ -462,8 +500,8 @@ ...@@ -462,8 +500,8 @@
(python-shell-output-filter): Fix comment typo. (python-shell-output-filter): Fix comment typo.
Fix Python shell prompts detection for remote hosts. Fix Python shell prompts detection for remote hosts.
* progmodes/python.el (python-shell-prompt-detect): Replace * progmodes/python.el (python-shell-prompt-detect):
call-process with process-file and make it more robust. Replace call-process with process-file and make it more robust.
Autodetect Python shell prompts. (Bug#17370) Autodetect Python shell prompts. (Bug#17370)
* progmodes/python.el: * progmodes/python.el:
......
...@@ -4759,7 +4759,7 @@ Before and after saving the buffer, this function runs ...@@ -4759,7 +4759,7 @@ Before and after saving the buffer, this function runs
;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like ;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like
;; backup-buffer. ;; backup-buffer.
(defun basic-save-buffer-2 () (defun basic-save-buffer-2 ()
(let (tempsetmodes setmodes writecoding) (let (tempsetmodes setmodes)
(if (not (file-writable-p buffer-file-name)) (if (not (file-writable-p buffer-file-name))
(let ((dir (file-name-directory buffer-file-name))) (let ((dir (file-name-directory buffer-file-name)))
(if (not (file-directory-p dir)) (if (not (file-directory-p dir))
...@@ -4775,14 +4775,6 @@ Before and after saving the buffer, this function runs ...@@ -4775,14 +4775,6 @@ Before and after saving the buffer, this function runs
buffer-file-name))) buffer-file-name)))
(setq tempsetmodes t) (setq tempsetmodes t)
(error "Attempt to save to a file which you aren't allowed to write")))))) (error "Attempt to save to a file which you aren't allowed to write"))))))
;; This may involve prompting, so do it now before backing up the file.
;; Otherwise there can be a delay while the user answers the
;; prompt during which the original file has been renamed. (Bug#13522)
(setq writecoding
;; Args here should match write-region call below around
;; which we use writecoding.
(choose-write-coding-system nil nil buffer-file-name nil t
buffer-file-truename))
(or buffer-backed-up (or buffer-backed-up
(setq setmodes (backup-buffer))) (setq setmodes (backup-buffer)))
(let* ((dir (file-name-directory buffer-file-name)) (let* ((dir (file-name-directory buffer-file-name))
...@@ -4864,11 +4856,10 @@ Before and after saving the buffer, this function runs ...@@ -4864,11 +4856,10 @@ Before and after saving the buffer, this function runs
(logior (car setmodes) 128)))))) (logior (car setmodes) 128))))))
(let (success) (let (success)
(unwind-protect (unwind-protect
(progn
;; Pass in nil&nil rather than point-min&max to indicate ;; Pass in nil&nil rather than point-min&max to indicate
;; we're saving the buffer rather than just a region. ;; we're saving the buffer rather than just a region.
;; write-region-annotate-functions may make us of it. ;; write-region-annotate-functions may make us of it.
(let ((coding-system-for-write writecoding)
(coding-system-require-warning nil))
(write-region nil nil (write-region nil nil
buffer-file-name nil t buffer-file-truename) buffer-file-name nil t buffer-file-truename)
(setq success t)) (setq success t))
......
...@@ -774,8 +774,7 @@ with the top-level Info directory. ...@@ -774,8 +774,7 @@ with the top-level Info directory.
In interactive use, a non-numeric prefix argument directs In interactive use, a non-numeric prefix argument directs
this command to read a file name from the minibuffer. this command to read a file name from the minibuffer.
A numeric prefix argument N selects an Info buffer named A numeric prefix argument of N selects an Info buffer named \"*info*<N>\".
\"*info*<%s>\".
The search path for Info files is in the variable `Info-directory-list'. The search path for Info files is in the variable `Info-directory-list'.
The top-level Info directory is made by combining all the files named `dir' The top-level Info directory is made by combining all the files named `dir'
...@@ -4009,6 +4008,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'." ...@@ -4009,6 +4008,7 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
(define-key map "," 'Info-index-next) (define-key map "," 'Info-index-next)
(define-key map "\177" 'Info-scroll-down) (define-key map "\177" 'Info-scroll-down)
(define-key map [mouse-2] 'Info-mouse-follow-nearest-node) (define-key map [mouse-2] 'Info-mouse-follow-nearest-node)
(define-key map [down-mouse-2] 'ignore) ;Override potential global binding.
(define-key map [follow-link] 'mouse-face) (define-key map [follow-link] 'mouse-face)
(define-key map [XF86Back] 'Info-history-back) (define-key map [XF86Back] 'Info-history-back)
(define-key map [XF86Forward] 'Info-history-forward) (define-key map [XF86Forward] 'Info-history-forward)
......
...@@ -94,15 +94,14 @@ point at the click position." ...@@ -94,15 +94,14 @@ point at the click position."
(defun mouse--down-1-maybe-follows-link (&optional _prompt) (defun mouse--down-1-maybe-follows-link (&optional _prompt)
"Turn `mouse-1' events into `mouse-2' events if follows-link. "Turn `mouse-1' events into `mouse-2' events if follows-link.
Expects to be bound to `down-mouse-1' in `key-translation-map'." Expects to be bound to `down-mouse-1' in `key-translation-map'."
(if (or (null mouse-1-click-follows-link) (when (and mouse-1-click-follows-link
(not (eq (if (eq mouse-1-click-follows-link 'double) (eq (if (eq mouse-1-click-follows-link 'double)
'double-down-mouse-1 'down-mouse-1) 'double-down-mouse-1 'down-mouse-1)
(car-safe last-input-event))) (car-safe last-input-event))
(not (mouse-on-link-p (event-start last-input-event))) (mouse-on-link-p (event-start last-input-event))
(and (not mouse-1-click-in-non-selected-windows) (or mouse-1-click-in-non-selected-windows
(not (eq (selected-window) (eq (selected-window)
(posn-window (event-start last-input-event)))))) (posn-window (event-start last-input-event)))))
nil
(let ((this-event last-input-event) (let ((this-event last-input-event)
(timedout (timedout
(sit-for (if (numberp mouse-1-click-follows-link) (sit-for (if (numberp mouse-1-click-follows-link)
...@@ -118,19 +117,14 @@ Expects to be bound to `down-mouse-1' in `key-translation-map'." ...@@ -118,19 +117,14 @@ Expects to be bound to `down-mouse-1' in `key-translation-map'."
'double-mouse-1 'mouse-1)) 'double-mouse-1 'mouse-1))
;; Turn the mouse-1 into a mouse-2 to follow links. ;; Turn the mouse-1 into a mouse-2 to follow links.
(let ((newup (if (eq mouse-1-click-follows-link 'double) (let ((newup (if (eq mouse-1-click-follows-link 'double)
'double-mouse-2 'mouse-2)) 'double-mouse-2 'mouse-2)))
(newdown (if (eq mouse-1-click-follows-link 'double)
'double-down-mouse-2 'down-mouse-2)))
;; If mouse-2 has never been done by the user, it doesn't have ;; If mouse-2 has never been done by the user, it doesn't have
;; the necessary property to be interpreted correctly. ;; the necessary property to be interpreted correctly.
(put newup 'event-kind (get (car event) 'event-kind)) (unless (get newup 'event-kind)
(put newdown 'event-kind (get (car this-event) 'event-kind)) (put newup 'event-kind (get (car event) 'event-kind)))
(push (cons newup (cdr event)) unread-command-events) (push (cons newup (cdr event)) unread-command-events)
;; Modify the event in place, so read-key-sequence doesn't ;; Don't change the down event, only the up-event (bug#18212).
;; generate a second fake prefix key (see fake_prefixed_keys in nil)
;; src/keyboard.c).
(setcar this-event newdown)
(vector this-event))
(push event unread-command-events) (push event unread-command-events)
nil)))))) nil))))))
......
...@@ -5140,7 +5140,7 @@ or the frame." ...@@ -5140,7 +5140,7 @@ or the frame."
0) 0)
0))) 0)))
(if (floatp lsp) (if (floatp lsp)
(setq lsp (* dfh lsp))) (setq lsp (truncate (* (frame-char-height) lsp))))
(+ dfh lsp))) (+ dfh lsp)))
(defun window-screen-lines () (defun window-screen-lines ()
...@@ -5152,10 +5152,9 @@ in the window, not in units of the frame's default font, and also accounts ...@@ -5152,10 +5152,9 @@ in the window, not in units of the frame's default font, and also accounts
for `line-spacing', if any, defined for the window's buffer or frame. for `line-spacing', if any, defined for the window's buffer or frame.
The value is a floating-point number." The value is a floating-point number."
(let ((canonical (window-text-height)) (let ((edges (window-inside-pixel-edges))
(fch (frame-char-height))
(dlh (default-line-height))) (dlh (default-line-height)))
(/ (* (float canonical) fch) dlh))) (/ (float (- (nth 3 edges) (nth 1 edges))) dlh)))
;; Returns non-nil if partial move was done. ;; Returns non-nil if partial move was done.
(defun line-move-partial (arg noerror to-end) (defun line-move-partial (arg noerror to-end)
......
...@@ -1155,8 +1155,17 @@ dumping to it." ...@@ -1155,8 +1155,17 @@ dumping to it."
WINDOW must be a valid window and defaults to the selected one. WINDOW must be a valid window and defaults to the selected one.
If HORIZONTAL is omitted or nil, return the total height of If HORIZONTAL is omitted or nil, return the total height of
WINDOW, in lines, like `window-total-height'. Otherwise return WINDOW, in lines. If WINDOW is live, its total height includes,
the total width, in columns, like `window-total-width'. in addition to the height of WINDOW's text, the heights of
WINDOW's mode and header line and a bottom divider, if any.
If HORIZONTAL is non-nil, return the total width of WINDOW, in
columns. If WINDOW is live, its total width includes, in
addition to the width of WINDOW's text, the widths of WINDOW's
fringes, margins, scroll bars and its right divider, if any.
If WINDOW is internal, return the respective size of the screen
areas spanned by its children.
Optional argument ROUND is handled as for `window-total-height' Optional argument ROUND is handled as for `window-total-height'
and `window-total-width'." and `window-total-width'."
...@@ -6440,7 +6449,10 @@ again with `display-buffer-pop-up-window'." ...@@ -6440,7 +6449,10 @@ again with `display-buffer-pop-up-window'."
This either splits the selected window or reuses the window below This either splits the selected window or reuses the window below
the selected one." the selected one."
(let (window) (let (window)
(or (and (not (frame-parameter nil 'unsplittable)) (or (and (setq window (window-in-direction 'below))
(eq buffer (window-buffer window))
(window--display-buffer buffer window 'reuse alist))
(and (not (frame-parameter nil 'unsplittable))
(let ((split-height-threshold 0) (let ((split-height-threshold 0)
split-width-threshold) split-width-threshold)
(setq window (window--try-to-split-window (selected-window) alist))) (setq window (window--try-to-split-window (selected-window) alist)))
......
2014-08-11 Glenn Morris <rgm@gnu.org>
* fileio.c: Revert 2013-01-31 change, which chose coding system for
writing before backing up, since it causes a more serious problem
than the one it solves. (Closes Bug#18141, reopens Bug#13522.)
(choose_write_coding_system): No longer callable from Lisp.
Move last piece back here from Fwrite_region.
(Fwrite_region, syms_of_fileio): Update for above changes.
2014-08-11 Martin Rudalics <rudalics@gmx.at>
* window.c (Fwindow_valid_p): Fix doc-string (Bug#18194).
(Fwindow_new_total, Fwindow_normal_size, Fwindow_new_normal)
(Fwindow_new_pixel, Fset_window_new_pixel)
(Fset_window_new_total, Fset_window_new_normal)
(Fwindow_resize_apply): Fix doc-strings (see Bug#18112).
See also:
http://lists.gnu.org/archive/html/bug-gnu-emacs/2014-08/msg00287.html
2014-08-11 Eli Zaretskii <eliz@gnu.org>
* fontset.c (Finternal_char_font): Recompute basic faces if the
frame's face cache was cleared. (Bug#18162)
2014-08-11 Dmitry Antipov <dmantipov@yandex.ru>
Fix bug with uninitialized undo list of an indirect buffer (Bug#18180).
* buffer.c (Fmake_indirect_buffer): Initialize undo list with the
base buffer's undo list.
2014-08-10 Reuben Thomas <rrt@sc3d.org> 2014-08-10 Reuben Thomas <rrt@sc3d.org>
Fix a couple of recent inadvertent breaks of the MSDOS port. Fix a couple of recent inadvertent breaks of the MSDOS port.
......
...@@ -826,6 +826,9 @@ CLONE nil means the indirect buffer's state is reset to default values. */) ...@@ -826,6 +826,9 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
set_string_intervals (name, NULL); set_string_intervals (name, NULL);
bset_name (b, name); bset_name (b, name);
/* An indirect buffer shares undo list of its base (Bug#18180). */
bset_undo_list (b, BVAR (b->base_buffer, undo_list));
reset_buffer (b); reset_buffer (b);
reset_buffer_local_variables (b, 1); reset_buffer_local_variables (b, 1);
......
...@@ -1190,8 +1190,8 @@ alloc_destination (struct coding_system *coding, ptrdiff_t nbytes, ...@@ -1190,8 +1190,8 @@ alloc_destination (struct coding_system *coding, ptrdiff_t nbytes,
#define UTF_8_BOM_2 0xBB #define UTF_8_BOM_2 0xBB
#define UTF_8_BOM_3 0xBF #define UTF_8_BOM_3 0xBF
/* Unlike the other detect_coding_XXX, this function counts number of /* Unlike the other detect_coding_XXX, this function counts the number
characters and check EOL format. */ of characters and checks the EOL format. */
static bool static bool
detect_coding_utf_8 (struct coding_system *coding, detect_coding_utf_8 (struct coding_system *coding,
...@@ -11265,7 +11265,7 @@ decode text as usual. */); ...@@ -11265,7 +11265,7 @@ decode text as usual. */);
DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization, DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization,
doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files. doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files.
Internal use only. Removed after the experimental optimizer gets stable. */); Internal use only. Remove after the experimental optimizer becomes stable. */);
disable_ascii_optimization = 0; disable_ascii_optimization = 0;
DEFVAR_LISP ("translation-table-for-input", Vtranslation_table_for_input, DEFVAR_LISP ("translation-table-for-input", Vtranslation_table_for_input,
......
...@@ -323,7 +323,6 @@ static Lisp_Object Qfile_acl; ...@@ -323,7 +323,6 @@ static Lisp_Object Qfile_acl;
static Lisp_Object Qset_file_acl; static Lisp_Object Qset_file_acl;
static Lisp_Object Qfile_newer_than_file_p; static Lisp_Object Qfile_newer_than_file_p;
Lisp_Object Qinsert_file_contents; Lisp_Object Qinsert_file_contents;
static Lisp_Object Qchoose_write_coding_system;
Lisp_Object Qwrite_region; Lisp_Object Qwrite_region;
static Lisp_Object Qverify_visited_file_modtime; static Lisp_Object Qverify_visited_file_modtime;
static Lisp_Object Qset_visited_file_modtime; static Lisp_Object Qset_visited_file_modtime;
...@@ -4525,24 +4524,14 @@ build_annotations_unwind (Lisp_Object arg) ...@@ -4525,24 +4524,14 @@ build_annotations_unwind (Lisp_Object arg)
/* Decide the coding-system to encode the data with. */ /* Decide the coding-system to encode the data with. */
DEFUN ("choose-write-coding-system", Fchoose_write_coding_system, static Lisp_Object
Schoose_write_coding_system, 3, 6, 0, choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
doc: /* Choose the coding system for writing a file. Lisp_Object append, Lisp_Object visit, Lisp_Object lockname,
Arguments are as for `write-region'. struct coding_system *coding)
This function is for internal use only. It may prompt the user. */ )
(Lisp_Object start, Lisp_Object end, Lisp_Object filename,
Lisp_Object append, Lisp_Object visit, Lisp_Object lockname)
{ {
Lisp_Object val; Lisp_Object val;
Lisp_Object eol_parent = Qnil; Lisp_Object eol_parent = Qnil;
/* Mimic write-region behavior. */
if (NILP (start))
{
XSETFASTINT (start, BEGV);
XSETFASTINT (end, ZV);
}
if (auto_saving if (auto_saving
&& NILP (Fstring_equal (BVAR (current_buffer, filename), && NILP (Fstring_equal (BVAR (current_buffer, filename),
BVAR (current_buffer, auto_save_file_name)))) BVAR (current_buffer, auto_save_file_name))))
...@@ -4635,6 +4624,10 @@ This function is for internal use only. It may prompt the user. */ ) ...@@ -4635,6 +4624,10 @@ This function is for internal use only. It may prompt the user. */ )
} }
val = coding_inherit_eol_type (val, eol_parent); val = coding_inherit_eol_type (val, eol_parent);
setup_coding_system (val, coding);
if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
return val; return val;
} }
...@@ -4803,14 +4796,9 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, ...@@ -4803,14 +4796,9 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
We used to make this choice before calling build_annotations, but that We used to make this choice before calling build_annotations, but that
leads to problems when a write-annotate-function takes care of leads to problems when a write-annotate-function takes care of
unsavable chars (as was the case with X-Symbol). */ unsavable chars (as was the case with X-Symbol). */
Vlast_coding_system_used = Vlast_coding_system_used
Fchoose_write_coding_system (start, end, filename, = choose_write_coding_system (start, end, filename,
append, visit, lockname); append, visit, lockname, &coding);
setup_coding_system (Vlast_coding_system_used, &coding);