aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2014-08-10 17:59:34 -0700
committerGlenn Morris2014-08-10 17:59:34 -0700
commitc7367d2de3343e56171c4fe6d439a3ed5f40d06c (patch)
tree54fe9166f6b4320d9518bbac11e2d575a9fda7c2
parent6b7d077506304f440d311fa7b29d210b7a3e121c (diff)
parentf314e84fce8b394da20aa1d69121c74fb34f9a1e (diff)
downloademacs-c7367d2de3343e56171c4fe6d439a3ed5f40d06c.tar.gz
emacs-c7367d2de3343e56171c4fe6d439a3ed5f40d06c.zip
Merge from emacs-24; up to 2014-06-28T23:35:17Z!rgm@gnu.org
-rw-r--r--ChangeLog13
-rw-r--r--configure.ac2
-rw-r--r--etc/tutorials/TUTORIAL.fr4
-rw-r--r--lib/save-cwd.c88
-rw-r--r--lib/save-cwd.h40
-rw-r--r--lisp/ChangeLog42
-rw-r--r--lisp/files.el13
-rw-r--r--lisp/info.el4
-rw-r--r--lisp/mouse.el32
-rw-r--r--lisp/simple.el7
-rw-r--r--lisp/window.el18
-rw-r--r--src/ChangeLog30
-rw-r--r--src/buffer.c3
-rw-r--r--src/coding.c6
-rw-r--r--src/fileio.c36
-rw-r--r--src/fontset.c4
-rw-r--r--src/window.c64
-rw-r--r--test/ChangeLog6
-rw-r--r--test/automated/data/files-bug18141.el.gzbin0 -> 77 bytes
-rw-r--r--test/automated/files.el18
20 files changed, 323 insertions, 107 deletions
diff --git a/ChangeLog b/ChangeLog
index 3511f0434aa..069b3545e0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
12014-08-11 Paul Eggert <eggert@cs.ucla.edu>
2
3 Don't prevent random file systems from being unmounted (Bug#18232).
4 This fix relies on having the 'fchdir' function, and on having
5 "." be searchable (or at least readable, on platforms lacking O_SEARCH),
6 but that's good enough to handle the vast majority of cases and the
7 remaining folks can just live with the annoyance of file systems
8 that occasionally can't be unmounted.
9 * configure.ac (fchdir): New function to check for.
10 * lib/save-cwd.c: Copy from gnulib, except omit the part that
11 allocates memory, since that can cause problems in Emacs.
12 * lib/save-cwd.h: Copy from gnulib.
13
12014-08-10 Eli Zaretskii <eliz@gnu.org> 142014-08-10 Eli Zaretskii <eliz@gnu.org>
2 15
3 * config.bat: Fix some confusing wording. 16 * config.bat: Fix some confusing wording.
diff --git a/configure.ac b/configure.ac
index 7e101aa9fc9..3e49527e0f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3547,7 +3547,7 @@ AC_SUBST(BLESSMAIL_TARGET)
3547 3547
3548OLD_LIBS=$LIBS 3548OLD_LIBS=$LIBS
3549LIBS="$LIB_PTHREAD $LIB_MATH $LIBS" 3549LIBS="$LIB_PTHREAD $LIB_MATH $LIBS"
3550AC_CHECK_FUNCS(accept4 gethostname \ 3550AC_CHECK_FUNCS(accept4 fchdir gethostname \
3551getrusage get_current_dir_name \ 3551getrusage get_current_dir_name \
3552lrand48 random rint \ 3552lrand48 random rint \
3553select getpagesize setlocale \ 3553select getpagesize setlocale \
diff --git a/etc/tutorials/TUTORIAL.fr b/etc/tutorials/TUTORIAL.fr
index 916ec51285d..30a5c717055 100644
--- a/etc/tutorials/TUTORIAL.fr
+++ b/etc/tutorials/TUTORIAL.fr
@@ -698,7 +698,7 @@ inquiétez pour les modifications que vous avez faites, C-x C-c vous
698proposera de sauvegarder tous les fichiers modifiés avant de quitter 698proposera de sauvegarder tous les fichiers modifiés avant de quitter
699Emacs). 699Emacs).
700 700
701Si vous utiliser un affichage graphique, vous n'avez pas besoin de 701Si vous utilisez un affichage graphique, vous n'avez pas besoin de
702commande spéciale pour vous déplacer d'Emacs à une autre application. 702commande spéciale pour vous déplacer d'Emacs à une autre application.
703Vous pouvez le faire à l'aide de la souris ou avec les commandes du 703Vous pouvez le faire à l'aide de la souris ou avec les commandes du
704gestionnaire de fenêtres. Cependant, si vous utilisez un terminal 704gestionnaire de fenêtres. Cependant, si vous utilisez un terminal
@@ -1143,7 +1143,7 @@ C-x C-f à côté de find-file).
1143>> Faites C-x 1 pour supprimer la fenêtre d'aide. 1143>> Faites C-x 1 pour supprimer la fenêtre d'aide.
1144 1144
1145 C-h i Manuels en ligne (alias Info). Cette commande vous place dans 1145 C-h i Manuels en ligne (alias Info). Cette commande vous place dans
1146 un tampon spéciale, appelé « *info* », où vous pouvez 1146 un tampon spécial, appelé « *info* », où vous pouvez
1147 lire les manuels en ligne des paquetages installés sur 1147 lire les manuels en ligne des paquetages installés sur
1148 votre système. Faites m emacs <Entrée> pour lire le 1148 votre système. Faites m emacs <Entrée> pour lire le
1149 manuel d'Emacs. Si vous n'avez jamais utilisé Info 1149 manuel d'Emacs. Si vous n'avez jamais utilisé Info
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index b8dae34ca02..833783cbab0 100644
--- a/lib/save-cwd.c
+++ b/lib/save-cwd.c
@@ -1,3 +1,89 @@
1/* save-cwd.c -- Save and restore current working directory.
2
3 Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2014 Free Software
4 Foundation, Inc.
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19/* Gnulib needs to save and restore the current working directory to
20 fully emulate functions like fstatat. But Emacs doesn't care what
21 the current working directory is; it always uses absolute file
22 names. This module replaces the Gnulib module by omitting the code
23 that Emacs does not need. */
24
1#include <config.h> 25#include <config.h>
2#define SAVE_CWD_INLINE _GL_EXTERN_INLINE 26
3#include "save-cwd.h" 27#include "save-cwd.h"
28
29#include <fcntl.h>
30#include <unistd.h>
31
32/* Record the location of the current working directory in CWD so that
33 the program may change to other directories and later use restore_cwd
34 to return to the recorded location. This function may allocate
35 space using malloc (via getcwd) or leave a file descriptor open;
36 use free_cwd to perform the necessary free or close. Upon failure,
37 no memory is allocated, any locally opened file descriptors are
38 closed; return non-zero -- in that case, free_cwd need not be
39 called, but doing so is ok. Otherwise, return zero.
40
41 The _raison d'etre_ for this interface is that the working directory
42 is sometimes inaccessible, and getcwd is not robust or as efficient.
43 So, we prefer to use the open/fchdir approach, but fall back on
44 getcwd if necessary. This module works for most cases with just
45 the getcwd-lgpl module, but to be truly robust, use the getcwd module.
46
47 Some systems lack fchdir altogether: e.g., OS/2, pre-2001 Cygwin,
48 SCO Xenix. Also, SunOS 4 and Irix 5.3 provide the function, yet it
49 doesn't work for partitions on which auditing is enabled. If
50 you're still using an obsolete system with these problems, please
51 send email to the maintainer of this code. */
52
53#if !defined HAVE_FCHDIR && !defined fchdir
54# define fchdir(fd) (-1)
55#endif
56
57int
58save_cwd (struct saved_cwd *cwd)
59{
60 cwd->desc = open (".", O_SEARCH | O_CLOEXEC);
61 /* The 'name' member is present only to minimize differences from
62 gnulib. Initialize it to zero, if only to simplify debugging. */
63 cwd->name = 0;
64 return 0;
65}
66
67/* Change to recorded location, CWD, in directory hierarchy.
68 Upon failure, return -1 (errno is set by chdir or fchdir).
69 Upon success, return zero. */
70
71int
72restore_cwd (const struct saved_cwd *cwd)
73{
74 /* Restore the previous directory if possible, to avoid tying down
75 the file system of the new directory (Bug#18232).
76 Don't worry if fchdir fails, as Emacs doesn't care what the
77 working directory is. The fchdir call is inside an 'if' merely to
78 pacify compilers that complain if fchdir's return value is ignored. */
79 if (fchdir (cwd->desc) == 0)
80 return 0;
81
82 return 0;
83}
84
85void
86free_cwd (struct saved_cwd *cwd)
87{
88 close (cwd->desc);
89}
diff --git a/lib/save-cwd.h b/lib/save-cwd.h
index 9a1eb3519c8..6b84e4601d3 100644
--- a/lib/save-cwd.h
+++ b/lib/save-cwd.h
@@ -1,6 +1,7 @@
1/* Do not save and restore the current working directory. 1/* Save and restore current working directory.
2 2
3 Copyright 2013-2014 Free Software Foundation, Inc. 3 Copyright (C) 1995, 1997-1998, 2003, 2009-2014 Free Software Foundation,
4 Inc.
4 5
5 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
@@ -15,32 +16,19 @@
15 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 18
18/* Gnulib needs to save and restore the current working directory to 19/* Written by Jim Meyering. */
19 fully emulate functions like fstatat. But Emacs doesn't care what
20 the current working directory is; it always uses absolute file
21 names. This module replaces the Gnulib module by omitting the code
22 that Emacs does not need. */
23 20
24#ifndef SAVE_CWD_H 21#ifndef SAVE_CWD_H
25#define SAVE_CWD_H 1 22# define SAVE_CWD_H 1
26 23
27_GL_INLINE_HEADER_BEGIN 24struct saved_cwd
28#ifndef SAVE_CWD_INLINE 25 {
29# define SAVE_CWD_INLINE _GL_INLINE 26 int desc;
30#endif 27 char *name;
28 };
31 29
32struct saved_cwd { int desc; }; 30int save_cwd (struct saved_cwd *cwd);
31int restore_cwd (const struct saved_cwd *cwd);
32void free_cwd (struct saved_cwd *cwd);
33 33
34SAVE_CWD_INLINE int 34#endif /* SAVE_CWD_H */
35save_cwd (struct saved_cwd *cwd)
36{
37 cwd->desc = -1;
38 return 0;
39}
40
41SAVE_CWD_INLINE int restore_cwd (struct saved_cwd const *cwd) { return 0; }
42SAVE_CWD_INLINE void free_cwd (struct saved_cwd *cwd) { }
43
44_GL_INLINE_HEADER_END
45
46#endif
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ab1fad7bc34..daf9f28d8fc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,41 @@
12014-08-11 Glenn Morris <rgm@gnu.org>
2
3 * files.el (basic-save-buffer-2): Revert 2013-01-31 change, which
4 chose coding system for writing before backing up, since it causes
5 a more serious problem than the one it solves. (Closes Bug#18141,
6 reopens Bug#13522.)
7
82014-08-11 Martin Rudalics <rudalics@gmx.at>
9
10 * window.el (window-total-size): Make doc-string more self-contained.
11
12 * window.el (display-buffer-below-selected): Restore original
13 behavior if buffer is already displayed in the window below the
14 selected one (Bug#18181).
15
162014-08-11 Stefan Monnier <monnier@iro.umontreal.ca>
17
18 * mouse.el (mouse--down-1-maybe-follows-link): Don't convert the down
19 event (bug#18212).
20
212014-08-11 Eli Zaretskii <eliz@gnu.org>
22
23 * info.el (info): Doc fix.
24
252014-08-11 Stefan Monnier <monnier@iro.umontreal.ca>
26
27 * info.el (Info-mode-map): Override a global down-mouse-2 binding
28 (bug#18212).
29
302014-08-11 Eli Zaretskii <eliz@gnu.org>
31
32 * simple.el (default-line-height): A floating-point value of
33 line-spacing means a fraction of the default frame font's height,
34 not of the font currently used by the 'default' face.
35 Truncate the pixel value, like the display engine does.
36 (window-screen-lines): Use window-inside-pixel-edges for
37 determining the window height in pixels. (Bug#18195)
38
12014-08-11 Grégoire Jadi <daimrod@gmail.com> 392014-08-11 Grégoire Jadi <daimrod@gmail.com>
2 40
3 * leim/quail/latin-post.el: Transform " __" into " _". (Bug#18023) 41 * leim/quail/latin-post.el: Transform " __" into " _". (Bug#18023)
@@ -462,8 +500,8 @@
462 (python-shell-output-filter): Fix comment typo. 500 (python-shell-output-filter): Fix comment typo.
463 501
464 Fix Python shell prompts detection for remote hosts. 502 Fix Python shell prompts detection for remote hosts.
465 * progmodes/python.el (python-shell-prompt-detect): Replace 503 * progmodes/python.el (python-shell-prompt-detect):
466 call-process with process-file and make it more robust. 504 Replace call-process with process-file and make it more robust.
467 505
468 Autodetect Python shell prompts. (Bug#17370) 506 Autodetect Python shell prompts. (Bug#17370)
469 * progmodes/python.el: 507 * progmodes/python.el:
diff --git a/lisp/files.el b/lisp/files.el
index 5cff5b11ee9..a9a279b2fa4 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4759,7 +4759,7 @@ Before and after saving the buffer, this function runs
4759;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like 4759;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like
4760;; backup-buffer. 4760;; backup-buffer.
4761(defun basic-save-buffer-2 () 4761(defun basic-save-buffer-2 ()
4762 (let (tempsetmodes setmodes writecoding) 4762 (let (tempsetmodes setmodes)
4763 (if (not (file-writable-p buffer-file-name)) 4763 (if (not (file-writable-p buffer-file-name))
4764 (let ((dir (file-name-directory buffer-file-name))) 4764 (let ((dir (file-name-directory buffer-file-name)))
4765 (if (not (file-directory-p dir)) 4765 (if (not (file-directory-p dir))
@@ -4775,14 +4775,6 @@ Before and after saving the buffer, this function runs
4775 buffer-file-name))) 4775 buffer-file-name)))
4776 (setq tempsetmodes t) 4776 (setq tempsetmodes t)
4777 (error "Attempt to save to a file which you aren't allowed to write")))))) 4777 (error "Attempt to save to a file which you aren't allowed to write"))))))
4778 ;; This may involve prompting, so do it now before backing up the file.
4779 ;; Otherwise there can be a delay while the user answers the
4780 ;; prompt during which the original file has been renamed. (Bug#13522)
4781 (setq writecoding
4782 ;; Args here should match write-region call below around
4783 ;; which we use writecoding.
4784 (choose-write-coding-system nil nil buffer-file-name nil t
4785 buffer-file-truename))
4786 (or buffer-backed-up 4778 (or buffer-backed-up
4787 (setq setmodes (backup-buffer))) 4779 (setq setmodes (backup-buffer)))
4788 (let* ((dir (file-name-directory buffer-file-name)) 4780 (let* ((dir (file-name-directory buffer-file-name))
@@ -4864,11 +4856,10 @@ Before and after saving the buffer, this function runs
4864 (logior (car setmodes) 128)))))) 4856 (logior (car setmodes) 128))))))
4865 (let (success) 4857 (let (success)
4866 (unwind-protect 4858 (unwind-protect
4859 (progn
4867 ;; Pass in nil&nil rather than point-min&max to indicate 4860 ;; Pass in nil&nil rather than point-min&max to indicate
4868 ;; we're saving the buffer rather than just a region. 4861 ;; we're saving the buffer rather than just a region.
4869 ;; write-region-annotate-functions may make us of it. 4862 ;; write-region-annotate-functions may make us of it.
4870 (let ((coding-system-for-write writecoding)
4871 (coding-system-require-warning nil))
4872 (write-region nil nil 4863 (write-region nil nil
4873 buffer-file-name nil t buffer-file-truename) 4864 buffer-file-name nil t buffer-file-truename)
4874 (setq success t)) 4865 (setq success t))
diff --git a/lisp/info.el b/lisp/info.el
index 405d6a22449..59501c73534 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -774,8 +774,7 @@ with the top-level Info directory.
774In interactive use, a non-numeric prefix argument directs 774In interactive use, a non-numeric prefix argument directs
775this command to read a file name from the minibuffer. 775this command to read a file name from the minibuffer.
776 776
777A numeric prefix argument N selects an Info buffer named 777A numeric prefix argument of N selects an Info buffer named \"*info*<N>\".
778\"*info*<%s>\".
779 778
780The search path for Info files is in the variable `Info-directory-list'. 779The search path for Info files is in the variable `Info-directory-list'.
781The top-level Info directory is made by combining all the files named `dir' 780The 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 (define-key map "," 'Info-index-next) 4008 (define-key map "," 'Info-index-next)
4010 (define-key map "\177" 'Info-scroll-down) 4009 (define-key map "\177" 'Info-scroll-down)
4011 (define-key map [mouse-2] 'Info-mouse-follow-nearest-node) 4010 (define-key map [mouse-2] 'Info-mouse-follow-nearest-node)
4011 (define-key map [down-mouse-2] 'ignore) ;Override potential global binding.
4012 (define-key map [follow-link] 'mouse-face) 4012 (define-key map [follow-link] 'mouse-face)
4013 (define-key map [XF86Back] 'Info-history-back) 4013 (define-key map [XF86Back] 'Info-history-back)
4014 (define-key map [XF86Forward] 'Info-history-forward) 4014 (define-key map [XF86Forward] 'Info-history-forward)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 2606c8b4ca4..a10f4d67593 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -94,15 +94,14 @@ point at the click position."
94(defun mouse--down-1-maybe-follows-link (&optional _prompt) 94(defun mouse--down-1-maybe-follows-link (&optional _prompt)
95 "Turn `mouse-1' events into `mouse-2' events if follows-link. 95 "Turn `mouse-1' events into `mouse-2' events if follows-link.
96Expects to be bound to `down-mouse-1' in `key-translation-map'." 96Expects to be bound to `down-mouse-1' in `key-translation-map'."
97 (if (or (null mouse-1-click-follows-link) 97 (when (and mouse-1-click-follows-link
98 (not (eq (if (eq mouse-1-click-follows-link 'double) 98 (eq (if (eq mouse-1-click-follows-link 'double)
99 'double-down-mouse-1 'down-mouse-1) 99 'double-down-mouse-1 'down-mouse-1)
100 (car-safe last-input-event))) 100 (car-safe last-input-event))
101 (not (mouse-on-link-p (event-start last-input-event))) 101 (mouse-on-link-p (event-start last-input-event))
102 (and (not mouse-1-click-in-non-selected-windows) 102 (or mouse-1-click-in-non-selected-windows
103 (not (eq (selected-window) 103 (eq (selected-window)
104 (posn-window (event-start last-input-event)))))) 104 (posn-window (event-start last-input-event)))))
105 nil
106 (let ((this-event last-input-event) 105 (let ((this-event last-input-event)
107 (timedout 106 (timedout
108 (sit-for (if (numberp mouse-1-click-follows-link) 107 (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 'double-mouse-1 'mouse-1)) 117 'double-mouse-1 'mouse-1))
119 ;; Turn the mouse-1 into a mouse-2 to follow links. 118 ;; Turn the mouse-1 into a mouse-2 to follow links.
120 (let ((newup (if (eq mouse-1-click-follows-link 'double) 119 (let ((newup (if (eq mouse-1-click-follows-link 'double)
121 'double-mouse-2 'mouse-2)) 120 'double-mouse-2 'mouse-2)))
122 (newdown (if (eq mouse-1-click-follows-link 'double)
123 'double-down-mouse-2 'down-mouse-2)))
124 ;; If mouse-2 has never been done by the user, it doesn't have 121 ;; If mouse-2 has never been done by the user, it doesn't have
125 ;; the necessary property to be interpreted correctly. 122 ;; the necessary property to be interpreted correctly.
126 (put newup 'event-kind (get (car event) 'event-kind)) 123 (unless (get newup 'event-kind)
127 (put newdown 'event-kind (get (car this-event) 'event-kind)) 124 (put newup 'event-kind (get (car event) 'event-kind)))
128 (push (cons newup (cdr event)) unread-command-events) 125 (push (cons newup (cdr event)) unread-command-events)
129 ;; Modify the event in place, so read-key-sequence doesn't 126 ;; Don't change the down event, only the up-event (bug#18212).
130 ;; generate a second fake prefix key (see fake_prefixed_keys in 127 nil)
131 ;; src/keyboard.c).
132 (setcar this-event newdown)
133 (vector this-event))
134 (push event unread-command-events) 128 (push event unread-command-events)
135 nil)))))) 129 nil))))))
136 130
diff --git a/lisp/simple.el b/lisp/simple.el
index 5da662c2124..cdff8d7fc3a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5140,7 +5140,7 @@ or the frame."
5140 0) 5140 0)
5141 0))) 5141 0)))
5142 (if (floatp lsp) 5142 (if (floatp lsp)
5143 (setq lsp (* dfh lsp))) 5143 (setq lsp (truncate (* (frame-char-height) lsp))))
5144 (+ dfh lsp))) 5144 (+ dfh lsp)))
5145 5145
5146(defun window-screen-lines () 5146(defun window-screen-lines ()
@@ -5152,10 +5152,9 @@ in the window, not in units of the frame's default font, and also accounts
5152for `line-spacing', if any, defined for the window's buffer or frame. 5152for `line-spacing', if any, defined for the window's buffer or frame.
5153 5153
5154The value is a floating-point number." 5154The value is a floating-point number."
5155 (let ((canonical (window-text-height)) 5155 (let ((edges (window-inside-pixel-edges))
5156 (fch (frame-char-height))
5157 (dlh (default-line-height))) 5156 (dlh (default-line-height)))
5158 (/ (* (float canonical) fch) dlh))) 5157 (/ (float (- (nth 3 edges) (nth 1 edges))) dlh)))
5159 5158
5160;; Returns non-nil if partial move was done. 5159;; Returns non-nil if partial move was done.
5161(defun line-move-partial (arg noerror to-end) 5160(defun line-move-partial (arg noerror to-end)
diff --git a/lisp/window.el b/lisp/window.el
index 03caf831111..a05dddeac9e 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1155,8 +1155,17 @@ dumping to it."
1155WINDOW must be a valid window and defaults to the selected one. 1155WINDOW must be a valid window and defaults to the selected one.
1156 1156
1157If HORIZONTAL is omitted or nil, return the total height of 1157If HORIZONTAL is omitted or nil, return the total height of
1158WINDOW, in lines, like `window-total-height'. Otherwise return 1158WINDOW, in lines. If WINDOW is live, its total height includes,
1159the total width, in columns, like `window-total-width'. 1159in addition to the height of WINDOW's text, the heights of
1160WINDOW's mode and header line and a bottom divider, if any.
1161
1162If HORIZONTAL is non-nil, return the total width of WINDOW, in
1163columns. If WINDOW is live, its total width includes, in
1164addition to the width of WINDOW's text, the widths of WINDOW's
1165fringes, margins, scroll bars and its right divider, if any.
1166
1167If WINDOW is internal, return the respective size of the screen
1168areas spanned by its children.
1160 1169
1161Optional argument ROUND is handled as for `window-total-height' 1170Optional argument ROUND is handled as for `window-total-height'
1162and `window-total-width'." 1171and `window-total-width'."
@@ -6440,7 +6449,10 @@ again with `display-buffer-pop-up-window'."
6440This either splits the selected window or reuses the window below 6449This either splits the selected window or reuses the window below
6441the selected one." 6450the selected one."
6442 (let (window) 6451 (let (window)
6443 (or (and (not (frame-parameter nil 'unsplittable)) 6452 (or (and (setq window (window-in-direction 'below))
6453 (eq buffer (window-buffer window))
6454 (window--display-buffer buffer window 'reuse alist))
6455 (and (not (frame-parameter nil 'unsplittable))
6444 (let ((split-height-threshold 0) 6456 (let ((split-height-threshold 0)
6445 split-width-threshold) 6457 split-width-threshold)
6446 (setq window (window--try-to-split-window (selected-window) alist))) 6458 (setq window (window--try-to-split-window (selected-window) alist)))
diff --git a/src/ChangeLog b/src/ChangeLog
index 0bc8a712112..aa2f95907eb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,33 @@
12014-08-11 Glenn Morris <rgm@gnu.org>
2
3 * fileio.c: Revert 2013-01-31 change, which chose coding system for
4 writing before backing up, since it causes a more serious problem
5 than the one it solves. (Closes Bug#18141, reopens Bug#13522.)
6 (choose_write_coding_system): No longer callable from Lisp.
7 Move last piece back here from Fwrite_region.
8 (Fwrite_region, syms_of_fileio): Update for above changes.
9
102014-08-11 Martin Rudalics <rudalics@gmx.at>
11
12 * window.c (Fwindow_valid_p): Fix doc-string (Bug#18194).
13 (Fwindow_new_total, Fwindow_normal_size, Fwindow_new_normal)
14 (Fwindow_new_pixel, Fset_window_new_pixel)
15 (Fset_window_new_total, Fset_window_new_normal)
16 (Fwindow_resize_apply): Fix doc-strings (see Bug#18112).
17 See also:
18 http://lists.gnu.org/archive/html/bug-gnu-emacs/2014-08/msg00287.html
19
202014-08-11 Eli Zaretskii <eliz@gnu.org>
21
22 * fontset.c (Finternal_char_font): Recompute basic faces if the
23 frame's face cache was cleared. (Bug#18162)
24
252014-08-11 Dmitry Antipov <dmantipov@yandex.ru>
26
27 Fix bug with uninitialized undo list of an indirect buffer (Bug#18180).
28 * buffer.c (Fmake_indirect_buffer): Initialize undo list with the
29 base buffer's undo list.
30
12014-08-10 Reuben Thomas <rrt@sc3d.org> 312014-08-10 Reuben Thomas <rrt@sc3d.org>
2 32
3 Fix a couple of recent inadvertent breaks of the MSDOS port. 33 Fix a couple of recent inadvertent breaks of the MSDOS port.
diff --git a/src/buffer.c b/src/buffer.c
index 1973a93a57d..d2c7729d1c2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -826,6 +826,9 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
826 set_string_intervals (name, NULL); 826 set_string_intervals (name, NULL);
827 bset_name (b, name); 827 bset_name (b, name);
828 828
829 /* An indirect buffer shares undo list of its base (Bug#18180). */
830 bset_undo_list (b, BVAR (b->base_buffer, undo_list));
831
829 reset_buffer (b); 832 reset_buffer (b);
830 reset_buffer_local_variables (b, 1); 833 reset_buffer_local_variables (b, 1);
831 834
diff --git a/src/coding.c b/src/coding.c
index 523a6bf0f27..8b620af8695 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1190,8 +1190,8 @@ alloc_destination (struct coding_system *coding, ptrdiff_t nbytes,
1190#define UTF_8_BOM_2 0xBB 1190#define UTF_8_BOM_2 0xBB
1191#define UTF_8_BOM_3 0xBF 1191#define UTF_8_BOM_3 0xBF
1192 1192
1193/* Unlike the other detect_coding_XXX, this function counts number of 1193/* Unlike the other detect_coding_XXX, this function counts the number
1194 characters and check EOL format. */ 1194 of characters and checks the EOL format. */
1195 1195
1196static bool 1196static bool
1197detect_coding_utf_8 (struct coding_system *coding, 1197detect_coding_utf_8 (struct coding_system *coding,
@@ -11265,7 +11265,7 @@ decode text as usual. */);
11265 11265
11266 DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization, 11266 DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization,
11267 doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files. 11267 doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files.
11268Internal use only. Removed after the experimental optimizer gets stable. */); 11268Internal use only. Remove after the experimental optimizer becomes stable. */);
11269 disable_ascii_optimization = 0; 11269 disable_ascii_optimization = 0;
11270 11270
11271 DEFVAR_LISP ("translation-table-for-input", Vtranslation_table_for_input, 11271 DEFVAR_LISP ("translation-table-for-input", Vtranslation_table_for_input,
diff --git a/src/fileio.c b/src/fileio.c
index f0bd75b170e..d9c7397c2de 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -323,7 +323,6 @@ static Lisp_Object Qfile_acl;
323static Lisp_Object Qset_file_acl; 323static Lisp_Object Qset_file_acl;
324static Lisp_Object Qfile_newer_than_file_p; 324static Lisp_Object Qfile_newer_than_file_p;
325Lisp_Object Qinsert_file_contents; 325Lisp_Object Qinsert_file_contents;
326static Lisp_Object Qchoose_write_coding_system;
327Lisp_Object Qwrite_region; 326Lisp_Object Qwrite_region;
328static Lisp_Object Qverify_visited_file_modtime; 327static Lisp_Object Qverify_visited_file_modtime;
329static Lisp_Object Qset_visited_file_modtime; 328static Lisp_Object Qset_visited_file_modtime;
@@ -4525,24 +4524,14 @@ build_annotations_unwind (Lisp_Object arg)
4525 4524
4526/* Decide the coding-system to encode the data with. */ 4525/* Decide the coding-system to encode the data with. */
4527 4526
4528DEFUN ("choose-write-coding-system", Fchoose_write_coding_system, 4527static Lisp_Object
4529 Schoose_write_coding_system, 3, 6, 0, 4528choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4530 doc: /* Choose the coding system for writing a file. 4529 Lisp_Object append, Lisp_Object visit, Lisp_Object lockname,
4531Arguments are as for `write-region'. 4530 struct coding_system *coding)
4532This function is for internal use only. It may prompt the user. */ )
4533 (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4534 Lisp_Object append, Lisp_Object visit, Lisp_Object lockname)
4535{ 4531{
4536 Lisp_Object val; 4532 Lisp_Object val;
4537 Lisp_Object eol_parent = Qnil; 4533 Lisp_Object eol_parent = Qnil;
4538 4534
4539 /* Mimic write-region behavior. */
4540 if (NILP (start))
4541 {
4542 XSETFASTINT (start, BEGV);
4543 XSETFASTINT (end, ZV);
4544 }
4545
4546 if (auto_saving 4535 if (auto_saving
4547 && NILP (Fstring_equal (BVAR (current_buffer, filename), 4536 && NILP (Fstring_equal (BVAR (current_buffer, filename),
4548 BVAR (current_buffer, auto_save_file_name)))) 4537 BVAR (current_buffer, auto_save_file_name))))
@@ -4635,6 +4624,10 @@ This function is for internal use only. It may prompt the user. */ )
4635 } 4624 }
4636 4625
4637 val = coding_inherit_eol_type (val, eol_parent); 4626 val = coding_inherit_eol_type (val, eol_parent);
4627 setup_coding_system (val, coding);
4628
4629 if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
4630 coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
4638 return val; 4631 return val;
4639} 4632}
4640 4633
@@ -4803,14 +4796,9 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
4803 We used to make this choice before calling build_annotations, but that 4796 We used to make this choice before calling build_annotations, but that
4804 leads to problems when a write-annotate-function takes care of 4797 leads to problems when a write-annotate-function takes care of
4805 unsavable chars (as was the case with X-Symbol). */ 4798 unsavable chars (as was the case with X-Symbol). */
4806 Vlast_coding_system_used = 4799 Vlast_coding_system_used
4807 Fchoose_write_coding_system (start, end, filename, 4800 = choose_write_coding_system (start, end, filename,
4808 append, visit, lockname); 4801 append, visit, lockname, &coding);
4809
4810 setup_coding_system (Vlast_coding_system_used, &coding);
4811
4812 if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
4813 coding.mode |= CODING_MODE_SELECTIVE_DISPLAY;
4814 4802
4815 if (open_and_close_file && !auto_saving) 4803 if (open_and_close_file && !auto_saving)
4816 { 4804 {
@@ -5829,7 +5817,6 @@ syms_of_fileio (void)
5829 DEFSYM (Qset_file_acl, "set-file-acl"); 5817 DEFSYM (Qset_file_acl, "set-file-acl");
5830 DEFSYM (Qfile_newer_than_file_p, "file-newer-than-file-p"); 5818 DEFSYM (Qfile_newer_than_file_p, "file-newer-than-file-p");
5831 DEFSYM (Qinsert_file_contents, "insert-file-contents"); 5819 DEFSYM (Qinsert_file_contents, "insert-file-contents");
5832 DEFSYM (Qchoose_write_coding_system, "choose-write-coding-system");
5833 DEFSYM (Qwrite_region, "write-region"); 5820 DEFSYM (Qwrite_region, "write-region");
5834 DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime"); 5821 DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime");
5835 DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime"); 5822 DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime");
@@ -6068,7 +6055,6 @@ This includes interactive calls to `delete-file' and
6068 defsubr (&Sdefault_file_modes); 6055 defsubr (&Sdefault_file_modes);
6069 defsubr (&Sfile_newer_than_file_p); 6056 defsubr (&Sfile_newer_than_file_p);
6070 defsubr (&Sinsert_file_contents); 6057 defsubr (&Sinsert_file_contents);
6071 defsubr (&Schoose_write_coding_system);
6072 defsubr (&Swrite_region); 6058 defsubr (&Swrite_region);
6073 defsubr (&Scar_less_than_car); 6059 defsubr (&Scar_less_than_car);
6074 defsubr (&Sverify_visited_file_modtime); 6060 defsubr (&Sverify_visited_file_modtime);
diff --git a/src/fontset.c b/src/fontset.c
index e34719e5cdf..d99a3bcb7ef 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1843,6 +1843,10 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
1843 return Qnil; 1843 return Qnil;
1844 if (!FRAME_WINDOW_P (f)) 1844 if (!FRAME_WINDOW_P (f))
1845 return Qnil; 1845 return Qnil;
1846 /* We need the basic faces to be valid below, so recompute them if
1847 some code just happened to clear the face cache. */
1848 if (FRAME_FACE_CACHE (f)->used == 0)
1849 recompute_basic_faces (f);
1846 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil); 1850 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil);
1847 face = FACE_FROM_ID (f, face_id); 1851 face = FACE_FROM_ID (f, face_id);
1848 if (face->font) 1852 if (face->font)
diff --git a/src/window.c b/src/window.c
index 049c0d122a3..ac685f6867f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -329,7 +329,7 @@ DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
329DEFUN ("window-valid-p", Fwindow_valid_p, Swindow_valid_p, 1, 1, 0, 329DEFUN ("window-valid-p", Fwindow_valid_p, Swindow_valid_p, 1, 1, 0,
330 doc: /* Return t if OBJECT is a valid window and nil otherwise. 330 doc: /* Return t if OBJECT is a valid window and nil otherwise.
331A valid window is either a window that displays a buffer or an internal 331A valid window is either a window that displays a buffer or an internal
332window. Deleted windows are not live. */) 332window. Windows that have been deleted are not valid. */)
333 (Lisp_Object object) 333 (Lisp_Object object)
334{ 334{
335 return WINDOW_VALID_P (object) ? Qt : Qnil; 335 return WINDOW_VALID_P (object) ? Qt : Qnil;
@@ -810,7 +810,12 @@ total width of WINDOW. */)
810 810
811DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 811DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
812 doc: /* Return the new total size of window WINDOW. 812 doc: /* Return the new total size of window WINDOW.
813WINDOW must be a valid window and defaults to the selected one. */) 813WINDOW must be a valid window and defaults to the selected one.
814
815The new total size of WINDOW is the value set by the last call of
816`set-window-new-total' for WINDOW. If it is valid, it will be shortly
817installed as WINDOW's total height (see `window-total-height') or total
818width (see `window-total-width'). */)
814 (Lisp_Object window) 819 (Lisp_Object window)
815{ 820{
816 return decode_valid_window (window)->new_total; 821 return decode_valid_window (window)->new_total;
@@ -819,7 +824,25 @@ WINDOW must be a valid window and defaults to the selected one. */)
819DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, 824DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0,
820 doc: /* Return the normal height of window WINDOW. 825 doc: /* Return the normal height of window WINDOW.
821WINDOW must be a valid window and defaults to the selected one. 826WINDOW must be a valid window and defaults to the selected one.
822If HORIZONTAL is non-nil, return the normal width of WINDOW. */) 827If HORIZONTAL is non-nil, return the normal width of WINDOW.
828
829The normal height of a frame's root window or a window that is
830horizontally combined (a window that has a left or right sibling) is
8311.0. The normal height of a window that is vertically combined (has a
832sibling above or below) is the fraction of the window's height with
833respect to its parent. The sum of the normal heights of all windows in a
834vertical combination equals 1.0.
835
836Similarly, the normal width of a frame's root window or a window that is
837vertically combined equals 1.0. The normal width of a window that is
838horizontally combined is the fraction of the window's width with respect
839to its parent. The sum of the normal widths of all windows in a
840horizontal combination equals 1.0.
841
842The normal sizes of windows are used to restore the proportional sizes
843of windows after they have been shrunk to their minimum sizes; for
844example when a frame is temporarily made very small and afterwards gets
845re-enlarged to its previous size. */)
823 (Lisp_Object window, Lisp_Object horizontal) 846 (Lisp_Object window, Lisp_Object horizontal)
824{ 847{
825 struct window *w = decode_valid_window (window); 848 struct window *w = decode_valid_window (window);
@@ -829,7 +852,11 @@ If HORIZONTAL is non-nil, return the normal width of WINDOW. */)
829 852
830DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, 853DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0,
831 doc: /* Return new normal size of window WINDOW. 854 doc: /* Return new normal size of window WINDOW.
832WINDOW must be a valid window and defaults to the selected one. */) 855WINDOW must be a valid window and defaults to the selected one.
856
857The new normal size of WINDOW is the value set by the last call of
858`set-window-new-normal' for WINDOW. If valid, it will be shortly
859installed as WINDOW's normal size (see `window-normal-size'). */)
833 (Lisp_Object window) 860 (Lisp_Object window)
834{ 861{
835 return decode_valid_window (window)->new_normal; 862 return decode_valid_window (window)->new_normal;
@@ -837,7 +864,12 @@ WINDOW must be a valid window and defaults to the selected one. */)
837 864
838DEFUN ("window-new-pixel", Fwindow_new_pixel, Swindow_new_pixel, 0, 1, 0, 865DEFUN ("window-new-pixel", Fwindow_new_pixel, Swindow_new_pixel, 0, 1, 0,
839 doc: /* Return new pixel size of window WINDOW. 866 doc: /* Return new pixel size of window WINDOW.
840WINDOW must be a valid window and defaults to the selected one. */) 867WINDOW must be a valid window and defaults to the selected one.
868
869The new pixel size of WINDOW is the value set by the last call of
870`set-window-new-pixel' for WINDOW. If it is valid, it will be shortly
871installed as WINDOW's pixel height (see `window-pixel-height') or pixel
872width (see `window-pixel-width'). */)
841 (Lisp_Object window) 873 (Lisp_Object window)
842{ 874{
843 return decode_valid_window (window)->new_pixel; 875 return decode_valid_window (window)->new_pixel;
@@ -3705,6 +3737,10 @@ Return SIZE.
3705Optional argument ADD non-nil means add SIZE to the new pixel size of 3737Optional argument ADD non-nil means add SIZE to the new pixel size of
3706WINDOW and return the sum. 3738WINDOW and return the sum.
3707 3739
3740The new pixel size of WINDOW, if valid, will be shortly installed as
3741WINDOW's pixel height (see `window-pixel-height') or pixel width (see
3742`window-pixel-width').
3743
3708Note: This function does not operate on any child windows of WINDOW. */) 3744Note: This function does not operate on any child windows of WINDOW. */)
3709 (Lisp_Object window, Lisp_Object size, Lisp_Object add) 3745 (Lisp_Object window, Lisp_Object size, Lisp_Object add)
3710{ 3746{
@@ -3729,6 +3765,10 @@ Return SIZE.
3729Optional argument ADD non-nil means add SIZE to the new total size of 3765Optional argument ADD non-nil means add SIZE to the new total size of
3730WINDOW and return the sum. 3766WINDOW and return the sum.
3731 3767
3768The new total size of WINDOW, if valid, will be shortly installed as
3769WINDOW's total height (see `window-total-height') or total width (see
3770`window-total-width').
3771
3732Note: This function does not operate on any child windows of WINDOW. */) 3772Note: This function does not operate on any child windows of WINDOW. */)
3733 (Lisp_Object window, Lisp_Object size, Lisp_Object add) 3773 (Lisp_Object window, Lisp_Object size, Lisp_Object add)
3734{ 3774{
@@ -3748,6 +3788,9 @@ DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal,
3748WINDOW must be a valid window and defaults to the selected one. 3788WINDOW must be a valid window and defaults to the selected one.
3749Return SIZE. 3789Return SIZE.
3750 3790
3791The new normal size of WINDOW, if valid, will be shortly installed as
3792WINDOW's normal size (see `window-normal-size').
3793
3751Note: This function does not operate on any child windows of WINDOW. */) 3794Note: This function does not operate on any child windows of WINDOW. */)
3752 (Lisp_Object window, Lisp_Object size) 3795 (Lisp_Object window, Lisp_Object size)
3753{ 3796{
@@ -4012,9 +4055,14 @@ If FRAME is omitted or nil, it defaults to the selected frame.
4012Optional argument HORIZONTAL omitted or nil means apply requested 4055Optional argument HORIZONTAL omitted or nil means apply requested
4013height values. HORIZONTAL non-nil means apply requested width values. 4056height values. HORIZONTAL non-nil means apply requested width values.
4014 4057
4015This function checks whether the requested values sum up to a valid 4058The requested size values are those set by `set-window-new-pixel' and
4016window layout, recursively assigns the new sizes of all child windows 4059`set-window-new-normal'. This function checks whether the requested
4017and calculates and assigns the new start positions of these windows. 4060values sum up to a valid window layout, recursively assigns the new
4061sizes of all child windows and calculates and assigns the new start
4062positions of these windows.
4063
4064Return t if the requested values have been applied correctly, nil
4065otherwise.
4018 4066
4019Note: This function does not check any of `window-fixed-size-p', 4067Note: This function does not check any of `window-fixed-size-p',
4020`window-min-height' or `window-min-width'. All these checks have to 4068`window-min-height' or `window-min-width'. All these checks have to
diff --git a/test/ChangeLog b/test/ChangeLog
index 5cae39dba87..2de81475e88 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
12014-08-11 Glenn Morris <rgm@gnu.org>
2
3 * automated/data/files-bug18141.el.gz: New file.
4 * automated/files.el (files-test-bug-18141-file):
5 New variable and test. (Bug#18141)
6
12014-08-10 Ulf Jasper <ulf.jasper@web.de> 72014-08-10 Ulf Jasper <ulf.jasper@web.de>
2 8
3 Enumerate evaluated sexp diary entries (Bug#7911). 9 Enumerate evaluated sexp diary entries (Bug#7911).
diff --git a/test/automated/data/files-bug18141.el.gz b/test/automated/data/files-bug18141.el.gz
new file mode 100644
index 00000000000..53d463e85b5
--- /dev/null
+++ b/test/automated/data/files-bug18141.el.gz
Binary files differ
diff --git a/test/automated/files.el b/test/automated/files.el
index 44816bc33f5..8db06f7dfe3 100644
--- a/test/automated/files.el
+++ b/test/automated/files.el
@@ -148,6 +148,24 @@ form.")
148 (should (file-test--do-local-variables-test str subtest)))))) 148 (should (file-test--do-local-variables-test str subtest))))))
149 (ad-disable-advice 'hack-local-variables-confirm 'around 'files-test))) 149 (ad-disable-advice 'hack-local-variables-confirm 'around 'files-test)))
150 150
151(defvar files-test-bug-18141-file
152 (expand-file-name "data/files-bug18141.el.gz" (getenv "EMACS_TEST_DIRECTORY"))
153 "Test file for bug#18141.")
154
155(ert-deftest files-test-bug-18141 ()
156 "Test for http://debbugs.gnu.org/18141 ."
157 (skip-unless (executable-find "gzip"))
158 (let ((tempfile (make-temp-file "files-test-bug-18141" nil ".gz")))
159 (unwind-protect
160 (progn
161 (copy-file files-test-bug-18141-file tempfile t)
162 (with-current-buffer (find-file-noselect tempfile)
163 (set-buffer-modified-p t)
164 (save-buffer)
165 (should (eq buffer-file-coding-system 'iso-2022-7bit-unix))))
166 (delete-file tempfile))))
167
168
151;; Stop the above "Local Var..." confusing Emacs. 169;; Stop the above "Local Var..." confusing Emacs.
152 170
153 171