[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] concurrency-libtask 76b7e0e 1/3: Merge branch 'master' int
From: |
Philipp Stephani |
Subject: |
[Emacs-diffs] concurrency-libtask 76b7e0e 1/3: Merge branch 'master' into concurrency-libtask |
Date: |
Sun, 30 Oct 2016 17:30:01 +0000 (UTC) |
branch: concurrency-libtask
commit 76b7e0efe42080c0f1b67650a1a6f56742f78076
Merge: 80d9d4e e2fd206
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>
Merge branch 'master' into concurrency-libtask
---
doc/emacs/text.texi | 14 ++++++++--
etc/NEWS | 5 ++++
lib/gnulib.mk | 1 +
lib/stdlib.in.h | 15 +++++++++++
lisp/electric.el | 58 +++++++++++++++++++++++++++---------------
lisp/emacs-lisp/avl-tree.el | 12 +++++----
m4/st_dm_mode.m4 | 2 +-
m4/stdint.m4 | 11 +++++++-
m4/stdlib_h.m4 | 5 ++--
m4/utimes.m4 | 2 +-
src/xwidget.c | 2 +-
test/lisp/thingatpt-tests.el | 26 +++++++++++++++++--
12 files changed, 118 insertions(+), 35 deletions(-)
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 7fa0804..4c6a1ff 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -412,6 +412,7 @@ beginning of a line.
@cindex mode, Electric Quote
@cindex curly quotes
@cindex curved quotes
address@hidden guillemets
@findex electric-quote-mode
One common way to quote is the typewriter convention, which quotes
using straight apostrophes @t{'like this'} or double-quotes @t{"like
@@ -420,9 +421,15 @@ left and right single or double quotation marks @t{‘like
this’} or
@t{“like this”}. In text files, typewriter quotes are simple and
portable; curved quotes are less ambiguous and typically look nicer.
address@hidden electric-quote-chars
Electric Quote mode makes it easier to type curved quotes. As you
type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
address@hidden to @t{“}, and @t{''} to @t{”}.
address@hidden to @t{“}, and @t{''} to @t{”}. It's possible to change the
+default quotes listed above, by customizing the variable
address@hidden, a list of four characters, where the
+items correspond to the left single quote, the right single quote, the
+left double quote and the right double quote, respectively, whose
+default value is @code{'(?‘ ?’ ?“ ?”)}.
@vindex electric-quote-paragraph
@vindex electric-quote-comment
@@ -443,7 +450,10 @@ type @kbd{C-q `} or @kbd{C-q '} instead of @kbd{`} or
@kbd{'}. To
insert a curved quote even when Electric Quote is disabled or
inactive, you can type @kbd{C-x 8 [} for @t{‘}, @kbd{C-x 8 ]} for
@t{’}, @kbd{C-x 8 @{} for @t{“}, and @kbd{C-x 8 @}} for @t{”}.
address@hidden Text}.
address@hidden Text}. Note that the value of
address@hidden does not affect these keybindings, they
+are not keybindings of @code{electric-quote-mode} but bound in
address@hidden
@node Filling
@section Filling Text
diff --git a/etc/NEWS b/etc/NEWS
index a160f81..addd056 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -61,6 +61,11 @@ affected by this, as SGI stopped supporting IRIX in December
2013.
* Changes in Emacs 26.1
++++
+** The new user variable 'electric-quote-chars' provides a list
+of curved quotes for 'electric-quote-mode', allowing user to choose
+the types of quotes to be used.
+
---
The group 'wp', whose label was "text", is now deprecated.
Use the new group 'text', which inherits from 'wp', instead.
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index a691a0b..56c2109 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -1258,6 +1258,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status
$(CXXDEFS_H) \
-e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
-e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
-e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
+ -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \
-e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
-e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 70dc88d..db3253b 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -521,6 +521,9 @@ _GL_CXXALIASWARN (putenv);
#endif
#if @GNULIB_QSORT_R@
+/* Sort an array of NMEMB elements, starting at address BASE, each element
+ occupying SIZE bytes, in ascending order according to the comparison
+ function COMPARE. */
# if @REPLACE_QSORT_R@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef qsort_r
@@ -535,12 +538,24 @@ _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t
nmemb, size_t size,
void *),
void *arg));
# else
+# if address@hidden@
+_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
+ int (*compare) (void const *, void const *,
+ void *),
+ void *arg) _GL_ARG_NONNULL ((1, 4)));
+# endif
_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
int (*compare) (void const *, void const *,
void *),
void *arg));
# endif
_GL_CXXALIASWARN (qsort_r);
+#elif defined GNULIB_POSIXCHECK
+# undef qsort_r
+# if HAVE_RAW_DECL_QSORT_R
+_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
+ "use gnulib module qsort_r for portability");
+# endif
#endif
diff --git a/lisp/electric.el b/lisp/electric.el
index f35f8b9..3e48737 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -425,6 +425,19 @@ The variable `electric-layout-rules' says when and how to
insert newlines."
:version "25.1"
:type 'boolean :safe 'booleanp :group 'electricity)
+(defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
+ "Curved quote characters for `electric-quote-mode'.
+This list's members correspond to left single quote, right single
+quote, left double quote, and right double quote, respectively."
+ :version "26.1"
+ :type '(list character character character character)
+ :safe #'(lambda (x)
+ (pcase x
+ (`(,(pred characterp) ,(pred characterp)
+ ,(pred characterp) ,(pred characterp))
+ t)))
+ :group 'electricity)
+
(defcustom electric-quote-paragraph t
"Non-nil means to use electric quoting in text paragraphs."
:version "25.1"
@@ -451,26 +464,28 @@ This requotes when a quoting key is typed."
(derived-mode-p 'text-mode)
(or (eq last-command-event ?\`)
(save-excursion (backward-paragraph) (point)))))))
- (when start
- (save-excursion
- (if (eq last-command-event ?\`)
- (cond ((search-backward "‘`" (- (point) 2) t)
- (replace-match "“")
- (when (and electric-pair-mode
- (eq (cdr-safe
- (assq ?‘ electric-pair-text-pairs))
- (char-after)))
- (delete-char 1))
- (setq last-command-event ?“))
- ((search-backward "`" (1- (point)) t)
- (replace-match "‘")
- (setq last-command-event ?‘)))
- (cond ((search-backward "’'" (- (point) 2) t)
- (replace-match "”")
- (setq last-command-event ?”))
- ((search-backward "'" (1- (point)) t)
- (replace-match "’")
- (setq last-command-event ?’)))))))))
+ (pcase electric-quote-chars
+ (`(,q< ,q> ,q<< ,q>>)
+ (when start
+ (save-excursion
+ (if (eq last-command-event ?\`)
+ (cond ((search-backward (string q< ?`) (- (point) 2) t)
+ (replace-match (string q<<))
+ (when (and electric-pair-mode
+ (eq (cdr-safe
+ (assq q< electric-pair-text-pairs))
+ (char-after)))
+ (delete-char 1))
+ (setq last-command-event q<<))
+ ((search-backward "`" (1- (point)) t)
+ (replace-match (string q<))
+ (setq last-command-event q<)))
+ (cond ((search-backward (string q> ?') (- (point) 2) t)
+ (replace-match (string q>>))
+ (setq last-command-event q>>))
+ ((search-backward "'" (1- (point)) t)
+ (replace-match (string q>))
+ (setq last-command-event q>)))))))))))
(put 'electric-quote-post-self-insert-function 'priority 10)
@@ -487,6 +502,9 @@ and text paragraphs, and these are selectively controlled
with
`electric-quote-comment', `electric-quote-string', and
`electric-quote-paragraph'.
+Customize `electric-quote-chars' to use characters other than the
+ones listed here.
+
This is a global minor mode. To toggle the mode in a single buffer,
use `electric-quote-local-mode'."
:global t :group 'electricity
diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el
index 74d8e59..707d1cb 100644
--- a/lisp/emacs-lisp/avl-tree.el
+++ b/lisp/emacs-lisp/avl-tree.el
@@ -98,7 +98,8 @@
;; avl-tree-right avl-tree-data] branch) node)
"Get value of a branch of a node.
NODE is the node, and BRANCH is the branch.
-0 for left pointer, 1 for right pointer and 2 for the data.")
+0 for left pointer, 1 for right pointer and 2 for the data.
+\n(fn BRANCH NODE)")
;; The funcall/aref trick wouldn't work for the setf method, unless we
@@ -400,7 +401,8 @@ itself."
reverse store)
(defalias 'avl-tree-stack-p #'avl-tree--stack-p
- "Return t if argument is an avl-tree-stack, nil otherwise.")
+ "Return t if OBJ is an avl-tree-stack, nil otherwise.
+\n(fn OBJ)")
(defun avl-tree--stack-repopulate (stack)
;; Recursively push children of the node at the head of STACK onto the
@@ -419,12 +421,12 @@ itself."
(defalias 'avl-tree-create #'avl-tree--create
"Create an empty AVL tree.
COMPARE-FUNCTION is a function which takes two arguments, A and B,
-and returns non-nil if A is less than B, and nil otherwise.")
+and returns non-nil if A is less than B, and nil otherwise.
+\n(fn COMPARE-FUNCTION)")
(defalias 'avl-tree-compare-function #'avl-tree--cmpfun
"Return the comparison function for the AVL tree TREE.
-
-\(fn TREE)")
+\n(fn TREE)")
(defun avl-tree-empty (tree)
"Return t if AVL tree TREE is empty, otherwise return nil."
diff --git a/m4/st_dm_mode.m4 b/m4/st_dm_mode.m4
index 1cfe68e..debd753 100644
--- a/m4/st_dm_mode.m4
+++ b/m4/st_dm_mode.m4
@@ -17,7 +17,7 @@ AC_DEFUN([AC_STRUCT_ST_DM_MODE],
if test $ac_cv_struct_st_dm_mode = yes; then
AC_DEFINE([HAVE_ST_DM_MODE], [1],
- [Define if struct stat has an st_dm_mode member. ])
+ [Define if struct stat has an st_dm_mode member.])
fi
]
)
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index fa6f103..05b6ab7 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,4 +1,4 @@
-# stdint.m4 serial 47
+# stdint.m4 serial 48
dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -154,6 +154,15 @@ uintptr_t h = UINTPTR_MAX;
intmax_t i = INTMAX_MAX;
uintmax_t j = UINTMAX_MAX;
+/* Check that SIZE_MAX has the correct type, if possible. */
+#if 201112 <= __STDC_VERSION__
+int k = _Generic (SIZE_MAX, size_t: 0);
+#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
+ || (0x5110 <= __SUNPRO_C && !__STDC__))
+extern size_t k;
+extern __typeof__ (SIZE_MAX) k;
+#endif
+
#include <limits.h> /* for CHAR_BIT */
#define TYPE_MINIMUM(t) \
((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index 19107c4..3999068 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 42
+# stdlib_h.m4 serial 43
dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,7 @@ AC_DEFUN([gl_STDLIB_H],
#endif
]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
- posix_openpt ptsname ptsname_r random random_r realpath rpmatch
+ posix_openpt ptsname ptsname_r qsort_r random random_r realpath rpmatch
secure_getenv setenv setstate setstate_r srandom srandom_r
strtod strtoll strtoull unlockpt unsetenv])
])
@@ -85,6 +85,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT])
HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME])
HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
+ HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R])
HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
diff --git a/m4/utimes.m4 b/m4/utimes.m4
index 1876bec..0778185 100644
--- a/m4/utimes.m4
+++ b/m4/utimes.m4
@@ -145,6 +145,6 @@ main ()
[gl_cv_func_working_utimes=no])])
if test $gl_cv_func_working_utimes = yes; then
- AC_DEFINE([HAVE_WORKING_UTIMES], [1], [Define if utimes works properly. ])
+ AC_DEFINE([HAVE_WORKING_UTIMES], [1], [Define if utimes works properly.])
fi
])
diff --git a/src/xwidget.c b/src/xwidget.c
index 0be2845..e97d963 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -722,7 +722,7 @@ argument procedure FUN.*/)
// procedure that retrieves the return value.
webkit_web_view_run_javascript (WEBKIT_WEB_VIEW (xw->widget_osr),
SSDATA (script),
- NULL, /*cancellable*/
+ NULL, /* cancelable */
callback,
(gpointer) fun);
return Qnil;
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index 2b8e067..71d2c88 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -84,12 +84,26 @@ position to retrieve THING.")
(goto-char (nth 1 test))
(should (equal (thing-at-point (nth 2 test)) (nth 3 test))))))
+;; These tests reflect the actual behaviour of
+;; `thing-at-point-bounds-of-list-at-point'.
(ert-deftest thing-at-point-bug24627 ()
"Test for http://debbugs.gnu.org/24627 ."
:expected-result :failed
- (let ((file
+ (let ((string-result '(("(a \"b\" c)" . (a "b" c))
+ (";(a \"b\" c)")
+ ("(a \"b\" c\n)" . (a "b" c))
+ ("\"(a b c)\"")
+ ("(a ;(b c d)\ne)" . (a e))
+ ("(foo\n(a ;(b c d)\ne) bar)" . (a e))
+ ("(foo\na ;(b c d)\ne bar)" . (foo a e bar))
+ ("(foo\n(a \"(b c d)\"\ne) bar)" . (a "(b c d)" e))
+ ("(b\n(a ;(foo c d)\ne) bar)" . (a e))
+ ("(princ \"(a b c)\")" . (princ "(a b c)"))
+ ("(defun foo ()\n \"Test function.\"\n ;;(a b)\n
nil)" . (defun foo nil "Test function." nil))))
+ (file
(expand-file-name "lisp/thingatpt.el" source-directory))
buf)
+ ;; Test for `thing-at-point'.
(when (file-exists-p file)
(unwind-protect
(progn
@@ -97,6 +111,14 @@ position to retrieve THING.")
(goto-char (point-max))
(forward-line -1)
(should-not (thing-at-point 'list)))
- (kill-buffer buf)))))
+ (kill-buffer buf)))
+ ;; Tests for `list-at-point'.
+ (dolist (str-res string-result)
+ (with-temp-buffer
+ (emacs-lisp-mode)
+ (insert (car str-res))
+ (re-search-backward "\\((a\\|^a\\)")
+ (should (equal (list-at-point)
+ (cdr str-res)))))))
;;; thingatpt.el ends here