emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 435da5d 5/5: Merge from origin/emacs-25


From: Paul Eggert
Subject: [Emacs-diffs] master 435da5d 5/5: Merge from origin/emacs-25
Date: Mon, 11 Apr 2016 16:10:16 +0000

branch: master
commit 435da5d2955ce35be4785b7d46566ed9b42ea9fb
Merge: 7c9e625 b134c20
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Merge from origin/emacs-25
    
    b134c20 Sync with gnulib
    bb30fa9 Fix last change on 2016-01-02
    488a72f ; Spelling fixes
    9b1aab9 Port run-prolog EMACS to SWI-Prolog 7.2.3
    0e7bcec Avoid crashes due to unreasonably large or small text scaling
    85f257c Improve documentation of 'with-eval-after-load'
    668c7bc Improve handling of non-ASCII characters in Git log messages
    b570769 Remove undefined behavior in OS X dumper.
    97211f3 Fix clipping of xwidgets
    e87fbc0 Improve Lisp-level documentation of tooltips
    9f1786e Faces names should not end in "-face".
    3283271 * src/xsmfns.c (syms_of_xsmfns): Remove stray "s in doc strings.
    a1f221b Comint and compile no longer set EMACS
    5c28890 * lisp/subr.el (read-key): Don't let the prompt linger (bug#2...
    a75b9a6 Merge branch 'emacs-25' of git.savannah.gnu.org:/srv/git/emac...
    c93ae7a Allow to customize names of executables used by grep.el
    f6497c6 Set locale encoding to UTF-8 when run from OS X GUI.
    7ad1d07 Avoid signaling errors in 'M-n' at the 'C-x C-f' prompt
    a3f1ac2 Avoid infinite loop in 'studlify-word'
    f36df4b Don’t recommend obsolete EMACS env var
    fb0b531 * lisp/emacs-lisp/package.el: Change from a few days ago need...
---
 ChangeLog.2                  |    2 +-
 doc/emacs/frames.texi        |   50 ++++++++++++++++++++++-----
 doc/lispref/display.texi     |   76 ++++++++++++++++++++++++++++++++++++++++++
 doc/lispref/elisp.texi       |    1 +
 doc/lispref/text.texi        |    5 +--
 doc/misc/efaq.texi           |   15 ++------
 doc/misc/texinfo.tex         |   70 +++++++++++++++++++++++++++++++++++---
 etc/NEWS                     |   19 +++++++++--
 etc/PROBLEMS                 |    8 ++---
 lib/stdint.in.h              |    9 +----
 lisp/ChangeLog.15            |    2 +-
 lisp/comint.el               |    7 ----
 lisp/emacs-lisp/lisp-mode.el |    6 ++--
 lisp/emacs-lisp/package.el   |    1 +
 lisp/face-remap.el           |   29 ++++++++++++++--
 lisp/ffap.el                 |    4 ++-
 lisp/net/tramp-sh.el         |    1 -
 lisp/play/studly.el          |    8 ++--
 lisp/progmodes/compile.el    |    8 ----
 lisp/progmodes/grep.el       |   48 +++++++++++++++++---------
 lisp/progmodes/prolog.el     |   16 ++++++++-
 lisp/rect.el                 |    5 ++-
 lisp/subr.el                 |    7 +++-
 lisp/vc/vc-git.el            |   66 ++++++++++++++++++++++++++++--------
 lisp/vc/vc-hooks.el          |   18 +++++-----
 src/ChangeLog.12             |    2 +-
 src/nsterm.m                 |    9 ++++-
 src/unexmacosx.c             |   21 +++++++++++-
 src/xsmfns.c                 |    4 +-
 src/xwidget.c                |   34 +++++++++----------
 30 files changed, 409 insertions(+), 142 deletions(-)

diff --git a/ChangeLog.2 b/ChangeLog.2
index bc09faf..04ecc82 100644
--- a/ChangeLog.2
+++ b/ChangeLog.2
@@ -21251,7 +21251,7 @@
 
 2015-09-01  Paul Eggert  <address@hidden>
 
-       terminal-init-w32console mimicks command-line
+       terminal-init-w32console mimics command-line
        Problem reported by Eli Zaretskii.
        * lisp/startup.el (startup--setup-quote-display):
        New function, refactored from a part of ‘command-line’.
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 35b3f83..383ae7f 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -1152,11 +1152,11 @@ change the variable @code{x-gtk-file-dialog-help-text} 
to @code{nil}.
 @section Tooltips
 @cindex tooltips
 
-  @dfn{Tooltips} are small windows that display text information at
-the current mouse position.  They activate when there is a pause in
-mouse movement over some significant piece of text in a window, or the
-mode line, or some other part of the Emacs frame such as a tool bar
-button or menu item.
+  @dfn{Tooltips} are small special frames that display text
+information at the current mouse position.  They activate when there
+is a pause in mouse movement over some significant piece of text in a
+window, or the mode line, or some other part of the Emacs frame such
+as a tool bar button or menu item.
 
 @findex tooltip-mode
   You can toggle the use of tooltips with the command @kbd{M-x
@@ -1164,11 +1164,41 @@ tooltip-mode}.  When Tooltip mode is disabled, the help 
text is
 displayed in the echo area instead.  To control the use of tooltips at
 startup, customize the variable @code{tooltip-mode}.
 
address@hidden tooltip-delay
-  The variables @code{tooltip-delay} specifies how long Emacs should
-wait before displaying a tooltip.  For additional customization
-options for displaying tooltips, use @kbd{M-x customize-group
address@hidden tooltip @key{RET}}.
+The following variables provide customization options for tooltip
+display:
+
address@hidden @code
address@hidden tooltip-delay
+This variable specifies how long Emacs should wait before displaying
+the first tooltip.  The value is in seconds.
+
address@hidden tooltip-short-delay
+This variable specifies how long Emacs should wait before displaying
+subsequent tooltips on different items, having already displayed the
+first tooltip.  The value is in seconds.
+
address@hidden tooltip-hide-delay
+The number of seconds since displaying a tooltip to hide it, if the
+mouse doesn't move.
+
address@hidden tooltip-x-offset
address@hidden tooltip-y-offset
+The X and Y offsets, in pixels, of the left top corner of the tooltip
+from the mouse pointer position.  Note that these are ignored if
address@hidden was customized to include,
+respectively, the @code{left} and @code{top} parameters.  The values
+of the offsets should be chosen so that the tooltip doesn't cover the
+mouse pointer's hot spot, or it might interfere with clicking the
+mouse.
+
address@hidden tooltip-frame-parameters
+The frame parameters used for displaying tooltips.  @xref{Frame
+Parameters,,, elisp, The Emacs Lisp Reference Manual}, and also
address@hidden,,, elisp, The Emacs Lisp Reference Manual}.
address@hidden vtable
+
+For additional customization options for displaying tooltips, use
address@hidden customize-group @key{RET} tooltip @key{RET}}.
 
 @vindex x-gtk-use-system-tooltips
   If Emacs is built with GTK+ support, it displays tooltips via GTK+,
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 1e45501..3cd1d4e 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -34,6 +34,7 @@ that Emacs presents to the user.
 * Character Display::   How Emacs displays individual characters.
 * Beeping::             Audible signal to the user.
 * Window Systems::      Which window system is being used.
+* Tooltips::            Tooltip display in Emacs.
 * Bidirectional Display:: Display of bidirectional scripts, such as
                              Arabic and Farsi.
 @end menu
@@ -7131,6 +7132,81 @@ indicator of Emacs capabilities on a given display type. 
 Instead, use
 @code{display-graphic-p} or any of the other @code{display-*-p}
 predicates described in @ref{Display Feature Testing}.
 
address@hidden Tooltips
address@hidden Tooltips
address@hidden tooltips
address@hidden are special frames (@pxref{Frames}) that are used to
+display helpful hints (a.k.a.@: ``tips'') related to the current
+position of the mouse pointer.  Emacs uses tooltips to display help
+strings about active portions of text (@pxref{Special Properties}) and
+about various UI elements, such as menu items (@pxref{Extended Menu
+Items}) and tool-bar buttons (@pxref{Tool Bar}).
+
address@hidden tooltip-mode
+Tooltip Mode is a minor mode that enables display of tooltips.
+Turning off this mode causes the tooltips be displayed in the echo
+area.  On text-mode (a.k.a.@: ``TTY'') frames, tooltips are always
+displayed in the echo area.
address@hidden defun
+
address@hidden x-gtk-use-system-tooltips
+When Emacs is built with GTK+ support, it by default displays tooltips
+using GTK+ functions, and the appearance of the tooltips is then
+controlled by GTK+ settings.  GTK+ tooltips can be disabled by
+changing the value of the variable @code{x-gtk-use-system-tooltips} to
address@hidden  The rest of this subsection describes how to control
+non-GTK+ tooltips, which are presented by Emacs itself.
+
+Since tooltips are special frames, they have their frame parameters
+(@pxref{Frame Parameters}).  Unlike other frames, the frame parameters
+for tooltips are stored in a special variable.
+
address@hidden tooltip-frame-parameters
+This customizable option holds the frame parameters used for
+displaying tooltips.  Any font and color parameters are ignored, and
+the corresponding attributes of the @code{tooltip} face are used
+instead.  If @code{left} or @code{top} parameters are included, they
+are used as absolute frame-relative coordinates where the tooltip
+should be shown.  (Mouse-relative position of the tooltip can be
+customized using the variables described in @ref{Tooltips,,, emacs,
+The GNU Emacs Manual}.)  Note that the @code{left} and @code{top}
+parameters, if present, override the values of mouse-relative offsets.
address@hidden defvar
+
address@hidden address@hidden face}
+The @code{tooltip} face determines the appearance of text shown in
+tooltips.  It should generally use a variable-pitch font of size that
+is preferably smaller than the default frame font.
+
address@hidden tooltip-help-tips
address@hidden tooltip-functions
+This abnormal hook is a list of functions to call when Emacs needs to
+display a tooltip.  Each function is called with a single argument
address@hidden which is a copy of the last mouse movement event.  If a
+function on this list actually displays the tooltip, it should return
address@hidden, and then the rest of the functions will not be
+called.  The default value of this variable is a single function
address@hidden
address@hidden defvar
+
+If you write your own function to be put on the
address@hidden list, you may need to know the buffer of the
+mouse event that triggered the tooltip display.  The following
+function provides that information.
+
address@hidden tooltip-event-buffer event
+This function returns the buffer over which @var{event} occurred.
+Call it with the argument of the function from
address@hidden to obtain the buffer whose text triggered the
+tooltip.  Note that the event might occur not over a buffer (e.g.,
+over the tool bar), in which case this function will return
address@hidden
address@hidden defun
+
+Other aspects of tooltip display are controlled by several
+customizable settings; see @ref{Tooltips,,, emacs, The GNU Emacs
+Manual}.
+
 @node Bidirectional Display
 @section Bidirectional Display
 @cindex bidirectional display
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 4c1541e..a3bff0b 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1380,6 +1380,7 @@ Emacs Display
 * Character Display::       How Emacs displays individual characters.
 * Beeping::                 Audible signal to the user.
 * Window Systems::          Which window system is being used.
+* Tooltips::                Tooltip display in Emacs.
 * Bidirectional Display::   Display of bidirectional scripts, such as
                               Arabic and Farsi.
 
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 55f0290..991b47d 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -3279,12 +3279,11 @@ or shorter, higher or lower, wider or narrow, or 
replaced with an image.
 
 @item help-echo
 @kindex help-echo @r{(text property)}
address@hidden tooltip
address@hidden tooltip for help strings
 @anchor{Text help-echo}
 If text has a string as its @code{help-echo} property, then when you
 move the mouse onto that text, Emacs displays that string in the echo
-area, or in the tooltip window (@pxref{Tooltips,,, emacs, The GNU Emacs
-Manual}).
+area, or in the tooltip window (@pxref{Tooltips}).
 
 If the value of the @code{help-echo} property is a function, that
 function is called with three arguments, @var{window}, @var{object} and
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index 5008db3..1fa4649 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -2664,11 +2664,6 @@ by typing @kbd{M-x ansi-color-for-comint-mode} in the 
Shell buffer, or
 by adding @code{(add-hook 'shell-mode-hook
 'ansi-color-for-comint-mode-on)} to your init file.
 
-In Emacs versions before 21.1, the @code{ansi-color} package is not
-included.  In that case, you need to unalias @code{ls} for interactive
-shells running in Emacs; this can be done by checking the @code{EMACS}
-variable in the environment.
-
 @node Fullscreen mode on MS-Windows
 @section How can I start Emacs in fullscreen mode on MS-Windows?
 @cindex Maximize frame
@@ -2757,11 +2752,9 @@ For @code{tcsh}, put this in your @file{.cshrc} (or 
@file{.tcshrc})
 file:
 
 @example
-if ($?EMACS) then
-    if ("$EMACS" =~ /*) then
-        if ($?tcsh) unset edit
-        stty nl
-    endif
+if ($?INSIDE_EMACS && $?tcsh)
+    unset edit
+    stty -icrnl -onlcr -echo susp ^Z
 endif
 @end example
 
@@ -2769,7 +2762,7 @@ Or put this in your @file{.emacs_tcsh} or 
@file{~/.emacs.d/init_tcsh.sh} file:
 
 @example
 unset edit
-stty nl
+stty -icrnl -onlcr -echo susp ^Z
 @end example
 
 Alternatively, use @code{csh} in your shell buffers instead of
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 75017af..d164d45 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2016-03-25.17}
+\def\texinfoversion{2016-03-29.15}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -1550,8 +1550,7 @@ output) for that.)}
     \fi
     \turnoffactive
     \makevalueexpandable
-    % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
-    % Therefore \txiescapepdf is not necessary.
+    \txiescapepdf\pdfdestname
     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
   }}
   %
@@ -1566,9 +1565,12 @@ output) for that.)}
     \fi
     {
       \turnoffactive
-      % In the case of XeTeX, xdvipdfmx converts strings to UTF-16.
-      % Therefore \txiescapepdf is not necessary.
-      \special{pdf:out [-] #2 << /Title (#1) /A << /S /GoTo /D 
(name\pdfoutlinedest) >> >> }%
+      \txiescapepdf\pdfoutlinedest
+      \edef\pdfoutlinetext{#1}%
+      \txiescapepdf\pdfoutlinetext
+      %
+      \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
+        << /S /GoTo /D (name\pdfoutlinedest) >> >> }%
     }
   }
   %
@@ -1624,6 +1626,20 @@ output) for that.)}
   % ``\special{pdf:dest ...}'' can not handle non-ASCII strings.
   % It fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
 %
+  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
+    \ifx\PP\D\let\nextsp\relax
+    \else\let\nextsp\skipspaces
+      \addtokens{\filename}{\PP}%
+      \advance\filenamelength by 1
+    \fi
+    \nextsp}
+  \def\getfilename#1{%
+    \filenamelength=0
+    % If we don't expand the argument now, \skipspaces will get
+    % snagged on things like "@value{foo}".
+    \edef\temp{#1}%
+    \expandafter\skipspaces\temp|\relax
+  }
   % make a live url in pdf output.
   \def\pdfurl#1{%
     \begingroup
@@ -8760,6 +8776,7 @@ end
   %
   % Make link in pdf output.
   \ifpdf
+    % For pdfTeX and LuaTeX
     {\indexnofonts
      \turnoffactive
      \makevalueexpandable
@@ -8786,6 +8803,47 @@ end
      \fi
     }%
     \setcolor{\linkcolor}%
+  \else
+    \ifx\XeTeXrevision\thisisundefined
+    \else
+      % For XeTeX
+      {\indexnofonts
+       \turnoffactive
+       \makevalueexpandable
+       % This expands tokens, so do it after making catcode changes, so _
+       % etc. don't get their TeX definitions.  This ignores all spaces in
+       % #4, including (wrongly) those in the middle of the filename.
+       \getfilename{#4}%
+       %
+       % This (wrongly) does not take account of leading or trailing
+       % spaces in #1, which should be ignored.
+       \iftxiuseunicodedestname
+         \def\pdfxrefdest{#1}% Pass through Unicode characters.
+       \else
+         \edef\pdfxrefdest{#1}% Replace Unicode characters to ASCII.
+       \fi
+       \ifx\pdfxrefdest\empty
+         \def\pdfxrefdest{Top}% no empty targets
+       \else
+         \txiescapepdf\pdfxrefdest  % escape PDF special chars
+       \fi
+       %
+       \leavevmode
+       \ifnum\filenamelength>0
+         % By the default settings,
+         % XeTeX (xdvipdfmx) replaces link destination names with integers.
+         % In this case, the replaced destination names of
+         % remote PDF cannot be known. In order to avoid replacement,
+         % you can use commandline option `-C 0x0010' for xdvipdfmx.
+         \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
+           << /S /GoToR /F (\the\filename.pdf) /D (name\pdfxrefdest) >> >>}%
+       \else
+         \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
+           << /S /GoTo /D (name\pdfxrefdest) >> >>}%
+       \fi
+      }%
+      \setcolor{\linkcolor}%
+    \fi
   \fi
   {%
     % Have to otherify everything special to allow the \csname to
diff --git a/etc/NEWS b/etc/NEWS
index 0152593..59f8d08 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1303,6 +1303,17 @@ See the 'vc-faces' customization group.
 the color range from 'vc-annotate-color-map' is applied to the
 background or to the foreground.
 
+---
+*** New options for customizing encoding of Git commit log messages.
+The new options `vc-git-commits-coding-system' and
+`vc-git-log-output-coding-system' allow to customize the encoding of
+the log messages sent to Git when committing, and the decoding of the
+log messages read from Git history commands.  Both default to UTF-8;
+if you customize them, make sure they are consistent with the Git
+config variables i18n.commitEncoding and i18n.logOutputEncoding.
+(`vc-git-commits-coding-system' existed previously, but was a
+variable, not a user option.)
+
 +++
 *** 'compare-windows' now compares text with the most recently selected window
 instead of the next window.  If you want the previous behavior of
@@ -1723,8 +1734,10 @@ symbol-function was changed not to signal 
'void-function' any more.
 *** As a consequence, the second arg of 'indirect-function' is now obsolete.
 
 +++
-** Although comint, term, and compile still set the EMACS variable,
-this is now considered deprecated and will be removed in a future release.
+** M-x shell and M-x compile no longer set the EMACS environment variable.
+This avoids clashing when other programs use the variable for other purposes.
+Although M-x term still sets EMACS for compatibility with Bash 4.3 and earlier,
+this is deprecated and will be phased out when Bash 4.4 or later takes over.
 Use the INSIDE_EMACS environment variable instead.
 
 ** 'C-up', 'C-down', 'C-left' and 'C-right' are now defined in term
@@ -2119,7 +2132,7 @@ function 'encode-time', which already accepted a simple 
time zone rule
 argument, has been extended to accept all the new forms.
 
 *** Incompatible change in the third argument of 'format-time-string'.
-Previously, any non-nil argument was interpeted as specifying Universal Time.
+Previously, any non-nil argument was interpreted as specifying Universal Time.
 This is no longer true; packages that want Universal Time should pass t
 as the third argument.
 
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index f61921a..2ccb771 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -459,11 +459,9 @@ smart.  It sees that the Shell uses terminal type 
'unknown' and turns
 on the flag to output ^M at the end of each line.  You can fix the
 problem by adding this to your .cshrc file:
 
-    if ($?EMACS) then
-        if ("$EMACS" =~ /*) then
-            unset edit
-            stty  -icrnl -onlcr -echo susp ^Z
-        endif
+    if ($?INSIDE_EMACS && $?tcsh)
+        unset edit
+        stty -icrnl -onlcr -echo susp ^Z
     endif
 
 *** Emacs startup on GNU/Linux systems (and possibly other systems) is slow.
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 0bb9ad4..cf65ec6 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -118,15 +118,10 @@
    picky compilers.  */
 
 #define _STDINT_MIN(signed, bits, zero) \
-  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
+  ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero))
 
 #define _STDINT_MAX(signed, bits, zero) \
-  ((signed) \
-   ? ~ _STDINT_MIN (signed, bits, zero) \
-   : /* The expression for the unsigned case.  The subtraction of (signed) \
-        is a nop in the unsigned case and avoids "signed integer overflow" \
-        warnings in the signed case.  */ \
-     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
+  (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
 
 #if !GNULIB_defined_stdint_types
 
diff --git a/lisp/ChangeLog.15 b/lisp/ChangeLog.15
index 88f5487..46fa01a 100644
--- a/lisp/ChangeLog.15
+++ b/lisp/ChangeLog.15
@@ -5820,7 +5820,7 @@
        * epa.el (epa-passphrase-callback-function): Say what we're
        querying the password for.
 
-       * ibuffer.el (ibuffer-visit-buffer): To mimick list-buffers
+       * ibuffer.el (ibuffer-visit-buffer): To mimic list-buffers
        behavior, don't bury the ibuffer buffer when visiting other buffers.
 
 2010-10-08  Chong Yidong  <address@hidden>
diff --git a/lisp/comint.el b/lisp/comint.el
index cb79c17..dcd4a5a 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -816,13 +816,6 @@ series of processes in the same Comint buffer.  The hook
                    (format "COLUMNS=%d" (window-width)))
            (list "TERM=emacs"
                  (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))
-
-         ;; This hack is for backward compatibility with Bash 4.3 and
-         ;; earlier.  It can break common uses of 'configure', so
-         ;; remove it once Bash 4.4 or later is common.
-         (unless (getenv "EMACS")
-           (list "EMACS=t"))
-
          (list (format "INSIDE_EMACS=%s,comint" emacs-version))
          process-environment))
        (default-directory
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index b4bb3b0..74aebc0 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -398,6 +398,9 @@ This will generate compile-time constants from BINDINGS."
        lisp-el-font-lock-keywords-1
        `( ;; Regexp negated char group.
          ("\\[\\(\\^\\)" 1 font-lock-negation-char-face prepend)
+         ;; Erroneous structures.
+         (,(concat "(" el-errs-re "\\_>")
+          (1 font-lock-warning-face))
          ;; Control structures.  Common Lisp forms.
          (lisp--el-match-keyword . 1)
          ;; Exit/Feature symbols as constants.
@@ -405,9 +408,6 @@ This will generate compile-time constants from BINDINGS."
                    "[ \t']*\\(" lisp-mode-symbol-regexp "\\)?")
            (1 font-lock-keyword-face)
            (2 font-lock-constant-face nil t))
-         ;; Erroneous structures.
-         (,(concat "(" el-errs-re "\\_>")
-          (1 font-lock-warning-face prepend))
          ;; Words inside \\[] tend to be for `substitute-command-keys'.
          (,(concat "\\\\\\\\\\[\\(" lisp-mode-symbol-regexp "\\)\\]")
           (1 font-lock-constant-face prepend))
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 4da66d2..d5d35d7 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -146,6 +146,7 @@
 (eval-when-compile (require 'subr-x))
 (eval-when-compile (require 'cl-lib))
 (eval-when-compile (require 'epg))      ;For setf accessors.
+(require 'seq)
 
 (require 'tabulated-list)
 (require 'macroexp)
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 0da6be7..9c2cae1 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -256,6 +256,23 @@ disable `text-scale-mode' as necessary)."
                                                text-scale-mode-amount))))
   (force-window-update (current-buffer)))
 
+(defun text-scale-min-amount ()
+  "Return the minimum amount of text-scaling we allow."
+  ;; When the resulting pixel-height of characters will become smaller
+  ;; than 1 pixel, we can expect trouble from the display engine.
+  ;; E.g., it requires that the character glyph's ascent is
+  ;; non-negative.
+  (log (/ 1.0 (frame-char-height)) text-scale-mode-step))
+
+(defun text-scale-max-amount ()
+  "Return the maximum amount of text-scaling we allow."
+  ;; The display engine uses a 16-bit short for pixel-width of
+  ;; characters, thus the 0xffff limitation.  It also makes no sense
+  ;; to have characters wider than the display.
+  (log (/ (min (display-pixel-width) #xffff)
+          (frame-char-width))
+       text-scale-mode-step))
+
 ;;;###autoload
 (defun text-scale-set (level)
   "Set the scale factor of the default face in the current buffer to LEVEL.
@@ -266,7 +283,8 @@ Each step scales the height of the default face by the 
variable
 `text-scale-mode-step' (a negative number decreases the height by
 the same amount)."
   (interactive "p")
-  (setq text-scale-mode-amount level)
+  (setq text-scale-mode-amount
+        (max (min level (text-scale-max-amount)) (text-scale-min-amount)))
   (text-scale-mode (if (zerop text-scale-mode-amount) -1 1)))
 
 ;;;###autoload
@@ -279,8 +297,13 @@ Each step scales the height of the default face by the 
variable
 height by the same amount).  As a special case, an argument of 0
 will remove any scaling currently active."
   (interactive "p")
-  (setq text-scale-mode-amount
-       (if (= inc 0) 0 (+ (if text-scale-mode text-scale-mode-amount 0) inc)))
+  (let* ((current-value (if text-scale-mode text-scale-mode-amount 0))
+         (new-value (if (= inc 0) 0 (+ current-value inc))))
+    (if (or (> new-value (text-scale-max-amount))
+            (< new-value (text-scale-min-amount)))
+        (user-error "Cannot %s the default face height more than it already is"
+                    (if (> inc 0) "increase" "decrease")))
+    (setq text-scale-mode-amount new-value))
   (text-scale-mode (if (zerop text-scale-mode-amount) -1 1)))
 
 ;;;###autoload
diff --git a/lisp/ffap.el b/lisp/ffap.el
index abf979f..7013e6e 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1966,7 +1966,9 @@ Only intended for interactive use."
 (defun ffap-guess-file-name-at-point ()
   "Try to get a file name at point.
 This hook is intended to be put in `file-name-at-point-functions'."
-  (let ((guess (ffap-guesser)))
+  ;; ffap-guesser can signal an error, and we don't want that when,
+  ;; e.g., the user types M-n at the "C-x C-f" prompt.
+  (let ((guess (ignore-errors (ffap-guesser))))
     (when (stringp guess)
       (let ((url (ffap-url-p guess)))
        (or url
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 2667aaf..b2293a2 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -542,7 +542,6 @@ as given in your `~/.profile'."
 (defcustom tramp-remote-process-environment
   `("TMOUT=0" "LC_CTYPE=''"
     ,(format "TERM=%s" tramp-terminal-type)
-    "EMACS=t" ;; Deprecated; remove this line once Bash 4.4-or-later is common.
     ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version)
     "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat"
     "autocorrect=" "correct=")
diff --git a/lisp/play/studly.el b/lisp/play/studly.el
index f6aae45..ff1bf03 100644
--- a/lisp/play/studly.el
+++ b/lisp/play/studly.el
@@ -25,10 +25,10 @@
     (setq begin (point))
     (while (and (<= (point) end)
                (not (looking-at "\\W*\\'")))
-      (forward-word 1)
-      (backward-word 1)
+      (forward-word-strictly 1)
+      (backward-word-strictly 1)
       (setq begin (max (point) begin))
-      (forward-word 1)
+      (forward-word-strictly 1)
       (let ((offset 0)
            (word-end (min (point) end))
            c)
@@ -55,7 +55,7 @@
   "Studlify-case the current word, or COUNT words if given an argument."
   (interactive "*p")
   (let ((begin (point)) end rb re)
-    (forward-word count)
+    (forward-word-strictly count)
     (setq end (point))
     (setq rb (min begin end) re (max begin end))
     (studlify-region rb re)))
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 0b15a28..b7ab408 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1702,14 +1702,6 @@ Returns the compilation buffer created."
                (list "TERM=emacs"
                      (format "TERMCAP=emacs:co#%d:tc=unknown:"
                              (window-width))))
-
-             ;; Set the EMACS variable, but
-             ;; don't override users' setting of $EMACS.
-             ;; Remove this hack once Bash 4.4-or-later is common,
-             ;; since it can break 'configure'.
-             (unless (getenv "EMACS")
-               (list "EMACS=t"))
-
              (list (format "INSIDE_EMACS=%s,compile" emacs-version))
              (copy-sequence process-environment))))
        (set (make-local-variable 'compilation-arguments)
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 2b44b58..a478c95 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -427,21 +427,34 @@ Notice that using \\[next-error] or 
\\[compile-goto-error] modifies
 This gets tacked on the end of the generated expressions.")
 
 ;;;###autoload
-(defvar grep-program (purecopy "grep")
+(defcustom grep-program (purecopy "grep")
   "The default grep program for `grep-command' and `grep-find-command'.
-This variable's value takes effect when `grep-compute-defaults' is called.")
+This variable's value takes effect when `grep-compute-defaults' is called."
+  :type 'string
+  :version "25.1"
+  :group 'grep)
 
 ;;;###autoload
-(defvar find-program (purecopy "find")
+(defcustom grep-find-program (purecopy "find")
   "The default find program.
 This is used by commands like `grep-find-command', `find-dired'
-and others.")
+and others."
+  :type 'string
+  :version "25.1"
+  :group 'grep)
+
+(define-obsolete-variable-alias 'find-program 'grep-find-program "25.1")
 
 ;;;###autoload
-(defvar xargs-program (purecopy "xargs")
+(defcustom grep-xargs-program (purecopy "xargs")
   "The default xargs program for `grep-find-command'.
 See `grep-find-use-xargs'.
-This variable's value takes effect when `grep-compute-defaults' is called.")
+This variable's value takes effect when `grep-compute-defaults' is called."
+  :type 'string
+  :version "25.1"
+  :group 'grep)
+
+(define-obsolete-variable-alias 'xargs-program 'grep-xargs-program "25.1")
 
 ;;;###autoload
 (defvar grep-find-use-xargs nil
@@ -611,13 +624,14 @@ This function is called from `compilation-filter-hook'."
        (unless grep-find-use-xargs
          (setq grep-find-use-xargs
                (cond
-                ((grep-probe find-program
+                ((grep-probe grep-find-program
                              `(nil nil nil ,null-device "-exec" "echo"
                                    "{}" "+"))
                  'exec-plus)
                 ((and
-                  (grep-probe find-program `(nil nil nil ,null-device 
"-print0"))
-                  (grep-probe xargs-program `(nil nil nil "-0" "echo")))
+                  (grep-probe grep-find-program
+                               `(nil nil nil ,null-device "-print0"))
+                  (grep-probe grep-xargs-program `(nil nil nil "-0" "echo")))
                  'gnu)
                 (t
                  'exec))))
@@ -628,10 +642,11 @@ This function is called from `compilation-filter-hook'."
                       ;; after the pipe symbol be quoted if they use
                       ;; forward slashes as directory separators.
                       (format "%s . -type f -print0 | \"%s\" -0 %s"
-                              find-program xargs-program grep-command))
+                              grep-find-program grep-xargs-program
+                               grep-command))
                      ((memq grep-find-use-xargs '(exec exec-plus))
                       (let ((cmd0 (format "%s . -type f -exec %s"
-                                          find-program grep-command))
+                                          grep-find-program grep-command))
                             (null (if grep-use-null-device
                                       (format "%s " null-device)
                                     "")))
@@ -643,7 +658,8 @@ This function is called from `compilation-filter-hook'."
                          (1+ (length cmd0)))))
                      (t
                       (format "%s . -type f -print | \"%s\" %s"
-                              find-program xargs-program grep-command)))))
+                              grep-find-program grep-xargs-program
+                               grep-command)))))
        (unless grep-find-template
          (setq grep-find-template
                (let ((gcmd (format "%s <C> %s <R>"
@@ -653,17 +669,17 @@ This function is called from `compilation-filter-hook'."
                              "")))
                  (cond ((eq grep-find-use-xargs 'gnu)
                         (format "%s <D> <X> -type f <F> -print0 | \"%s\" -0 %s"
-                                find-program xargs-program gcmd))
+                                grep-find-program grep-xargs-program gcmd))
                        ((eq grep-find-use-xargs 'exec)
                         (format "%s <D> <X> -type f <F> -exec %s {} %s%s"
-                                find-program gcmd null
+                                grep-find-program gcmd null
                                 (shell-quote-argument ";")))
                        ((eq grep-find-use-xargs 'exec-plus)
                         (format "%s <D> <X> -type f <F> -exec %s %s{} +"
-                                find-program gcmd null))
+                                grep-find-program gcmd null))
                        (t
                         (format "%s <D> <X> -type f <F> -print | \"%s\" %s"
-                                find-program xargs-program gcmd))))))))
+                                grep-find-program grep-xargs-program 
gcmd))))))))
 
     ;; Save defaults for this host.
     (setq grep-host-defaults-alist
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 9ee405b..212a5fa 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -1374,8 +1374,20 @@ the variable `prolog-prompt-regexp'."
       ()
     (with-current-buffer (get-buffer-create "*prolog*")
       (prolog-inferior-mode)
-      (apply 'make-comint-in-buffer "prolog" (current-buffer)
-             (prolog-program-name) nil (prolog-program-switches))
+
+      ;; The "INFERIOR=yes" hack is for SWI-Prolog 7.2.3 and earlier,
+      ;; which assumes it is running under Emacs if either INFERIOR=yes or
+      ;; if EMACS is set to a nonempty value.  The EMACS setting is
+      ;; obsolescent, so set INFERIOR.  Newer versions of SWI-Prolog should
+      ;; know about INSIDE_EMACS (which replaced EMACS) and should not need
+      ;; this hack.
+      (let ((process-environment
+            (if (getenv "INFERIOR")
+                process-environment
+              (cons "INFERIOR=yes" process-environment))))
+       (apply 'make-comint-in-buffer "prolog" (current-buffer)
+              (prolog-program-name) nil (prolog-program-switches)))
+
       (unless prolog-system
         ;; Setup auto-detection.
         (setq-local
diff --git a/lisp/rect.el b/lisp/rect.el
index 73790f2..685213a 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -398,8 +398,9 @@ With a prefix (or a FILL) argument, also fill too short 
lines."
 (defun rectangle--space-to (col)
   (propertize " " 'display `(space :align-to ,col)))
 
-(defface rectangle-preview-face '((t :inherit region))
-  "The face to use for the `string-rectangle' preview.")
+(defface rectangle-preview '((t :inherit region))
+  "The face to use for the `string-rectangle' preview."
+  :version "25.1")
 
 (defcustom rectangle-preview t
   "If non-nil, `string-rectangle' will show an-the-fly preview."
diff --git a/lisp/subr.el b/lisp/subr.el
index a6d6fa4..2dfd96e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2087,6 +2087,10 @@ some sort of escape sequence, the ambiguity is resolved 
via `read-key-delay'."
                 (aref keys 1)
               key)))
       (cancel-timer timer)
+      ;; For some reason, `read-key(-sequence)' leaves the prompt in the echo
+      ;; area, whereas `read-event' seems to empty it just before returning
+      ;; (bug#22714).  So, let's mimic the behavior of `read-event'.
+      (message nil)
       (use-global-map old-global-map))))
 
 (defvar read-passwd-map
@@ -4107,7 +4111,8 @@ This function makes or adds to an entry on 
`after-load-alist'."
 (defmacro with-eval-after-load (file &rest body)
   "Execute BODY after FILE is loaded.
 FILE is normally a feature name, but it can also be a file name,
-in case that file does not provide any feature."
+in case that file does not provide any feature.  See `eval-after-load'
+for more details about the different forms of FILE and their semantics."
   (declare (indent 1) (debug t))
   `(eval-after-load ,file (lambda () ,@body)))
 
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index f2466d8..2fd84f1 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -165,8 +165,20 @@ matching the resulting Git log output, and KEYWORDS is a 
list of
   :type '(list string string (repeat sexp))
   :version "24.1")
 
-(defvar vc-git-commits-coding-system 'utf-8
-  "Default coding system for git commits.")
+(defcustom vc-git-commits-coding-system 'utf-8
+  "Default coding system for sending commit log messages to Git.
+
+Should be consistent with the Git config value i18n.commitEncoding,
+and should also be consistent with `locale-coding-system'."
+  :type '(coding-system :tag "Coding system to encode Git commit logs")
+  :version "25.1")
+
+(defcustom vc-git-log-output-coding-system 'utf-8
+  "Default coding system for receiving log output from Git.
+
+Should be consistent with the Git config value i18n.logOutputEncoding."
+  :type '(coding-system :tag "Coding system to decode Git log output")
+  :version "25.1")
 
 ;; History of Git commands.
 (defvar vc-git-history nil)
@@ -680,21 +692,43 @@ It is based on `log-edit-mode', and has Git-specific 
extensions.")
          (default-directory (expand-file-name root))
          (only (or (cdr files)
                    (not (equal root (abbreviate-file-name file1)))))
-         (coding-system-for-write vc-git-commits-coding-system))
+         (pcsw coding-system-for-write)
+         (coding-system-for-write
+          ;; On MS-Windows, we must encode command-line arguments in
+          ;; the system codepage.
+          (if (eq system-type 'windows-nt)
+              locale-coding-system
+            (or coding-system-for-write vc-git-commits-coding-system)))
+         (msg-file
+          ;; On MS-Windows, pass the commit log message through a
+          ;; file, to work around the limitation that command-line
+          ;; arguments must be in the system codepage, and therefore
+          ;; might not support the non-ASCII characters in the log
+          ;; message.
+          (if (eq system-type 'windows-nt) (make-temp-file "git-msg"))))
     (cl-flet ((boolean-arg-fn
                (argument)
                (lambda (value) (when (equal value "yes") (list argument)))))
       ;; When operating on the whole tree, better pass "-a" than ".", since "."
       ;; fails when we're committing a merge.
       (apply 'vc-git-command nil 0 (if only files)
-             (nconc (list "commit" "-m")
-                    (log-edit-extract-headers
-                     `(("Author" . "--author")
-                       ("Date" . "--date")
-                       ("Amend" . ,(boolean-arg-fn "--amend"))
-                       ("Sign-Off" . ,(boolean-arg-fn "--signoff")))
-                     comment)
-                   (if only (list "--only" "--") '("-a")))))))
+             (nconc (if msg-file (list "commit" "-F" msg-file)
+                      (list "commit" "-m"))
+                    (let ((args
+                           (log-edit-extract-headers
+                            `(("Author" . "--author")
+                              ("Date" . "--date")
+                              ("Amend" . ,(boolean-arg-fn "--amend"))
+                              ("Sign-Off" . ,(boolean-arg-fn "--signoff")))
+                            comment)))
+                      (when msg-file
+                        (let ((coding-system-for-write
+                               (or pcsw vc-git-commits-coding-system)))
+                          (write-region (car args) nil msg-file))
+                        (setq args (cdr args)))
+                      args)
+                   (if only (list "--only" "--") '("-a")))))
+    (if (and msg-file (file-exists-p msg-file)) (delete-file msg-file))))
 
 (defun vc-git-find-revision (file rev buffer)
   (let* (process-file-side-effects
@@ -854,7 +888,7 @@ If SHORTLOG is non-nil, use a short format based on 
`vc-git-root-log-format'.
 If START-REVISION is non-nil, it is the newest revision to show.
 If LIMIT is non-nil, show no more than this many entries."
   (let ((coding-system-for-read
-         (or coding-system-for-read vc-git-commits-coding-system)))
+         (or coding-system-for-read vc-git-log-output-coding-system)))
     ;; `vc-do-command' creates the buffer, but we need it before running
     ;; the command.
     (vc-setup-buffer buffer)
@@ -1389,7 +1423,7 @@ This command shares argument histories with \\[rgrep] and 
\\[grep]."
 The difference to vc-do-command is that this function always invokes
 `vc-git-program'."
   (let ((coding-system-for-read
-         (or coding-system-for-read vc-git-commits-coding-system))
+         (or coding-system-for-read vc-git-log-output-coding-system))
        (coding-system-for-write
          (or coding-system-for-write vc-git-commits-coding-system)))
     (apply 'vc-do-command (or buffer "*vc*") okstatus vc-git-program
@@ -1414,8 +1448,10 @@ The difference to vc-do-command is that this function 
always invokes
   ;; directories.  We enable `inhibit-null-byte-detection', otherwise
   ;; Tramp's eol conversion might be confused.
   (let ((inhibit-null-byte-detection t)
-       (coding-system-for-read vc-git-commits-coding-system)
-       (coding-system-for-write vc-git-commits-coding-system)
+       (coding-system-for-read
+         (or coding-system-for-read vc-git-log-output-coding-system))
+       (coding-system-for-write
+         (or coding-system-for-write vc-git-commits-coding-system))
        (process-environment (cons "PAGER=" process-environment)))
     (apply 'process-file vc-git-program nil buffer nil command args)))
 
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 97ccec8..4c0161d 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -40,7 +40,7 @@
   :group 'mode-line
   :version "25.1")
 
-(defface vc-state-base-face
+(defface vc-state-base
   '((default))
   "Base face for VC state indicator."
   :group 'vc-faces
@@ -48,49 +48,49 @@
   :version "25.1")
 
 (defface vc-up-to-date-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file is up to date."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-needs-update-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file needs update."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-locked-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file locked."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-locally-added-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file is locally added."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-conflict-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file contains merge conflicts."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-removed-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file was removed from the VC system."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-missing-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file is missing from the file system."
   :version "25.1"
   :group 'vc-faces)
 
 (defface vc-edited-state
-  '((default :inherit vc-state-base-face))
+  '((default :inherit vc-state-base))
   "Face for VC modeline state when the file is edited."
   :version "25.1"
   :group 'vc-faces)
diff --git a/src/ChangeLog.12 b/src/ChangeLog.12
index 3045ecd..b2df482 100644
--- a/src/ChangeLog.12
+++ b/src/ChangeLog.12
@@ -2895,7 +2895,7 @@
        (wait_reading_process_output, init_process_emacs):
        Assume O_NONBLOCK.
        (wait_reading_process_output): Put in a special case for WINDOWSNT
-       to mimick the older behavior where it had O_NDELAY but not O_NONBLOCK.
+       to mimic the older behavior where it had O_NDELAY but not O_NONBLOCK.
        It's not clear this is needed, but it's a more-conservative change.
        (create_process): Assume FD_CLOEXEC.
        (create_process, create_pty): Assume O_NOCTTY.
diff --git a/src/nsterm.m b/src/nsterm.m
index 4048ac4..34c5395 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -596,8 +596,15 @@ ns_init_locale (void)
 
   @try
     {
+      /* It seems OS X should probably use UTF-8 everywhere.
+         'localeIdentifier' does not specify the encoding, and I can't
+         find any way to get the OS to tell us which encoding to use,
+         so hard-code '.UTF-8'. */
+      NSString *localeID = [NSString stringWithFormat:@"address@hidden",
+                                     [locale localeIdentifier]];
+
       /* Set LANG to locale, but not if LANG is already set. */
-      setenv("LANG", [[locale localeIdentifier] UTF8String], 0);
+      setenv("LANG", [localeID UTF8String], 0);
     }
   @catch (NSException *e)
     {
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 827eda5..bdacc8b 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -103,9 +103,11 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include <fcntl.h>
 #include <stdarg.h>
+#include <stdint.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <mach/mach.h>
+#include <mach/vm_map.h>
 #include <mach-o/loader.h>
 #include <mach-o/reloc.h>
 #ifdef HAVE_MALLOC_MALLOC_H
@@ -217,10 +219,27 @@ unexec_read (void *dest, size_t n)
 static int
 unexec_write (off_t dest, const void *src, size_t count)
 {
+  task_t task = mach_task_self();
+  if (task == MACH_PORT_NULL || task == MACH_PORT_DEAD)
+    return false;
+
   if (lseek (outfd, dest, SEEK_SET) != dest)
     return 0;
 
-  return write (outfd, src, count) == count;
+  /* We use the Mach virtual memory API to read our process memory
+     because using src directly would be undefined behavior and fails
+     under Address Sanitizer.  */
+  bool success = false;
+  vm_offset_t data;
+  mach_msg_type_number_t data_count;
+  if (vm_read (task, (uintptr_t) src, count, &data, &data_count)
+      == KERN_SUCCESS)
+    {
+      success =
+        write (outfd, (const void *) (uintptr_t) data, data_count) == count;
+      vm_deallocate (task, data, data_count);
+    }
+  return success;
 }
 
 /* Write COUNT bytes of zeros to outfd starting at offset DEST.
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 296b1cc..a7ec8e0 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -545,7 +545,7 @@ syms_of_xsmfns (void)
 Changing the value does not change the session id used by Emacs.
 The value is nil if no session manager is running.
 See also `x-session-previous-id', `emacs-save-session-functions',
-`emacs-session-save' and `emacs-session-restore'." */);
+`emacs-session-save' and `emacs-session-restore'.  */);
   Vx_session_id = Qnil;
 
   DEFVAR_LISP ("x-session-previous-id", Vx_session_previous_id,
@@ -568,7 +568,7 @@ The session id Emacs has while it is running is in the 
variable
 same, depending on how the session manager works.
 
 See also `emacs-save-session-functions', `emacs-session-save' and
-`emacs-session-restore'." */);
+`emacs-session-restore'.  */);
   Vx_session_previous_id = Qnil;
 
   defsubr (&Shandle_save_session);
diff --git a/src/xwidget.c b/src/xwidget.c
index 8ff4c23..7e96307 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -578,24 +578,22 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
      other time to know things like window placement etc.  */
   xv = xwidget_init_view (xww, s, x, y);
 
-  /* Calculate clipping, which is used for all manner of onscreen
-     xwidget views.  Each widget border can get clipped by other emacs
-     objects so there are four clipping variables.  */
-  clip_right =
-    min (xww->width,
-         WINDOW_RIGHT_EDGE_X (s->w) - x -
-         WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w) -
-         WINDOW_RIGHT_FRINGE_WIDTH (s->w));
-  clip_left =
-    max (0,
-         WINDOW_LEFT_EDGE_X (s->w) - x +
-         WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w) +
-         WINDOW_LEFT_FRINGE_WIDTH (s->w));
-
-  clip_bottom =
-    min (xww->height,
-         WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y);
-  clip_top = max (0, WINDOW_TOP_EDGE_Y (s->w) - y);
+  int text_area_x, text_area_y, text_area_width, text_area_height;
+
+  window_box (s->w,
+              ANY_AREA,
+              &text_area_x,
+              &text_area_y,
+              &text_area_width,
+              &text_area_height);
+  clip_right = min (xww->width,
+                    text_area_width);
+  clip_left = max (0,
+                   text_area_x);
+
+  clip_bottom = min (xww->height,
+                     text_area_height);
+  clip_top = max (0, text_area_y);
 
   /* We are concerned with movement of the onscreen area.  The area
      might sit still when the widget actually moves.  This happens



reply via email to

[Prev in Thread] Current Thread [Next in Thread]