aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2013-12-09 19:20:34 +0200
committerEli Zaretskii2013-12-09 19:20:34 +0200
commitcc24ef09f8c050808f9f4989e49122b206e8c934 (patch)
tree578b29e1c9dd276a965e7b2559f8b09c21df9a83
parent439b1ae89e7c0660ef0a8fa540b12977e38dedf8 (diff)
parentad8a47b89fc3c5a3302255f318b1ed805838cf72 (diff)
downloademacs-cc24ef09f8c050808f9f4989e49122b206e8c934.tar.gz
emacs-cc24ef09f8c050808f9f4989e49122b206e8c934.zip
Merge from trunk.
-rw-r--r--ChangeLog35
-rw-r--r--configure.ac24
-rw-r--r--doc/emacs/ChangeLog4
-rw-r--r--doc/emacs/msdog.texi2
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/display.texi4
-rw-r--r--doc/lispref/processes.texi2
-rw-r--r--doc/lispref/windows.texi2
-rw-r--r--doc/misc/ChangeLog4
-rw-r--r--doc/misc/dbus.texi2
-rw-r--r--etc/NEWS11
-rw-r--r--lib/gl_openssl.h116
-rw-r--r--lib/gnulib.mk17
-rw-r--r--lib/md5.c7
-rw-r--r--lib/md5.h20
-rw-r--r--lib/sha1.c7
-rw-r--r--lib/sha1.h21
-rw-r--r--lib/sha256.c7
-rw-r--r--lib/sha256.h30
-rw-r--r--lib/sha512.c7
-rw-r--r--lib/sha512.h31
-rw-r--r--lisp/ChangeLog145
-rw-r--r--lisp/ChangeLog.102
-rw-r--r--lisp/autorevert.el10
-rw-r--r--lisp/delsel.el10
-rw-r--r--lisp/emacs-lisp/debug.el2
-rw-r--r--lisp/emacs-lisp/helpers.el2
-rw-r--r--lisp/emulation/cua-base.el150
-rw-r--r--lisp/emulation/cua-gmrk.el1
-rw-r--r--lisp/emulation/cua-rect.el72
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/gnus-msg.el8
-rw-r--r--lisp/help-fns.el49
-rw-r--r--lisp/menu-bar.el12
-rw-r--r--lisp/org/ox-ascii.el2
-rw-r--r--lisp/progmodes/flymake.el664
-rw-r--r--lisp/progmodes/js.el108
-rw-r--r--lisp/progmodes/ruby-mode.el40
-rw-r--r--lisp/rect.el134
-rw-r--r--lisp/register.el18
-rw-r--r--lisp/subr.el1
-rw-r--r--m4/absolute-header.m4102
-rw-r--r--m4/gl-openssl.m448
-rw-r--r--m4/gnulib-comp.m44
-rw-r--r--m4/include_next.m453
-rw-r--r--m4/md5.m46
-rw-r--r--m4/sha1.m46
-rw-r--r--m4/sha256.m46
-rw-r--r--m4/sha512.m46
-rw-r--r--src/ChangeLog141
-rw-r--r--src/ChangeLog.34
-rw-r--r--src/Makefile.in2
-rw-r--r--src/alloc.c5
-rw-r--r--src/emacs.c5
-rw-r--r--src/eval.c2
-rw-r--r--src/frame.c4
-rw-r--r--src/frame.h13
-rw-r--r--src/gtkutil.c4
-rw-r--r--src/keyboard.c10
-rw-r--r--src/nsterm.h1
-rw-r--r--src/nsterm.m25
-rw-r--r--src/w32term.c8
-rw-r--r--src/window.c1
-rw-r--r--src/xmenu.c2
-rw-r--r--src/xterm.c3
-rw-r--r--src/xterm.h2
-rw-r--r--test/ChangeLog4
-rw-r--r--test/indent/js.js49
-rw-r--r--test/indent/ruby.rb3
69 files changed, 1375 insertions, 938 deletions
diff --git a/ChangeLog b/ChangeLog
index 6183719e98c..9e47a2a4d07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
12013-12-08 Eli Zaretskii <eliz@gnu.org>
2
3 * configure.ac (HAVE_RSVG) [mingw32]: Don't link against librsvg
4 statically.
5
62013-12-08 Paul Eggert <eggert@cs.ucla.edu>
7
8 * configure.ac: Simplify supression of GTK deprecation warning.
9 Move -DGDK_DISABLE_DEPRECATION_WARNINGS out of the command line
10 and into config.h, to shorten the command line when doing 'make'.
11 Don't AC_SUBST GTK_CFLAGS, as this is not needed.
12
13 Use libcrypto's checksum implementations if available, for speed.
14 On commonly used platform libcrypto uses architecture-specific
15 assembly code, which is significantly faster than the C code we
16 were using. See Pádraig Brady's note in
17 <http://lists.gnu.org/archive/html/bug-gnulib/2013-12/msg00000.html>.
18 Merge from gnulib, incorporating:
19 2013-12-07 md5, sha1, sha256, sha512: add gl_SET_CRYPTO_CHECK_DEFAULT
20 2013-12-07 md5, sha1, sha256, sha512: add 'auto', and set-default method
21 2013-12-04 include_next: minimize code duplication
22 2013-12-03 md5, sha1, sha256, sha512: support mandating use of openssl
23 2013-12-02 md5, sha1, sha256, sha512: use openssl routines if available
24 * configure.ac (--without-all): Set with_openssl_default too.
25 Use gl_SET_CRYPTO_CHECK_DEFAULT to default to 'auto'.
26 (HAVE_LIB_CRYPTO): New var.
27 Say whether Emacs is configured to use a crypto library.
28 * lib/gl_openssl.h, m4/absolute-header.m4, m4/gl-openssl.m4:
29 New files, copied from gnulib.
30 * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
31 * lib/md5.c, lib/md5.h, lib/sha1.c, lib/sha1.h:
32 * lib/sha256.c, lib/sha256.h, lib/sha512.c, lib/sha512.h:
33 * m4/include_next.m4, m4/md5.m4, m4/sha1.m4, m4/sha256.m4, m4/sha512.m4:
34 Update from gnulib.
35
12013-12-01 Dmitry Gutov <dgutov@yandex.ru> 362013-12-01 Dmitry Gutov <dgutov@yandex.ru>
2 37
3 * .dir-locals.el (log-edit-move): Add the "Author: " header. 38 * .dir-locals.el (log-edit-move): Add the "Author: " header.
diff --git a/configure.ac b/configure.ac
index 46ddb43635c..1f99a658cec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,8 +94,9 @@ AC_ARG_WITH(all,
94[AS_HELP_STRING([--without-all], 94[AS_HELP_STRING([--without-all],
95 [omit almost all features and build 95 [omit almost all features and build
96 small executable with minimal dependencies])], 96 small executable with minimal dependencies])],
97 with_features=$withval, 97 [with_features=$withval
98 with_features=yes) 98 with_openssl_default=$withval],
99 [with_features=yes])
99 100
100dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING) 101dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
101dnl Create a new --with option that defaults to being disabled. 102dnl Create a new --with option that defaults to being disabled.
@@ -2135,6 +2136,10 @@ if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${opsys}" =
2135 if test $HAVE_RSVG = yes; then 2136 if test $HAVE_RSVG = yes; then
2136 AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.]) 2137 AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
2137 CFLAGS="$CFLAGS $RSVG_CFLAGS" 2138 CFLAGS="$CFLAGS $RSVG_CFLAGS"
2139 # Windows loads librsvg dynamically
2140 if test "${opsys}" = "mingw32"; then
2141 RSVG_LIBS=
2142 fi
2138 LIBS="$RSVG_LIBS $LIBS" 2143 LIBS="$RSVG_LIBS $LIBS"
2139 fi 2144 fi
2140 fi 2145 fi
@@ -2184,8 +2189,10 @@ if test "${opsys}" != "mingw32"; then
2184 gtk_term_header=gtkutil.h 2189 gtk_term_header=gtkutil.h
2185 USE_GTK_TOOLKIT="GTK3" 2190 USE_GTK_TOOLKIT="GTK3"
2186 if test "x$ac_enable_gtk_deprecation_warnings" = x; then 2191 if test "x$ac_enable_gtk_deprecation_warnings" = x; then
2187 GTK_CFLAGS="$GTK_CFLAGS -DGDK_DISABLE_DEPRECATION_WARNINGS" 2192 AC_DEFINE([GDK_DISABLE_DEPRECATION_WARNINGS], [1],
2188 GTK_CFLAGS="$GTK_CFLAGS -DGLIB_DISABLE_DEPRECATION_WARNINGS" 2193 [Define to 1 to disable GTK+/GDK deprecation warnings.])
2194 AC_DEFINE([GLIB_DISABLE_DEPRECATION_WARNINGS], [1],
2195 [Define to 1 to disable Glib deprecation warnings.])
2189 fi 2196 fi
2190 else 2197 else
2191 check_gtk2=yes 2198 check_gtk2=yes
@@ -2211,7 +2218,6 @@ fi
2211 2218
2212if test x"$pkg_check_gtk" = xyes; then 2219if test x"$pkg_check_gtk" = xyes; then
2213 2220
2214 AC_SUBST(GTK_CFLAGS)
2215 AC_SUBST(GTK_LIBS) 2221 AC_SUBST(GTK_LIBS)
2216 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS" 2222 C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
2217 CFLAGS="$CFLAGS $GTK_CFLAGS" 2223 CFLAGS="$CFLAGS $GTK_CFLAGS"
@@ -4691,6 +4697,7 @@ CFLAGS=$pre_PKG_CONFIG_CFLAGS
4691LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS" 4697LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
4692gl_ASSERT_NO_GNULIB_POSIXCHECK 4698gl_ASSERT_NO_GNULIB_POSIXCHECK
4693gl_ASSERT_NO_GNULIB_TESTS 4699gl_ASSERT_NO_GNULIB_TESTS
4700gl_SET_CRYPTO_CHECK_DEFAULT([auto])
4694gl_INIT 4701gl_INIT
4695CFLAGS=$SAVE_CFLAGS 4702CFLAGS=$SAVE_CFLAGS
4696LIBS=$SAVE_LIBS 4703LIBS=$SAVE_LIBS
@@ -4842,6 +4849,12 @@ else
4842 acl_summary=no 4849 acl_summary=no
4843fi 4850fi
4844 4851
4852if test -n "$LIB_CRYPTO"; then
4853 HAVE_LIB_CRYPTO=yes
4854else
4855 HAVE_LIB_CRYPTO=no
4856fi
4857
4845echo " 4858echo "
4846Configured for \`${canonical}'. 4859Configured for \`${canonical}'.
4847 4860
@@ -4881,6 +4894,7 @@ echo " Does Emacs use -lgconf? ${HAVE_GCONF}"
4881echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}" 4894echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}"
4882echo " Does Emacs use a file notification library? ${NOTIFY_SUMMARY}" 4895echo " Does Emacs use a file notification library? ${NOTIFY_SUMMARY}"
4883echo " Does Emacs use access control lists? ${acl_summary}" 4896echo " Does Emacs use access control lists? ${acl_summary}"
4897echo " Does Emacs use a crypto library? ${HAVE_LIB_CRYPTO} $LIB_CRYPTO"
4884echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}" 4898echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}"
4885echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}" 4899echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}"
4886echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}" 4900echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}"
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index cf37ab25199..5da37003152 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,7 @@
12013-12-08 Juanma Barranquero <lekktu@gmail.com>
2
3 * msdog.texi (Windows Keyboard): Fix typo.
4
12013-11-30 Glenn Morris <rgm@gnu.org> 52013-11-30 Glenn Morris <rgm@gnu.org>
2 6
3 * Makefile.in (distclean): Remove Makefile. 7 * Makefile.in (distclean): Remove Makefile.
diff --git a/doc/emacs/msdog.texi b/doc/emacs/msdog.texi
index 0f01958b51c..5fbf2e45e4a 100644
--- a/doc/emacs/msdog.texi
+++ b/doc/emacs/msdog.texi
@@ -482,7 +482,7 @@ the variable @code{w32-alt-is-meta} to a @code{nil} value.
482@kbd{Alt-@key{TAB}}, for its own use. These key combinations are 482@kbd{Alt-@key{TAB}}, for its own use. These key combinations are
483intercepted by the system before Emacs can see them. You can use the 483intercepted by the system before Emacs can see them. You can use the
484@code{w32-register-hot-key} function to allow a key sequence to be 484@code{w32-register-hot-key} function to allow a key sequence to be
485seen by Emacs instead of being grabbed by Windows. This functions 485seen by Emacs instead of being grabbed by Windows. This function
486registers a key sequence as a @dfn{hot key}, overriding the special 486registers a key sequence as a @dfn{hot key}, overriding the special
487meaning of that key sequence for Windows. (MS-Windows is told that 487meaning of that key sequence for Windows. (MS-Windows is told that
488the key sequence is a hot key only when one of the Emacs windows has 488the key sequence is a hot key only when one of the Emacs windows has
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index f4f036f33ad..d2173793d00 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,9 @@
12013-12-08 Juanma Barranquero <lekktu@gmail.com>
2
3 * display.texi (Progress, Face Remapping):
4 * processes.texi (Serial Ports):
5 * windows.texi (Recombining Windows): Fix typos. (Bug#16089)
6
12013-12-04 Juri Linkov <juri@jurta.org> 72013-12-04 Juri Linkov <juri@jurta.org>
2 8
3 * searching.texi (Search and Replace): Fix `unread-command-events' 9 * searching.texi (Search and Replace): Fix `unread-command-events'
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index eeede08ecd9..c6eeaf9c6a8 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -439,7 +439,7 @@ that it prints a message in the echo area unconditionally.
439 439
440The first two arguments have the same meaning as for 440The first two arguments have the same meaning as for
441@code{progress-reporter-update}. Optional @var{new-message} allows 441@code{progress-reporter-update}. Optional @var{new-message} allows
442you to change the message of the @var{reporter}. Since this functions 442you to change the message of the @var{reporter}. Since this function
443always updates the echo area, such a change will be immediately 443always updates the echo area, such a change will be immediately
444presented to the user. 444presented to the user.
445@end defun 445@end defun
@@ -2683,7 +2683,7 @@ and @code{face-remap-reset-base} functions; it is intended for major
2683modes to remap faces in the buffers they control. 2683modes to remap faces in the buffers they control.
2684 2684
2685@defun face-remap-add-relative face &rest specs 2685@defun face-remap-add-relative face &rest specs
2686This functions adds the face spec in @var{specs} as relative 2686This function adds the face spec in @var{specs} as relative
2687remappings for face @var{face} in the current buffer. The remaining 2687remappings for face @var{face} in the current buffer. The remaining
2688arguments, @var{specs}, should form either a list of face names, or a 2688arguments, @var{specs}, should form either a list of face names, or a
2689property list of attribute/value pairs. 2689property list of attribute/value pairs.
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 1181244a974..880d5fff598 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -2613,7 +2613,7 @@ Here is an example:
2613@cindex stopbits, in serial connections 2613@cindex stopbits, in serial connections
2614@cindex flowcontrol, in serial connections 2614@cindex flowcontrol, in serial connections
2615 2615
2616This functions configures a serial port connection. Arguments are 2616This function configures a serial port connection. Arguments are
2617specified as keyword/argument pairs. Attributes that are not given 2617specified as keyword/argument pairs. Attributes that are not given
2618are re-initialized from the process's current configuration (available 2618are re-initialized from the process's current configuration (available
2619via the function @code{process-contact}), or set to reasonable default 2619via the function @code{process-contact}), or set to reasonable default
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 661860025f3..673351005fb 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -1164,7 +1164,7 @@ vertical combination @var{W1}.
1164 1164
1165@cindex window combination limit 1165@cindex window combination limit
1166@defun set-window-combination-limit window limit 1166@defun set-window-combination-limit window limit
1167This functions sets the @dfn{combination limit} of the window 1167This function sets the @dfn{combination limit} of the window
1168@var{window} to @var{limit}. This value can be retrieved via the 1168@var{window} to @var{limit}. This value can be retrieved via the
1169function @code{window-combination-limit}. See below for its effects; 1169function @code{window-combination-limit}. See below for its effects;
1170note that it is only meaningful for internal windows. The 1170note that it is only meaningful for internal windows. The
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 5a7b301d5b0..83e681990aa 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,7 @@
12013-12-08 Juanma Barranquero <lekktu@gmail.com>
2
3 * dbus.texi (Properties and Annotations): Fix typo.
4
12013-12-06 Bastien Guerry <bzg@gnu.org> 52013-12-06 Bastien Guerry <bzg@gnu.org>
2 6
3 * org.texi: Don't include Emacs version within Org's version. 7 * org.texi: Don't include Emacs version within Org's version.
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi
index 1e887e02a30..a6155e2e724 100644
--- a/doc/misc/dbus.texi
+++ b/doc/misc/dbus.texi
@@ -760,7 +760,7 @@ If there are no properties, @code{nil} is returned. Example:
760@end defun 760@end defun
761 761
762@defun dbus-get-all-managed-objects bus service path 762@defun dbus-get-all-managed-objects bus service path
763This functions returns all objects at @var{bus}, @var{service}, 763This function returns all objects at @var{bus}, @var{service},
764@var{path}, and the children of @var{path}. The result is a list of 764@var{path}, and the children of @var{path}. The result is a list of
765objects. Every object is a cons of an existing path name, and the 765objects. Every object is a cons of an existing path name, and the
766list of available interface objects. An interface object is another 766list of available interface objects. An interface object is another
diff --git a/etc/NEWS b/etc/NEWS
index f354f5ce2f7..7f9aeffa5c6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -661,6 +661,17 @@ whether it is safe to use Bash's --noediting option. These days
661 661
662*** Add more Ruby file types to `auto-mode-alist'. 662*** Add more Ruby file types to `auto-mode-alist'.
663 663
664** JS Mode
665
666*** Better indentation of multiple-variable declarations.
667If declaration spans several lines, variables on the following lines
668are lined up to the first one.
669
670*** We now recognize and better indent continuations in array
671comprehensions.
672
673*** New option `js-switch-indent-offset`.
674
664 675
665* New Modes and Packages in Emacs 24.4 676* New Modes and Packages in Emacs 24.4
666 677
diff --git a/lib/gl_openssl.h b/lib/gl_openssl.h
new file mode 100644
index 00000000000..1fb61066b11
--- /dev/null
+++ b/lib/gl_openssl.h
@@ -0,0 +1,116 @@
1/* gl_openssl.h -- wrap openssl crypto hash routines in gnulib interface
2
3 Copyright (C) 2013 Free Software Foundation, Inc.
4
5 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 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 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
18/* Written by Pádraig Brady */
19
20#ifndef GL_OPENSSL_NAME
21# error "Please define GL_OPENSSL_NAME to 1,5,256 etc."
22#endif
23
24#ifndef _GL_INLINE_HEADER_BEGIN
25# error "Please include config.h first."
26#endif
27_GL_INLINE_HEADER_BEGIN
28#ifndef GL_OPENSSL_INLINE
29# define GL_OPENSSL_INLINE _GL_INLINE
30#endif
31
32/* Concatenate two preprocessor tokens. */
33#define _GLCRYPTO_CONCAT_(prefix, suffix) prefix##suffix
34#define _GLCRYPTO_CONCAT(prefix, suffix) _GLCRYPTO_CONCAT_ (prefix, suffix)
35
36#if GL_OPENSSL_NAME == 5
37# define OPENSSL_ALG md5
38#else
39# define OPENSSL_ALG _GLCRYPTO_CONCAT (sha, GL_OPENSSL_NAME)
40#endif
41
42/* Context type mappings. */
43#if BASE_OPENSSL_TYPE != GL_OPENSSL_NAME
44# undef BASE_OPENSSL_TYPE
45# if GL_OPENSSL_NAME == 224
46# define BASE_OPENSSL_TYPE 256
47# elif GL_OPENSSL_NAME == 384
48# define BASE_OPENSSL_TYPE 512
49# endif
50# define md5_CTX MD5_CTX
51# define sha1_CTX SHA_CTX
52# define sha224_CTX SHA256_CTX
53# define sha224_ctx sha256_ctx
54# define sha256_CTX SHA256_CTX
55# define sha384_CTX SHA512_CTX
56# define sha384_ctx sha512_ctx
57# define sha512_CTX SHA512_CTX
58# undef _gl_CTX
59# undef _gl_ctx
60# define _gl_CTX _GLCRYPTO_CONCAT (OPENSSL_ALG, _CTX) /* openssl type. */
61# define _gl_ctx _GLCRYPTO_CONCAT (OPENSSL_ALG, _ctx) /* gnulib type. */
62
63struct _gl_ctx { _gl_CTX CTX; };
64#endif
65
66/* Function name mappings. */
67#define md5_prefix MD5
68#define sha1_prefix SHA1
69#define sha224_prefix SHA224
70#define sha256_prefix SHA256
71#define sha384_prefix SHA384
72#define sha512_prefix SHA512
73#define _GLCRYPTO_PREFIX _GLCRYPTO_CONCAT (OPENSSL_ALG, _prefix)
74#define OPENSSL_FN(suffix) _GLCRYPTO_CONCAT (_GLCRYPTO_PREFIX, suffix)
75#define GL_CRYPTO_FN(suffix) _GLCRYPTO_CONCAT (OPENSSL_ALG, suffix)
76
77GL_OPENSSL_INLINE void
78GL_CRYPTO_FN (_init_ctx) (struct _gl_ctx *ctx)
79{ (void) OPENSSL_FN (_Init) ((_gl_CTX *) ctx); }
80
81/* These were never exposed by gnulib. */
82#if ! (GL_OPENSSL_NAME == 224 || GL_OPENSSL_NAME == 384)
83GL_OPENSSL_INLINE void
84GL_CRYPTO_FN (_process_bytes) (const void *buf, size_t len, struct _gl_ctx *ctx)
85{ OPENSSL_FN (_Update) ((_gl_CTX *) ctx, buf, len); }
86
87GL_OPENSSL_INLINE void
88GL_CRYPTO_FN (_process_block) (const void *buf, size_t len, struct _gl_ctx *ctx)
89{ GL_CRYPTO_FN (_process_bytes) (buf, len, ctx); }
90#endif
91
92GL_OPENSSL_INLINE void *
93GL_CRYPTO_FN (_finish_ctx) (struct _gl_ctx *ctx, void *res)
94{ OPENSSL_FN (_Final) (res, (_gl_CTX *) ctx); return res; }
95
96GL_OPENSSL_INLINE void *
97GL_CRYPTO_FN (_buffer) (const char *buf, size_t len, void *res)
98{ return OPENSSL_FN () ((const unsigned char *) buf, len, res); }
99
100GL_OPENSSL_INLINE void *
101GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *res)
102{
103 /* Assume any unprocessed bytes in ctx are not to be ignored. */
104 _gl_CTX tmp_ctx = *(_gl_CTX *) ctx;
105 OPENSSL_FN (_Final) (res, &tmp_ctx);
106 return res;
107}
108
109/* Undef so we can include multiple times. */
110#undef GL_CRYPTO_FN
111#undef OPENSSL_FN
112#undef _GLCRYPTO_PREFIX
113#undef OPENSSL_ALG
114#undef GL_OPENSSL_NAME
115
116_GL_INLINE_HEADER_END
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 44cdc0cdaac..9617452a796 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -33,6 +33,15 @@ libgnu_a_LIBADD = $(gl_LIBOBJS)
33libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) 33libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
34EXTRA_libgnu_a_SOURCES = 34EXTRA_libgnu_a_SOURCES =
35 35
36## begin gnulib module absolute-header
37
38# Use this preprocessor expression to decide whether #include_next works.
39# Do not rely on a 'configure'-time test for this, since the expression
40# might appear in an installed header, which is used by some other compiler.
41HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
42
43## end gnulib module absolute-header
44
36## begin gnulib module alloca-opt 45## begin gnulib module alloca-opt
37 46
38BUILT_SOURCES += $(ALLOCA_H) 47BUILT_SOURCES += $(ALLOCA_H)
@@ -152,7 +161,7 @@ EXTRA_DIST += count-trailing-zeros.h
152 161
153libgnu_a_SOURCES += md5.c 162libgnu_a_SOURCES += md5.c
154 163
155EXTRA_DIST += md5.h 164EXTRA_DIST += gl_openssl.h md5.h
156 165
157## end gnulib module crypto/md5 166## end gnulib module crypto/md5
158 167
@@ -160,7 +169,7 @@ EXTRA_DIST += md5.h
160 169
161libgnu_a_SOURCES += sha1.c 170libgnu_a_SOURCES += sha1.c
162 171
163EXTRA_DIST += sha1.h 172EXTRA_DIST += gl_openssl.h sha1.h
164 173
165## end gnulib module crypto/sha1 174## end gnulib module crypto/sha1
166 175
@@ -168,7 +177,7 @@ EXTRA_DIST += sha1.h
168 177
169libgnu_a_SOURCES += sha256.c 178libgnu_a_SOURCES += sha256.c
170 179
171EXTRA_DIST += sha256.h 180EXTRA_DIST += gl_openssl.h sha256.h
172 181
173## end gnulib module crypto/sha256 182## end gnulib module crypto/sha256
174 183
@@ -176,7 +185,7 @@ EXTRA_DIST += sha256.h
176 185
177libgnu_a_SOURCES += sha512.c 186libgnu_a_SOURCES += sha512.c
178 187
179EXTRA_DIST += sha512.h 188EXTRA_DIST += gl_openssl.h sha512.h
180 189
181## end gnulib module crypto/sha512 190## end gnulib module crypto/sha512
182 191
diff --git a/lib/md5.c b/lib/md5.c
index f41b5beb7ce..ea2c1d5f3f8 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -21,6 +21,9 @@
21 21
22#include <config.h> 22#include <config.h>
23 23
24#if HAVE_OPENSSL_MD5
25# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
26#endif
24#include "md5.h" 27#include "md5.h"
25 28
26#include <stdalign.h> 29#include <stdalign.h>
@@ -61,6 +64,7 @@
61# error "invalid BLOCKSIZE" 64# error "invalid BLOCKSIZE"
62#endif 65#endif
63 66
67#if ! HAVE_OPENSSL_MD5
64/* This array contains the bytes used to pad the buffer to the next 68/* This array contains the bytes used to pad the buffer to the next
65 64-byte boundary. (RFC 1321, 3.1: Step 1) */ 69 64-byte boundary. (RFC 1321, 3.1: Step 1) */
66static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; 70static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
@@ -128,6 +132,7 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
128 132
129 return md5_read_ctx (ctx, resbuf); 133 return md5_read_ctx (ctx, resbuf);
130} 134}
135#endif
131 136
132/* Compute MD5 message digest for bytes read from STREAM. The 137/* Compute MD5 message digest for bytes read from STREAM. The
133 resulting message digest number will be written into the 16 bytes 138 resulting message digest number will be written into the 16 bytes
@@ -202,6 +207,7 @@ process_partial_block:
202 return 0; 207 return 0;
203} 208}
204 209
210#if ! HAVE_OPENSSL_MD5
205/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The 211/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
206 result is always in little endian byte order, so that a byte-wise 212 result is always in little endian byte order, so that a byte-wise
207 output yields to the wanted ASCII representation of the message 213 output yields to the wanted ASCII representation of the message
@@ -459,3 +465,4 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
459 ctx->C = C; 465 ctx->C = C;
460 ctx->D = D; 466 ctx->D = D;
461} 467}
468#endif
diff --git a/lib/md5.h b/lib/md5.h
index 634a7470f44..b09a68b148d 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -23,6 +23,10 @@
23#include <stdio.h> 23#include <stdio.h>
24#include <stdint.h> 24#include <stdint.h>
25 25
26# if HAVE_OPENSSL_MD5
27# include <openssl/md5.h>
28# endif
29
26#define MD5_DIGEST_SIZE 16 30#define MD5_DIGEST_SIZE 16
27#define MD5_BLOCK_SIZE 64 31#define MD5_BLOCK_SIZE 64
28 32
@@ -57,6 +61,10 @@
57extern "C" { 61extern "C" {
58# endif 62# endif
59 63
64# if HAVE_OPENSSL_MD5
65# define GL_OPENSSL_NAME 5
66# include "gl_openssl.h"
67# else
60/* Structure to save state of computation between the single steps. */ 68/* Structure to save state of computation between the single steps. */
61struct md5_ctx 69struct md5_ctx
62{ 70{
@@ -106,11 +114,6 @@ extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
106extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; 114extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
107 115
108 116
109/* Compute MD5 message digest for bytes read from STREAM. The
110 resulting message digest number will be written into the 16 bytes
111 beginning at RESBLOCK. */
112extern int __md5_stream (FILE *stream, void *resblock) __THROW;
113
114/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The 117/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
115 result is always in little endian byte order, so that a byte-wise 118 result is always in little endian byte order, so that a byte-wise
116 output yields to the wanted ASCII representation of the message 119 output yields to the wanted ASCII representation of the message
@@ -118,6 +121,13 @@ extern int __md5_stream (FILE *stream, void *resblock) __THROW;
118extern void *__md5_buffer (const char *buffer, size_t len, 121extern void *__md5_buffer (const char *buffer, size_t len,
119 void *resblock) __THROW; 122 void *resblock) __THROW;
120 123
124# endif
125/* Compute MD5 message digest for bytes read from STREAM. The
126 resulting message digest number will be written into the 16 bytes
127 beginning at RESBLOCK. */
128extern int __md5_stream (FILE *stream, void *resblock) __THROW;
129
130
121# ifdef __cplusplus 131# ifdef __cplusplus
122} 132}
123# endif 133# endif
diff --git a/lib/sha1.c b/lib/sha1.c
index 778389affc5..b1a24f9968d 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -23,6 +23,9 @@
23 23
24#include <config.h> 24#include <config.h>
25 25
26#if HAVE_OPENSSL_SHA1
27# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
28#endif
26#include "sha1.h" 29#include "sha1.h"
27 30
28#include <stdalign.h> 31#include <stdalign.h>
@@ -46,6 +49,7 @@
46# error "invalid BLOCKSIZE" 49# error "invalid BLOCKSIZE"
47#endif 50#endif
48 51
52#if ! HAVE_OPENSSL_SHA1
49/* This array contains the bytes used to pad the buffer to the next 53/* This array contains the bytes used to pad the buffer to the next
50 64-byte boundary. (RFC 1321, 3.1: Step 1) */ 54 64-byte boundary. (RFC 1321, 3.1: Step 1) */
51static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; 55static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
@@ -116,6 +120,7 @@ sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
116 120
117 return sha1_read_ctx (ctx, resbuf); 121 return sha1_read_ctx (ctx, resbuf);
118} 122}
123#endif
119 124
120/* Compute SHA1 message digest for bytes read from STREAM. The 125/* Compute SHA1 message digest for bytes read from STREAM. The
121 resulting message digest number will be written into the 16 bytes 126 resulting message digest number will be written into the 16 bytes
@@ -190,6 +195,7 @@ sha1_stream (FILE *stream, void *resblock)
190 return 0; 195 return 0;
191} 196}
192 197
198#if ! HAVE_OPENSSL_SHA1
193/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The 199/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
194 result is always in little endian byte order, so that a byte-wise 200 result is always in little endian byte order, so that a byte-wise
195 output yields to the wanted ASCII representation of the message 201 output yields to the wanted ASCII representation of the message
@@ -424,3 +430,4 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
424 e = ctx->E += e; 430 e = ctx->E += e;
425 } 431 }
426} 432}
433#endif
diff --git a/lib/sha1.h b/lib/sha1.h
index ddd386f9144..0ec953e8357 100644
--- a/lib/sha1.h
+++ b/lib/sha1.h
@@ -22,12 +22,20 @@
22# include <stdio.h> 22# include <stdio.h>
23# include <stdint.h> 23# include <stdint.h>
24 24
25# if HAVE_OPENSSL_SHA1
26# include <openssl/sha.h>
27# endif
28
25# ifdef __cplusplus 29# ifdef __cplusplus
26extern "C" { 30extern "C" {
27# endif 31# endif
28 32
29#define SHA1_DIGEST_SIZE 20 33#define SHA1_DIGEST_SIZE 20
30 34
35# if HAVE_OPENSSL_SHA1
36# define GL_OPENSSL_NAME 1
37# include "gl_openssl.h"
38# else
31/* Structure to save state of computation between the single steps. */ 39/* Structure to save state of computation between the single steps. */
32struct sha1_ctx 40struct sha1_ctx
33{ 41{
@@ -42,7 +50,6 @@ struct sha1_ctx
42 uint32_t buffer[32]; 50 uint32_t buffer[32];
43}; 51};
44 52
45
46/* Initialize structure containing state of computation. */ 53/* Initialize structure containing state of computation. */
47extern void sha1_init_ctx (struct sha1_ctx *ctx); 54extern void sha1_init_ctx (struct sha1_ctx *ctx);
48 55
@@ -73,17 +80,19 @@ extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
73extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); 80extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
74 81
75 82
76/* Compute SHA1 message digest for bytes read from STREAM. The
77 resulting message digest number will be written into the 20 bytes
78 beginning at RESBLOCK. */
79extern int sha1_stream (FILE *stream, void *resblock);
80
81/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The 83/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
82 result is always in little endian byte order, so that a byte-wise 84 result is always in little endian byte order, so that a byte-wise
83 output yields to the wanted ASCII representation of the message 85 output yields to the wanted ASCII representation of the message
84 digest. */ 86 digest. */
85extern void *sha1_buffer (const char *buffer, size_t len, void *resblock); 87extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
86 88
89# endif
90/* Compute SHA1 message digest for bytes read from STREAM. The
91 resulting message digest number will be written into the 20 bytes
92 beginning at RESBLOCK. */
93extern int sha1_stream (FILE *stream, void *resblock);
94
95
87# ifdef __cplusplus 96# ifdef __cplusplus
88} 97}
89# endif 98# endif
diff --git a/lib/sha256.c b/lib/sha256.c
index 4b2cee37fb5..9d6912cdc79 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -22,6 +22,9 @@
22 22
23#include <config.h> 23#include <config.h>
24 24
25#if HAVE_OPENSSL_SHA256
26# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
27#endif
25#include "sha256.h" 28#include "sha256.h"
26 29
27#include <stdalign.h> 30#include <stdalign.h>
@@ -45,6 +48,7 @@
45# error "invalid BLOCKSIZE" 48# error "invalid BLOCKSIZE"
46#endif 49#endif
47 50
51#if ! HAVE_OPENSSL_SHA256
48/* This array contains the bytes used to pad the buffer to the next 52/* This array contains the bytes used to pad the buffer to the next
49 64-byte boundary. */ 53 64-byte boundary. */
50static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; 54static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
@@ -163,6 +167,7 @@ sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
163 sha256_conclude_ctx (ctx); 167 sha256_conclude_ctx (ctx);
164 return sha224_read_ctx (ctx, resbuf); 168 return sha224_read_ctx (ctx, resbuf);
165} 169}
170#endif
166 171
167/* Compute SHA256 message digest for bytes read from STREAM. The 172/* Compute SHA256 message digest for bytes read from STREAM. The
168 resulting message digest number will be written into the 32 bytes 173 resulting message digest number will be written into the 32 bytes
@@ -308,6 +313,7 @@ sha224_stream (FILE *stream, void *resblock)
308 return 0; 313 return 0;
309} 314}
310 315
316#if ! HAVE_OPENSSL_SHA256
311/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The 317/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
312 result is always in little endian byte order, so that a byte-wise 318 result is always in little endian byte order, so that a byte-wise
313 output yields to the wanted ASCII representation of the message 319 output yields to the wanted ASCII representation of the message
@@ -567,3 +573,4 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
567 h = ctx->state[7] += h; 573 h = ctx->state[7] += h;
568 } 574 }
569} 575}
576#endif
diff --git a/lib/sha256.h b/lib/sha256.h
index 7e6252285bb..6ee326b0466 100644
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -21,10 +21,23 @@
21# include <stdio.h> 21# include <stdio.h>
22# include <stdint.h> 22# include <stdint.h>
23 23
24# if HAVE_OPENSSL_SHA256
25# include <openssl/sha.h>
26# endif
27
24# ifdef __cplusplus 28# ifdef __cplusplus
25extern "C" { 29extern "C" {
26# endif 30# endif
27 31
32enum { SHA224_DIGEST_SIZE = 224 / 8 };
33enum { SHA256_DIGEST_SIZE = 256 / 8 };
34
35# if HAVE_OPENSSL_SHA256
36# define GL_OPENSSL_NAME 224
37# include "gl_openssl.h"
38# define GL_OPENSSL_NAME 256
39# include "gl_openssl.h"
40# else
28/* Structure to save state of computation between the single steps. */ 41/* Structure to save state of computation between the single steps. */
29struct sha256_ctx 42struct sha256_ctx
30{ 43{
@@ -35,9 +48,6 @@ struct sha256_ctx
35 uint32_t buffer[32]; 48 uint32_t buffer[32];
36}; 49};
37 50
38enum { SHA224_DIGEST_SIZE = 224 / 8 };
39enum { SHA256_DIGEST_SIZE = 256 / 8 };
40
41/* Initialize structure containing state of computation. */ 51/* Initialize structure containing state of computation. */
42extern void sha256_init_ctx (struct sha256_ctx *ctx); 52extern void sha256_init_ctx (struct sha256_ctx *ctx);
43extern void sha224_init_ctx (struct sha256_ctx *ctx); 53extern void sha224_init_ctx (struct sha256_ctx *ctx);
@@ -71,12 +81,6 @@ extern void *sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
71extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf); 81extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
72 82
73 83
74/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The
75 resulting message digest number will be written into the 32 (28) bytes
76 beginning at RESBLOCK. */
77extern int sha256_stream (FILE *stream, void *resblock);
78extern int sha224_stream (FILE *stream, void *resblock);
79
80/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The 84/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The
81 result is always in little endian byte order, so that a byte-wise 85 result is always in little endian byte order, so that a byte-wise
82 output yields to the wanted ASCII representation of the message 86 output yields to the wanted ASCII representation of the message
@@ -84,6 +88,14 @@ extern int sha224_stream (FILE *stream, void *resblock);
84extern void *sha256_buffer (const char *buffer, size_t len, void *resblock); 88extern void *sha256_buffer (const char *buffer, size_t len, void *resblock);
85extern void *sha224_buffer (const char *buffer, size_t len, void *resblock); 89extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
86 90
91# endif
92/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The
93 resulting message digest number will be written into the 32 (28) bytes
94 beginning at RESBLOCK. */
95extern int sha256_stream (FILE *stream, void *resblock);
96extern int sha224_stream (FILE *stream, void *resblock);
97
98
87# ifdef __cplusplus 99# ifdef __cplusplus
88} 100}
89# endif 101# endif
diff --git a/lib/sha512.c b/lib/sha512.c
index 79f11257474..8429bb9b03a 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -22,6 +22,9 @@
22 22
23#include <config.h> 23#include <config.h>
24 24
25#if HAVE_OPENSSL_SHA512
26# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
27#endif
25#include "sha512.h" 28#include "sha512.h"
26 29
27#include <stdalign.h> 30#include <stdalign.h>
@@ -52,6 +55,7 @@
52# error "invalid BLOCKSIZE" 55# error "invalid BLOCKSIZE"
53#endif 56#endif
54 57
58#if ! HAVE_OPENSSL_SHA512
55/* This array contains the bytes used to pad the buffer to the next 59/* This array contains the bytes used to pad the buffer to the next
56 128-byte boundary. */ 60 128-byte boundary. */
57static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ }; 61static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ };
@@ -171,6 +175,7 @@ sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
171 sha512_conclude_ctx (ctx); 175 sha512_conclude_ctx (ctx);
172 return sha384_read_ctx (ctx, resbuf); 176 return sha384_read_ctx (ctx, resbuf);
173} 177}
178#endif
174 179
175/* Compute SHA512 message digest for bytes read from STREAM. The 180/* Compute SHA512 message digest for bytes read from STREAM. The
176 resulting message digest number will be written into the 64 bytes 181 resulting message digest number will be written into the 64 bytes
@@ -316,6 +321,7 @@ sha384_stream (FILE *stream, void *resblock)
316 return 0; 321 return 0;
317} 322}
318 323
324#if ! HAVE_OPENSSL_SHA512
319/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The 325/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
320 result is always in little endian byte order, so that a byte-wise 326 result is always in little endian byte order, so that a byte-wise
321 output yields to the wanted ASCII representation of the message 327 output yields to the wanted ASCII representation of the message
@@ -619,3 +625,4 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
619 h = ctx->state[7] = u64plus (ctx->state[7], h); 625 h = ctx->state[7] = u64plus (ctx->state[7], h);
620 } 626 }
621} 627}
628#endif
diff --git a/lib/sha512.h b/lib/sha512.h
index 2e78a5f9404..1de93da2f8a 100644
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -19,13 +19,25 @@
19# define SHA512_H 1 19# define SHA512_H 1
20 20
21# include <stdio.h> 21# include <stdio.h>
22
23# include "u64.h" 22# include "u64.h"
24 23
24# if HAVE_OPENSSL_SHA512
25# include <openssl/sha.h>
26# endif
27
25# ifdef __cplusplus 28# ifdef __cplusplus
26extern "C" { 29extern "C" {
27# endif 30# endif
28 31
32enum { SHA384_DIGEST_SIZE = 384 / 8 };
33enum { SHA512_DIGEST_SIZE = 512 / 8 };
34
35# if HAVE_OPENSSL_SHA512
36# define GL_OPENSSL_NAME 384
37# include "gl_openssl.h"
38# define GL_OPENSSL_NAME 512
39# include "gl_openssl.h"
40# else
29/* Structure to save state of computation between the single steps. */ 41/* Structure to save state of computation between the single steps. */
30struct sha512_ctx 42struct sha512_ctx
31{ 43{
@@ -36,9 +48,6 @@ struct sha512_ctx
36 u64 buffer[32]; 48 u64 buffer[32];
37}; 49};
38 50
39enum { SHA384_DIGEST_SIZE = 384 / 8 };
40enum { SHA512_DIGEST_SIZE = 512 / 8 };
41
42/* Initialize structure containing state of computation. */ 51/* Initialize structure containing state of computation. */
43extern void sha512_init_ctx (struct sha512_ctx *ctx); 52extern void sha512_init_ctx (struct sha512_ctx *ctx);
44extern void sha384_init_ctx (struct sha512_ctx *ctx); 53extern void sha384_init_ctx (struct sha512_ctx *ctx);
@@ -75,12 +84,6 @@ extern void *sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
75extern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf); 84extern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
76 85
77 86
78/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The
79 resulting message digest number will be written into the 64 (48) bytes
80 beginning at RESBLOCK. */
81extern int sha512_stream (FILE *stream, void *resblock);
82extern int sha384_stream (FILE *stream, void *resblock);
83
84/* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFER. The 87/* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFER. The
85 result is always in little endian byte order, so that a byte-wise 88 result is always in little endian byte order, so that a byte-wise
86 output yields to the wanted ASCII representation of the message 89 output yields to the wanted ASCII representation of the message
@@ -88,6 +91,14 @@ extern int sha384_stream (FILE *stream, void *resblock);
88extern void *sha512_buffer (const char *buffer, size_t len, void *resblock); 91extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
89extern void *sha384_buffer (const char *buffer, size_t len, void *resblock); 92extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
90 93
94# endif
95/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The
96 resulting message digest number will be written into the 64 (48) bytes
97 beginning at RESBLOCK. */
98extern int sha512_stream (FILE *stream, void *resblock);
99extern int sha384_stream (FILE *stream, void *resblock);
100
101
91# ifdef __cplusplus 102# ifdef __cplusplus
92} 103}
93# endif 104# endif
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5cac769f01b..8a05b461121 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,7 +1,140 @@
12013-12-09 Michael Albinus <michael.albinus@gmx.de>
2
3 * autorevert.el (auto-revert-notify-add-watch): Do not handle
4 symlinked files.
5
62013-12-09 Dmitry Gutov <dgutov@yandex.ru>
7
8 * progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Return t
9 after the end of a percent literal.
10
112013-12-09 Cameron Desautels <camdez@gmail.com> (tiny change)
12
13 * progmodes/ruby-mode.el (ruby-forward-string): Document. Handle
14 caret-delimited strings (Bug#16079).
15
162013-12-09 Dmitry Gutov <dgutov@yandex.ru>
17
18 * progmodes/ruby-mode.el (ruby-accurate-end-of-block): When
19 `ruby-use-smie' is t, use `smie-forward-sexp' instead of
20 `ruby-parse-partial' (Bug#16078).
21
222013-12-09 Leo Liu <sdl.web@gmail.com>
23
24 * subr.el (read-passwd): Disable show-paren-mode. (Bug#16091)
25
262013-12-08 Dmitry Gutov <dgutov@yandex.ru>
27
28 * progmodes/js.el (js-auto-indent-flag): Remove, was unused.
29 (js-switch-indent-offset): New option.
30 (js--proper-indentation): Use it. And handle the case when
31 "default" is actually a key in an object literal.
32 (js--same-line): New function.
33 (js--multi-line-declaration-indentation): Use it.
34 (js--indent-in-array-comp, js--array-comp-indentation): New
35 functions.
36 (js--proper-indentation): Use them, to handle array comprehension
37 continuations.
38
392013-12-08 Leo Liu <sdl.web@gmail.com>
40
41 * progmodes/flymake.el (flymake-highlight-line): Re-write.
42 (flymake-make-overlay): Remove arg MOUSE-FACE.
43 (flymake-save-string-to-file, flymake-read-file-to-string): Remove.
44
452013-12-08 Stefan Monnier <monnier@iro.umontreal.ca>
46
47 * emulation/cua-rect.el (cua--rectangle-highlight-for-redisplay):
48 New function.
49 (redisplay-highlight-region-function): Use it.
50
51 * emulation/cua-base.el (cua--explicit-region-start)
52 (cua--last-region-shifted): Remove.
53 (cua--deactivate): Use deactivate-mark.
54 (cua--pre-command-handler-1): Don't handle shift-selection.
55 (cua--post-command-handler-1): Don't change transient-mark-mode.
56 (cua--select-keymaps): Use region-active-p rather than
57 cua--explicit-region-start or cua--last-region-shifted.
58 (cua-mode): Enable shift-select-mode.
59
602013-12-08 Leo Liu <sdl.web@gmail.com>
61
62 * progmodes/flymake.el (flymake-popup-current-error-menu):
63 Rename from flymake-display-err-menu-for-current-line. Reimplement.
64 (flymake-posn-at-point-as-event, flymake-popup-menu)
65 (flymake-make-emacs-menu): Remove. (Bug#16077)
66
672013-12-08 Stefan Monnier <monnier@iro.umontreal.ca>
68
69 * rect.el (rectangle-mark-mode): Activate mark even if
70 transient-mark-mode is off (bug#16066).
71 (rectangle--highlight-for-redisplay): Fix boundary condition when point
72 is > mark and at bolp.
73
74 * emulation/cua-rect.el (cua--rectangle-region-extract): New function.
75 (region-extract-function): Use it.
76 (cua-mouse-save-then-kill-rectangle): Use cua-copy-region.
77 (cua-copy-rectangle, cua-cut-rectangle, cua-delete-rectangle):
78 Delete functions.
79 (cua--init-rectangles): Don't re-remap copy-region-as-kill,
80 kill-ring-save, kill-region, delete-char, delete-forward-char.
81 Ignore self-insert-iso.
82
83 * emulation/cua-gmrk.el (cua--init-global-mark):
84 Ignore `self-insert-iso'.
85
86 * emulation/cua-base.el (cua--prefix-copy-handler)
87 (cua--prefix-cut-handler): Rely on region-extract-function rather than
88 checking cua--rectangle.
89 (cua-delete-region): Use region-extract-function.
90 (cua-replace-region): Delete function.
91 (cua-copy-region, cua-cut-region): Obey region-extract-function.
92 (cua--pre-command-handler-1): Don't do the delete-selection thing.
93 (cua--self-insert-char-p): Ignore `self-insert-iso'.
94 (cua--init-keymaps): Don't remap delete-selection commands.
95 (cua-mode): Use delete-selection-mode instead of rolling our own
96 (bug#16085).
97
98 * menu-bar.el (clipboard-kill-ring-save, clipboard-kill-region):
99 Obey region-extract-function.
100
101 Make registers and delete-selection-mode work on rectangles.
102 * register.el (describe-register-1): Don't modify the register's value.
103 (copy-to-register): Obey region-extract-function.
104 * delsel.el (delete-active-region): Obey region-extract-function.
105
1062013-12-08 Leo Liu <sdl.web@gmail.com>
107
108 * progmodes/flymake.el (flymake, flymake-error-bitmap)
109 (flymake-warning-bitmap, flymake-fringe-indicator-position)
110 (flymake-compilation-prevents-syntax-check)
111 (flymake-start-syntax-check-on-newline)
112 (flymake-no-changes-timeout, flymake-gui-warnings-enabled)
113 (flymake-start-syntax-check-on-find-file, flymake-log-level)
114 (flymake-xml-program, flymake-master-file-dirs)
115 (flymake-master-file-count-limit)
116 (flymake-allowed-file-name-masks): Relocate.
117 (flymake-makehash, flymake-float-time)
118 (flymake-replace-regexp-in-string, flymake-split-string)
119 (flymake-get-temp-dir): Remove.
120 (flymake-popup-menu, flymake-nop, flymake-make-xemacs-menu)
121 (flymake-current-row, flymake-selected-frame)
122 (flymake-get-point-pixel-pos): Remove xemacs compatibity and
123 related functions. (Bug#16077)
124
1252013-12-07 Bozhidar Batsov <bozhidar@batsov.com>
126
127 * emacs-lisp/helpers.el (string-blank-p): Use `string-match-p'.
128
1292013-12-07 Tassilo Horn <tsdh@gnu.org>
130
131 * help-fns.el (describe-function-1): Use new advice-* functions
132 rather than old ad-* functions. Fix function type description and
133 source links for advised functions and subrs.
134
12013-12-07 Lars Magne Ingebrigtsen <larsi@gnus.org> 1352013-12-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 136
3 * net/shr.el (shr-tag-img): Don't bug out on <img src=""> 137 * net/shr.el (shr-tag-img): Don't bug out on <img src=""> data.
4 data.
5 138
62013-12-06 Michael Albinus <michael.albinus@gmx.de> 1392013-12-06 Michael Albinus <michael.albinus@gmx.de>
7 140
@@ -13,8 +146,8 @@
13 146
142013-12-06 Dmitry Gutov <dgutov@yandex.ru> 1472013-12-06 Dmitry Gutov <dgutov@yandex.ru>
15 148
16 * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Touch 149 * progmodes/ruby-mode.el (ruby-syntax-propertize-function):
17 up the last change. 150 Touch up the last change.
18 151
192013-12-06 Leo Liu <sdl.web@gmail.com> 1522013-12-06 Leo Liu <sdl.web@gmail.com>
20 153
@@ -44,8 +177,8 @@
44 177
452013-12-06 Dmitry Gutov <dgutov@yandex.ru> 1782013-12-06 Dmitry Gutov <dgutov@yandex.ru>
46 179
47 * progmodes/octave.el (inferior-octave-completion-table): Turn 180 * progmodes/octave.el (inferior-octave-completion-table):
48 back into function, use `completion-table-with-cache' 181 Turn back into function, use `completion-table-with-cache'
49 (Bug#11906). Update all references. 182 (Bug#11906). Update all references.
50 183
51 * minibuffer.el (completion-table-with-cache): New function. 184 * minibuffer.el (completion-table-with-cache): New function.
diff --git a/lisp/ChangeLog.10 b/lisp/ChangeLog.10
index 30afe9ce970..74e05e40410 100644
--- a/lisp/ChangeLog.10
+++ b/lisp/ChangeLog.10
@@ -5639,7 +5639,7 @@
5639 add handling of entry attributes using diary-pull-attrs. 5639 add handling of entry attributes using diary-pull-attrs.
5640 (mark-calendar-days-named, mark-calendar-days-named) 5640 (mark-calendar-days-named, mark-calendar-days-named)
5641 (mark-calendar-date-pattern, mark-calendar-month) 5641 (mark-calendar-date-pattern, mark-calendar-month)
5642 (add-to-diary-list): Add optional paramater `color' for passing 5642 (add-to-diary-list): Add optional parameter `color' for passing
5643 face attribute info through the callchain. Pass this parameter around. 5643 face attribute info through the callchain. Pass this parameter around.
5644 5644
56452003-02-11 Stefan Monnier <monnier@cs.yale.edu> 56452003-02-11 Stefan Monnier <monnier@cs.yale.edu>
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 65526f07e1b..f0929f95e38 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -504,13 +504,15 @@ will use an up-to-date value of `auto-revert-interval'"
504 504
505(defun auto-revert-notify-add-watch () 505(defun auto-revert-notify-add-watch ()
506 "Enable file notification for current buffer's associated file." 506 "Enable file notification for current buffer's associated file."
507 (when (string-match auto-revert-notify-exclude-dir-regexp 507 ;; We can assume that `buffer-file-name' and
508 (expand-file-name default-directory)) 508 ;; `auto-revert-use-notify' are non-nil.
509 (when (or (string-match auto-revert-notify-exclude-dir-regexp
510 (expand-file-name default-directory))
511 (not (file-symlink-p buffer-file-name)))
509 ;; Fallback to file checks. 512 ;; Fallback to file checks.
510 (set (make-local-variable 'auto-revert-use-notify) nil)) 513 (set (make-local-variable 'auto-revert-use-notify) nil))
511 514
512 (when (and buffer-file-name auto-revert-use-notify 515 (when (not auto-revert-notify-watch-descriptor)
513 (not auto-revert-notify-watch-descriptor))
514 (setq auto-revert-notify-watch-descriptor 516 (setq auto-revert-notify-watch-descriptor
515 (ignore-errors 517 (ignore-errors
516 (file-notify-add-watch 518 (file-notify-add-watch
diff --git a/lisp/delsel.el b/lisp/delsel.el
index 07a7a37db34..3c9a6561cde 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -78,8 +78,8 @@ any selection."
78 "Delete the active region. 78 "Delete the active region.
79If KILLP in not-nil, the active region is killed instead of deleted." 79If KILLP in not-nil, the active region is killed instead of deleted."
80 (if killp 80 (if killp
81 (kill-region (point) (mark)) 81 (kill-region (point) (mark) t)
82 (delete-region (point) (mark))) 82 (funcall region-extract-function 'delete-only))
83 t) 83 t)
84 84
85(defun delete-selection-helper (type) 85(defun delete-selection-helper (type)
@@ -197,9 +197,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
197 (define-key minibuffer-local-completion-map "\C-g" 'abort-recursive-edit) 197 (define-key minibuffer-local-completion-map "\C-g" 'abort-recursive-edit)
198 (define-key minibuffer-local-must-match-map "\C-g" 'abort-recursive-edit) 198 (define-key minibuffer-local-must-match-map "\C-g" 'abort-recursive-edit)
199 (define-key minibuffer-local-isearch-map "\C-g" 'abort-recursive-edit) 199 (define-key minibuffer-local-isearch-map "\C-g" 'abort-recursive-edit)
200 (dolist (sym '(self-insert-command self-insert-iso yank clipboard-yank 200 (dolist (sym '(self-insert-command yank clipboard-yank
201 insert-register delete-backward-char backward-delete-char-untabify 201 insert-register
202 delete-char newline-and-indent newline open-line)) 202 newline-and-indent newline open-line))
203 (put sym 'delete-selection nil)) 203 (put sym 'delete-selection nil))
204 ;; continue standard unloading 204 ;; continue standard unloading
205 nil) 205 nil)
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 87d1d1eae64..dbd0f092446 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -642,7 +642,7 @@ The environment used is the one when entering the activation frame at point."
642 (define-key map "h" 'describe-mode) 642 (define-key map "h" 'describe-mode)
643 (define-key map "q" 'top-level) 643 (define-key map "q" 'top-level)
644 (define-key map "e" 'debugger-eval-expression) 644 (define-key map "e" 'debugger-eval-expression)
645 (define-key map "v" 'debugger-toggle-locals) ;"v" is for "v"ariables. 645 (define-key map "v" 'debugger-toggle-locals) ; "v" is for "variables".
646 (define-key map " " 'next-line) 646 (define-key map " " 'next-line)
647 (define-key map "R" 'debugger-record-expression) 647 (define-key map "R" 'debugger-record-expression)
648 (define-key map "\C-m" 'debug-help-follow) 648 (define-key map "\C-m" 'debug-help-follow)
diff --git a/lisp/emacs-lisp/helpers.el b/lisp/emacs-lisp/helpers.el
index 8049f4e1d1d..b7996ade777 100644
--- a/lisp/emacs-lisp/helpers.el
+++ b/lisp/emacs-lisp/helpers.el
@@ -67,7 +67,7 @@
67 67
68(defsubst string-blank-p (string) 68(defsubst string-blank-p (string)
69 "Check whether STRING is either empty or only whitespace." 69 "Check whether STRING is either empty or only whitespace."
70 (string-empty-p (string-trim string))) 70 (string-match-p "\\`[ \t\n\r]*\\'" string))
71 71
72(provide 'helpers) 72(provide 'helpers)
73 73
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 292fd401a56..6c891c10eed 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -96,10 +96,6 @@
96;; This is done by highlighting the first occurrence of "redo" 96;; This is done by highlighting the first occurrence of "redo"
97;; and type "repeat" M-v M-v. 97;; and type "repeat" M-v M-v.
98 98
99;; Note: Since CUA-mode duplicates the functionality of the
100;; delete-selection-mode, that mode is automatically disabled when
101;; CUA-mode is enabled.
102
103 99
104;; CUA mode indications 100;; CUA mode indications
105;; -------------------- 101;; --------------------
@@ -601,8 +597,6 @@ a cons (TYPE . COLOR), then both properties are affected."
601 cua--last-killed-rectangle nil)) 597 cua--last-killed-rectangle nil))
602 598
603;; All behind cua--rectangle tests. 599;; All behind cua--rectangle tests.
604(declare-function cua-copy-rectangle "cua-rect" (arg))
605(declare-function cua-cut-rectangle "cua-rect" (arg))
606(declare-function cua--rectangle-left "cua-rect" (&optional val)) 600(declare-function cua--rectangle-left "cua-rect" (&optional val))
607(declare-function cua--delete-rectangle "cua-rect" ()) 601(declare-function cua--delete-rectangle "cua-rect" ())
608(declare-function cua--insert-rectangle "cua-rect" 602(declare-function cua--insert-rectangle "cua-rect"
@@ -631,13 +625,6 @@ a cons (TYPE . COLOR), then both properties are affected."
631 625
632;;; Aux. variables 626;;; Aux. variables
633 627
634;; Current region was started using cua-set-mark.
635(defvar cua--explicit-region-start nil)
636(make-variable-buffer-local 'cua--explicit-region-start)
637
638;; Latest region was started using shifted movement command.
639(defvar cua--last-region-shifted nil)
640
641;; buffer + point prior to current command when rectangle is active 628;; buffer + point prior to current command when rectangle is active
642;; checked in post-command hook to see if point was moved 629;; checked in post-command hook to see if point was moved
643(defvar cua--buffer-and-point-before-command nil) 630(defvar cua--buffer-and-point-before-command nil)
@@ -733,9 +720,7 @@ Repeating prefix key when region is active works as a single prefix key."
733(defun cua--prefix-copy-handler (arg) 720(defun cua--prefix-copy-handler (arg)
734 "Copy region/rectangle, then replay last key." 721 "Copy region/rectangle, then replay last key."
735 (interactive "P") 722 (interactive "P")
736 (if cua--rectangle 723 (cua-copy-region arg)
737 (cua-copy-rectangle arg)
738 (cua-copy-region arg))
739 (let ((keys (this-single-command-keys))) 724 (let ((keys (this-single-command-keys)))
740 (setq unread-command-events 725 (setq unread-command-events
741 (cons (aref keys (1- (length keys))) unread-command-events)))) 726 (cons (aref keys (1- (length keys))) unread-command-events))))
@@ -743,9 +728,7 @@ Repeating prefix key when region is active works as a single prefix key."
743(defun cua--prefix-cut-handler (arg) 728(defun cua--prefix-cut-handler (arg)
744 "Cut region/rectangle, then replay last key." 729 "Cut region/rectangle, then replay last key."
745 (interactive "P") 730 (interactive "P")
746 (if cua--rectangle 731 (cua-cut-region arg)
747 (cua-cut-rectangle arg)
748 (cua-cut-region arg))
749 (let ((keys (this-single-command-keys))) 732 (let ((keys (this-single-command-keys)))
750 (setq unread-command-events 733 (setq unread-command-events
751 (cons (aref keys (1- (length keys))) unread-command-events)))) 734 (cons (aref keys (1- (length keys))) unread-command-events))))
@@ -772,11 +755,9 @@ Repeating prefix key when region is active works as a single prefix key."
772 deactivate-mark nil)) 755 deactivate-mark nil))
773 756
774(defun cua--deactivate (&optional now) 757(defun cua--deactivate (&optional now)
775 (setq cua--explicit-region-start nil)
776 (if (not now) 758 (if (not now)
777 (setq deactivate-mark t) 759 (setq deactivate-mark t)
778 (setq mark-active nil) 760 (deactivate-mark)))
779 (run-hooks 'deactivate-mark-hook)))
780 761
781(defun cua--filter-buffer-noprops (start end) 762(defun cua--filter-buffer-noprops (start end)
782 (let ((str (filter-buffer-substring start end))) 763 (let ((str (filter-buffer-substring start end)))
@@ -815,10 +796,10 @@ Save a copy in register 0 if `cua-delete-copy-to-register-0' is non-nil."
815 (let ((start (mark)) (end (point))) 796 (let ((start (mark)) (end (point)))
816 (or (<= start end) 797 (or (<= start end)
817 (setq start (prog1 end (setq end start)))) 798 (setq start (prog1 end (setq end start))))
818 (setq cua--last-deleted-region-text (filter-buffer-substring start end)) 799 (setq cua--last-deleted-region-text
800 (funcall region-extract-function t))
819 (if cua-delete-copy-to-register-0 801 (if cua-delete-copy-to-register-0
820 (set-register ?0 cua--last-deleted-region-text)) 802 (set-register ?0 cua--last-deleted-region-text))
821 (delete-region start end)
822 (setq cua--last-deleted-region-pos 803 (setq cua--last-deleted-region-pos
823 (cons (current-buffer) 804 (cons (current-buffer)
824 (and (consp buffer-undo-list) 805 (and (consp buffer-undo-list)
@@ -826,17 +807,6 @@ Save a copy in register 0 if `cua-delete-copy-to-register-0' is non-nil."
826 (cua--deactivate) 807 (cua--deactivate)
827 (/= start end))) 808 (/= start end)))
828 809
829(defun cua-replace-region ()
830 "Replace the active region with the character you type."
831 (interactive)
832 (let ((not-empty (and cua-delete-selection (cua-delete-region))))
833 (unless (eq this-original-command this-command)
834 (let ((overwrite-mode
835 (and overwrite-mode
836 not-empty
837 (not (eq this-original-command 'self-insert-command)))))
838 (cua--fallback)))))
839
840(defun cua-copy-region (arg) 810(defun cua-copy-region (arg)
841 "Copy the region to the kill ring. 811 "Copy the region to the kill ring.
842With numeric prefix arg, copy to register 0-9 instead." 812With numeric prefix arg, copy to register 0-9 instead."
@@ -848,11 +818,11 @@ With numeric prefix arg, copy to register 0-9 instead."
848 (setq start (prog1 end (setq end start)))) 818 (setq start (prog1 end (setq end start))))
849 (cond 819 (cond
850 (cua--register 820 (cua--register
851 (copy-to-register cua--register start end nil)) 821 (copy-to-register cua--register start end nil 'region))
852 ((eq this-original-command 'clipboard-kill-ring-save) 822 ((eq this-original-command 'clipboard-kill-ring-save)
853 (clipboard-kill-ring-save start end)) 823 (clipboard-kill-ring-save start end 'region))
854 (t 824 (t
855 (copy-region-as-kill start end))) 825 (copy-region-as-kill start end 'region)))
856 (if cua-keep-region-after-copy 826 (if cua-keep-region-after-copy
857 (cua--keep-active) 827 (cua--keep-active)
858 (cua--deactivate)))) 828 (cua--deactivate))))
@@ -870,11 +840,11 @@ With numeric prefix arg, copy to register 0-9 instead."
870 (setq start (prog1 end (setq end start)))) 840 (setq start (prog1 end (setq end start))))
871 (cond 841 (cond
872 (cua--register 842 (cua--register
873 (copy-to-register cua--register start end t)) 843 (copy-to-register cua--register start end t 'region))
874 ((eq this-original-command 'clipboard-kill-region) 844 ((eq this-original-command 'clipboard-kill-region)
875 (clipboard-kill-region start end)) 845 (clipboard-kill-region start end 'region))
876 (t 846 (t
877 (kill-region start end)))) 847 (kill-region start end 'region))))
878 (cua--deactivate))) 848 (cua--deactivate)))
879 849
880;;; Generic commands for regions, rectangles, and global marks 850;;; Generic commands for regions, rectangles, and global marks
@@ -883,7 +853,6 @@ With numeric prefix arg, copy to register 0-9 instead."
883 "Cancel the active region, rectangle, or global mark." 853 "Cancel the active region, rectangle, or global mark."
884 (interactive) 854 (interactive)
885 (setq mark-active nil) 855 (setq mark-active nil)
886 (setq cua--explicit-region-start nil)
887 (if (fboundp 'cua--cancel-rectangle) 856 (if (fboundp 'cua--cancel-rectangle)
888 (cua--cancel-rectangle))) 857 (cua--cancel-rectangle)))
889 858
@@ -1130,14 +1099,12 @@ With a double \\[universal-argument] prefix argument, unconditionally set mark."
1130 (message "Mark cleared")) 1099 (message "Mark cleared"))
1131 (t 1100 (t
1132 (push-mark-command nil nil) 1101 (push-mark-command nil nil)
1133 (setq cua--explicit-region-start t)
1134 (setq cua--last-region-shifted nil)
1135 (if cua-enable-region-auto-help 1102 (if cua-enable-region-auto-help
1136 (cua-help-for-region t))))) 1103 (cua-help-for-region t)))))
1137 1104
1138;;; Scrolling commands which does not signal errors at top/bottom 1105;; Scrolling commands which do not signal errors at top/bottom
1139;;; of buffer at first key-press (instead moves to top/bottom 1106;; of buffer at first key-press (instead moves to top/bottom
1140;;; of buffer). 1107;; of buffer).
1141 1108
1142(defun cua-scroll-up (&optional arg) 1109(defun cua-scroll-up (&optional arg)
1143 "Scroll text of current window upward ARG lines; or near full screen if no ARG. 1110 "Scroll text of current window upward ARG lines; or near full screen if no ARG.
@@ -1221,53 +1188,13 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1221 ((not (symbolp this-command)) 1188 ((not (symbolp this-command))
1222 nil) 1189 nil)
1223 1190
1224 ;; Handle delete-selection property on non-movement commands
1225 ((not (eq (get this-command 'CUA) 'move)) 1191 ((not (eq (get this-command 'CUA) 'move))
1226 (when (and mark-active (not deactivate-mark)) 1192 nil)
1227 (let* ((ds (or (get this-command 'delete-selection)
1228 (get this-command 'pending-delete)))
1229 (nc (cond
1230 ((not ds) nil)
1231 ((eq ds 'yank)
1232 'cua-paste)
1233 ((eq ds 'kill)
1234 (if cua--rectangle
1235 'cua-copy-rectangle
1236 'cua-copy-region))
1237 ((eq ds 'supersede)
1238 (if cua--rectangle
1239 'cua-delete-rectangle
1240 'cua-delete-region))
1241 (t
1242 (if cua--rectangle
1243 'cua-delete-rectangle ;; replace?
1244 'cua-replace-region)))))
1245 (if nc
1246 (setq this-original-command this-command
1247 this-command nc)))))
1248
1249 ;; Handle shifted cursor keys and other movement commands.
1250 ;; If region is not active, region is activated if key is shifted.
1251 ;; If region is active, region is canceled if key is unshifted
1252 ;; (and region not started with C-SPC).
1253 ;; If rectangle is active, expand rectangle in specified direction and
1254 ;; ignore the movement.
1255 (this-command-keys-shift-translated
1256 (unless mark-active
1257 (push-mark-command nil t))
1258 (setq cua--last-region-shifted t)
1259 (setq cua--explicit-region-start nil))
1260 1193
1261 ;; Set mark if user explicitly said to do so 1194 ;; Set mark if user explicitly said to do so
1262 ((or cua--explicit-region-start cua--rectangle) 1195 (cua--rectangle ;FIXME: ??
1263 (unless mark-active 1196 (unless mark-active
1264 (push-mark-command nil nil))) 1197 (push-mark-command nil nil))))
1265
1266 ;; Else clear mark after this command.
1267 (t
1268 ;; If we set mark-active to nil here, the region highlight will not be
1269 ;; removed by the direct_output_ commands.
1270 (setq deactivate-mark t)))
1271 1198
1272 ;; Detect extension of rectangles by mouse or other movement 1199 ;; Detect extension of rectangles by mouse or other movement
1273 (setq cua--buffer-and-point-before-command 1200 (setq cua--buffer-and-point-before-command
@@ -1287,22 +1214,13 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1287 (when (fboundp 'cua--rectangle-post-command) 1214 (when (fboundp 'cua--rectangle-post-command)
1288 (cua--rectangle-post-command)) 1215 (cua--rectangle-post-command))
1289 (setq cua--buffer-and-point-before-command nil) 1216 (setq cua--buffer-and-point-before-command nil)
1290 (if (or (not mark-active) deactivate-mark)
1291 (setq cua--explicit-region-start nil))
1292 1217
1293 ;; Debugging 1218 ;; Debugging
1294 (if cua--debug 1219 (if cua--debug
1295 (cond 1220 (cond
1296 (cua--rectangle (cua--rectangle-assert)) 1221 (cua--rectangle (cua--rectangle-assert))
1297 (mark-active (message "Mark=%d Point=%d Expl=%s" 1222 (mark-active (message "Mark=%d Point=%d" (mark t) (point)))))
1298 (mark t) (point) cua--explicit-region-start)))) 1223
1299
1300 ;; Disable transient-mark-mode if rectangle active in current buffer.
1301 (if (not (window-minibuffer-p))
1302 (setq transient-mark-mode (and (not cua--rectangle)
1303 (if cua-highlight-region-shift-only
1304 (not cua--explicit-region-start)
1305 t))))
1306 (if cua-enable-cursor-indications 1224 (if cua-enable-cursor-indications
1307 (cua--update-indications)) 1225 (cua--update-indications))
1308 1226
@@ -1329,7 +1247,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1329 ;; Return DEF if current key sequence is self-inserting in 1247 ;; Return DEF if current key sequence is self-inserting in
1330 ;; global-map. 1248 ;; global-map.
1331 (if (memq (global-key-binding (this-single-command-keys)) 1249 (if (memq (global-key-binding (this-single-command-keys))
1332 '(self-insert-command self-insert-iso)) 1250 '(self-insert-command))
1333 def nil)) 1251 def nil))
1334 1252
1335(defvar cua-global-keymap (make-sparse-keymap) 1253(defvar cua-global-keymap (make-sparse-keymap)
@@ -1366,7 +1284,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1366 cua-enable-cua-keys 1284 cua-enable-cua-keys
1367 (not cua-inhibit-cua-keys) 1285 (not cua-inhibit-cua-keys)
1368 (or (eq cua-enable-cua-keys t) 1286 (or (eq cua-enable-cua-keys t)
1369 (not cua--explicit-region-start)) 1287 (region-active-p))
1370 (not executing-kbd-macro) 1288 (not executing-kbd-macro)
1371 (not cua--prefix-override-timer))) 1289 (not cua--prefix-override-timer)))
1372 (setq cua--ena-prefix-repeat-keymap 1290 (setq cua--ena-prefix-repeat-keymap
@@ -1377,7 +1295,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1377 (and cua-enable-cua-keys 1295 (and cua-enable-cua-keys
1378 (not cua-inhibit-cua-keys) 1296 (not cua-inhibit-cua-keys)
1379 (or (eq cua-enable-cua-keys t) 1297 (or (eq cua-enable-cua-keys t)
1380 cua--last-region-shifted))) 1298 (region-active-p))))
1381 (setq cua--ena-global-mark-keymap 1299 (setq cua--ena-global-mark-keymap
1382 (and cua--global-mark-active 1300 (and cua--global-mark-active
1383 (not (window-minibuffer-p))))) 1301 (not (window-minibuffer-p)))))
@@ -1457,13 +1375,6 @@ If ARG is the atom `-', scroll upward by nearly full screen."
1457 (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix) 1375 (define-key cua--region-keymap [(shift control x)] 'cua--shift-control-x-prefix)
1458 (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix) 1376 (define-key cua--region-keymap [(shift control c)] 'cua--shift-control-c-prefix)
1459 1377
1460 ;; replace current region
1461 (define-key cua--region-keymap [remap self-insert-command] 'cua-replace-region)
1462 (define-key cua--region-keymap [remap self-insert-iso] 'cua-replace-region)
1463 (define-key cua--region-keymap [remap insert-register] 'cua-replace-region)
1464 (define-key cua--region-keymap [remap newline-and-indent] 'cua-replace-region)
1465 (define-key cua--region-keymap [remap newline] 'cua-replace-region)
1466 (define-key cua--region-keymap [remap open-line] 'cua-replace-region)
1467 ;; delete current region 1378 ;; delete current region
1468 (define-key cua--region-keymap [remap delete-backward-char] 'cua-delete-region) 1379 (define-key cua--region-keymap [remap delete-backward-char] 'cua-delete-region)
1469 (define-key cua--region-keymap [remap backward-delete-char] 'cua-delete-region) 1380 (define-key cua--region-keymap [remap backward-delete-char] 'cua-delete-region)
@@ -1589,20 +1500,21 @@ shifted movement key, set `cua-highlight-region-shift-only'."
1589 (and (boundp 'delete-selection-mode) delete-selection-mode) 1500 (and (boundp 'delete-selection-mode) delete-selection-mode)
1590 (and (boundp 'pc-selection-mode) pc-selection-mode) 1501 (and (boundp 'pc-selection-mode) pc-selection-mode)
1591 shift-select-mode)) 1502 shift-select-mode))
1592 (if (and (boundp 'delete-selection-mode) delete-selection-mode) 1503 (if cua-delete-selection
1593 (delete-selection-mode -1)) 1504 (delete-selection-mode 1)
1505 (if (and (boundp 'delete-selection-mode) delete-selection-mode)
1506 (delete-selection-mode -1)))
1594 (if (and (boundp 'pc-selection-mode) pc-selection-mode) 1507 (if (and (boundp 'pc-selection-mode) pc-selection-mode)
1595 (pc-selection-mode -1)) 1508 (pc-selection-mode -1))
1596 (cua--deactivate) 1509 (cua--deactivate)
1597 (setq shift-select-mode nil) 1510 (setq shift-select-mode t)
1598 (setq transient-mark-mode (and cua-mode 1511 (transient-mark-mode (if cua-highlight-region-shift-only -1 1)))
1599 (if cua-highlight-region-shift-only
1600 (not cua--explicit-region-start)
1601 t))))
1602 (cua--saved-state 1512 (cua--saved-state
1603 (setq transient-mark-mode (car cua--saved-state)) 1513 (setq transient-mark-mode (car cua--saved-state))
1604 (if (nth 1 cua--saved-state) 1514 (if (nth 1 cua--saved-state)
1605 (delete-selection-mode 1)) 1515 (delete-selection-mode 1)
1516 (if (and (boundp 'delete-selection-mode) delete-selection-mode)
1517 (delete-selection-mode -1)))
1606 (if (nth 2 cua--saved-state) 1518 (if (nth 2 cua--saved-state)
1607 (pc-selection-mode 1)) 1519 (pc-selection-mode 1))
1608 (setq shift-select-mode (nth 3 cua--saved-state)) 1520 (setq shift-select-mode (nth 3 cua--saved-state))
diff --git a/lisp/emulation/cua-gmrk.el b/lisp/emulation/cua-gmrk.el
index 78665624946..5554a7b6f01 100644
--- a/lisp/emulation/cua-gmrk.el
+++ b/lisp/emulation/cua-gmrk.el
@@ -362,7 +362,6 @@ With prefix argument, don't jump to global mark when canceling it."
362 (define-key cua--global-mark-keymap [remap backward-delete-char] 'cua-delete-backward-char-at-global-mark) 362 (define-key cua--global-mark-keymap [remap backward-delete-char] 'cua-delete-backward-char-at-global-mark)
363 (define-key cua--global-mark-keymap [remap backward-delete-char-untabify] 'cua-delete-backward-char-at-global-mark) 363 (define-key cua--global-mark-keymap [remap backward-delete-char-untabify] 'cua-delete-backward-char-at-global-mark)
364 (define-key cua--global-mark-keymap [remap self-insert-command] 'cua-insert-char-at-global-mark) 364 (define-key cua--global-mark-keymap [remap self-insert-command] 'cua-insert-char-at-global-mark)
365 (define-key cua--global-mark-keymap [remap self-insert-iso] 'cua-insert-char-at-global-mark)
366 365
367 ;; Catch self-inserting characters which are "stolen" by other modes 366 ;; Catch self-inserting characters which are "stolen" by other modes
368 (define-key cua--global-mark-keymap [t] 367 (define-key cua--global-mark-keymap [t]
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 16d109c6360..8941bf27de7 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -461,7 +461,7 @@ If command is repeated at same position, delete the rectangle."
461 (cua--deactivate)) 461 (cua--deactivate))
462 (cua-mouse-resize-rectangle event) 462 (cua-mouse-resize-rectangle event)
463 (let ((cua-keep-region-after-copy t)) 463 (let ((cua-keep-region-after-copy t))
464 (cua-copy-rectangle arg) 464 (cua-copy-region arg)
465 (setq cua--mouse-last-pos (cons (point) cua--last-killed-rectangle))))) 465 (setq cua--mouse-last-pos (cons (point) cua--last-killed-rectangle)))))
466 466
467(defun cua--mouse-ignore (_event) 467(defun cua--mouse-ignore (_event)
@@ -877,8 +877,7 @@ With prefix argument, activate previous rectangle if possible."
877 (push-mark nil nil t))) 877 (push-mark nil nil t)))
878 (cua--activate-rectangle) 878 (cua--activate-rectangle)
879 (cua--rectangle-set-corners) 879 (cua--rectangle-set-corners)
880 (setq mark-active t 880 (setq mark-active t)
881 cua--explicit-region-start t)
882 (if cua-enable-rectangle-auto-help 881 (if cua-enable-rectangle-auto-help
883 (cua-help-for-rectangle t)))) 882 (cua-help-for-rectangle t))))
884 883
@@ -886,8 +885,7 @@ With prefix argument, activate previous rectangle if possible."
886 "Cancel current rectangle." 885 "Cancel current rectangle."
887 (interactive) 886 (interactive)
888 (when cua--rectangle 887 (when cua--rectangle
889 (setq mark-active nil 888 (setq mark-active nil)
890 cua--explicit-region-start nil)
891 (cua--deactivate-rectangle))) 889 (cua--deactivate-rectangle)))
892 890
893(defun cua-toggle-rectangle-mark () 891(defun cua-toggle-rectangle-mark ()
@@ -945,32 +943,6 @@ With prefix argument, toggle restriction."
945 (interactive) 943 (interactive)
946 (cua--rectangle-move 'right)) 944 (cua--rectangle-move 'right))
947 945
948(defun cua-copy-rectangle (arg)
949 (interactive "P")
950 (setq arg (cua--prefix-arg arg))
951 (cua--copy-rectangle-as-kill arg)
952 (if cua-keep-region-after-copy
953 (cua--keep-active)
954 (cua--deactivate)))
955
956(defun cua-cut-rectangle (arg)
957 (interactive "P")
958 (if buffer-read-only
959 (cua-copy-rectangle arg)
960 (setq arg (cua--prefix-arg arg))
961 (goto-char (min (mark) (point)))
962 (cua--copy-rectangle-as-kill arg)
963 (cua--delete-rectangle))
964 (cua--deactivate))
965
966(defun cua-delete-rectangle ()
967 (interactive)
968 (goto-char (min (point) (mark)))
969 (if cua-delete-copy-to-register-0
970 (set-register ?0 (cua--extract-rectangle)))
971 (cua--delete-rectangle)
972 (cua--deactivate))
973
974(defun cua-rotate-rectangle () 946(defun cua-rotate-rectangle ()
975 (interactive) 947 (interactive)
976 (cua--rectangle-corner (if (= (cua--rectangle-left) (cua--rectangle-right)) 0 1)) 948 (cua--rectangle-corner (if (= (cua--rectangle-left) (cua--rectangle-right)) 0 1))
@@ -1402,6 +1374,38 @@ With prefix arg, indent to that column."
1402 (goto-char cua--rect-undo-set-point) 1374 (goto-char cua--rect-undo-set-point)
1403 (setq cua--rect-undo-set-point nil))) 1375 (setq cua--rect-undo-set-point nil)))
1404 1376
1377(add-function :around region-extract-function
1378 #'cua--rectangle-region-extract)
1379(add-function :around redisplay-highlight-region-function
1380 #'cua--rectangle-highlight-for-redisplay)
1381
1382(defun cua--rectangle-highlight-for-redisplay (orig &rest args)
1383 (if (not cua--rectangle) (apply orig args)
1384 ;; When cua--rectangle is active, just don't highlight at all, since we
1385 ;; already do it elsewhere.
1386 ))
1387
1388(defun cua--rectangle-region-extract (orig &optional delete)
1389 (cond
1390 ((not cua--rectangle) (funcall orig delete))
1391 ((eq delete 'delete-only) (cua--delete-rectangle))
1392 (t
1393 (let* ((strs (cua--extract-rectangle))
1394 (str (mapconcat #'identity strs "\n")))
1395 (if delete (cua--delete-rectangle))
1396 (setq killed-rectangle strs)
1397 (setq cua--last-killed-rectangle
1398 (cons (and kill-ring (car kill-ring)) killed-rectangle))
1399 (when (eq last-command 'kill-region)
1400 ;; Try to prevent kill-region from appending this to some
1401 ;; earlier element.
1402 (setq last-command 'kill-region-dont-append))
1403 (when strs
1404 (put-text-property 0 (length str) 'yank-handler
1405 `(rectangle--insert-for-yank ,strs t)
1406 str)
1407 str)))))
1408
1405;;; Initialization 1409;;; Initialization
1406 1410
1407(defun cua--rect-M/H-key (key cmd) 1411(defun cua--rect-M/H-key (key cmd)
@@ -1414,11 +1418,6 @@ With prefix arg, indent to that column."
1414 (cua--rect-M/H-key ?\s 'cua-clear-rectangle-mark) 1418 (cua--rect-M/H-key ?\s 'cua-clear-rectangle-mark)
1415 (cua--M/H-key cua--region-keymap ?\s 'cua-toggle-rectangle-mark)) 1419 (cua--M/H-key cua--region-keymap ?\s 'cua-toggle-rectangle-mark))
1416 1420
1417 (define-key cua--rectangle-keymap [remap copy-region-as-kill] 'cua-copy-rectangle)
1418 (define-key cua--rectangle-keymap [remap kill-ring-save] 'cua-copy-rectangle)
1419 (define-key cua--rectangle-keymap [remap kill-region] 'cua-cut-rectangle)
1420 (define-key cua--rectangle-keymap [remap delete-char] 'cua-delete-rectangle)
1421 (define-key cua--rectangle-keymap [remap delete-forward-char] 'cua-delete-rectangle)
1422 (define-key cua--rectangle-keymap [remap set-mark-command] 'cua-toggle-rectangle-mark) 1421 (define-key cua--rectangle-keymap [remap set-mark-command] 'cua-toggle-rectangle-mark)
1423 1422
1424 (define-key cua--rectangle-keymap [remap forward-char] 'cua-resize-rectangle-right) 1423 (define-key cua--rectangle-keymap [remap forward-char] 'cua-resize-rectangle-right)
@@ -1440,7 +1439,6 @@ With prefix arg, indent to that column."
1440 (define-key cua--rectangle-keymap [remap backward-delete-char] 'cua-delete-char-rectangle) 1439 (define-key cua--rectangle-keymap [remap backward-delete-char] 'cua-delete-char-rectangle)
1441 (define-key cua--rectangle-keymap [remap backward-delete-char-untabify] 'cua-delete-char-rectangle) 1440 (define-key cua--rectangle-keymap [remap backward-delete-char-untabify] 'cua-delete-char-rectangle)
1442 (define-key cua--rectangle-keymap [remap self-insert-command] 'cua-insert-char-rectangle) 1441 (define-key cua--rectangle-keymap [remap self-insert-command] 'cua-insert-char-rectangle)
1443 (define-key cua--rectangle-keymap [remap self-insert-iso] 'cua-insert-char-rectangle)
1444 1442
1445 ;; Catch self-inserting characters which are "stolen" by other modes 1443 ;; Catch self-inserting characters which are "stolen" by other modes
1446 (define-key cua--rectangle-keymap [t] 1444 (define-key cua--rectangle-keymap [t]
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 2026d11042d..83b66f78f64 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
12013-12-08 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * gnus-msg.el (gnus-setup-message): Fix the type of argument passed to
4 nnir-article-number and nnir-article-group.
5
12013-12-03 Vitalie Spinu <spinuvit@gmail.com> 62013-12-03 Vitalie Spinu <spinuvit@gmail.com>
2 7
3 * message.el (message-send-mail-with-sendmail): 8 * message.el (message-send-mail-with-sendmail):
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index 0f78f2edc5f..87eb6af9e3c 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -433,12 +433,14 @@ Thank you for your help in stamping out bugs.
433 (,buffer (buffer-name (current-buffer))) 433 (,buffer (buffer-name (current-buffer)))
434 (,article (if (and (gnus-nnir-group-p gnus-newsgroup-name) 434 (,article (if (and (gnus-nnir-group-p gnus-newsgroup-name)
435 gnus-article-reply) 435 gnus-article-reply)
436 (nnir-article-number gnus-article-reply) 436 (nnir-article-number (or (car-safe gnus-article-reply)
437 gnus-article-reply))
437 gnus-article-reply)) 438 gnus-article-reply))
438 (,yanked gnus-article-yanked-articles) 439 (,yanked gnus-article-yanked-articles)
439 (,group (if (and (gnus-nnir-group-p gnus-newsgroup-name) 440 (,group (if (and (gnus-nnir-group-p gnus-newsgroup-name)
440 gnus-article-reply) 441 gnus-article-reply)
441 (nnir-article-group gnus-article-reply) 442 (nnir-article-group (or (car-safe gnus-article-reply)
443 gnus-article-reply))
442 gnus-newsgroup-name)) 444 gnus-newsgroup-name))
443 (message-header-setup-hook 445 (message-header-setup-hook
444 (copy-sequence message-header-setup-hook)) 446 (copy-sequence message-header-setup-hook))
@@ -446,7 +448,7 @@ Thank you for your help in stamping out bugs.
446 (message-mode-hook (copy-sequence message-mode-hook))) 448 (message-mode-hook (copy-sequence message-mode-hook)))
447 (setq mml-buffer-list nil) 449 (setq mml-buffer-list nil)
448 (add-hook 'message-header-setup-hook (lambda () 450 (add-hook 'message-header-setup-hook (lambda ()
449 (gnus-inews-insert-gcc ,group))) 451 (gnus-inews-insert-gcc ,group)))
450 ;; message-newsreader and message-mailer were formerly set in 452 ;; message-newsreader and message-mailer were formerly set in
451 ;; gnus-inews-add-send-actions, but this is too late when 453 ;; gnus-inews-add-send-actions, but this is too late when
452 ;; message-generate-headers-first is used. --ansel 454 ;; message-generate-headers-first is used. --ansel
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 52aa0517fa8..4a96b23a2cd 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -382,8 +382,6 @@ suitable file is found, return nil."
382 (match-string 1 str)))) 382 (match-string 1 str))))
383 (and src-file (file-readable-p src-file) src-file)))))) 383 (and src-file (file-readable-p src-file) src-file))))))
384 384
385(declare-function ad-get-advice-info "advice" (function))
386
387(defun help-fns--key-bindings (function) 385(defun help-fns--key-bindings (function)
388 (when (commandp function) 386 (when (commandp function)
389 (let ((pt2 (with-current-buffer standard-output (point))) 387 (let ((pt2 (with-current-buffer standard-output (point)))
@@ -531,27 +529,34 @@ FILE is the file where FUNCTION was probably defined."
531 529
532;;;###autoload 530;;;###autoload
533(defun describe-function-1 (function) 531(defun describe-function-1 (function)
534 (let* ((advised (and (symbolp function) (featurep 'advice) 532 (let* ((advised (and (symbolp function)
535 (ad-get-advice-info function))) 533 (featurep 'nadvice)
534 (advice--p (advice--symbol-function function))))
536 ;; If the function is advised, use the symbol that has the 535 ;; If the function is advised, use the symbol that has the
537 ;; real definition, if that symbol is already set up. 536 ;; real definition, if that symbol is already set up.
538 (real-function 537 (real-function
539 (or (and advised 538 (or (and advised
540 (let ((origname (cdr (assq 'origname advised)))) 539 (let* ((advised-fn (advice--cdr
541 (and (fboundp origname) origname))) 540 (advice--symbol-function function))))
541 (while (advice--p advised-fn)
542 (setq advised-fn (advice--cdr advised-fn)))
543 advised-fn))
542 function)) 544 function))
543 ;; Get the real definition. 545 ;; Get the real definition.
544 (def (if (symbolp real-function) 546 (def (if (symbolp real-function)
545 (symbol-function real-function) 547 (symbol-function real-function)
546 function)) 548 real-function))
547 (aliased (symbolp def)) 549 (aliased (or (symbolp def)
548 (real-def (if aliased 550 ;; Advised & aliased function.
549 (let ((f def)) 551 (and advised (symbolp real-function))))
550 (while (and (fboundp f) 552 (real-def (cond
551 (symbolp (symbol-function f))) 553 (aliased (let ((f real-function))
552 (setq f (symbol-function f))) 554 (while (and (fboundp f)
553 f) 555 (symbolp (symbol-function f)))
554 def)) 556 (setq f (symbol-function f)))
557 f))
558 ((subrp def) (intern (subr-name def)))
559 (t def)))
555 (file-name (find-lisp-object-file-name function def)) 560 (file-name (find-lisp-object-file-name function def))
556 (pt1 (with-current-buffer (help-buffer) (point))) 561 (pt1 (with-current-buffer (help-buffer) (point)))
557 (beg (if (and (or (byte-code-function-p def) 562 (beg (if (and (or (byte-code-function-p def)
@@ -571,14 +576,20 @@ FILE is the file where FUNCTION was probably defined."
571 (if (eq 'unevalled (cdr (subr-arity def))) 576 (if (eq 'unevalled (cdr (subr-arity def)))
572 (concat beg "special form") 577 (concat beg "special form")
573 (concat beg "built-in function"))) 578 (concat beg "built-in function")))
574 ((byte-code-function-p def) 579 ;; Aliases are Lisp functions, so we need to check
575 (concat beg "compiled Lisp function")) 580 ;; aliases before functions.
576 (aliased 581 (aliased
577 (format "an alias for `%s'" real-def)) 582 (format "an alias for `%s'" real-def))
583 ((or (eq (car-safe def) 'macro)
584 ;; For advised macros, def is a lambda
585 ;; expression or a byte-code-function-p, so we
586 ;; need to check macros before functions.
587 (macrop function))
588 (concat beg "Lisp macro"))
589 ((byte-code-function-p def)
590 (concat beg "compiled Lisp function"))
578 ((eq (car-safe def) 'lambda) 591 ((eq (car-safe def) 'lambda)
579 (concat beg "Lisp function")) 592 (concat beg "Lisp function"))
580 ((eq (car-safe def) 'macro)
581 (concat beg "Lisp macro"))
582 ((eq (car-safe def) 'closure) 593 ((eq (car-safe def) 'closure)
583 (concat beg "Lisp closure")) 594 (concat beg "Lisp closure"))
584 ((autoloadp def) 595 ((autoloadp def)
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 13c4c36be17..9e267d26c9b 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -545,17 +545,17 @@
545 (let ((x-select-enable-clipboard t)) 545 (let ((x-select-enable-clipboard t))
546 (yank))) 546 (yank)))
547 547
548(defun clipboard-kill-ring-save (beg end) 548(defun clipboard-kill-ring-save (beg end &optional region)
549 "Copy region to kill ring, and save in the X clipboard." 549 "Copy region to kill ring, and save in the X clipboard."
550 (interactive "r") 550 (interactive "r\np")
551 (let ((x-select-enable-clipboard t)) 551 (let ((x-select-enable-clipboard t))
552 (kill-ring-save beg end))) 552 (kill-ring-save beg end region)))
553 553
554(defun clipboard-kill-region (beg end) 554(defun clipboard-kill-region (beg end &optional region)
555 "Kill the region, and save it in the X clipboard." 555 "Kill the region, and save it in the X clipboard."
556 (interactive "r") 556 (interactive "r\np")
557 (let ((x-select-enable-clipboard t)) 557 (let ((x-select-enable-clipboard t))
558 (kill-region beg end))) 558 (kill-region beg end region)))
559 559
560(defun menu-bar-enable-clipboard () 560(defun menu-bar-enable-clipboard ()
561 "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard. 561 "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el
index 55bda8368e0..ad44517fb6c 100644
--- a/lisp/org/ox-ascii.el
+++ b/lisp/org/ox-ascii.el
@@ -1198,7 +1198,7 @@ contextual information."
1198 (todo type priority name tags contents width inlinetask info) 1198 (todo type priority name tags contents width inlinetask info)
1199 "Format an inline task element for ASCII export. 1199 "Format an inline task element for ASCII export.
1200See `org-ascii-format-inlinetask-function' for a description 1200See `org-ascii-format-inlinetask-function' for a description
1201of the paramaters." 1201of the parameters."
1202 (let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)) 1202 (let* ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))
1203 (width (or width org-ascii-inlinetask-width))) 1203 (width (or width org-ascii-inlinetask-width)))
1204 (org-ascii--indent-string 1204 (org-ascii--indent-string
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index ab86b83f7bf..e81504ce947 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1,9 +1,9 @@
1;;; flymake.el --- a universal on-the-fly syntax checker 1;;; flymake.el --- a universal on-the-fly syntax checker -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 2003-2013 Free Software Foundation, Inc. 3;; Copyright (C) 2003-2013 Free Software Foundation, Inc.
4 4
5;; Author: Pavel Kobyakov <pk_at_work@yahoo.com> 5;; Author: Pavel Kobyakov <pk_at_work@yahoo.com>
6;; Maintainer: Pavel Kobyakov <pk_at_work@yahoo.com> 6;; Maintainer: Leo Liu <sdl.web@gmail.com>
7;; Version: 0.3 7;; Version: 0.3
8;; Keywords: c languages tools 8;; Keywords: c languages tools
9 9
@@ -24,9 +24,9 @@
24 24
25;;; Commentary: 25;;; Commentary:
26;; 26;;
27;; Flymake is a minor Emacs mode performing on-the-fly syntax 27;; Flymake is a minor Emacs mode performing on-the-fly syntax checks
28;; checks using the external syntax check tool (for C/C++ this 28;; using the external syntax check tool (for C/C++ this is usually the
29;; is usually the compiler) 29;; compiler).
30 30
31;;; Bugs/todo: 31;;; Bugs/todo:
32 32
@@ -36,188 +36,76 @@
36;;; Code: 36;;; Code:
37 37
38(eval-when-compile (require 'cl-lib)) 38(eval-when-compile (require 'cl-lib))
39(if (featurep 'xemacs) (require 'overlay))
40 39
41(defvar flymake-is-running nil 40(defgroup flymake nil
42 "If t, flymake syntax check process is running for the current buffer.") 41 "Universal on-the-fly syntax checker."
43(make-variable-buffer-local 'flymake-is-running) 42 :version "23.1"
43 :group 'tools)
44 44
45(defvar flymake-timer nil 45(defcustom flymake-error-bitmap '(exclamation-mark error)
46 "Timer for starting syntax check.") 46 "Bitmap (a symbol) used in the fringe for indicating errors.
47(make-variable-buffer-local 'flymake-timer) 47The value may also be a list of two elements where the second
48element specifies the face for the bitmap. For possible bitmap
49symbols, see `fringe-bitmaps'. See also `flymake-warning-bitmap'.
48 50
49(defvar flymake-last-change-time nil 51The option `flymake-fringe-indicator-position' controls how and where
50 "Time of last buffer change.") 52this is used."
51(make-variable-buffer-local 'flymake-last-change-time) 53 :group 'flymake
54 :version "24.3"
55 :type '(choice (symbol :tag "Bitmap")
56 (list :tag "Bitmap and face"
57 (symbol :tag "Bitmap")
58 (face :tag "Face"))))
52 59
53(defvar flymake-check-start-time nil 60(defcustom flymake-warning-bitmap 'question-mark
54 "Time at which syntax check was started.") 61 "Bitmap (a symbol) used in the fringe for indicating warnings.
55(make-variable-buffer-local 'flymake-check-start-time) 62The value may also be a list of two elements where the second
63element specifies the face for the bitmap. For possible bitmap
64symbols, see `fringe-bitmaps'. See also `flymake-error-bitmap'.
56 65
57(defvar flymake-check-was-interrupted nil 66The option `flymake-fringe-indicator-position' controls how and where
58 "Non-nil if syntax check was killed by `flymake-compile'.") 67this is used."
59(make-variable-buffer-local 'flymake-check-was-interrupted) 68 :group 'flymake
69 :version "24.3"
70 :type '(choice (symbol :tag "Bitmap")
71 (list :tag "Bitmap and face"
72 (symbol :tag "Bitmap")
73 (face :tag "Face"))))
60 74
61(defvar flymake-err-info nil 75(defcustom flymake-fringe-indicator-position 'left-fringe
62 "Sorted list of line numbers and lists of err info in the form (file, err-text).") 76 "The position to put flymake fringe indicator.
63(make-variable-buffer-local 'flymake-err-info) 77The value can be nil (do not use indicators), `left-fringe' or `right-fringe'.
78See `flymake-error-bitmap' and `flymake-warning-bitmap'."
79 :group 'flymake
80 :version "24.3"
81 :type '(choice (const left-fringe)
82 (const right-fringe)
83 (const :tag "No fringe indicators" nil)))
64 84
65(defvar flymake-new-err-info nil 85(defcustom flymake-compilation-prevents-syntax-check t
66 "Same as `flymake-err-info', effective when a syntax check is in progress.") 86 "If non-nil, don't start syntax check if compilation is running."
67(make-variable-buffer-local 'flymake-new-err-info) 87 :group 'flymake
68 88 :type 'boolean)
69;;;; [[ cross-emacs compatibility routines 89
70(defsubst flymake-makehash (&optional test) 90(defcustom flymake-start-syntax-check-on-newline t
71 "Create and return a new hash table using TEST to compare keys. 91 "Start syntax check if newline char was added/removed from the buffer."
72It uses the function `make-hash-table' to make a hash-table if 92 :group 'flymake
73you use GNU Emacs, otherwise it uses `makehash'." 93 :type 'boolean)
74 (if (fboundp 'make-hash-table) 94
75 (if test (make-hash-table :test test) (make-hash-table)) 95(defcustom flymake-no-changes-timeout 0.5
76 (with-no-warnings 96 "Time to wait after last change before starting compilation."
77 (makehash test)))) 97 :group 'flymake
78 98 :type 'number)
79(defalias 'flymake-float-time
80 (if (fboundp 'float-time)
81 'float-time
82 (if (featurep 'xemacs)
83 (lambda ()
84 (multiple-value-bind (s0 s1 s2) (values-list (current-time))
85 (+ (* (float (ash 1 16)) s0) (float s1) (* 0.0000001 s2)))))))
86
87(defalias 'flymake-replace-regexp-in-string
88 (if (eval-when-compile (fboundp 'replace-regexp-in-string))
89 'replace-regexp-in-string
90 (lambda (regexp rep str)
91 (replace-in-string str regexp rep))))
92
93(defalias 'flymake-split-string
94 (if (condition-case nil (equal (split-string " bc " " " t) '("bc"))
95 (error nil))
96 (lambda (str pattern) (split-string str pattern t))
97 (lambda (str pattern)
98 "Split STR into a list of substrings bounded by PATTERN.
99Zero-length substrings at the beginning and end of the list are omitted."
100 (let ((split (split-string str pattern)))
101 (while (equal (car split) "") (setq split (cdr split)))
102 (setq split (nreverse split))
103 (while (equal (car split) "") (setq split (cdr split)))
104 (nreverse split)))))
105
106(defalias 'flymake-get-temp-dir
107 (if (fboundp 'temp-directory)
108 'temp-directory
109 (lambda () temporary-file-directory)))
110
111(defun flymake-posn-at-point-as-event (&optional position window dx dy)
112 "Return pixel position of top left corner of glyph at POSITION.
113
114The position is relative to top left corner of WINDOW, as a
115mouse-1 click event (identical to the event that would be
116triggered by clicking mouse button 1 at the top left corner of
117the glyph).
118
119POSITION and WINDOW default to the position of point in the
120selected window.
121
122DX and DY specify optional offsets from the top left of the glyph."
123 (unless window (setq window (selected-window)))
124 (unless position (setq position (window-point window)))
125 (unless dx (setq dx 0))
126 (unless dy (setq dy 0))
127
128 (let* ((pos (posn-at-point position window))
129 (x-y (posn-x-y pos))
130 (edges (window-inside-pixel-edges window))
131 (win-x-y (window-pixel-edges window)))
132 ;; adjust for window edges
133 (setcar (nthcdr 2 pos)
134 (cons (+ (car x-y) (car edges) (- (car win-x-y)) dx)
135 (+ (cdr x-y) (cadr edges) (- (cadr win-x-y)) dy)))
136 (list 'mouse-1 pos)))
137
138(defun flymake-popup-menu (menu-data)
139 "Pop up the flymake menu at point, using the data MENU-DATA.
140POS is a list of the form ((X Y) WINDOW), where X and Y are
141pixels positions from the top left corner of WINDOW's frame.
142MENU-DATA is a list of error and warning messages returned by
143`flymake-make-err-menu-data'."
144 (if (featurep 'xemacs)
145 (let* ((pos (flymake-get-point-pixel-pos))
146 (x-pos (nth 0 pos))
147 (y-pos (nth 1 pos))
148 (fake-event-props '(button 1 x 1 y 1)))
149 (setq fake-event-props (plist-put fake-event-props 'x x-pos))
150 (setq fake-event-props (plist-put fake-event-props 'y y-pos))
151 (popup-menu (flymake-make-xemacs-menu menu-data)
152 (make-event 'button-press fake-event-props)))
153 (x-popup-menu (if (eval-when-compile (fboundp 'posn-at-point))
154 (flymake-posn-at-point-as-event)
155 (list (flymake-get-point-pixel-pos) (selected-window)))
156 (flymake-make-emacs-menu menu-data))))
157
158(defun flymake-make-emacs-menu (menu-data)
159 "Return a menu specifier using MENU-DATA.
160MENU-DATA is a list of error and warning messages returned by
161`flymake-make-err-menu-data'.
162See `x-popup-menu' for the menu specifier format."
163 (let* ((menu-title (nth 0 menu-data))
164 (menu-items (nth 1 menu-data))
165 (menu-commands (mapcar (lambda (foo)
166 (cons (nth 0 foo) (nth 1 foo)))
167 menu-items)))
168 (list menu-title (cons "" menu-commands))))
169
170(if (featurep 'xemacs) (progn
171
172(defun flymake-nop ()
173 "Do nothing."
174 nil)
175
176(defun flymake-make-xemacs-menu (menu-data)
177 "Return a menu specifier using MENU-DATA."
178 (let* ((menu-title (nth 0 menu-data))
179 (menu-items (nth 1 menu-data))
180 (menu-commands nil))
181 (setq menu-commands (mapcar (lambda (foo)
182 (vector (nth 0 foo) (or (nth 1 foo) '(flymake-nop)) t))
183 menu-items))
184 (cons menu-title menu-commands)))
185
186)) ;; xemacs
187
188(unless (eval-when-compile (fboundp 'posn-at-point))
189
190(defun flymake-current-row ()
191 "Return current row number in current frame."
192 (if (fboundp 'window-edges)
193 (+ (car (cdr (window-edges))) (count-lines (window-start) (point)))
194 (count-lines (window-start) (point))))
195
196(defun flymake-selected-frame ()
197 "Return the frame that is now selected."
198 (if (fboundp 'window-edges)
199 (selected-frame)
200 (selected-window)))
201
202(defun flymake-get-point-pixel-pos ()
203 "Return point position in pixels: (x, y)."
204 (let ((mouse-pos (mouse-position))
205 (pixel-pos nil)
206 (ret nil))
207 (if (car (cdr mouse-pos))
208 (progn
209 (set-mouse-position (flymake-selected-frame) (current-column) (flymake-current-row))
210 (setq pixel-pos (mouse-pixel-position))
211 (set-mouse-position (car mouse-pos) (car (cdr mouse-pos)) (cdr (cdr mouse-pos)))
212 (setq ret (list (car (cdr pixel-pos)) (cdr (cdr pixel-pos)))))
213 (progn
214 (setq ret '(0 0))))
215 (flymake-log 3 "mouse pos is %s" ret)
216 ret))
217 99
218) ;; End of (unless (fboundp 'posn-at-point) 100(defcustom flymake-gui-warnings-enabled t
101 "Enables/disables GUI warnings."
102 :group 'flymake
103 :type 'boolean)
219 104
220;;;; ]] 105(defcustom flymake-start-syntax-check-on-find-file t
106 "Start syntax check on find file."
107 :group 'flymake
108 :type 'boolean)
221 109
222(defcustom flymake-log-level -1 110(defcustom flymake-log-level -1
223 "Logging level, only messages with level lower or equal will be logged. 111 "Logging level, only messages with level lower or equal will be logged.
@@ -225,55 +113,6 @@ See `x-popup-menu' for the menu specifier format."
225 :group 'flymake 113 :group 'flymake
226 :type 'integer) 114 :type 'integer)
227 115
228
229;; (defcustom flymake-log-file-name "~/flymake.log"
230;; "Where to put the flymake log if logging is enabled.
231;;
232;; See `flymake-log-level' if you want to control what is logged."
233;; :group 'flymake
234;; :type 'string)
235
236(defun flymake-log (level text &rest args)
237 "Log a message at level LEVEL.
238If LEVEL is higher than `flymake-log-level', the message is
239ignored. Otherwise, it is printed using `message'.
240TEXT is a format control string, and the remaining arguments ARGS
241are the string substitutions (see the function `format')."
242 (if (<= level flymake-log-level)
243 (let* ((msg (apply 'format text args)))
244 (message "%s" msg)
245 ;;(with-temp-buffer
246 ;; (insert msg)
247 ;; (insert "\n")
248 ;; (flymake-save-buffer-in-file "~/flymake.log") ; make log file name customizable
249 ;;)
250 )))
251
252(defun flymake-ins-after (list pos val)
253 "Insert VAL into LIST after position POS.
254POS counts from zero."
255 (let ((tmp (copy-sequence list)))
256 (setcdr (nthcdr pos tmp) (cons val (nthcdr (1+ pos) tmp)))
257 tmp))
258
259(defun flymake-set-at (list pos val)
260 "Set VAL at position POS in LIST.
261POS counts from zero."
262 (let ((tmp (copy-sequence list)))
263 (setcar (nthcdr pos tmp) val)
264 tmp))
265
266(defvar flymake-processes nil
267 "List of currently active flymake processes.")
268
269(defvar flymake-output-residual nil)
270(make-variable-buffer-local 'flymake-output-residual)
271
272(defgroup flymake nil
273 "Universal on-the-fly syntax checker."
274 :version "23.1"
275 :group 'tools)
276
277(defcustom flymake-xml-program 116(defcustom flymake-xml-program
278 (if (executable-find "xmlstarlet") "xmlstarlet" "xml") 117 (if (executable-find "xmlstarlet") "xmlstarlet" "xml")
279 "Program to use for XML validation." 118 "Program to use for XML validation."
@@ -281,6 +120,16 @@ POS counts from zero."
281 :group 'flymake 120 :group 'flymake
282 :version "24.4") 121 :version "24.4")
283 122
123(defcustom flymake-master-file-dirs '("." "./src" "./UnitTest")
124 "Dirs where to look for master files."
125 :group 'flymake
126 :type '(repeat (string)))
127
128(defcustom flymake-master-file-count-limit 32
129 "Max number of master files to check."
130 :group 'flymake
131 :type 'integer)
132
284(defcustom flymake-allowed-file-name-masks 133(defcustom flymake-allowed-file-name-masks
285 '(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-simple-make-init) 134 '(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-simple-make-init)
286 ("\\.xml\\'" flymake-xml-init) 135 ("\\.xml\\'" flymake-xml-init)
@@ -322,6 +171,56 @@ NAME is the file name function to use, default `flymake-get-real-file-name'."
322 (const :tag "flymake-get-real-file-name" nil) 171 (const :tag "flymake-get-real-file-name" nil)
323 function)))) 172 function))))
324 173
174(defvar-local flymake-is-running nil
175 "If t, flymake syntax check process is running for the current buffer.")
176
177(defvar-local flymake-timer nil
178 "Timer for starting syntax check.")
179
180(defvar-local flymake-last-change-time nil
181 "Time of last buffer change.")
182
183(defvar-local flymake-check-start-time nil
184 "Time at which syntax check was started.")
185
186(defvar-local flymake-check-was-interrupted nil
187 "Non-nil if syntax check was killed by `flymake-compile'.")
188
189(defvar-local flymake-err-info nil
190 "Sorted list of line numbers and lists of err info in the form (file, err-text).")
191
192(defvar-local flymake-new-err-info nil
193 "Same as `flymake-err-info', effective when a syntax check is in progress.")
194
195(defun flymake-log (level text &rest args)
196 "Log a message at level LEVEL.
197If LEVEL is higher than `flymake-log-level', the message is
198ignored. Otherwise, it is printed using `message'.
199TEXT is a format control string, and the remaining arguments ARGS
200are the string substitutions (see the function `format')."
201 (if (<= level flymake-log-level)
202 (let* ((msg (apply 'format text args)))
203 (message "%s" msg))))
204
205(defun flymake-ins-after (list pos val)
206 "Insert VAL into LIST after position POS.
207POS counts from zero."
208 (let ((tmp (copy-sequence list)))
209 (setcdr (nthcdr pos tmp) (cons val (nthcdr (1+ pos) tmp)))
210 tmp))
211
212(defun flymake-set-at (list pos val)
213 "Set VAL at position POS in LIST.
214POS counts from zero."
215 (let ((tmp (copy-sequence list)))
216 (setcar (nthcdr pos tmp) val)
217 tmp))
218
219(defvar flymake-processes nil
220 "List of currently active flymake processes.")
221
222(defvar-local flymake-output-residual nil)
223
325(defun flymake-get-file-name-mode-and-masks (file-name) 224(defun flymake-get-file-name-mode-and-masks (file-name)
326 "Return the corresponding entry from `flymake-allowed-file-name-masks'." 225 "Return the corresponding entry from `flymake-allowed-file-name-masks'."
327 (unless (stringp file-name) 226 (unless (stringp file-name)
@@ -356,7 +255,7 @@ Return nil if we cannot, non-nil if we can."
356 (or (nth 2 (flymake-get-file-name-mode-and-masks file-name)) 255 (or (nth 2 (flymake-get-file-name-mode-and-masks file-name))
357 'flymake-get-real-file-name)) 256 'flymake-get-real-file-name))
358 257
359(defvar flymake-find-buildfile-cache (flymake-makehash 'equal)) 258(defvar flymake-find-buildfile-cache (make-hash-table :test #'equal))
360 259
361(defun flymake-get-buildfile-from-cache (dir-name) 260(defun flymake-get-buildfile-from-cache (dir-name)
362 "Look up DIR-NAME in cache and return its associated value. 261 "Look up DIR-NAME in cache and return its associated value.
@@ -400,16 +299,6 @@ Return t if so, nil if not."
400 (equal (flymake-fix-file-name file-name-one) 299 (equal (flymake-fix-file-name file-name-one)
401 (flymake-fix-file-name file-name-two))) 300 (flymake-fix-file-name file-name-two)))
402 301
403(defcustom flymake-master-file-dirs '("." "./src" "./UnitTest")
404 "Dirs where to look for master files."
405 :group 'flymake
406 :type '(repeat (string)))
407
408(defcustom flymake-master-file-count-limit 32
409 "Max number of master files to check."
410 :group 'flymake
411 :type 'integer)
412
413;; This is bound dynamically to pass a parameter to a sort predicate below 302;; This is bound dynamically to pass a parameter to a sort predicate below
414(defvar flymake-included-file-name) 303(defvar flymake-included-file-name)
415 304
@@ -456,12 +345,9 @@ to the beginning of the list (File.h -> File.cpp moved to top)."
456 (file-name-base file-one)) 345 (file-name-base file-one))
457 (not (equal file-one file-two)))) 346 (not (equal file-one file-two))))
458 347
459(defcustom flymake-check-file-limit 8192 348(defvar flymake-check-file-limit 8192
460 "Maximum number of chars to look at when checking possible master file. 349 "Maximum number of chars to look at when checking possible master file.
461Nil means search the entire file." 350Nil means search the entire file.")
462 :group 'flymake
463 :type '(choice (const :tag "No limit" nil)
464 (integer :tag "Characters")))
465 351
466(defun flymake-check-patch-master-file-buffer 352(defun flymake-check-patch-master-file-buffer
467 (master-file-temp-buffer 353 (master-file-temp-buffer
@@ -537,6 +423,7 @@ instead of reading master file from disk."
537 (flymake-log 2 "found master file %s" master-file-name)) 423 (flymake-log 2 "found master file %s" master-file-name))
538 found)) 424 found))
539 425
426;;; XXX: remove
540(defun flymake-replace-region (beg end rep) 427(defun flymake-replace-region (beg end rep)
541 "Replace text in BUFFER in region (BEG END) with REP." 428 "Replace text in BUFFER in region (BEG END) with REP."
542 (save-excursion 429 (save-excursion
@@ -622,16 +509,6 @@ Create parent directories as needed."
622 (write-region nil nil file-name nil 566) 509 (write-region nil nil file-name nil 566)
623 (flymake-log 3 "saved buffer %s in file %s" (buffer-name) file-name)) 510 (flymake-log 3 "saved buffer %s in file %s" (buffer-name) file-name))
624 511
625(defun flymake-save-string-to-file (file-name data)
626 "Save string DATA to file FILE-NAME."
627 (write-region data nil file-name nil 566))
628
629(defun flymake-read-file-to-string (file-name)
630 "Read contents of file FILE-NAME and return as a string."
631 (with-temp-buffer
632 (insert-file-contents file-name)
633 (buffer-substring (point-min) (point-max))))
634
635(defun flymake-process-filter (process output) 512(defun flymake-process-filter (process output)
636 "Parse OUTPUT and highlight error lines. 513 "Parse OUTPUT and highlight error lines.
637It's flymake process filter." 514It's flymake process filter."
@@ -681,7 +558,7 @@ It's flymake process filter."
681 (setq flymake-new-err-info nil) 558 (setq flymake-new-err-info nil)
682 (setq flymake-err-info 559 (setq flymake-err-info
683 (flymake-fix-line-numbers 560 (flymake-fix-line-numbers
684 flymake-err-info 1 (flymake-count-lines))) 561 flymake-err-info 1 (count-lines (point-min) (point-max))))
685 (flymake-delete-own-overlays) 562 (flymake-delete-own-overlays)
686 (flymake-highlight-err-lines flymake-err-info) 563 (flymake-highlight-err-lines flymake-err-info)
687 (let (err-count warn-count) 564 (let (err-count warn-count)
@@ -689,7 +566,7 @@ It's flymake process filter."
689 (setq warn-count (flymake-get-err-count flymake-err-info "w")) 566 (setq warn-count (flymake-get-err-count flymake-err-info "w"))
690 (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)" 567 (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
691 (buffer-name) err-count warn-count 568 (buffer-name) err-count warn-count
692 (- (flymake-float-time) flymake-check-start-time)) 569 (- (float-time) flymake-check-start-time))
693 (setq flymake-check-start-time nil) 570 (setq flymake-check-start-time nil)
694 571
695 (if (and (equal 0 err-count) (equal 0 warn-count)) 572 (if (and (equal 0 err-count) (equal 0 warn-count))
@@ -810,47 +687,7 @@ line number outside the file being compiled."
810 "Determine whether overlay OV was created by flymake." 687 "Determine whether overlay OV was created by flymake."
811 (and (overlayp ov) (overlay-get ov 'flymake-overlay))) 688 (and (overlayp ov) (overlay-get ov 'flymake-overlay)))
812 689
813(defcustom flymake-error-bitmap '(exclamation-mark error) 690(defun flymake-make-overlay (beg end tooltip-text face bitmap)
814 "Bitmap (a symbol) used in the fringe for indicating errors.
815The value may also be a list of two elements where the second
816element specifies the face for the bitmap. For possible bitmap
817symbols, see `fringe-bitmaps'. See also `flymake-warning-bitmap'.
818
819The option `flymake-fringe-indicator-position' controls how and where
820this is used."
821 :group 'flymake
822 :version "24.3"
823 :type '(choice (symbol :tag "Bitmap")
824 (list :tag "Bitmap and face"
825 (symbol :tag "Bitmap")
826 (face :tag "Face"))))
827
828(defcustom flymake-warning-bitmap 'question-mark
829 "Bitmap (a symbol) used in the fringe for indicating warnings.
830The value may also be a list of two elements where the second
831element specifies the face for the bitmap. For possible bitmap
832symbols, see `fringe-bitmaps'. See also `flymake-error-bitmap'.
833
834The option `flymake-fringe-indicator-position' controls how and where
835this is used."
836 :group 'flymake
837 :version "24.3"
838 :type '(choice (symbol :tag "Bitmap")
839 (list :tag "Bitmap and face"
840 (symbol :tag "Bitmap")
841 (face :tag "Face"))))
842
843(defcustom flymake-fringe-indicator-position 'left-fringe
844 "The position to put flymake fringe indicator.
845The value can be nil (do not use indicators), `left-fringe' or `right-fringe'.
846See `flymake-error-bitmap' and `flymake-warning-bitmap'."
847 :group 'flymake
848 :version "24.3"
849 :type '(choice (const left-fringe)
850 (const right-fringe)
851 (const :tag "No fringe indicators" nil)))
852
853(defun flymake-make-overlay (beg end tooltip-text face bitmap mouse-face)
854 "Allocate a flymake overlay in range BEG and END." 691 "Allocate a flymake overlay in range BEG and END."
855 (when (not (flymake-region-has-flymake-overlays beg end)) 692 (when (not (flymake-region-has-flymake-overlays beg end))
856 (let ((ov (make-overlay beg end nil t t)) 693 (let ((ov (make-overlay beg end nil t t))
@@ -861,7 +698,6 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'."
861 bitmap 698 bitmap
862 (list bitmap))))))) 699 (list bitmap)))))))
863 (overlay-put ov 'face face) 700 (overlay-put ov 'face face)
864 (overlay-put ov 'mouse-face mouse-face)
865 (overlay-put ov 'help-echo tooltip-text) 701 (overlay-put ov 'help-echo tooltip-text)
866 (overlay-put ov 'flymake-overlay t) 702 (overlay-put ov 'flymake-overlay t)
867 (overlay-put ov 'priority 100) 703 (overlay-put ov 'priority 100)
@@ -913,42 +749,19 @@ Return t if it has at least one flymake overlay, nil if no overlay."
913Perhaps use text from LINE-ERR-INFO-LIST to enhance highlighting." 749Perhaps use text from LINE-ERR-INFO-LIST to enhance highlighting."
914 (goto-char (point-min)) 750 (goto-char (point-min))
915 (forward-line (1- line-no)) 751 (forward-line (1- line-no))
916 (let* ((line-beg (point-at-bol)) 752 (pcase-let* ((beg (progn (back-to-indentation) (point)))
917 (line-end (point-at-eol)) 753 (end (progn
918 (beg line-beg) 754 (end-of-line)
919 (end line-end) 755 (skip-chars-backward " \t\f\t\n" beg)
920 (tooltip-text (flymake-ler-text (nth 0 line-err-info-list))) 756 (if (eq (point) beg)
921 (face nil) 757 (line-beginning-position 2)
922 (bitmap nil)) 758 (point))))
923 759 (tooltip-text (mapconcat #'flymake-ler-text line-err-info-list "\n"))
924 (goto-char line-beg) 760 (`(,face ,bitmap)
925 (while (looking-at "[ \t]") 761 (if (> (flymake-get-line-err-count line-err-info-list "e") 0)
926 (forward-char)) 762 (list 'flymake-errline flymake-error-bitmap)
927 763 (list 'flymake-warnline flymake-warning-bitmap))))
928 (setq beg (point)) 764 (flymake-make-overlay beg end tooltip-text face bitmap)))
929
930 (goto-char line-end)
931 (while (and (looking-at "[ \t\r\n]") (> (point) 1))
932 (backward-char))
933
934 (setq end (1+ (point)))
935
936 (when (<= end beg)
937 (setq beg line-beg)
938 (setq end line-end))
939
940 (when (= end beg)
941 (goto-char end)
942 (forward-line)
943 (setq end (point)))
944
945 (if (> (flymake-get-line-err-count line-err-info-list "e") 0)
946 (setq face 'flymake-errline
947 bitmap flymake-error-bitmap)
948 (setq face 'flymake-warnline
949 bitmap flymake-warning-bitmap))
950
951 (flymake-make-overlay beg end tooltip-text face bitmap nil)))
952 765
953(defun flymake-parse-err-lines (err-info-list lines) 766(defun flymake-parse-err-lines (err-info-list lines)
954 "Parse err LINES, store info in ERR-INFO-LIST." 767 "Parse err LINES, store info in ERR-INFO-LIST."
@@ -978,7 +791,7 @@ Perhaps use text from LINE-ERR-INFO-LIST to enhance highlighting."
978Return last one as residual if it does not end with newline char. 791Return last one as residual if it does not end with newline char.
979Returns ((LINES) RESIDUAL)." 792Returns ((LINES) RESIDUAL)."
980 (when (and output (> (length output) 0)) 793 (when (and output (> (length output) 0))
981 (let* ((lines (flymake-split-string output "[\n\r]+")) 794 (let* ((lines (split-string output "[\n\r]+" t))
982 (complete (equal "\n" (char-to-string (aref output (1- (length output)))))) 795 (complete (equal "\n" (char-to-string (aref output (1- (length output))))))
983 (residual nil)) 796 (residual nil))
984 (when (not complete) 797 (when (not complete)
@@ -1036,19 +849,6 @@ Convert it to flymake internal format."
1036Use `flymake-reformat-err-line-patterns-from-compile-el' to add patterns 849Use `flymake-reformat-err-line-patterns-from-compile-el' to add patterns
1037from compile.el") 850from compile.el")
1038 851
1039;;(defcustom flymake-err-line-patterns
1040;; '(
1041;; ; MS Visual C++ 6.0
1042;; ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
1043;; 1 3 4)
1044;; ; jikes
1045;; ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\):[ \t\n]*\\(.+\\)\\)"
1046;; 1 3 4))
1047;; "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)"
1048;; :group 'flymake
1049;; :type '(repeat (string number number number))
1050;;)
1051
1052(define-obsolete-variable-alias 'flymake-warning-re 'flymake-warning-predicate "24.4") 852(define-obsolete-variable-alias 'flymake-warning-re 'flymake-warning-predicate "24.4")
1053(defvar flymake-warning-predicate "^[wW]arning" 853(defvar flymake-warning-predicate "^[wW]arning"
1054 "Predicate matching against error text to detect a warning. 854 "Predicate matching against error text to detect a warning.
@@ -1163,26 +963,24 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
1163 (shell-quote-argument basedir) 963 (shell-quote-argument basedir)
1164 " DUMPVARS=INCLUDE_DIRS dumpvars")) 964 " DUMPVARS=INCLUDE_DIRS dumpvars"))
1165 (output (shell-command-to-string command-line)) 965 (output (shell-command-to-string command-line))
1166 (lines (flymake-split-string output "\n")) 966 (lines (split-string output "\n" t))
1167 (count (length lines)) 967 (count (length lines))
1168 (idx 0) 968 (idx 0)
1169 (inc-dirs nil)) 969 (inc-dirs nil))
1170 (while (and (< idx count) (not (string-match "^INCLUDE_DIRS=.*" (nth idx lines)))) 970 (while (and (< idx count) (not (string-match "^INCLUDE_DIRS=.*" (nth idx lines))))
1171 (setq idx (1+ idx))) 971 (setq idx (1+ idx)))
1172 (when (< idx count) 972 (when (< idx count)
1173 (let* ((inc-lines (flymake-split-string (nth idx lines) " *-I")) 973 (let* ((inc-lines (split-string (nth idx lines) " *-I" t))
1174 (inc-count (length inc-lines))) 974 (inc-count (length inc-lines)))
1175 (while (> inc-count 0) 975 (while (> inc-count 0)
1176 (when (not (string-match "^INCLUDE_DIRS=.*" (nth (1- inc-count) inc-lines))) 976 (when (not (string-match "^INCLUDE_DIRS=.*" (nth (1- inc-count) inc-lines)))
1177 (push (flymake-replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs)) 977 (push (replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs))
1178 (setq inc-count (1- inc-count))))) 978 (setq inc-count (1- inc-count)))))
1179 (flymake-add-project-include-dirs-to-cache basedir inc-dirs) 979 (flymake-add-project-include-dirs-to-cache basedir inc-dirs)
1180 inc-dirs))) 980 inc-dirs)))
1181 981
1182(defcustom flymake-get-project-include-dirs-function 'flymake-get-project-include-dirs-imp 982(defvar flymake-get-project-include-dirs-function #'flymake-get-project-include-dirs-imp
1183 "Function used to get project include dirs, one parameter: basedir name." 983 "Function used to get project include dirs, one parameter: basedir name.")
1184 :group 'flymake
1185 :type 'function)
1186 984
1187(defun flymake-get-project-include-dirs (basedir) 985(defun flymake-get-project-include-dirs (basedir)
1188 (funcall flymake-get-project-include-dirs-function basedir)) 986 (funcall flymake-get-project-include-dirs-function basedir))
@@ -1190,9 +988,9 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
1190(defun flymake-get-system-include-dirs () 988(defun flymake-get-system-include-dirs ()
1191 "System include dirs - from the 'INCLUDE' env setting." 989 "System include dirs - from the 'INCLUDE' env setting."
1192 (let* ((includes (getenv "INCLUDE"))) 990 (let* ((includes (getenv "INCLUDE")))
1193 (if includes (flymake-split-string includes path-separator) nil))) 991 (if includes (split-string includes path-separator t) nil)))
1194 992
1195(defvar flymake-project-include-dirs-cache (flymake-makehash 'equal)) 993(defvar flymake-project-include-dirs-cache (make-hash-table :test #'equal))
1196 994
1197(defun flymake-get-project-include-dirs-from-cache (base-dir) 995(defun flymake-get-project-include-dirs-from-cache (base-dir)
1198 (gethash base-dir flymake-project-include-dirs-cache)) 996 (gethash base-dir flymake-project-include-dirs-cache))
@@ -1232,11 +1030,6 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
1232 (error 1030 (error
1233 (flymake-log 1 "Failed to delete dir %s, error ignored" dir-name)))) 1031 (flymake-log 1 "Failed to delete dir %s, error ignored" dir-name))))
1234 1032
1235(defcustom flymake-compilation-prevents-syntax-check t
1236 "If non-nil, don't start syntax check if compilation is running."
1237 :group 'flymake
1238 :type 'boolean)
1239
1240(defun flymake-start-syntax-check () 1033(defun flymake-start-syntax-check ()
1241 "Start syntax checking for current buffer." 1034 "Start syntax checking for current buffer."
1242 (interactive) 1035 (interactive)
@@ -1280,7 +1073,7 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
1280 1073
1281 (setq flymake-is-running t) 1074 (setq flymake-is-running t)
1282 (setq flymake-last-change-time nil) 1075 (setq flymake-last-change-time nil)
1283 (setq flymake-check-start-time (flymake-float-time)) 1076 (setq flymake-check-start-time (float-time))
1284 1077
1285 (flymake-report-status nil "*") 1078 (flymake-report-status nil "*")
1286 (flymake-log 2 "started process %d, command=%s, dir=%s" 1079 (flymake-log 2 "started process %d, command=%s, dir=%s"
@@ -1321,71 +1114,49 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
1321 (flymake-stop-all-syntax-checks) 1114 (flymake-stop-all-syntax-checks)
1322 (call-interactively 'compile)) 1115 (call-interactively 'compile))
1323 1116
1324(defcustom flymake-no-changes-timeout 0.5
1325 "Time to wait after last change before starting compilation."
1326 :group 'flymake
1327 :type 'number)
1328
1329(defun flymake-on-timer-event (buffer) 1117(defun flymake-on-timer-event (buffer)
1330 "Start a syntax check for buffer BUFFER if necessary." 1118 "Start a syntax check for buffer BUFFER if necessary."
1331 (when (buffer-live-p buffer) 1119 (when (buffer-live-p buffer)
1332 (with-current-buffer buffer 1120 (with-current-buffer buffer
1333 (when (and (not flymake-is-running) 1121 (when (and (not flymake-is-running)
1334 flymake-last-change-time 1122 flymake-last-change-time
1335 (> (- (flymake-float-time) flymake-last-change-time) 1123 (> (- (float-time) flymake-last-change-time)
1336 flymake-no-changes-timeout)) 1124 flymake-no-changes-timeout))
1337 1125
1338 (setq flymake-last-change-time nil) 1126 (setq flymake-last-change-time nil)
1339 (flymake-log 3 "starting syntax check as more than 1 second passed since last change") 1127 (flymake-log 3 "starting syntax check as more than 1 second passed since last change")
1340 (flymake-start-syntax-check))))) 1128 (flymake-start-syntax-check)))))
1341 1129
1342(defun flymake-current-line-no () 1130(define-obsolete-function-alias 'flymake-display-err-menu-for-current-line
1343 "Return number of current line in current buffer." 1131 'flymake-popup-current-error-menu "24.4")
1344 (count-lines (point-min) (if (eobp) (point) (1+ (point))))) 1132
1345 1133(defun flymake-popup-current-error-menu (&optional event)
1346(defun flymake-count-lines () 1134 "Pop up a menu with errors/warnings for current line."
1347 "Return number of lines in buffer BUFFER." 1135 (interactive (list last-nonmenu-event))
1348 (count-lines (point-min) (point-max))) 1136 (let* ((line-no (line-number-at-pos))
1349 1137 (errors (or (car (flymake-find-err-info flymake-err-info line-no))
1350(defun flymake-display-err-menu-for-current-line () 1138 (user-error "No errors for current line")))
1351 "Display a menu with errors/warnings for current line if it has errors and/or warnings." 1139 (menu (mapcar (lambda (x)
1352 (interactive) 1140 (if (flymake-ler-file x)
1353 (let* ((line-no (flymake-current-line-no)) 1141 (cons (format "%s - %s(%d)"
1354 (line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no))) 1142 (flymake-ler-text x)
1355 (menu-data (flymake-make-err-menu-data line-no line-err-info-list)) 1143 (flymake-ler-file x)
1356 (choice nil)) 1144 (flymake-ler-line x))
1357 (if menu-data 1145 x)
1358 (progn 1146 (list (flymake-ler-text x))))
1359 (setq choice (flymake-popup-menu menu-data)) 1147 errors))
1360 (flymake-log 3 "choice=%s" choice) 1148 (event (if (mouse-event-p event)
1361 (when choice 1149 event
1362 (eval choice))) 1150 (list 'mouse-1 (posn-at-point))))
1363 (flymake-log 1 "no errors for line %d" line-no)))) 1151 (title (format "Line %d: %d error(s), %d warning(s)"
1364 1152 line-no
1365(defun flymake-make-err-menu-data (line-no line-err-info-list) 1153 (flymake-get-line-err-count errors "e")
1366 "Make a (menu-title (item-title item-action)*) list with errors/warnings from LINE-ERR-INFO-LIST." 1154 (flymake-get-line-err-count errors "w")))
1367 (let* ((menu-items nil)) 1155 (choice (x-popup-menu event (list title (cons "" menu)))))
1368 (when line-err-info-list 1156 (flymake-log 3 "choice=%s" choice)
1369 (let* ((count (length line-err-info-list)) 1157 (when choice
1370 (menu-item-text nil)) 1158 (flymake-goto-file-and-line (flymake-ler-full-file choice)
1371 (while (> count 0) 1159 (flymake-ler-line choice)))))
1372 (setq menu-item-text (flymake-ler-text (nth (1- count) line-err-info-list)))
1373 (let* ((file (flymake-ler-file (nth (1- count) line-err-info-list)))
1374 (full-file (flymake-ler-full-file (nth (1- count) line-err-info-list)))
1375 (line (flymake-ler-line (nth (1- count) line-err-info-list))))
1376 (if file
1377 (setq menu-item-text (concat menu-item-text " - " file "(" (format "%d" line) ")")))
1378 (setq menu-items (cons (list menu-item-text
1379 (if file (list 'flymake-goto-file-and-line full-file line) nil))
1380 menu-items)))
1381 (setq count (1- count)))
1382 (flymake-log 3 "created menu-items with %d item(s)" (length menu-items))))
1383 (if menu-items
1384 (let* ((menu-title (format "Line %d: %d error(s), %d warning(s)" line-no
1385 (flymake-get-line-err-count line-err-info-list "e")
1386 (flymake-get-line-err-count line-err-info-list "w"))))
1387 (list menu-title menu-items))
1388 nil)))
1389 1160
1390(defun flymake-goto-file-and-line (file line) 1161(defun flymake-goto-file-and-line (file line)
1391 "Try to get buffer for FILE and goto line LINE in it." 1162 "Try to get buffer for FILE and goto line LINE in it."
@@ -1396,17 +1167,9 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
1396 (forward-line (1- line)))) 1167 (forward-line (1- line))))
1397 1168
1398;; flymake minor mode declarations 1169;; flymake minor mode declarations
1399(defvar flymake-mode-line nil) 1170(defvar-local flymake-mode-line nil)
1400 1171(defvar-local flymake-mode-line-e-w nil)
1401(make-variable-buffer-local 'flymake-mode-line) 1172(defvar-local flymake-mode-line-status nil)
1402
1403(defvar flymake-mode-line-e-w nil)
1404
1405(make-variable-buffer-local 'flymake-mode-line-e-w)
1406
1407(defvar flymake-mode-line-status nil)
1408
1409(make-variable-buffer-local 'flymake-mode-line-status)
1410 1173
1411(defun flymake-report-status (e-w &optional status) 1174(defun flymake-report-status (e-w &optional status)
1412 "Show status in mode line." 1175 "Show status in mode line."
@@ -1425,11 +1188,6 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
1425 "Display a warning to user." 1188 "Display a warning to user."
1426 (message-box warning)) 1189 (message-box warning))
1427 1190
1428(defcustom flymake-gui-warnings-enabled t
1429 "Enables/disables GUI warnings."
1430 :group 'flymake
1431 :type 'boolean)
1432
1433(defun flymake-report-fatal-status (status warning) 1191(defun flymake-report-fatal-status (status warning)
1434 "Display a warning and switch flymake mode off." 1192 "Display a warning and switch flymake mode off."
1435 (when flymake-gui-warnings-enabled 1193 (when flymake-gui-warnings-enabled
@@ -1439,17 +1197,8 @@ For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
1439 (flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status %s, warning %s" 1197 (flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status %s, warning %s"
1440 (buffer-name) status warning)) 1198 (buffer-name) status warning))
1441 1199
1442(defcustom flymake-start-syntax-check-on-find-file t
1443 "Start syntax check on find file."
1444 :group 'flymake
1445 :type 'boolean)
1446
1447;;;###autoload 1200;;;###autoload
1448(define-minor-mode flymake-mode 1201(define-minor-mode flymake-mode nil
1449 "Toggle on-the-fly syntax checking.
1450With a prefix argument ARG, enable the mode if ARG is positive,
1451and disable it otherwise. If called from Lisp, enable the mode
1452if ARG is omitted or nil."
1453 :group 'flymake :lighter flymake-mode-line 1202 :group 'flymake :lighter flymake-mode-line
1454 (cond 1203 (cond
1455 1204
@@ -1505,19 +1254,14 @@ if ARG is omitted or nil."
1505 (flymake-mode 0) 1254 (flymake-mode 0)
1506 (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name))) 1255 (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name)))
1507 1256
1508(defcustom flymake-start-syntax-check-on-newline t
1509 "Start syntax check if newline char was added/removed from the buffer."
1510 :group 'flymake
1511 :type 'boolean)
1512
1513(defun flymake-after-change-function (start stop _len) 1257(defun flymake-after-change-function (start stop _len)
1514 "Start syntax check for current buffer if it isn't already running." 1258 "Start syntax check for current buffer if it isn't already running."
1515 ;;+(flymake-log 0 "setting change time to %s" (flymake-float-time)) 1259 ;;+(flymake-log 0 "setting change time to %s" (float-time))
1516 (let((new-text (buffer-substring start stop))) 1260 (let((new-text (buffer-substring start stop)))
1517 (when (and flymake-start-syntax-check-on-newline (equal new-text "\n")) 1261 (when (and flymake-start-syntax-check-on-newline (equal new-text "\n"))
1518 (flymake-log 3 "starting syntax check as new-line has been seen") 1262 (flymake-log 3 "starting syntax check as new-line has been seen")
1519 (flymake-start-syntax-check)) 1263 (flymake-start-syntax-check))
1520 (setq flymake-last-change-time (flymake-float-time)))) 1264 (setq flymake-last-change-time (float-time))))
1521 1265
1522(defun flymake-after-save-hook () 1266(defun flymake-after-save-hook ()
1523 (if (local-variable-p 'flymake-mode (current-buffer)) ; (???) other way to determine whether flymake is active in buffer being saved? 1267 (if (local-variable-p 'flymake-mode (current-buffer)) ; (???) other way to determine whether flymake is active in buffer being saved?
@@ -1584,7 +1328,7 @@ if ARG is omitted or nil."
1584(defun flymake-goto-next-error () 1328(defun flymake-goto-next-error ()
1585 "Go to next error in err ring." 1329 "Go to next error in err ring."
1586 (interactive) 1330 (interactive)
1587 (let ((line-no (flymake-get-next-err-line-no flymake-err-info (flymake-current-line-no)))) 1331 (let ((line-no (flymake-get-next-err-line-no flymake-err-info (line-number-at-pos))))
1588 (when (not line-no) 1332 (when (not line-no)
1589 (setq line-no (flymake-get-first-err-line-no flymake-err-info)) 1333 (setq line-no (flymake-get-first-err-line-no flymake-err-info))
1590 (flymake-log 1 "passed end of file")) 1334 (flymake-log 1 "passed end of file"))
@@ -1595,7 +1339,7 @@ if ARG is omitted or nil."
1595(defun flymake-goto-prev-error () 1339(defun flymake-goto-prev-error ()
1596 "Go to previous error in err ring." 1340 "Go to previous error in err ring."
1597 (interactive) 1341 (interactive)
1598 (let ((line-no (flymake-get-prev-err-line-no flymake-err-info (flymake-current-line-no)))) 1342 (let ((line-no (flymake-get-prev-err-line-no flymake-err-info (line-number-at-pos))))
1599 (when (not line-no) 1343 (when (not line-no)
1600 (setq line-no (flymake-get-last-err-line-no flymake-err-info)) 1344 (setq line-no (flymake-get-last-err-line-no flymake-err-info))
1601 (flymake-log 1 "passed beginning of file")) 1345 (flymake-log 1 "passed beginning of file"))
@@ -1631,14 +1375,14 @@ if ARG is omitted or nil."
1631 ;; trying to remove the leading / of absolute file names. 1375 ;; trying to remove the leading / of absolute file names.
1632 (slash-pos (string-match "/" dir)) 1376 (slash-pos (string-match "/" dir))
1633 (temp-dir (expand-file-name (substring dir (1+ slash-pos)) 1377 (temp-dir (expand-file-name (substring dir (1+ slash-pos))
1634 (flymake-get-temp-dir)))) 1378 temporary-file-directory)))
1635 1379
1636 (file-truename (expand-file-name (file-name-nondirectory file-name) 1380 (file-truename (expand-file-name (file-name-nondirectory file-name)
1637 temp-dir)))) 1381 temp-dir))))
1638 1382
1639(defun flymake-delete-temp-directory (dir-name) 1383(defun flymake-delete-temp-directory (dir-name)
1640 "Attempt to delete temp dir created by `flymake-create-temp-with-folder-structure', do not fail on error." 1384 "Attempt to delete temp dir created by `flymake-create-temp-with-folder-structure', do not fail on error."
1641 (let* ((temp-dir (flymake-get-temp-dir)) 1385 (let* ((temp-dir temporary-file-directory)
1642 (suffix (substring dir-name (1+ (length temp-dir))))) 1386 (suffix (substring dir-name (1+ (length temp-dir)))))
1643 1387
1644 (while (> (length suffix) 0) 1388 (while (> (length suffix) 0)
@@ -1648,17 +1392,10 @@ if ARG is omitted or nil."
1648 (file-truename (expand-file-name suffix temp-dir))) 1392 (file-truename (expand-file-name suffix temp-dir)))
1649 (setq suffix (file-name-directory suffix))))) 1393 (setq suffix (file-name-directory suffix)))))
1650 1394
1651(defvar flymake-temp-source-file-name nil) 1395(defvar-local flymake-temp-source-file-name nil)
1652(make-variable-buffer-local 'flymake-temp-source-file-name) 1396(defvar-local flymake-master-file-name nil)
1653 1397(defvar-local flymake-temp-master-file-name nil)
1654(defvar flymake-master-file-name nil) 1398(defvar-local flymake-base-dir nil)
1655(make-variable-buffer-local 'flymake-master-file-name)
1656
1657(defvar flymake-temp-master-file-name nil)
1658(make-variable-buffer-local 'flymake-temp-master-file-name)
1659
1660(defvar flymake-base-dir nil)
1661(make-variable-buffer-local 'flymake-base-dir)
1662 1399
1663(defun flymake-init-create-temp-buffer-copy (create-temp-f) 1400(defun flymake-init-create-temp-buffer-copy (create-temp-f)
1664 "Make a temporary copy of the current buffer, save its name in buffer data and return the name." 1401 "Make a temporary copy of the current buffer, save its name in buffer data and return the name."
@@ -1899,5 +1636,4 @@ Use CREATE-TEMP-F for creating temp copy."
1899 'flymake-create-temp-inplace)))) 1636 'flymake-create-temp-inplace))))
1900 1637
1901(provide 'flymake) 1638(provide 'flymake)
1902
1903;;; flymake.el ends here 1639;;; flymake.el ends here
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 17c13607d71..572b59ecd9b 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -459,12 +459,13 @@ The value must be no less than minus `js-indent-level'."
459 :group 'js 459 :group 'js
460 :version "24.1") 460 :version "24.1")
461 461
462(defcustom js-auto-indent-flag t 462(defcustom js-switch-indent-offset 0
463 "Whether to automatically indent when typing punctuation characters. 463 "Number of additional spaces for indenting the contents of a switch block.
464If non-nil, the characters {}();,: also indent the current line 464The value must not be negative."
465in Javascript mode." 465 :type 'integer
466 :type 'boolean 466 :safe 'integerp
467 :group 'js) 467 :group 'js
468 :version "24.4")
468 469
469(defcustom js-flat-functions nil 470(defcustom js-flat-functions nil
470 "Treat nested functions as top-level functions in `js-mode'. 471 "Treat nested functions as top-level functions in `js-mode'.
@@ -1766,6 +1767,10 @@ nil."
1766 (list (cons 'c js-comment-lineup-func)))) 1767 (list (cons 'c js-comment-lineup-func))))
1767 (c-get-syntactic-indentation (list (cons symbol anchor))))) 1768 (c-get-syntactic-indentation (list (cons symbol anchor)))))
1768 1769
1770(defun js--same-line (pos)
1771 (and (>= pos (point-at-bol))
1772 (<= pos (point-at-eol))))
1773
1769(defun js--multi-line-declaration-indentation () 1774(defun js--multi-line-declaration-indentation ()
1770 "Helper function for `js--proper-indentation'. 1775 "Helper function for `js--proper-indentation'.
1771Return the proper indentation of the current line if it belongs to a declaration 1776Return the proper indentation of the current line if it belongs to a declaration
@@ -1788,8 +1793,7 @@ statement spanning multiple lines; otherwise, return nil."
1788 (looking-at js--indent-operator-re) 1793 (looking-at js--indent-operator-re)
1789 (js--backward-syntactic-ws)) 1794 (js--backward-syntactic-ws))
1790 (not (eq (char-before) ?\;))) 1795 (not (eq (char-before) ?\;)))
1791 (and (>= pos (point-at-bol)) 1796 (js--same-line pos)))))
1792 (<= pos (point-at-eol)))))))
1793 (condition-case nil 1797 (condition-case nil
1794 (backward-sexp) 1798 (backward-sexp)
1795 (scan-error (setq at-opening-bracket t)))) 1799 (scan-error (setq at-opening-bracket t))))
@@ -1797,23 +1801,68 @@ statement spanning multiple lines; otherwise, return nil."
1797 (goto-char (match-end 0)) 1801 (goto-char (match-end 0))
1798 (1+ (current-column))))))) 1802 (1+ (current-column)))))))
1799 1803
1804(defun js--indent-in-array-comp (bracket)
1805 "Return non-nil if we think we're in an array comprehension.
1806In particular, return the buffer position of the first `for' kwd."
1807 (let ((end (point)))
1808 (save-excursion
1809 (goto-char bracket)
1810 (when (looking-at "\\[")
1811 (forward-char 1)
1812 (js--forward-syntactic-ws)
1813 (if (looking-at "[[{]")
1814 (let (forward-sexp-function) ; Use Lisp version.
1815 (forward-sexp) ; Skip destructuring form.
1816 (js--forward-syntactic-ws)
1817 (if (and (/= (char-after) ?,) ; Regular array.
1818 (looking-at "for"))
1819 (match-beginning 0)))
1820 ;; To skip arbitrary expressions we need the parser,
1821 ;; so we'll just guess at it.
1822 (if (and (> end (point)) ; Not empty literal.
1823 (re-search-forward "[^,]]* \\(for\\) " end t)
1824 ;; Not inside comment or string literal.
1825 (not (nth 8 (parse-partial-sexp bracket (point)))))
1826 (match-beginning 1)))))))
1827
1828(defun js--array-comp-indentation (bracket for-kwd)
1829 (if (js--same-line for-kwd)
1830 ;; First continuation line.
1831 (save-excursion
1832 (goto-char bracket)
1833 (forward-char 1)
1834 (skip-chars-forward " \t")
1835 (current-column))
1836 (save-excursion
1837 (goto-char for-kwd)
1838 (current-column))))
1839
1800(defun js--proper-indentation (parse-status) 1840(defun js--proper-indentation (parse-status)
1801 "Return the proper indentation for the current line." 1841 "Return the proper indentation for the current line."
1802 (save-excursion 1842 (save-excursion
1803 (back-to-indentation) 1843 (back-to-indentation)
1804 (cond ((nth 4 parse-status) 1844 (cond ((nth 4 parse-status) ; inside comment
1805 (js--get-c-offset 'c (nth 8 parse-status))) 1845 (js--get-c-offset 'c (nth 8 parse-status)))
1806 ((nth 8 parse-status) 0) ; inside string 1846 ((nth 3 parse-status) 0) ; inside string
1807 ((js--ctrl-statement-indentation))
1808 ((js--multi-line-declaration-indentation))
1809 ((eq (char-after) ?#) 0) 1847 ((eq (char-after) ?#) 0)
1810 ((save-excursion (js--beginning-of-macro)) 4) 1848 ((save-excursion (js--beginning-of-macro)) 4)
1849 ;; Indent array comprehension continuation lines specially.
1850 ((let ((bracket (nth 1 parse-status))
1851 beg)
1852 (and bracket
1853 (not (js--same-line bracket))
1854 (setq beg (js--indent-in-array-comp bracket))
1855 ;; At or after the first loop?
1856 (>= (point) beg)
1857 (js--array-comp-indentation bracket beg))))
1858 ((js--ctrl-statement-indentation))
1859 ((js--multi-line-declaration-indentation))
1811 ((nth 1 parse-status) 1860 ((nth 1 parse-status)
1812 ;; A single closing paren/bracket should be indented at the 1861 ;; A single closing paren/bracket should be indented at the
1813 ;; same level as the opening statement. Same goes for 1862 ;; same level as the opening statement. Same goes for
1814 ;; "case" and "default". 1863 ;; "case" and "default".
1815 (let ((same-indent-p (looking-at 1864 (let ((same-indent-p (looking-at "[]})]"))
1816 "[]})]\\|\\_<case\\_>\\|\\_<default\\_>")) 1865 (switch-keyword-p (looking-at "default\\_>\\|case\\_>[^:]"))
1817 (continued-expr-p (js--continued-expression-p))) 1866 (continued-expr-p (js--continued-expression-p)))
1818 (goto-char (nth 1 parse-status)) ; go to the opening char 1867 (goto-char (nth 1 parse-status)) ; go to the opening char
1819 (if (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)") 1868 (if (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)")
@@ -1821,17 +1870,26 @@ statement spanning multiple lines; otherwise, return nil."
1821 (skip-syntax-backward " ") 1870 (skip-syntax-backward " ")
1822 (when (eq (char-before) ?\)) (backward-list)) 1871 (when (eq (char-before) ?\)) (backward-list))
1823 (back-to-indentation) 1872 (back-to-indentation)
1824 (cond (same-indent-p 1873 (let* ((in-switch-p (unless same-indent-p
1825 (current-column)) 1874 (looking-at "\\_<switch\\_>")))
1826 (continued-expr-p 1875 (same-indent-p (or same-indent-p
1827 (+ (current-column) (* 2 js-indent-level) 1876 (and switch-keyword-p
1828 js-expr-indent-offset)) 1877 in-switch-p)))
1829 (t 1878 (indent
1830 (+ (current-column) js-indent-level 1879 (cond (same-indent-p
1831 (pcase (char-after (nth 1 parse-status)) 1880 (current-column))
1832 (?\( js-paren-indent-offset) 1881 (continued-expr-p
1833 (?\[ js-square-indent-offset) 1882 (+ (current-column) (* 2 js-indent-level)
1834 (?\{ js-curly-indent-offset)))))) 1883 js-expr-indent-offset))
1884 (t
1885 (+ (current-column) js-indent-level
1886 (pcase (char-after (nth 1 parse-status))
1887 (?\( js-paren-indent-offset)
1888 (?\[ js-square-indent-offset)
1889 (?\{ js-curly-indent-offset)))))))
1890 (if in-switch-p
1891 (+ indent js-switch-indent-offset)
1892 indent)))
1835 ;; If there is something following the opening 1893 ;; If there is something following the opening
1836 ;; paren/bracket, everything else should be indented at 1894 ;; paren/bracket, everything else should be indented at
1837 ;; the same level. 1895 ;; the same level.
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 3d30cb015d6..af7a4d8c321 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -362,8 +362,8 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
362 (and (memq (char-before) 362 (and (memq (char-before)
363 '(?\; ?- ?+ ?* ?/ ?: ?. ?, ?\[ ?\( ?\{ ?\\ ?& ?> ?< ?% 363 '(?\; ?- ?+ ?* ?/ ?: ?. ?, ?\[ ?\( ?\{ ?\\ ?& ?> ?< ?%
364 ?~ ?^)) 364 ?~ ?^))
365 ;; Make sure it's not the end of a regexp. 365 ;; Not the end of a regexp or a percent literal.
366 (not (eq (car (syntax-after (1- (point)))) 7))) 366 (not (memq (car (syntax-after (1- (point)))) '(7 15))))
367 (and (eq (char-before) ?\?) 367 (and (eq (char-before) ?\?)
368 (equal (save-excursion (ruby-smie--backward-token)) "?")) 368 (equal (save-excursion (ruby-smie--backward-token)) "?"))
369 (and (eq (char-before) ?=) 369 (and (eq (char-before) ?=)
@@ -614,11 +614,16 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
614 (nreverse (ruby-imenu-create-index-in-block nil (point-min) nil))) 614 (nreverse (ruby-imenu-create-index-in-block nil (point-min) nil)))
615 615
616(defun ruby-accurate-end-of-block (&optional end) 616(defun ruby-accurate-end-of-block (&optional end)
617 "TODO: document." 617 "Jump to the end of the current block or END, whichever is closer."
618 (let (state 618 (let (state
619 (end (or end (point-max)))) 619 (end (or end (point-max))))
620 (while (and (setq state (apply 'ruby-parse-partial end state)) 620 (if ruby-use-smie
621 (>= (nth 2 state) 0) (< (point) end))))) 621 (save-restriction
622 (back-to-indentation)
623 (narrow-to-region (point) end)
624 (smie-forward-sexp))
625 (while (and (setq state (apply 'ruby-parse-partial end state))
626 (>= (nth 2 state) 0) (< (point) end))))))
622 627
623(defun ruby-mode-variables () 628(defun ruby-mode-variables ()
624 "Set up initial buffer-local variables for Ruby mode." 629 "Set up initial buffer-local variables for Ruby mode."
@@ -790,11 +795,28 @@ Can be one of `heredoc', `modifier', `expr-qstr', `expr-re'."
790 (t nil))))))))) 795 (t nil)))))))))
791 796
792(defun ruby-forward-string (term &optional end no-error expand) 797(defun ruby-forward-string (term &optional end no-error expand)
793 "TODO: document." 798 "Move forward across one balanced pair of string delimiters.
799Skips escaped delimiters. If EXPAND is non-nil, also ignores
800delimiters in interpolated strings.
801
802TERM should be a string containing either a single, self-matching
803delimiter (e.g. \"/\"), or a pair of matching delimiters with the
804close delimiter first (e.g. \"][\").
805
806When non-nil, search is bounded by position END.
807
808Throws an error if a balanced match is not found, unless NO-ERROR
809is non-nil, in which case nil will be returned.
810
811This command assumes the character after point is an opening
812delimiter."
794 (let ((n 1) (c (string-to-char term)) 813 (let ((n 1) (c (string-to-char term))
795 (re (if expand 814 (re (concat "[^\\]\\(\\\\\\\\\\)*\\("
796 (concat "[^\\]\\(\\\\\\\\\\)*\\([" term "]\\|\\(#{\\)\\)") 815 (if (string= term "^") ;[^] is not a valid regexp
797 (concat "[^\\]\\(\\\\\\\\\\)*[" term "]")))) 816 "\\^"
817 (concat "[" term "]"))
818 (when expand "\\|\\(#{\\)")
819 "\\)")))
798 (while (and (re-search-forward re end no-error) 820 (while (and (re-search-forward re end no-error)
799 (if (match-beginning 3) 821 (if (match-beginning 3)
800 (ruby-forward-string "}{" end no-error nil) 822 (ruby-forward-string "}{" end no-error nil)
diff --git a/lisp/rect.el b/lisp/rect.el
index ad94663fc96..be29517e087 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -443,7 +443,9 @@ with a prefix argument, prompt for START-AT and FORMAT."
443Activates the region if needed. Only lasts until the region is deactivated." 443Activates the region if needed. Only lasts until the region is deactivated."
444 nil nil nil 444 nil nil nil
445 (when rectangle-mark-mode 445 (when rectangle-mark-mode
446 (unless (region-active-p) (push-mark-command t)))) 446 (unless (region-active-p)
447 (push-mark)
448 (activate-mark))))
447 449
448(defun rectangle--extract-region (orig &optional delete) 450(defun rectangle--extract-region (orig &optional delete)
449 (if (not rectangle-mark-mode) 451 (if (not rectangle-mark-mode)
@@ -495,70 +497,72 @@ Activates the region if needed. Only lasts until the region is deactivated."
495 (leftcol (min ptcol markcol)) 497 (leftcol (min ptcol markcol))
496 (rightcol (max ptcol markcol))) 498 (rightcol (max ptcol markcol)))
497 (goto-char start) 499 (goto-char start)
498 (while (< (point) end) 500 (while
499 (let* ((mleft (move-to-column leftcol)) 501 (let* ((mleft (move-to-column leftcol))
500 (left (point)) 502 (left (point))
501 (mright (move-to-column rightcol)) 503 (mright (move-to-column rightcol))
502 (right (point)) 504 (right (point))
503 (ol 505 (ol
504 (if (not old) 506 (if (not old)
505 (let ((ol (make-overlay left right))) 507 (let ((ol (make-overlay left right)))
506 (overlay-put ol 'window window) 508 (overlay-put ol 'window window)
507 (overlay-put ol 'face 'region) 509 (overlay-put ol 'face 'region)
508 ol) 510 ol)
509 (let ((ol (pop old))) 511 (let ((ol (pop old)))
510 (move-overlay ol left right (current-buffer)) 512 (move-overlay ol left right (current-buffer))
511 ol)))) 513 ol))))
512 ;; `move-to-column' may stop before the column (if bumping into 514 ;; `move-to-column' may stop before the column (if bumping into
513 ;; EOL) or overshoot it a little, when column is in the middle 515 ;; EOL) or overshoot it a little, when column is in the middle
514 ;; of a char. 516 ;; of a char.
515 (cond 517 (cond
516 ((< mleft leftcol) ;`leftcol' is past EOL. 518 ((< mleft leftcol) ;`leftcol' is past EOL.
517 (overlay-put ol 'before-string 519 (overlay-put ol 'before-string
518 (spaces-string (- leftcol mleft))) 520 (spaces-string (- leftcol mleft)))
519 (setq mright (max mright leftcol))) 521 (setq mright (max mright leftcol)))
520 ((and (> mleft leftcol) ;`leftcol' is in the middle of a char. 522 ((and (> mleft leftcol) ;`leftcol' is in the middle of a char.
521 (eq (char-before left) ?\t)) 523 (eq (char-before left) ?\t))
522 (setq left (1- left)) 524 (setq left (1- left))
523 (move-overlay ol left right) 525 (move-overlay ol left right)
524 (goto-char left) 526 (goto-char left)
525 (overlay-put ol 'before-string 527 (overlay-put ol 'before-string
526 (spaces-string (- leftcol (current-column))))) 528 (spaces-string (- leftcol (current-column)))))
527 ((overlay-get ol 'before-string) 529 ((overlay-get ol 'before-string)
528 (overlay-put ol 'before-string nil))) 530 (overlay-put ol 'before-string nil)))
529 (cond 531 (cond
530 ((< mright rightcol) ;`rightcol' is past EOL. 532 ((< mright rightcol) ;`rightcol' is past EOL.
531 (let ((str (make-string (- rightcol mright) ?\s))) 533 (let ((str (make-string (- rightcol mright) ?\s)))
532 (put-text-property 0 (length str) 'face 'region str) 534 (put-text-property 0 (length str) 'face 'region str)
533 ;; If cursor happens to be here, draw it *before* rather than 535 ;; If cursor happens to be here, draw it *before* rather than
534 ;; after this highlighted pseudo-text. 536 ;; after this highlighted pseudo-text.
535 (put-text-property 0 1 'cursor t str) 537 (put-text-property 0 1 'cursor t str)
536 (overlay-put ol 'after-string str))) 538 (overlay-put ol 'after-string str)))
537 ((and (> mright rightcol) ;`rightcol' is in the middle of a char. 539 ((and (> mright rightcol) ;`rightcol's in the middle of a char.
538 (eq (char-before right) ?\t)) 540 (eq (char-before right) ?\t))
539 (setq right (1- right)) 541 (setq right (1- right))
540 (move-overlay ol left right) 542 (move-overlay ol left right)
541 (if (= rightcol leftcol) 543 (if (= rightcol leftcol)
542 (overlay-put ol 'after-string nil) 544 (overlay-put ol 'after-string nil)
543 (goto-char right) 545 (goto-char right)
544 (let ((str (make-string 546 (let ((str (make-string
545 (- rightcol (max leftcol (current-column))) ?\s))) 547 (- rightcol (max leftcol (current-column)))
546 (put-text-property 0 (length str) 'face 'region str) 548 ?\s)))
547 (when (= left right) 549 (put-text-property 0 (length str) 'face 'region str)
548 ;; If cursor happens to be here, draw it *before* rather 550 (when (= left right)
549 ;; than after this highlighted pseudo-text. 551 ;; If cursor happens to be here, draw it *before* rather
550 (put-text-property 0 1 'cursor 1 str)) 552 ;; than after this highlighted pseudo-text.
551 (overlay-put ol 'after-string str)))) 553 (put-text-property 0 1 'cursor 1 str))
552 ((overlay-get ol 'after-string) 554 (overlay-put ol 'after-string str))))
553 (overlay-put ol 'after-string nil))) 555 ((overlay-get ol 'after-string)
554 (when (= leftcol rightcol) 556 (overlay-put ol 'after-string nil)))
555 ;; Make zero-width rectangles visible! 557 (when (= leftcol rightcol)
556 (overlay-put ol 'after-string 558 ;; Make zero-width rectangles visible!
557 (concat (propertize " " 559 (overlay-put ol 'after-string
558 'face '(region (:height 0.2))) 560 (concat (propertize " "
559 (overlay-get ol 'after-string)))) 561 'face '(region (:height 0.2)))
560 (push ol nrol)) 562 (overlay-get ol 'after-string))))
561 (forward-line 1)) 563 (push ol nrol)
564 (and (zerop (forward-line 1))
565 (<= (point) end))))
562 (mapc #'delete-overlay old) 566 (mapc #'delete-overlay old)
563 `(rectangle ,(buffer-chars-modified-tick) ,start ,end ,@nrol)))))) 567 `(rectangle ,(buffer-chars-modified-tick) ,start ,end ,@nrol))))))
564 568
diff --git a/lisp/register.el b/lisp/register.el
index 2e22502cfeb..623b1f2c0c8 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -364,6 +364,7 @@ The Lisp value REGISTER is a character."
364 (princ (car val)))) 364 (princ (car val))))
365 365
366 ((stringp val) 366 ((stringp val)
367 (setq val (copy-sequence val))
367 (if (eq yank-excluded-properties t) 368 (if (eq yank-excluded-properties t)
368 (set-text-properties 0 (length val) nil val) 369 (set-text-properties 0 (length val) nil val)
369 (remove-list-of-text-properties 0 (length val) 370 (remove-list-of-text-properties 0 (length val)
@@ -417,19 +418,24 @@ Interactively, second arg is non-nil if prefix arg is supplied."
417 (error "Register does not contain text")))) 418 (error "Register does not contain text"))))
418 (if (not arg) (exchange-point-and-mark))) 419 (if (not arg) (exchange-point-and-mark)))
419 420
420(defun copy-to-register (register start end &optional delete-flag) 421(defun copy-to-register (register start end &optional delete-flag region)
421 "Copy region into register REGISTER. 422 "Copy region into register REGISTER.
422With prefix arg, delete as well. 423With prefix arg, delete as well.
423Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. 424Called from program, takes four args: REGISTER, START, END and DELETE-FLAG.
424START and END are buffer positions indicating what to copy." 425START and END are buffer positions indicating what to copy.
426The optional argument REGION if non-nil, indicates that we're not just copying
427some text between START and END, but we're copying the region."
425 (interactive (list (register-read-with-preview "Copy to register: ") 428 (interactive (list (register-read-with-preview "Copy to register: ")
426 (region-beginning) 429 (region-beginning)
427 (region-end) 430 (region-end)
428 current-prefix-arg)) 431 current-prefix-arg
429 (set-register register (filter-buffer-substring start end)) 432 t))
433 (set-register register (if region
434 (funcall region-extract-function delete-flag)
435 (prog1 (filter-buffer-substring start end)
436 (if delete-flag (delete-region start end)))))
430 (setq deactivate-mark t) 437 (setq deactivate-mark t)
431 (cond (delete-flag 438 (cond (delete-flag)
432 (delete-region start end))
433 ((called-interactively-p 'interactive) 439 ((called-interactively-p 'interactive)
434 (indicate-copied-region)))) 440 (indicate-copied-region))))
435 441
diff --git a/lisp/subr.el b/lisp/subr.el
index 6b1e99f337c..d86469dd158 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2038,6 +2038,7 @@ by doing (clear-string STRING)."
2038 (setq-local select-active-regions nil) 2038 (setq-local select-active-regions nil)
2039 (use-local-map read-passwd-map) 2039 (use-local-map read-passwd-map)
2040 (setq-local inhibit-modification-hooks nil) ;bug#15501. 2040 (setq-local inhibit-modification-hooks nil) ;bug#15501.
2041 (setq-local show-paren-mode nil) ;bug#16091.
2041 (add-hook 'after-change-functions hide-chars-fun nil 'local)) 2042 (add-hook 'after-change-functions hide-chars-fun nil 'local))
2042 (unwind-protect 2043 (unwind-protect
2043 (let ((enable-recursive-minibuffers t)) 2044 (let ((enable-recursive-minibuffers t))
diff --git a/m4/absolute-header.m4 b/m4/absolute-header.m4
new file mode 100644
index 00000000000..89ff5beb65f
--- /dev/null
+++ b/m4/absolute-header.m4
@@ -0,0 +1,102 @@
1# absolute-header.m4 serial 16
2dnl Copyright (C) 2006-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Derek Price.
8
9# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
10# ---------------------------------------
11# Find the absolute name of a header file, testing first if the header exists.
12# If the header were sys/inttypes.h, this macro would define
13# ABSOLUTE_SYS_INTTYPES_H to the '""' quoted absolute name of sys/inttypes.h
14# in config.h
15# (e.g. '#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"').
16# The three "///" are to pacify Sun C 5.8, which otherwise would say
17# "warning: #include of /usr/include/... may be non-portable".
18# Use '""', not '<>', so that the /// cannot be confused with a C99 comment.
19# Note: This macro assumes that the header file is not empty after
20# preprocessing, i.e. it does not only define preprocessor macros but also
21# provides some type/enum definitions or function/variable declarations.
22AC_DEFUN([gl_ABSOLUTE_HEADER],
23[AC_REQUIRE([AC_CANONICAL_HOST])
24AC_LANG_PREPROC_REQUIRE()dnl
25dnl FIXME: gl_absolute_header and ac_header_exists must be used unquoted
26dnl until we can assume autoconf 2.64 or newer.
27m4_foreach_w([gl_HEADER_NAME], [$1],
28 [AS_VAR_PUSHDEF([gl_absolute_header],
29 [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl
30 AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>],
31 m4_defn([gl_absolute_header]),
32 [AS_VAR_PUSHDEF([ac_header_exists],
33 [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl
34 AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl
35 if test AS_VAR_GET(ac_header_exists) = yes; then
36 gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME]))
37 fi
38 AS_VAR_POPDEF([ac_header_exists])dnl
39 ])dnl
40 AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])),
41 ["AS_VAR_GET(gl_absolute_header)"],
42 [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.])
43 AS_VAR_POPDEF([gl_absolute_header])dnl
44])dnl
45])# gl_ABSOLUTE_HEADER
46
47# gl_ABSOLUTE_HEADER_ONE(HEADER)
48# ------------------------------
49# Like gl_ABSOLUTE_HEADER, except that:
50# - it assumes that the header exists,
51# - it uses the current CPPFLAGS,
52# - it does not cache the result,
53# - it is silent.
54AC_DEFUN([gl_ABSOLUTE_HEADER_ONE],
55[
56 AC_REQUIRE([AC_CANONICAL_HOST])
57 AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])])
58 dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
59 dnl that contain only a #include of other header files and no
60 dnl non-comment tokens of their own. This leads to a failure to
61 dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
62 dnl and others. The workaround is to force preservation of comments
63 dnl through option -C. This ensures all necessary #line directives
64 dnl are present. GCC supports option -C as well.
65 case "$host_os" in
66 aix*) gl_absname_cpp="$ac_cpp -C" ;;
67 *) gl_absname_cpp="$ac_cpp" ;;
68 esac
69changequote(,)
70 case "$host_os" in
71 mingw*)
72 dnl For the sake of native Windows compilers (excluding gcc),
73 dnl treat backslash as a directory separator, like /.
74 dnl Actually, these compilers use a double-backslash as
75 dnl directory separator, inside the
76 dnl # line "filename"
77 dnl directives.
78 gl_dirsep_regex='[/\\]'
79 ;;
80 *)
81 gl_dirsep_regex='\/'
82 ;;
83 esac
84 dnl A sed expression that turns a string into a basic regular
85 dnl expression, for use within "/.../".
86 gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
87 gl_header_literal_regex=`echo '$1' \
88 | sed -e "$gl_make_literal_regex_sed"`
89 gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
90 s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
91 s|^/[^/]|//&|
92 p
93 q
94 }'
95changequote([,])
96 dnl eval is necessary to expand gl_absname_cpp.
97 dnl Ultrix and Pyramid sh refuse to redirect output of eval,
98 dnl so use subshell.
99 AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]),
100[`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
101 sed -n "$gl_absolute_header_sed"`])
102])
diff --git a/m4/gl-openssl.m4 b/m4/gl-openssl.m4
new file mode 100644
index 00000000000..c8f9dd95e68
--- /dev/null
+++ b/m4/gl-openssl.m4
@@ -0,0 +1,48 @@
1# gl-openssl.m4 serial 3
2dnl Copyright (C) 2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT],
8[
9 m4_define([gl_CRYPTO_CHECK_DEFAULT], [$1])
10])
11gl_SET_CRYPTO_CHECK_DEFAULT([no])
12
13AC_DEFUN([gl_CRYPTO_CHECK],
14[
15 m4_divert_once([DEFAULTS], [with_openssl_default='gl_CRYPTO_CHECK_DEFAULT'])
16
17 AC_ARG_WITH([openssl],
18 [AS_HELP_STRING([--with-openssl],
19 [use libcrypto hash routines. Valid ARGs are:
20 'yes', 'no', 'auto' => use if available,
21 'optional' => use if available and warn if not available;
22 default is ']gl_CRYPTO_CHECK_DEFAULT['])],
23 [],
24 [with_openssl=$with_openssl_default])
25
26 if test "x$1" = xMD5; then
27 ALG_header=md5.h
28 else
29 ALG_header=sha.h
30 fi
31
32 LIB_CRYPTO=
33 AC_SUBST([LIB_CRYPTO])
34 if test "x$with_openssl" != xno; then
35 AC_CHECK_LIB([crypto], [$1],
36 [AC_CHECK_HEADERS([openssl/$ALG_header],
37 [LIB_CRYPTO=-lcrypto
38 AC_DEFINE([HAVE_OPENSSL_$1], [1],
39 [Define to 1 if libcrypto is used for $1.])])])
40 if test "x$LIB_CRYPTO" = x; then
41 if test "x$with_openssl" = xyes; then
42 AC_MSG_ERROR([openssl development library not found for $1])
43 elif test "x$with_openssl" = xoptional; then
44 AC_MSG_WARN([openssl development library not found for $1])
45 fi
46 fi
47 fi
48])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index c707e34993d..3a04c84ac90 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -38,6 +38,7 @@ AC_DEFUN([gl_EARLY],
38 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable 38 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
39 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable 39 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
40 AC_REQUIRE([gl_PROG_AR_RANLIB]) 40 AC_REQUIRE([gl_PROG_AR_RANLIB])
41 # Code from module absolute-header:
41 # Code from module alloca-opt: 42 # Code from module alloca-opt:
42 # Code from module allocator: 43 # Code from module allocator:
43 # Code from module at-internal: 44 # Code from module at-internal:
@@ -847,6 +848,7 @@ AC_DEFUN([gl_FILE_LIST], [
847 lib/gettext.h 848 lib/gettext.h
848 lib/gettime.c 849 lib/gettime.c
849 lib/gettimeofday.c 850 lib/gettimeofday.c
851 lib/gl_openssl.h
850 lib/group-member.c 852 lib/group-member.c
851 lib/intprops.h 853 lib/intprops.h
852 lib/inttypes.in.h 854 lib/inttypes.in.h
@@ -921,6 +923,7 @@ AC_DEFUN([gl_FILE_LIST], [
921 lib/verify.h 923 lib/verify.h
922 lib/xalloc-oversized.h 924 lib/xalloc-oversized.h
923 m4/00gnulib.m4 925 m4/00gnulib.m4
926 m4/absolute-header.m4
924 m4/acl.m4 927 m4/acl.m4
925 m4/alloca.m4 928 m4/alloca.m4
926 m4/byteswap.m4 929 m4/byteswap.m4
@@ -953,6 +956,7 @@ AC_DEFUN([gl_FILE_LIST], [
953 m4/getopt.m4 956 m4/getopt.m4
954 m4/gettime.m4 957 m4/gettime.m4
955 m4/gettimeofday.m4 958 m4/gettimeofday.m4
959 m4/gl-openssl.m4
956 m4/gnulib-common.m4 960 m4/gnulib-common.m4
957 m4/group-member.m4 961 m4/group-member.m4
958 m4/include_next.m4 962 m4/include_next.m4
diff --git a/m4/include_next.m4 b/m4/include_next.m4
index 108d945677f..f09dbe66395 100644
--- a/m4/include_next.m4
+++ b/m4/include_next.m4
@@ -192,56 +192,9 @@ dnl until we can assume autoconf 2.64 or newer.
192 if test AS_VAR_GET(gl_header_exists) = yes; then 192 if test AS_VAR_GET(gl_header_exists) = yes; then
193 AS_VAR_POPDEF([gl_header_exists]) 193 AS_VAR_POPDEF([gl_header_exists])
194 ]) 194 ])
195 AC_LANG_CONFTEST( 195 gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME)
196 [AC_LANG_SOURCE( 196 AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME))
197 [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] 197 AS_VAR_SET(gl_next_header, ['"'$gl_header'"'])
198 )])
199 dnl AIX "xlc -E" and "cc -E" omit #line directives for header
200 dnl files that contain only a #include of other header files and
201 dnl no non-comment tokens of their own. This leads to a failure
202 dnl to detect the absolute name of <dirent.h>, <signal.h>,
203 dnl <poll.h> and others. The workaround is to force preservation
204 dnl of comments through option -C. This ensures all necessary
205 dnl #line directives are present. GCC supports option -C as well.
206 case "$host_os" in
207 aix*) gl_absname_cpp="$ac_cpp -C" ;;
208 *) gl_absname_cpp="$ac_cpp" ;;
209 esac
210changequote(,)
211 case "$host_os" in
212 mingw*)
213 dnl For the sake of native Windows compilers (excluding gcc),
214 dnl treat backslash as a directory separator, like /.
215 dnl Actually, these compilers use a double-backslash as
216 dnl directory separator, inside the
217 dnl # line "filename"
218 dnl directives.
219 gl_dirsep_regex='[/\\]'
220 ;;
221 *)
222 gl_dirsep_regex='\/'
223 ;;
224 esac
225 dnl A sed expression that turns a string into a basic regular
226 dnl expression, for use within "/.../".
227 gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
228changequote([,])
229 gl_header_literal_regex=`echo ']m4_defn([gl_HEADER_NAME])[' \
230 | sed -e "$gl_make_literal_regex_sed"`
231 gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
232 s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
233changequote(,)dnl
234 s|^/[^/]|//&|
235changequote([,])dnl
236 p
237 q
238 }'
239 dnl eval is necessary to expand gl_absname_cpp.
240 dnl Ultrix and Pyramid sh refuse to redirect output of eval,
241 dnl so use subshell.
242 AS_VAR_SET(gl_next_header,
243 ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
244 sed -n "$gl_absolute_header_sed"`'"'])
245 m4_if([$2], [check], 198 m4_if([$2], [check],
246 [else 199 [else
247 AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) 200 AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>'])
diff --git a/m4/md5.m4 b/m4/md5.m4
index 0ad6f504b53..541a26b5298 100644
--- a/m4/md5.m4
+++ b/m4/md5.m4
@@ -1,4 +1,4 @@
1# md5.m4 serial 13 1# md5.m4 serial 14
2dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -8,5 +8,7 @@ AC_DEFUN([gl_MD5],
8[ 8[
9 dnl Prerequisites of lib/md5.c. 9 dnl Prerequisites of lib/md5.c.
10 AC_REQUIRE([gl_BIGENDIAN]) 10 AC_REQUIRE([gl_BIGENDIAN])
11 : 11
12 dnl Determine HAVE_OPENSSL_MD5 and LIB_CRYPTO
13 gl_CRYPTO_CHECK([MD5])
12]) 14])
diff --git a/m4/sha1.m4 b/m4/sha1.m4
index 21c775e364e..57d5256652a 100644
--- a/m4/sha1.m4
+++ b/m4/sha1.m4
@@ -1,4 +1,4 @@
1# sha1.m4 serial 11 1# sha1.m4 serial 12
2dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -8,5 +8,7 @@ AC_DEFUN([gl_SHA1],
8[ 8[
9 dnl Prerequisites of lib/sha1.c. 9 dnl Prerequisites of lib/sha1.c.
10 AC_REQUIRE([gl_BIGENDIAN]) 10 AC_REQUIRE([gl_BIGENDIAN])
11 : 11
12 dnl Determine HAVE_OPENSSL_SHA1 and LIB_CRYPTO
13 gl_CRYPTO_CHECK([SHA1])
12]) 14])
diff --git a/m4/sha256.m4 b/m4/sha256.m4
index cbbd17a6444..3a194674697 100644
--- a/m4/sha256.m4
+++ b/m4/sha256.m4
@@ -1,4 +1,4 @@
1# sha256.m4 serial 7 1# sha256.m4 serial 8
2dnl Copyright (C) 2005, 2008-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -8,5 +8,7 @@ AC_DEFUN([gl_SHA256],
8[ 8[
9 dnl Prerequisites of lib/sha256.c. 9 dnl Prerequisites of lib/sha256.c.
10 AC_REQUIRE([gl_BIGENDIAN]) 10 AC_REQUIRE([gl_BIGENDIAN])
11 : 11
12 dnl Determine HAVE_OPENSSL_SHA256 and LIB_CRYPTO
13 gl_CRYPTO_CHECK([SHA256])
12]) 14])
diff --git a/m4/sha512.m4 b/m4/sha512.m4
index f4a6bf13baa..d929195e9a2 100644
--- a/m4/sha512.m4
+++ b/m4/sha512.m4
@@ -1,4 +1,4 @@
1# sha512.m4 serial 8 1# sha512.m4 serial 9
2dnl Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -8,5 +8,7 @@ AC_DEFUN([gl_SHA512],
8[ 8[
9 dnl Prerequisites of lib/sha512.c. 9 dnl Prerequisites of lib/sha512.c.
10 AC_REQUIRE([gl_BIGENDIAN]) 10 AC_REQUIRE([gl_BIGENDIAN])
11 : 11
12 dnl Determine HAVE_OPENSSL_SHA512 and LIB_CRYPTO
13 gl_CRYPTO_CHECK([SHA512])
12]) 14])
diff --git a/src/ChangeLog b/src/ChangeLog
index e67fdada36f..0970bf62b52 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,66 @@
12013-12-09 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * gtkutil.c (USE_NEW_GTK_FONT_CHOOSER) [HAVE_FREETYPE]:
4 Avoid unused macro warning if configured --without-xft.
5
62013-12-09 Jan Djärv <jan.h.d@swipnet.se>
7
8 * alloc.c (Fmemory_limit): Avoid compiler warning. Return 0 always.
9
102013-12-08 Jan Djärv <jan.h.d@swipnet.se>
11
12 * nsterm.m (updateFrameSize:): Fix GNUStep toolbar not updating.
13
14 * emacs.c (main): Call fixup_locale a second time for GNUStep.
15
162013-12-08 Martin Rudalics <rudalics@gmx.at>
17
18 * frame.c (x_set_font): Mark frame as garbaged (Bug#16028).
19
202013-12-08 Paul Eggert <eggert@cs.ucla.edu>
21
22 Use libcrypto's checksum implementations if available, for speed.
23 * Makefile.in (LIB_CRYPTO): New macro.
24 (LIBES): Use it.
25
26 * frame.h (SET_FRAME_VISIBLE): Now an inline function.
27 The macro didn't conform to C99 due to type mismatch,
28 which caused compilation failure with Sun C 5.12,
29 and it was confusing anyway. Include window.h to declare
30 redisplay_other_windows.
31
322013-12-08 Stefan Monnier <monnier@iro.umontreal.ca>
33
34 * window.c (set_window_buffer): Update mode line (bug#16084).
35
362013-12-07 Paul Eggert <eggert@cs.ucla.edu>
37
38 Fix minor problems found by static checking.
39 * keyboard.c (poll_for_input_1, input_polling_used):
40 Define only if HAVE_NTGUI.
41 * xmenu.c (popup_activate_callback): Omit unnecessary
42 check against USE_X_TOOLKIT, which must be defined here anyway.
43 * xterm.c, xterm.h (x_dispatch_event) [! (USE_X_TOOLKIT || USE_MOTIF)]:
44 Now static.
45
462013-12-07 Martin Rudalics <rudalics@gmx.at>
47
48 * w32term.c (w32_read_socket): Fix int/Lisp_Object type mixup.
49
12013-12-07 Jan Djärv <jan.h.d@swipnet.se> 502013-12-07 Jan Djärv <jan.h.d@swipnet.se>
2 51
52 * gtkutil.c (tb_size_cb): Call xg_height_or_width_changed.
53
54 * nsterm.m (x_set_window_size): Remove fprintf.
55 (init): Define always. Set applicationDidFinishLaunchingCalled
56 for GNUStep.
57 (applicationDidFinishLaunching:):
58 Set applicationDidFinishLaunchingCalled.
59 (applicationDidBecomeActive:): Call applicationDidFinishLaunching if
60 not called.
61
62 * nsterm.h (EmacsApp): Add applicationDidFinishLaunchingCalled.
63
3 Pixel resize changes for NS (Bug#16049). 64 Pixel resize changes for NS (Bug#16049).
4 * nsterm.m (x_set_window_size): Change parameters rows/cols to 65 * nsterm.m (x_set_window_size): Change parameters rows/cols to
5 height/width. row/cols are locals. 66 height/width. row/cols are locals.
@@ -7,8 +68,8 @@
7 (updateFrameSize:): Remove gsextra. Adjust for pixelwise resize. 68 (updateFrameSize:): Remove gsextra. Adjust for pixelwise resize.
8 (windowWillResize): Remove gsextra. Calculate extra as in 69 (windowWillResize): Remove gsextra. Calculate extra as in
9 updateFrameSize. 70 updateFrameSize.
10 (x_new_font): Don't change frame size if fullscreen. Change 71 (x_new_font): Don't change frame size if fullscreen.
11 size pixelwise. 72 Change size pixelwise.
12 73
13 * nsfns.m (Fx_create_frame): Call change_frame_size twice as per 74 * nsfns.m (Fx_create_frame): Call change_frame_size twice as per
14 comment in xfns.c. Change to pixelwise call. 75 comment in xfns.c. Change to pixelwise call.
@@ -210,8 +271,8 @@
210 ON_RIGHT_DIVIDER and ON_BOTTOM_DIVIDER. 271 ON_RIGHT_DIVIDER and ON_BOTTOM_DIVIDER.
211 (struct glyph_matrix): Replace window_left_col and 272 (struct glyph_matrix): Replace window_left_col and
212 window_top_line by window_pixel_left and window_pixel_top. 273 window_top_line by window_pixel_left and window_pixel_top.
213 (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P): Minor 274 (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P):
214 rewrite. 275 Minor rewrite.
215 (enum face_id): Add WINDOW_DIVIDER_FACE_ID. 276 (enum face_id): Add WINDOW_DIVIDER_FACE_ID.
216 (draw_window_divider, move_it_to, x_draw_right_divider) 277 (draw_window_divider, move_it_to, x_draw_right_divider)
217 (x_draw_bottom_divider, change_frame_size): Add or fix 278 (x_draw_bottom_divider, change_frame_size): Add or fix
@@ -226,8 +287,8 @@
226 (init_display): Adjusts calls of change_frame_size. 287 (init_display): Adjusts calls of change_frame_size.
227 (change_frame_size, change_frame_size_1): Handle pixelwise 288 (change_frame_size, change_frame_size_1): Handle pixelwise
228 changes. 289 changes.
229 * frame.c (Qright_divider_width, Qbottom_divider_width): New 290 * frame.c (Qright_divider_width, Qbottom_divider_width):
230 Lisp objects. 291 New Lisp objects.
231 (set_menu_bar_lines_1, set_menu_bar_lines, make_frame) 292 (set_menu_bar_lines_1, set_menu_bar_lines, make_frame)
232 (make_terminal_frame, Fmake_terminal_frame, Fframe_parameters) 293 (make_terminal_frame, Fmake_terminal_frame, Fframe_parameters)
233 (x_set_internal_border_width, x_set_vertical_scroll_bars) 294 (x_set_internal_border_width, x_set_vertical_scroll_bars)
@@ -238,15 +299,15 @@
238 (Fframe_text_width, Fframe_text_height, Fscroll_bar_width) 299 (Fframe_text_width, Fframe_text_height, Fscroll_bar_width)
239 (Ffringe_width, Fborder_width, Fright_divider_width) 300 (Ffringe_width, Fborder_width, Fright_divider_width)
240 (Fbottom_divider_width): New functions, defsubr them. 301 (Fbottom_divider_width): New functions, defsubr them.
241 (Fset_frame_height, Fset_frame_width, Fset_frame_size): New 302 (Fset_frame_height, Fset_frame_width, Fset_frame_size):
242 argument pixelwise. 303 New argument pixelwise.
243 (struct frame_parm_table): New members Qright_divider_width and 304 (struct frame_parm_table): New members Qright_divider_width and
244 Qbottom_divider_width. 305 Qbottom_divider_width.
245 (x_set_frame_parameters): Handle parameters for pixelwise sizes. 306 (x_set_frame_parameters): Handle parameters for pixelwise sizes.
246 (x_report_frame_params): Handle Qright_divider_width and 307 (x_report_frame_params): Handle Qright_divider_width and
247 Qbottom_divider_width. 308 Qbottom_divider_width.
248 (x_set_right_divider_width, x_set_bottom_divider_width): New 309 (x_set_right_divider_width, x_set_bottom_divider_width):
249 functions. 310 New functions.
250 (frame_resize_pixelwise): New option. 311 (frame_resize_pixelwise): New option.
251 * frame.h (struct frame): Add tool_bar_height, menu_bar_height, 312 * frame.h (struct frame): Add tool_bar_height, menu_bar_height,
252 new_pixelwise, right_divider_width and bottom_divider_width; 313 new_pixelwise, right_divider_width and bottom_divider_width;
@@ -257,8 +318,8 @@
257 FRAME_TEXT_WIDTH respectively. 318 FRAME_TEXT_WIDTH respectively.
258 (FRAME_MENU_BAR_HEIGHT, FRAME_TOOL_BAR_HEIGHT) 319 (FRAME_MENU_BAR_HEIGHT, FRAME_TOOL_BAR_HEIGHT)
259 (FRAME_RIGHT_DIVIDER_WIDTH, FRAME_BOTTOM_DIVIDER_WIDTH) 320 (FRAME_RIGHT_DIVIDER_WIDTH, FRAME_BOTTOM_DIVIDER_WIDTH)
260 (FRAME_TEXT_TO_PIXEL_WIDTH, FRAME_PIXEL_TO_TEXT_WIDTH): New 321 (FRAME_TEXT_TO_PIXEL_WIDTH, FRAME_PIXEL_TO_TEXT_WIDTH):
261 macros. 322 New macros.
262 (FRAME_TOP_MARGIN_HEIGHT, FRAME_LEFT_SCROLL_BAR_AREA_WIDTH) 323 (FRAME_TOP_MARGIN_HEIGHT, FRAME_LEFT_SCROLL_BAR_AREA_WIDTH)
263 (FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH, FRAME_SCROLL_BAR_AREA_WIDTH) 324 (FRAME_RIGHT_SCROLL_BAR_AREA_WIDTH, FRAME_SCROLL_BAR_AREA_WIDTH)
264 (SET_FRAME_COLS, SET_FRAME_WIDTH, SET_FRAME_HEIGHT) 325 (SET_FRAME_COLS, SET_FRAME_WIDTH, SET_FRAME_HEIGHT)
@@ -268,8 +329,8 @@
268 * fringe.c (draw_fringe_bitmap_1): Handle right divder. 329 * fringe.c (draw_fringe_bitmap_1): Handle right divder.
269 * gtkutil.c (xg_frame_resized, xg_frame_set_char_size) 330 * gtkutil.c (xg_frame_resized, xg_frame_set_char_size)
270 (x_wm_set_size_hint): Handle frame pixel sizes. 331 (x_wm_set_size_hint): Handle frame pixel sizes.
271 * indent.c (compute_motion, Fcompute_motion): Call 332 * indent.c (compute_motion, Fcompute_motion):
272 window_body_width instead of window_body_cols. 333 Call window_body_width instead of window_body_cols.
273 * keyboard.c (Qright_divider, Qbottom_divider): New symbols. 334 * keyboard.c (Qright_divider, Qbottom_divider): New symbols.
274 (make_lispy_position): Handle right and bottom dividers. 335 (make_lispy_position): Handle right and bottom dividers.
275 (Fsuspend_emacs): Pixelize call of change_frame_size. 336 (Fsuspend_emacs): Pixelize call of change_frame_size.
@@ -277,13 +338,13 @@
277 * lisp.h: Extern set_frame_param. 338 * lisp.h: Extern set_frame_param.
278 * nsfns.m (x_set_tool_bar_lines): Pixelize call of 339 * nsfns.m (x_set_tool_bar_lines): Pixelize call of
279 x_set_window_size. 340 x_set_window_size.
280 (Fx_create_frame): Add entry for vertical_drag_cursor. Pixelize 341 (Fx_create_frame): Add entry for vertical_drag_cursor.
281 call of change_frame_size. 342 Pixelize call of change_frame_size.
282 * nsterm.h (struct ns_output): Add vertical_drag_cursor. 343 * nsterm.h (struct ns_output): Add vertical_drag_cursor.
283 * nsterm.m (ns_update_window_end): Optionally draw right 344 * nsterm.m (ns_update_window_end): Optionally draw right
284 divider. 345 divider.
285 (x_set_window_size): Add argument pixelwise. Call 346 (x_set_window_size): Add argument pixelwise.
286 check_frame_size and change_frame_size with pixelwise zero. 347 Call check_frame_size and change_frame_size with pixelwise zero.
287 (ns_draw_window_divider): New function. 348 (ns_draw_window_divider): New function.
288 (ns_redisplay_interface): Add ns_draw_window_divider. 349 (ns_redisplay_interface): Add ns_draw_window_divider.
289 (updateFrameSize:): Call change_frame_size with pixelwise zero. 350 (updateFrameSize:): Call change_frame_size with pixelwise zero.
@@ -294,12 +355,12 @@
294 * w32fns.c (x_set_mouse_color): Handle vertical drag cursor. 355 * w32fns.c (x_set_mouse_color): Handle vertical drag cursor.
295 (x_set_menu_bar_lines, x_set_tool_bar_lines): Calculate pixelwise. 356 (x_set_menu_bar_lines, x_set_tool_bar_lines): Calculate pixelwise.
296 (w32_createwindow): Use scroll bar area width. 357 (w32_createwindow): Use scroll bar area width.
297 (w32_wnd_proc): Handle bottom divider width. For 358 (w32_wnd_proc): Handle bottom divider width.
298 WM_WINDOWPOSCHANGING return zero if we resize pixelwise. 359 For WM_WINDOWPOSCHANGING return zero if we resize pixelwise.
299 (Fx_create_frame): Default divider width parameters. Caclulate 360 (Fx_create_frame): Default divider width parameters.
300 sizes pixelwise. Add vertical drag cursor support. 361 Caclulate sizes pixelwise. Add vertical drag cursor support.
301 (x_create_tip_frame): Default divider widths to zero. Pixelize 362 (x_create_tip_frame): Default divider widths to zero.
302 call to change_frame_size. 363 Pixelize call to change_frame_size.
303 (Fx_show_tip): Add handling of divider widths. Pixelize window 364 (Fx_show_tip): Add handling of divider widths. Pixelize window
304 position and sizes. 365 position and sizes.
305 (Fw32_frame_rect): New function. 366 (Fw32_frame_rect): New function.
@@ -314,8 +375,8 @@
314 (x_update_window_end): Handle right divider. 375 (x_update_window_end): Handle right divider.
315 (w32_draw_fringe_bitmap, x_scroll_run) 376 (w32_draw_fringe_bitmap, x_scroll_run)
316 (w32_set_vertical_scroll_bar): Pixelize scrollbar widths. 377 (w32_set_vertical_scroll_bar): Pixelize scrollbar widths.
317 (w32_read_socket): Handle SIZE_MAXIMIZED separately. Calculate 378 (w32_read_socket): Handle SIZE_MAXIMIZED separately.
318 new frame sizes pixelwise. 379 Calculate new frame sizes pixelwise.
319 (x_new_font): Pixelize call to x_set_window_size. 380 (x_new_font): Pixelize call to x_set_window_size.
320 (x_check_fullscreen): Pixelize call to change_frame_size. 381 (x_check_fullscreen): Pixelize call to change_frame_size.
321 (x_set_window_size_1, x_set_window_size): New argument 382 (x_set_window_size_1, x_set_window_size): New argument
@@ -334,16 +395,16 @@
334 (Fset_window_new_pixel, window_resize_apply_total) 395 (Fset_window_new_pixel, window_resize_apply_total)
335 (Fwindow_resize_apply_total): New functions. 396 (Fwindow_resize_apply_total): New functions.
336 (window_body_height, window_body_width): Rename from 397 (window_body_height, window_body_width): Rename from
337 window_body_lines. New argument PIXELWISE. Calculate 398 window_body_lines. New argument PIXELWISE.
338 pixelwise. 399 Calculate pixelwise.
339 (Fwindow_body_height, Fwindow_body_width): New argument 400 (Fwindow_body_height, Fwindow_body_width): New argument
340 PIXELWISE. 401 PIXELWISE.
341 (coordinates_in_window, window_relative_x_coord): Use window's 402 (coordinates_in_window, window_relative_x_coord): Use window's
342 pixel width instead of total width. 403 pixel width instead of total width.
343 (replace_window, recombine_windows): Initialize pixel values. 404 (replace_window, recombine_windows): Initialize pixel values.
344 (resize_root_window, resize_frame_windows, grow_mini_window) 405 (resize_root_window, resize_frame_windows, grow_mini_window)
345 (shrink_mini_window): New argument PIXELWISE. Calculate 406 (shrink_mini_window): New argument PIXELWISE.
346 pixelwise. 407 Calculate pixelwise.
347 (Fdelete_other_windows_internal, adjust_window_margins) 408 (Fdelete_other_windows_internal, adjust_window_margins)
348 (window_resize_check, window_resize_apply) 409 (window_resize_check, window_resize_apply)
349 (Fdelete_window_internal, Fresize_mini_window_internal) 410 (Fdelete_window_internal, Fresize_mini_window_internal)
@@ -368,11 +429,11 @@
368 slots in save_window_data and saved_window. 429 slots in save_window_data and saved_window.
369 (Fset_window_scroll_bars): Fix doc-string. 430 (Fset_window_scroll_bars): Fix doc-string.
370 (window_resize_pixelwise): New variable. 431 (window_resize_pixelwise): New variable.
371 (coordinates_in_window, Fcoordinates_in_window_p): Handle 432 (coordinates_in_window, Fcoordinates_in_window_p):
372 dividers. 433 Handle dividers.
373 (make_parent_window): Adjust sequence_number. 434 (make_parent_window): Adjust sequence_number.
374 (Fwindow_right_divider_width, Fwindow_bottom_divider_width): New 435 (Fwindow_right_divider_width, Fwindow_bottom_divider_width):
375 functions. 436 New functions.
376 * window.h (struct window): New members new_pixel, pixel_left, 437 * window.h (struct window): New members new_pixel, pixel_left,
377 pixel_top, pixel_width, pixel_height. Restore sequence_number. 438 pixel_top, pixel_width, pixel_height. Restore sequence_number.
378 (wset_new_pixel): New function. 439 (wset_new_pixel): New function.
@@ -406,10 +467,10 @@
406 encountered. 467 encountered.
407 (Fwindow_text_pixel_size): New function. 468 (Fwindow_text_pixel_size): New function.
408 (resize_mini_window, update_tool_bar): Calculate pixelwise. 469 (resize_mini_window, update_tool_bar): Calculate pixelwise.
409 (tool_bar_lines_needed): Rename to tool_bar_height. Calculate 470 (tool_bar_lines_needed): Rename to tool_bar_height.
410 pixelwise. 471 Calculate pixelwise.
411 (Ftool_bar_lines_needed): Rename to Ftool_bar_height. Calculate 472 (Ftool_bar_lines_needed): Rename to Ftool_bar_height.
412 pixelwise. 473 Calculate pixelwise.
413 (redisplay_tool_bar): Calculate pixelwise. 474 (redisplay_tool_bar): Calculate pixelwise.
414 (redisplay_window): Calculate pixelwise. Handle dividers. 475 (redisplay_window): Calculate pixelwise. Handle dividers.
415 (draw_glyphs, x_clear_end_of_line, note_mouse_highlight) 476 (draw_glyphs, x_clear_end_of_line, note_mouse_highlight)
@@ -424,8 +485,8 @@
424 (x_set_menu_bar_lines, x_set_tool_bar_lines): Calculate pixelwise. 485 (x_set_menu_bar_lines, x_set_tool_bar_lines): Calculate pixelwise.
425 (x_set_scroll_bar_default_width): Default actual width to 16. 486 (x_set_scroll_bar_default_width): Default actual width to 16.
426 (Fx_create_frame): Set sizes pixelwise. 487 (Fx_create_frame): Set sizes pixelwise.
427 (x_create_tip_frame): Default divider widths to zero. Pixelize 488 (x_create_tip_frame): Default divider widths to zero.
428 call of change_frame_size. 489 Pixelize call of change_frame_size.
429 (Fx_show_tip): Handle divider widths. Initial pixel position 490 (Fx_show_tip): Handle divider widths. Initial pixel position
430 and sizes. 491 and sizes.
431 (frame_parm_handler x_frame_parm_handlers): Add divider widths. 492 (frame_parm_handler x_frame_parm_handlers): Add divider widths.
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index fb1b96f738c..ff0f4bf7ae8 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -12845,8 +12845,8 @@
12845 longer DEFVARed: they are already declared in window.c. 12845 longer DEFVARed: they are already declared in window.c.
12846 12846
12847 * screen.c (window_from_coordinates): Use Fnext_window, even if 12847 * screen.c (window_from_coordinates): Use Fnext_window, even if
12848 MULTI_SCREEN, to obtain the next window. This is an test. 12848 MULTI_SCREEN, to obtain the next window. This is a test.
12849 Also, new paramater part returns text or modeline symbol. 12849 Also, new parameter part returns text or modeline symbol.
12850 (Flocate_window_from_coordinates): Pass &part to 12850 (Flocate_window_from_coordinates): Pass &part to
12851 window_from_coordinates. 12851 window_from_coordinates.
12852 (coordinates_in_window): Don't say modeline if window_height is 1, 12852 (coordinates_in_window): Don't say modeline if window_height is 1,
diff --git a/src/Makefile.in b/src/Makefile.in
index 7d91928acfe..cef1ba5ed2e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -139,6 +139,7 @@ M17N_FLT_LIBS = @M17N_FLT_LIBS@
139 139
140LIB_ACL=@LIB_ACL@ 140LIB_ACL=@LIB_ACL@
141LIB_CLOCK_GETTIME=@LIB_CLOCK_GETTIME@ 141LIB_CLOCK_GETTIME=@LIB_CLOCK_GETTIME@
142LIB_CRYPTO=@LIB_CRYPTO@
142LIB_EACCESS=@LIB_EACCESS@ 143LIB_EACCESS=@LIB_EACCESS@
143LIB_FDATASYNC=@LIB_FDATASYNC@ 144LIB_FDATASYNC=@LIB_FDATASYNC@
144LIB_TIMER_TIME=@LIB_TIMER_TIME@ 145LIB_TIMER_TIME=@LIB_TIMER_TIME@
@@ -403,6 +404,7 @@ ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj)
403LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \ 404LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
404 $(LIBX_OTHER) $(LIBSOUND) \ 405 $(LIBX_OTHER) $(LIBSOUND) \
405 $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(LIB_CLOCK_GETTIME) \ 406 $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(LIB_CLOCK_GETTIME) \
407 $(LIB_CRYPTO) \
406 $(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \ 408 $(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \
407 $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) \ 409 $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) \
408 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ 410 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
diff --git a/src/alloc.c b/src/alloc.c
index f076075a94f..aeda42637cd 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6633,7 +6633,12 @@ We divide the value by 1024 to make sure it fits in a Lisp integer. */)
6633{ 6633{
6634 Lisp_Object end; 6634 Lisp_Object end;
6635 6635
6636#ifdef HAVE_NS
6637 /* Avoid warning. sbrk has no relation to memory allocated anyway. */
6638 XSETINT (end, 0);
6639#else
6636 XSETINT (end, (intptr_t) (char *) sbrk (0) / 1024); 6640 XSETINT (end, (intptr_t) (char *) sbrk (0) / 1024);
6641#endif
6637 6642
6638 return end; 6643 return end;
6639} 6644}
diff --git a/src/emacs.c b/src/emacs.c
index af69e2c4efe..9c5a33d5a89 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1217,6 +1217,11 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1217 1217
1218#ifdef HAVE_NS 1218#ifdef HAVE_NS
1219 ns_pool = ns_alloc_autorelease_pool (); 1219 ns_pool = ns_alloc_autorelease_pool ();
1220#ifdef NS_IMPL_GNUSTEP
1221 /* GNUStep stupidly resets our locale settings after we made them. */
1222 fixup_locale ();
1223#endif
1224
1220 if (!noninteractive) 1225 if (!noninteractive)
1221 { 1226 {
1222#ifdef NS_IMPL_COCOA 1227#ifdef NS_IMPL_COCOA
diff --git a/src/eval.c b/src/eval.c
index 81666830f4e..1dca9295cfb 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3597,7 +3597,7 @@ NFRAMES and BASE specify the activation frame to use, as in `backtrace-frame'.
3597 /* The specpdl entries normally contain the symbol being bound along with its 3597 /* The specpdl entries normally contain the symbol being bound along with its
3598 `old_value', so it can be restored. The new value to which it is bound is 3598 `old_value', so it can be restored. The new value to which it is bound is
3599 available in one of two places: either in the current value of the 3599 available in one of two places: either in the current value of the
3600 variable (if it hasn't been rebount yet) or in the `old_value' slot of the 3600 variable (if it hasn't been rebound yet) or in the `old_value' slot of the
3601 next specpdl entry for it. 3601 next specpdl entry for it.
3602 `backtrace_eval_unrewind' happens to swap the role of `old_value' 3602 `backtrace_eval_unrewind' happens to swap the role of `old_value'
3603 and "new value", so we abuse it here, to fetch the new value. 3603 and "new value", so we abuse it here, to fetch the new value.
diff --git a/src/frame.c b/src/frame.c
index 03bdf696c47..e13c3768e12 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3314,9 +3314,13 @@ x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3314#endif 3314#endif
3315 /* Recalculate toolbar height. */ 3315 /* Recalculate toolbar height. */
3316 f->n_tool_bar_rows = 0; 3316 f->n_tool_bar_rows = 0;
3317
3317 /* Ensure we redraw it. */ 3318 /* Ensure we redraw it. */
3318 clear_current_matrices (f); 3319 clear_current_matrices (f);
3319 3320
3321 /* Attempt to hunt down bug#16028. */
3322 SET_FRAME_GARBAGED (f);
3323
3320 recompute_basic_faces (f); 3324 recompute_basic_faces (f);
3321 3325
3322 do_pending_window_change (0); 3326 do_pending_window_change (0);
diff --git a/src/frame.h b/src/frame.h
index 8369cf6b17e..0f6a674dc06 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -25,6 +25,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25 25
26#include "dispextern.h" 26#include "dispextern.h"
27#include "termhooks.h" 27#include "termhooks.h"
28#include "window.h"
28 29
29INLINE_HEADER_BEGIN 30INLINE_HEADER_BEGIN
30 31
@@ -956,10 +957,14 @@ default_pixels_per_inch_y (void)
956 if some changes were applied to it while it wasn't visible (and hence 957 if some changes were applied to it while it wasn't visible (and hence
957 wasn't redisplayed). */ 958 wasn't redisplayed). */
958 959
959#define SET_FRAME_VISIBLE(f, v) \ 960INLINE void
960 (((f)->visible == 0 || ((f)->visible == 2)) && ((v) == 1) \ 961SET_FRAME_VISIBLE (struct frame *f, int v)
961 ? redisplay_other_windows () : 0, \ 962{
962 (f)->visible = (eassert (0 <= (v) && (v) <= 2), (v))) 963 eassert (0 <= v && v <= 2);
964 if (v == 1 && f->visible != 1)
965 redisplay_other_windows ();
966 f->visible = v;
967}
963 968
964/* Set iconify of frame F. */ 969/* Set iconify of frame F. */
965 970
diff --git a/src/gtkutil.c b/src/gtkutil.c
index ef422989c61..e5d6414cf75 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -78,6 +78,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
78#define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) 78#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
79#endif 79#endif
80 80
81#ifdef HAVE_FREETYPE
81#if GTK_CHECK_VERSION (3, 2, 0) 82#if GTK_CHECK_VERSION (3, 2, 0)
82#define USE_NEW_GTK_FONT_CHOOSER 1 83#define USE_NEW_GTK_FONT_CHOOSER 1
83#else 84#else
@@ -89,6 +90,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
89#define gtk_font_chooser_set_font(x, y) \ 90#define gtk_font_chooser_set_font(x, y) \
90 gtk_font_selection_dialog_set_font_name (x, y) 91 gtk_font_selection_dialog_set_font_name (x, y)
91#endif 92#endif
93#endif /* HAVE_FREETYPE */
92 94
93#ifndef HAVE_GTK3 95#ifndef HAVE_GTK3
94#ifdef USE_GTK_TOOLTIP 96#ifdef USE_GTK_TOOLTIP
@@ -4350,7 +4352,7 @@ tb_size_cb (GtkWidget *widget,
4350 size hints if tool bar size changes. Seen on Fedora 18 at least. */ 4352 size hints if tool bar size changes. Seen on Fedora 18 at least. */
4351 struct frame *f = user_data; 4353 struct frame *f = user_data;
4352 if (xg_update_tool_bar_sizes (f)) 4354 if (xg_update_tool_bar_sizes (f))
4353 x_wm_set_size_hint (f, 0, 0); 4355 xg_height_or_width_changed (f);
4354} 4356}
4355 4357
4356/* Create a tool bar for frame F. */ 4358/* Create a tool bar for frame F. */
diff --git a/src/keyboard.c b/src/keyboard.c
index b50c06b4154..913a277ca79 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1954,10 +1954,8 @@ int poll_suppress_count;
1954 1954
1955static struct atimer *poll_timer; 1955static struct atimer *poll_timer;
1956 1956
1957/* Poll for input, so that we catch a C-g if it comes in. This 1957#ifdef HAVE_NTGUI
1958 function is called from x_make_frame_visible, see comment 1958/* Poll for input, so that we catch a C-g if it comes in. */
1959 there. */
1960
1961void 1959void
1962poll_for_input_1 (void) 1960poll_for_input_1 (void)
1963{ 1961{
@@ -1965,6 +1963,7 @@ poll_for_input_1 (void)
1965 && !waiting_for_input) 1963 && !waiting_for_input)
1966 gobble_input (); 1964 gobble_input ();
1967} 1965}
1966#endif
1968 1967
1969/* Timer callback function for poll_timer. TIMER is equal to 1968/* Timer callback function for poll_timer. TIMER is equal to
1970 poll_timer. */ 1969 poll_timer. */
@@ -2016,6 +2015,8 @@ start_polling (void)
2016#endif 2015#endif
2017} 2016}
2018 2017
2018#ifdef HAVE_NTGUI
2019
2019/* True if we are using polling to handle input asynchronously. */ 2020/* True if we are using polling to handle input asynchronously. */
2020 2021
2021bool 2022bool
@@ -2030,6 +2031,7 @@ input_polling_used (void)
2030 return 0; 2031 return 0;
2031#endif 2032#endif
2032} 2033}
2034#endif
2033 2035
2034/* Turn off polling. */ 2036/* Turn off polling. */
2035 2037
diff --git a/src/nsterm.h b/src/nsterm.h
index 976347ad3b4..0215f13dffd 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -90,6 +90,7 @@ typedef float EmacsCGFloat;
90 BOOL isFirst; 90 BOOL isFirst;
91#endif 91#endif
92#ifdef NS_IMPL_GNUSTEP 92#ifdef NS_IMPL_GNUSTEP
93 BOOL applicationDidFinishLaunchingCalled;
93@public 94@public
94 int nextappdefined; 95 int nextappdefined;
95#endif 96#endif
diff --git a/src/nsterm.m b/src/nsterm.m
index 37edfb238a9..9c87923f32e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1320,8 +1320,6 @@ x_set_window_size (struct frame *f,
1320 [view setRows: rows andColumns: cols]; 1320 [view setRows: rows andColumns: cols];
1321 [window setFrame: wr display: YES]; 1321 [window setFrame: wr display: YES];
1322 1322
1323 fprintf (stderr, "\tx_set_window_size %d, %d\t%d, %d\n", cols, rows, pixelwidth, pixelheight);
1324
1325 /* This is a trick to compensate for Emacs' managing the scrollbar area 1323 /* This is a trick to compensate for Emacs' managing the scrollbar area
1326 as a fixed number of standard character columns. Instead of leaving 1324 as a fixed number of standard character columns. Instead of leaving
1327 blank space for the extra, we chopped it off above. Now for 1325 blank space for the extra, we chopped it off above. Now for
@@ -4410,15 +4408,22 @@ ns_term_shutdown (int sig)
4410 4408
4411@implementation EmacsApp 4409@implementation EmacsApp
4412 4410
4413#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
4414- (id)init 4411- (id)init
4415{ 4412{
4416 if (self = [super init]) 4413 if (self = [super init])
4417 self->isFirst = YES; 4414 {
4415#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
4416 self->isFirst = YES;
4417#endif
4418#ifdef NS_IMPL_GNUSTEP
4419 self->applicationDidFinishLaunchingCalled = NO;
4420#endif
4421 }
4418 4422
4419 return self; 4423 return self;
4420} 4424}
4421 4425
4426#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
4422- (void)run 4427- (void)run
4423{ 4428{
4424 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 4429 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -4605,6 +4610,9 @@ ns_term_shutdown (int sig)
4605 -------------------------------------------------------------------------- */ 4610 -------------------------------------------------------------------------- */
4606{ 4611{
4607 NSTRACE (applicationDidFinishLaunching); 4612 NSTRACE (applicationDidFinishLaunching);
4613#ifdef NS_IMPL_GNUSTEP
4614 ((EmacsApp *)self)->applicationDidFinishLaunchingCalled = YES;
4615#endif
4608 [NSApp setServicesProvider: NSApp]; 4616 [NSApp setServicesProvider: NSApp];
4609 ns_send_appdefined (-2); 4617 ns_send_appdefined (-2);
4610} 4618}
@@ -4732,6 +4740,10 @@ not_in_argv (NSString *arg)
4732{ 4740{
4733 NSTRACE (applicationDidBecomeActive); 4741 NSTRACE (applicationDidBecomeActive);
4734 4742
4743#ifdef NS_IMPL_GNUSTEP
4744 if (! applicationDidFinishLaunchingCalled)
4745 [self applicationDidFinishLaunching:notification];
4746#endif
4735 //ns_app_active=YES; 4747 //ns_app_active=YES;
4736 4748
4737 ns_update_auto_hide_menu_bar (); 4749 ns_update_auto_hide_menu_bar ();
@@ -5670,6 +5682,11 @@ not_in_argv (NSString *arg)
5670 5682
5671 if (! [self isFullscreen]) 5683 if (! [self isFullscreen])
5672 { 5684 {
5685#ifdef NS_IMPL_GNUSTEP
5686 // GNUStep does not always update the tool bar height. Force it.
5687 if (toolbar) update_frame_tool_bar (emacsframe);
5688#endif
5689
5673 extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe) 5690 extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
5674 + FRAME_TOOLBAR_HEIGHT (emacsframe); 5691 + FRAME_TOOLBAR_HEIGHT (emacsframe);
5675 } 5692 }
diff --git a/src/w32term.c b/src/w32term.c
index 9c74304a83a..64febea6a1a 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4764,9 +4764,9 @@ w32_read_socket (struct terminal *terminal,
4764 record_asynch_buffer_change (); 4764 record_asynch_buffer_change ();
4765 } 4765 }
4766 4766
4767 if (get_frame_param (f, Qfullscreen) == Qnil) 4767 if (EQ (get_frame_param (f, Qfullscreen), Qnil))
4768 set_frame_param (f, Qfullscreen, Qmaximized); 4768 set_frame_param (f, Qfullscreen, Qmaximized);
4769 else if (get_frame_param (f, Qfullscreen) != Qmaximized) 4769 else if (! EQ (get_frame_param (f, Qfullscreen), Qmaximized))
4770 set_frame_param (f, Qmaximized, Qmaximized); 4770 set_frame_param (f, Qmaximized, Qmaximized);
4771 4771
4772 break; 4772 break;
@@ -4803,9 +4803,9 @@ w32_read_socket (struct terminal *terminal,
4803 record_asynch_buffer_change (); 4803 record_asynch_buffer_change ();
4804 } 4804 }
4805 4805
4806 if (get_frame_param (f, Qfullscreen) == Qmaximized) 4806 if (EQ (get_frame_param (f, Qfullscreen), Qmaximized))
4807 set_frame_param (f, Qfullscreen, Qnil); 4807 set_frame_param (f, Qfullscreen, Qnil);
4808 else if (get_frame_param (f, Qmaximized) != Qnil) 4808 else if (! EQ (get_frame_param (f, Qmaximized), Qnil))
4809 set_frame_param (f, Qmaximized, Qnil); 4809 set_frame_param (f, Qmaximized, Qnil);
4810 4810
4811 break; 4811 break;
diff --git a/src/window.c b/src/window.c
index d1f3dd599b1..426edc6099c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3365,6 +3365,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
3365 /* Maybe we could move this into the `if' but it's not obviously safe and 3365 /* Maybe we could move this into the `if' but it's not obviously safe and
3366 I doubt it's worth the trouble. */ 3366 I doubt it's worth the trouble. */
3367 wset_redisplay (w); 3367 wset_redisplay (w);
3368 w->update_mode_line = true;
3368 3369
3369 /* We must select BUFFER for running the window-scroll-functions. */ 3370 /* We must select BUFFER for running the window-scroll-functions. */
3370 /* We can't check ! NILP (Vwindow_scroll_functions) here 3371 /* We can't check ! NILP (Vwindow_scroll_functions) here
diff --git a/src/xmenu.c b/src/xmenu.c
index d587610fdd7..fb3baa01ef4 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -510,9 +510,7 @@ static void
510popup_activate_callback (Widget widget, LWLIB_ID id, XtPointer client_data) 510popup_activate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
511{ 511{
512 popup_activated_flag = 1; 512 popup_activated_flag = 1;
513#ifdef USE_X_TOOLKIT
514 x_activate_timeout_atimer (); 513 x_activate_timeout_atimer ();
515#endif
516} 514}
517#endif 515#endif
518 516
diff --git a/src/xterm.c b/src/xterm.c
index e8e69c666ee..90c7c36c44f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -248,6 +248,9 @@ static void x_sync_with_move (struct frame *, int, int, int);
248static int handle_one_xevent (struct x_display_info *, 248static int handle_one_xevent (struct x_display_info *,
249 const XEvent *, int *, 249 const XEvent *, int *,
250 struct input_event *); 250 struct input_event *);
251#if ! (defined USE_X_TOOLKIT || defined USE_MOTIF)
252static int x_dispatch_event (XEvent *, Display *);
253#endif
251/* Don't declare this _Noreturn because we want no 254/* Don't declare this _Noreturn because we want no
252 interference with debugging failing X calls. */ 255 interference with debugging failing X calls. */
253static void x_connection_closed (Display *, const char *); 256static void x_connection_closed (Display *, const char *);
diff --git a/src/xterm.h b/src/xterm.h
index 3d954fb8600..eff75403476 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -945,7 +945,9 @@ extern void x_clear_area (Display *, Window, int, int, int, int);
945extern void x_mouse_leave (struct x_display_info *); 945extern void x_mouse_leave (struct x_display_info *);
946#endif 946#endif
947 947
948#if defined USE_X_TOOLKIT || defined USE_MOTIF
948extern int x_dispatch_event (XEvent *, Display *); 949extern int x_dispatch_event (XEvent *, Display *);
950#endif
949extern int x_x_to_emacs_modifiers (struct x_display_info *, int); 951extern int x_x_to_emacs_modifiers (struct x_display_info *, int);
950extern int x_display_pixel_height (struct x_display_info *); 952extern int x_display_pixel_height (struct x_display_info *);
951extern int x_display_pixel_width (struct x_display_info *); 953extern int x_display_pixel_width (struct x_display_info *);
diff --git a/test/ChangeLog b/test/ChangeLog
index bb2caea6a7c..8fc6bc5158a 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
12013-12-08 Dmitry Gutov <dgutov@yandex.ru>
2
3 * indent/js.js: New file.
4
12013-12-05 Michael Albinus <michael.albinus@gmx.de> 52013-12-05 Michael Albinus <michael.albinus@gmx.de>
2 6
3 * automated/dbus-tests.el: New file. 7 * automated/dbus-tests.el: New file.
diff --git a/test/indent/js.js b/test/indent/js.js
new file mode 100644
index 00000000000..d623a0dc5bc
--- /dev/null
+++ b/test/indent/js.js
@@ -0,0 +1,49 @@
1var a = 1;
2b = 2;
3
4let c = 1,
5 d = 2;
6
7var e = 100500,
8 + 1;
9
10var f = bar('/protocols/')
11baz();
12
13var h = 100500
141;
15
16const i = 1,
17 j = 2;
18
19var k = 1,
20 l = [
21 1, 2,
22 3, 4
23 ],
24 m = 5;
25
26var n = function() {
27 return 7;
28},
29 o = 8;
30
31foo(bar, function() {
32 return 2;
33});
34
35switch (b) {
36case "a":
37 2;
38default:
39 3;
40}
41
42var p = {
43 case: 'zzzz',
44 default: 'donkey',
45 tee: 'ornery'
46};
47
48var evens = [e for each (e in range(0, 21))
49 if (ed % 2 == 0)];
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index a3ab73bcfb5..3c4d68a97bf 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -299,3 +299,6 @@ def qux
299 tee 299 tee
300 end 300 end
301end 301end
302
303%^abc^
304ddd