emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] xwidget_mvp b72e831 6/7: Merge remote-tracking branch 'ori


From: Joakim Verona
Subject: [Emacs-diffs] xwidget_mvp b72e831 6/7: Merge remote-tracking branch 'origin/master' into xwidget_mvp
Date: Tue, 15 Sep 2015 08:28:55 +0000

branch: xwidget_mvp
commit b72e831080fbb2027f1cacb94a543fa248ed6a30
Merge: a127e39 8aa0386
Author: Joakim Verona <address@hidden>
Commit: Joakim Verona <address@hidden>

    Merge remote-tracking branch 'origin/master' into xwidget_mvp
---
 doc/lispref/sequences.texi          |   22 +++++
 doc/lispref/syntax.texi             |   11 +++-
 lisp/cedet/mode-local.el            |    6 +-
 lisp/emacs-lisp/advice.el           |    3 +-
 lisp/emacs-lisp/bytecomp.el         |    6 +-
 lisp/emacs-lisp/cconv.el            |    2 +-
 lisp/emacs-lisp/checkdoc.el         |    2 +-
 lisp/emacs-lisp/eieio-core.el       |    2 +-
 lisp/emacs-lisp/seq.el              |   13 +++
 lisp/international/mule-cmds.el     |    6 +-
 lisp/international/mule-util.el     |    2 +-
 lisp/mpc.el                         |   14 +++-
 lisp/progmodes/elisp-mode.el        |    4 +-
 lisp/progmodes/verilog-mode.el      |   12 ++--
 src/editfns.c                       |    2 +-
 src/frame.h                         |    2 +-
 src/image.c                         |    2 +-
 src/lisp.h                          |    4 +-
 src/process.c                       |    2 +-
 src/xdisp.c                         |    6 +-
 src/xfaces.c                        |    3 +-
 src/xselect.c                       |    4 +-
 test/automated/file-notify-tests.el |  146 +++++++++++++++++++++++++----------
 test/automated/seq-tests.el         |   10 +++
 24 files changed, 206 insertions(+), 80 deletions(-)

diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index f73779b..d019045 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -578,6 +578,28 @@ value is the value returned by @var{predicate}.
 @end example
 @end defun
 
address@hidden seq-find predicate sequence &optional sentinel
+  This function returns the first element for which @var{predicate}
+returns address@hidden in @var{sequence}.  If no element matches
address@hidden, @var{sentinel} is returned if address@hidden,
address@hidden otherwise.
+
+Note that this function has an ambiguity if the found element is
address@hidden, and if no @var{sentinel} is specified, as it cannot be
+known if an element was found or not.
+
address@hidden
address@hidden
+(seq-find #'numberp ["abc" 1 nil])
address@hidden 1
address@hidden group
address@hidden
+(seq-find #'numberp ["abc" "def"])
address@hidden nil
address@hidden group
address@hidden example
address@hidden defun
+
 @defun seq-every-p predicate sequence
   This function returns address@hidden if applying @var{predicate}
 to every element of @var{sequence} returns address@hidden
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index 3ab1e9d..5d9935d 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -1084,14 +1084,23 @@ documentation @var{docstring}, for the category table 
@var{table}.
 
 Here's an example of defining a new category for characters that have
 strong right-to-left directionality (@pxref{Bidirectional Display})
-and using it in a special category table:
+and using it in a special category table.  To obtain the information
+about the directionality of characters, the example code uses the
address@hidden Unicode property (@pxref{Character Properties,
+bidi-class}).
 
 @example
 (defvar special-category-table-for-bidi
+  ;;     Make an empty category-table.
   (let ((category-table (make-category-table))
+        ;; Create a char-table which gives the 'bidi-class' Unicode
+        ;; property for each character.
         (uniprop-table (unicode-property-table-internal 'bidi-class)))
     (define-category ?R "Characters of bidi-class R, AL, or RLO"
                      category-table)
+    ;; Modify the category entry of each character whose 'bidi-class'
+    ;; Unicode property is R, AL, or RLO -- these have a
+    ;; right-to-left directionality.
     (map-char-table
      #'(lambda (key val)
          (if (memq val '(R AL RLO))
diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el
index 64c1f08..edf7647 100644
--- a/lisp/cedet/mode-local.el
+++ b/lisp/cedet/mode-local.el
@@ -677,7 +677,7 @@ SYMBOL is a function that can be overridden."
     result))
 
 (defun xref-mode-local-overload (symbol)
-  "For ‘elisp-xref-find-def-functions’; add overloads for SYMBOL."
+  "For `elisp-xref-find-def-functions'; add overloads for SYMBOL."
   ;; Current buffer is the buffer where xref-find-definitions was invoked.
   (when (get symbol 'mode-local-overload)
     (let* ((symbol-file (find-lisp-object-file-name symbol (symbol-function 
symbol)))
@@ -738,11 +738,11 @@ SYMBOL is a function that can be overridden."
 
 (defconst xref-mode-local-find-overloadable-regexp
   "(\\(\\(define-overloadable-function\\)\\|\\(define-overload\\)\\) +%s"
-  "Regexp used by ‘xref-find-definitions’ when searching for a
+  "Regexp used by `xref-find-definitions' when searching for a
   mode-local overloadable function definition.")
 
 (defun xref-mode-local-find-override (meta-name)
-  "Function used by ‘xref-find-definitions’ when searching for an
+  "Function used by `xref-find-definitions' when searching for an
   override of a mode-local overloadable function.
 META-NAME is a cons (OVERLOADABLE-SYMBOL . MAJOR-MODE)."
   (let* ((override (car meta-name))
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 62330fc..35cbcc2 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -168,7 +168,8 @@
 ;;  "Switch to non-existing buffers only upon confirmation."
 ;;  (interactive "BSwitch to buffer: ")
 ;;  (if (or (get-buffer (ad-get-arg 0))
-;;          (y-or-n-p (format "‘%s’ does not exist, create? " (ad-get-arg 0))))
+;;          (y-or-n-p (format-message "`%s' does not exist, create? "
+;;                                    (ad-get-arg 0))))
 ;;      ad-do-it))
 ;;
 ;;(defadvice find-file (before existing-files-only activate)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 279ffa3..8b47bbf 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1814,7 +1814,7 @@ The value is non-nil if there were no errors, nil if 
errors."
     ;; compile this file.
     (if (with-current-buffer input-buffer no-byte-compile)
        (progn
-         ;; (message "%s not compiled because of ‘no-byte-compile: %s’"
+         ;; (message "%s not compiled because of `no-byte-compile: %s'"
          ;;       (byte-compile-abbreviate-file filename)
          ;;       (with-current-buffer input-buffer no-byte-compile))
          (when (file-exists-p target-file)
@@ -4196,7 +4196,7 @@ binding slots have been popped."
                       ;;              (consp (get condition
                       ;;                          'error-conditions)))))
                       ;; (byte-compile-warn
-                      ;;   "‘%s’ is not a known condition name
+                      ;;   "`%s' is not a known condition name
                       ;;   (in condition-case)"
                       ;;   condition))
                       )
@@ -4235,7 +4235,7 @@ binding slots have been popped."
           ;; for the argument to `signal', not to `condition-case'.
           ;;(unless (consp (get c 'error-conditions))
           ;;  (byte-compile-warn
-          ;;   "‘%s’ is not a known condition name (in condition-case)"
+          ;;   "`%s' is not a known condition name (in condition-case)"
           ;;   c))
           )
         (byte-compile-push-constant condition))
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index 205ae6d..0f75f0a 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -679,7 +679,7 @@ and updates the data stored in ENV."
 
     ;; ((and `(quote ,v . ,_) (guard (assq v env)))
     ;;  (byte-compile-log-warning
-    ;;   (format-message "Possible confusion variable/symbol for ‘%S’" v)))
+    ;;   (format-message "Possible confusion variable/symbol for `%S'" v)))
 
     (`(quote . ,_) nil)                 ; quote form
     (`(function . ,_) nil)              ; same as quote
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 4a9e16a..bf1a21a 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1663,7 +1663,7 @@ function,command,variable,option or symbol." ms1))))))
             ;;           (concat "\\<" (regexp-quote (car fp)) "\\>")
             ;;           newname))
             ;;         (checkdoc-create-error
-            ;;          "Flag variable names should normally end in ‘-flag’" s
+            ;;          "Flag variable names should normally end in `-flag'" s
             ;;          (marker-position e)))))
             ;; Done with variables
             ))
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index a2f5f8a..29c4467 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -850,7 +850,7 @@ Fills in the default value in CLASS' in SLOT with VALUE."
       ;; gnus/registry.el, so it might be used elsewhere as well, so let's
       ;; keep it for now.
       ;; FIXME: Generate a compile-time warning for it!
-      ;; (error "Can't ‘oset-default’ an instance-allocated slot: %S of %S"
+      ;; (error "Can't `oset-default' an instance-allocated slot: %S of %S"
       ;;        slot class)
       (eieio--validate-slot-value class c value slot)
       ;; Set this into the storage for defaults.
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 751c18f..4b50a0a 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -270,6 +270,19 @@ If so, return the non-nil value returned by PRED."
           (throw 'seq--break result))))
     nil))
 
+(cl-defgeneric seq-find (pred seq &optional sentinel)
+  "Return the first element for which (PRED element) is non-nil in SEQ.
+If no element is found, return SENTINEL or nil.
+
+Note that `seq-find' has an ambiguity if the found element is nil
+and if no SENTINEL is specified, as it cannot be known if an
+element was found or not."
+  (catch 'seq--break
+    (seq-doseq (elt seq)
+      (when (funcall pred elt)
+        (throw 'seq--break elt)))
+    sentinel))
+
 (cl-defgeneric seq-count (pred seq)
   "Return the number of elements for which (PRED element) is non-nil in SEQ."
   (let ((count 0))
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 4fd4b90..0c4c99c 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1272,7 +1272,7 @@ This file contains a list of libraries of Emacs input 
methods (LEIM)
 in the format of Lisp expression for registering each input method.
 Emacs loads this file at startup time.")
 
-(defconst leim-list-header (format
+(defconst leim-list-header (format-message
 ";;; %s -- list of LEIM (Library of Emacs Input Method) -*-coding: utf-8;-*-
 ;;
 ;; This file is automatically generated.
@@ -1286,9 +1286,9 @@ Emacs loads this file at startup time.")
 ;;    INPUT-METHOD LANGUAGE-NAME ACTIVATE-FUNC
 ;;    TITLE DESCRIPTION
 ;;    ARG ...)
-;; See the function ‘register-input-method’ for the meanings of the arguments.
+;; See the function `register-input-method' for the meanings of the arguments.
 ;;
-;; If this directory is included in ‘load-path’, Emacs automatically
+;; If this directory is included in `load-path', Emacs automatically
 ;; loads this file at startup time.
 
 "
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index 9025863..b575c2b 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -284,7 +284,7 @@ per-character basis, this may not be accurate."
                 ;; On a text terminal supporting glyph codes, CHAR is
                 ;; displayable if its glyph code is nonnegative.
                 (<= 0 font-glyph))
-            ;; On a teext terminal without glyph codes, CHAR is displayable
+            ;; On a text terminal without glyph codes, CHAR is displayable
             ;; if the coding system for the terminal can encode it.
             (let ((coding (terminal-coding-system)))
               (when coding
diff --git a/lisp/mpc.el b/lisp/mpc.el
index b7c19a9..bc7d473 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -268,7 +268,10 @@ defaults to 6600 and HOST defaults to localhost."
                 (if (string-match "[^[:digit:]]" v)
                     (string-to-number v)
                   v)))))
-    (when (string-prefix-p "/" host)    ;FIXME: Use file-name-absolute-p?
+    (when (file-name-absolute-p host)
+      ;; Expand file name because `file-name-absolute-p'
+      ;; considers paths beginning with "~" as absolute
+      (setq host (expand-file-name host))
       (setq local t))
 
     (mpc--debug "Connecting to %s:%s..." host port)
@@ -909,8 +912,13 @@ If PLAYLIST is t or nil or missing, use the main playlist."
 (defun mpc-file-local-copy (file)
   ;; Try to set mpc-mpd-music-directory.
   (when (and (null mpc-mpd-music-directory)
-             (string-match "\\`localhost" mpc-host))
-    (let ((files '("~/.mpdconf" "/etc/mpd.conf"))
+             (or (string-match "\\`localhost" mpc-host)
+                 (file-name-absolute-p mpc-host)))
+    (let ((files `(,(let ((xdg (getenv "XDG_CONFIG_HOME")))
+                      (concat (if (and xdg (file-name-absolute-p xdg))
+                                  xdg "~/.config")
+                              "/mpd/mpd.conf"))
+                   "~/.mpdconf" "~/.mpd/mpd.conf" "/etc/mpd.conf"))
           file)
       (while (and files (not file))
         (if (file-exists-p (car files)) (setq file (car files)))
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 1cf52c0..8afae15 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -632,11 +632,11 @@ otherwise build the summary from TYPE and SYMBOL."
             (xref-make-elisp-location symbol type file)))
 
 (defvar elisp-xref-find-def-functions nil
-  "List of functions to be run from ‘elisp--xref-find-definitions’ to add 
additional xrefs.
+  "List of functions to be run from `elisp--xref-find-definitions' to add 
additional xrefs.
 Called with one arg; the symbol whose definition is desired.
 Each function should return a list of xrefs, or nil; the first
 non-nil result supercedes the xrefs produced by
-‘elisp--xref-find-definitions’.")
+`elisp--xref-find-definitions'.")
 
 ;; FIXME: name should be singular; match xref-find-definition
 (defun elisp--xref-find-definitions (symbol)
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index f83c676..5fcdba6 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -8666,7 +8666,7 @@ Return an array of [outputs inouts inputs wire reg assign 
const]."
 
 (defun verilog-read-sub-decls-expr (submoddecls comment port expr)
   "For `verilog-read-sub-decls-line', parse a subexpression and add signals."
-  ;;(message "vrsde: ‘%s’" expr)
+  ;;(message "vrsde: `%s'" expr)
   ;; Replace special /*[....]*/ comments inserted by verilog-auto-inst-port
   (setq expr (verilog-string-replace-matches "/\\*\\(\\[[^*]+\\]\\)\\*/" "\\1" 
nil nil expr))
   ;; Remove front operators
@@ -8685,25 +8685,25 @@ Return an array of [outputs inouts inputs wire reg 
assign const]."
     (let (sig vec multidim)
       ;; Remove leading reduction operators, etc
       (setq expr (verilog-string-replace-matches "^\\s-*[---+~!|&]+\\s-*" "" 
nil nil expr))
-      ;;(message "vrsde-ptop: ‘%s’" expr)
+      ;;(message "vrsde-ptop: `%s'" expr)
       (cond  ; Find \signal. Final space is part of escaped signal name
        ((string-match "^\\s-*\\(\\\\[^ \t\n\f]+\\s-\\)" expr)
-       ;;(message "vrsde-s: ‘%s’" (match-string 1 expr))
+       ;;(message "vrsde-s: `%s'" (match-string 1 expr))
        (setq sig (match-string 1 expr)
              expr (substring expr (match-end 0))))
        ;; Find signal
        ((string-match "^\\s-*\\([a-zA-Z_][a-zA-Z_0-9]*\\)" expr)
-       ;;(message "vrsde-s: ‘%s’" (match-string 1 expr))
+       ;;(message "vrsde-s: `%s'" (match-string 1 expr))
        (setq sig (verilog-string-remove-spaces (match-string 1 expr))
              expr (substring expr (match-end 0)))))
       ;; Find [vector] or [multi][multi][multi][vector]
       (while (string-match "^\\s-*\\(\\[[^]]+\\]\\)" expr)
-       ;;(message "vrsde-v: ‘%s’" (match-string 1 expr))
+       ;;(message "vrsde-v: `%s'" (match-string 1 expr))
        (when vec (setq multidim (cons vec multidim)))
        (setq vec (match-string 1 expr)
              expr (substring expr (match-end 0))))
       ;; If found signal, and nothing unrecognized, add the signal
-      ;;(message "vrsde-rem: ‘%s’" expr)
+      ;;(message "vrsde-rem: `%s'" expr)
       (when (and sig (string-match "^\\s-*$" expr))
        (verilog-read-sub-decls-sig submoddecls comment port sig vec 
multidim))))))
 
diff --git a/src/editfns.c b/src/editfns.c
index 831edb4..2080b53 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4154,7 +4154,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                      || conversion == 'X'))
            error ("Invalid format operation %%%c",
                   STRING_CHAR ((unsigned char *) format - 1));
-         else if (! (INTEGERP (args[n]) || FLOATP (args[n])))
+         else if (! NUMBERP (args[n]))
            error ("Format specifier doesn't match argument type");
          else
            {
diff --git a/src/frame.h b/src/frame.h
index 8ee37df..17e356d 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -618,7 +618,7 @@ fset_desired_tool_bar_string (struct frame *f, Lisp_Object 
val)
 }
 #endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
 
-#define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1)
+#define NUMVAL(X) (NUMBERP (X) ? XFLOATINT (X) : -1)
 
 INLINE double
 default_pixels_per_inch_x (void)
diff --git a/src/image.c b/src/image.c
index 2aa01e4..b586c53 100644
--- a/src/image.c
+++ b/src/image.c
@@ -797,7 +797,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword 
*keywords,
          return 0;
 
        case IMAGE_NUMBER_VALUE:
-         if (!INTEGERP (value) && !FLOATP (value))
+         if (! NUMBERP (value))
            return 0;
          break;
 
diff --git a/src/lisp.h b/src/lisp.h
index f6b0962..3381675 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2742,7 +2742,7 @@ XFLOATINT (Lisp_Object n)
 INLINE void
 CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
 {
-  CHECK_TYPE (FLOATP (x) || INTEGERP (x), Qnumberp, x);
+  CHECK_TYPE (NUMBERP (x), Qnumberp, x);
 }
 
 #define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x)                         \
@@ -2750,7 +2750,7 @@ CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
     if (MARKERP (x))                                                   \
       XSETFASTINT (x, marker_position (x));                            \
     else                                                               \
-      CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); \
+      CHECK_TYPE (NUMBERP (x), Qnumber_or_marker_p, x);                        
\
   } while (false)
 
 /* Since we can't assign directly to the CAR or CDR fields of a cons
diff --git a/src/process.c b/src/process.c
index 26f26c3..ed5f4c0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6269,7 +6269,7 @@ SIGCODE may be an integer, or a symbol whose name is a 
signal name.  */)
        {
          Lisp_Object process_number
            = string_to_number (SSDATA (process), 10, 1);
-         if (INTEGERP (process_number) || FLOATP (process_number))
+         if (NUMBERP (process_number))
            tem = process_number;
        }
       process = tem;
diff --git a/src/xdisp.c b/src/xdisp.c
index adec26e..fe76bf1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -24136,7 +24136,7 @@ calc_pixel_width_or_height (double *res, struct it *it, 
Lisp_Object prop,
        prop = Qnil;
     }
 
-  if (INTEGERP (prop) || FLOATP (prop))
+  if (NUMBERP (prop))
     {
       int base_unit = (width_p
                       ? FRAME_COLUMN_WIDTH (it->f)
@@ -24195,7 +24195,7 @@ calc_pixel_width_or_height (double *res, struct it *it, 
Lisp_Object prop,
            car = Qnil;
        }
 
-      if (INTEGERP (car) || FLOATP (car))
+      if (NUMBERP (car))
        {
          double fact;
          pixels = XFLOATINT (car);
@@ -29300,7 +29300,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
       Lisp_Object lr, lx0, ly0;
       if (CONSP (circ)
          && CONSP (XCAR (circ))
-         && (lr = XCDR (circ), INTEGERP (lr) || FLOATP (lr))
+         && (lr = XCDR (circ), NUMBERP (lr))
          && (lx0 = XCAR (XCAR (circ)), INTEGERP (lx0))
          && (ly0 = XCDR (XCAR (circ)), INTEGERP (ly0)))
        {
diff --git a/src/xfaces.c b/src/xfaces.c
index a4f1aa8..453fd58 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1669,8 +1669,7 @@ check_lface_attrs (Lisp_Object attrs[LFACE_VECTOR_SIZE])
           || SYMBOLP (attrs[LFACE_SWIDTH_INDEX]));
   eassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_HEIGHT_INDEX])
-          || INTEGERP (attrs[LFACE_HEIGHT_INDEX])
-          || FLOATP (attrs[LFACE_HEIGHT_INDEX])
+          || NUMBERP (attrs[LFACE_HEIGHT_INDEX])
           || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX]));
   eassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_WEIGHT_INDEX])
diff --git a/src/xselect.c b/src/xselect.c
index 94a5584..e7e3fe7 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2271,7 +2271,7 @@ x_fill_property_data (Display *dpy, Lisp_Object data, 
void *ret, int format)
     {
       Lisp_Object o = XCAR (iter);
 
-      if (INTEGERP (o) || FLOATP (o) || CONSP (o))
+      if (NUMBERP (o) || CONSP (o))
         {
           if (CONSP (o)
              && RANGED_INTEGERP (X_LONG_MIN >> 16, XCAR (o), X_LONG_MAX >> 16)
@@ -2547,7 +2547,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object 
dest, Lisp_Object from,
       else
         error ("DEST as a string must be one of PointerWindow or InputFocus");
     }
-  else if (INTEGERP (dest) || FLOATP (dest) || CONSP (dest))
+  else if (NUMBERP (dest) || CONSP (dest))
     CONS_TO_INTEGER (dest, Window, wdest);
   else
     error ("DEST must be a frame, nil, string, number or cons");
diff --git a/test/automated/file-notify-tests.el 
b/test/automated/file-notify-tests.el
index 2c6f916..99b0ebc 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -1,4 +1,4 @@
-;;; file-notify-tests.el --- Tests of file notifications
+;;; file-notify-tests.el --- Tests of file notifications  -*- lexical-binding: 
t; -*-
 
 ;; Copyright (C) 2013-2015 Free Software Foundation, Inc.
 
@@ -39,6 +39,9 @@
 (require 'filenotify)
 (require 'tramp)
 
+(declare-function tramp-get-remote-gvfs-monitor-dir "tramp-sh")
+(declare-function tramp-get-remote-inotifywait "tramp-sh")
+
 ;; There is no default value on w32 systems, which could work out of the box.
 (defconst file-notify-test-remote-temporary-file-directory
   (cond
@@ -62,6 +65,25 @@
 (defvar file-notify--test-event nil)
 (defvar file-notify--test-events nil)
 
+(defun file-notify--test-cleanup ()
+  "Cleanup after a test."
+  (file-notify-rm-watch file-notify--test-desc)
+
+  (when (and file-notify--test-tmpfile
+             (file-exists-p file-notify--test-tmpfile))
+    (delete-file file-notify--test-tmpfile))
+  (when (and file-notify--test-tmpfile1
+             (file-exists-p file-notify--test-tmpfile1))
+    (delete-file file-notify--test-tmpfile1))
+
+  (setq file-notify--test-tmpfile nil)
+  (setq file-notify--test-tmpfile1 nil)
+  (setq file-notify--test-desc nil)
+  (setq file-notify--test-results nil)
+  (setq file-notify--test-events nil)
+  (when file-notify--test-event
+    (error "file-notify--test-event should not be set but bound dynamically")))
+
 (setq password-cache-expiry nil
       tramp-verbose 0
       tramp-message-show-message nil)
@@ -117,10 +139,27 @@ being the result.")
 (ert-deftest file-notify-test00-availability ()
   "Test availability of `file-notify'."
   (skip-unless (file-notify--test-local-enabled))
+  ;; Report the native library which has been used.
+  (message
+   "%s library: `%s'"
+   (if (null (file-remote-p temporary-file-directory)) "Local" "Remote")
+   (if (null (file-remote-p temporary-file-directory))
+       file-notify--library
+     ;; FIXME: This is rude, using Tramp internal functions.  Maybe
+     ;; the upcoming `file-notify-available-p' could return the used
+     ;; native library.
+     (with-parsed-tramp-file-name temporary-file-directory nil
+         (cond
+          ;; gvfs-monitor-dir.
+          ((tramp-get-remote-gvfs-monitor-dir v) 'gfilenotify)
+          ;; inotifywait.
+          ((tramp-get-remote-inotifywait v) 'inotify)
+          ;; None.
+          (t (ert-fail "No remote library available"))))))
   (should
    (setq file-notify--test-desc
          (file-notify-add-watch temporary-file-directory '(change) 'ignore)))
-  (file-notify-rm-watch file-notify--test-desc))
+  (file-notify--test-cleanup))
 
 (file-notify--deftest-remote file-notify-test00-availability
   "Test availability of `file-notify' for remote files.")
@@ -158,7 +197,9 @@ being the result.")
   (should
    (equal (should-error
            (file-notify-add-watch temporary-file-directory '(change) 3))
-          '(wrong-type-argument 3))))
+          '(wrong-type-argument 3)))
+
+  (file-notify--test-cleanup))
 
 (file-notify--deftest-remote file-notify-test01-add-watch
   "Check `file-notify-add-watch' for remote files.")
@@ -181,13 +222,13 @@ is bound somewhere."
       (file-notify--event-file1-name file-notify--test-event)
       file-notify--test-tmpfile1))))
 
-(defun file-notify--test-event-handler (file-notify--test-event)
+(defun file-notify--test-event-handler (event)
   "Run a test over FILE-NOTIFY--TEST-EVENT.
 For later analysis, append the test result to
 `file-notify--test-results' and the event to
 `file-notify--test-events'."
-  (let ((result
-        (ert-run-test (make-ert-test :body 'file-notify--test-event-test))))
+  (let* ((file-notify--test-event event)
+         (result (ert-run-test (make-ert-test :body 
'file-notify--test-event-test))))
     (setq file-notify--test-events
           (append file-notify--test-events `(,file-notify--test-event)))
     (setq file-notify--test-results
@@ -205,6 +246,20 @@ TIMEOUT is the maximum time to wait for, in seconds."
      (while (null ,until)
        (read-event nil nil 0.1))))
 
+(defmacro file-notify--test-with-events (n timeout assert-fn &rest body)
+  "Run BODY collecting N events and then run ASSERT-FN.
+Don't wait longer than TIMEOUT seconds for the events to be delivered."
+  (declare (indent 3))
+  (let ((outer (make-symbol "outer")))
+    `(let ((,outer file-notify--test-events))
+       (let ((file-notify--test-events nil))
+         ,@body
+         (file-notify--wait-for-events
+          ,timeout (= ,n (length file-notify--test-events)))
+         (funcall ,assert-fn file-notify--test-events)
+         (setq ,outer (append ,outer file-notify--test-events)))
+       (setq file-notify--test-events ,outer))))
+
 (ert-deftest file-notify-test02-events ()
   "Check file creation/removal notifications."
   (skip-unless (file-notify--test-local-enabled))
@@ -221,40 +276,49 @@ TIMEOUT is the maximum time to wait for, in seconds."
         (should file-notify--test-desc)
 
         ;; Check creation, change, and deletion.
-        (write-region
-         "any text" nil file-notify--test-tmpfile nil 'no-message)
-        (delete-file file-notify--test-tmpfile)
-        (sleep-for 0.1)
-
-        ;; Check copy and rename.
-        (write-region
-         "any text" nil file-notify--test-tmpfile nil 'no-message)
-        (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
-        (delete-file file-notify--test-tmpfile)
-        (delete-file file-notify--test-tmpfile1)
-        (sleep-for 0.1)
-
-        (write-region
-         "any text" nil file-notify--test-tmpfile nil 'no-message)
-        (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
-        (delete-file file-notify--test-tmpfile1)
-        (sleep-for 0.1))
-
-    ;; Wait for events, and exit.
-    (file-notify--wait-for-events 5 file-notify--test-results)
-    (should (equal (mapcar #'cadr file-notify--test-events)
-                   '(created changed deleted
-                             created changed deleted
-                             created changed renamed)))
-    (file-notify-rm-watch file-notify--test-desc)
-    (ignore-errors (delete-file file-notify--test-tmpfile))
-    (ignore-errors (delete-file file-notify--test-tmpfile1)))
-
-  (should file-notify--test-results)
-  (dolist (result file-notify--test-results)
-    ;;(message "%s" (ert-test-result-messages result))
-    (when (ert-test-failed-p result)
-      (ert-fail (cadr (ert-test-result-with-condition-condition result))))))
+        (file-notify--test-with-events
+            3 3 (lambda (events)
+                  (should (equal '(created changed deleted)
+                                 (mapcar #'cadr events))))
+          (write-region
+           "any text" nil file-notify--test-tmpfile nil 'no-message)
+          (delete-file file-notify--test-tmpfile))
+
+        ;; Check copy.
+        (file-notify--test-with-events
+            3 3 (lambda (events)
+                  (should (equal '(created changed deleted)
+                                 (mapcar #'cadr events))))
+          (write-region
+           "any text" nil file-notify--test-tmpfile nil 'no-message)
+          (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1)
+          (delete-file file-notify--test-tmpfile)
+          (delete-file file-notify--test-tmpfile1))
+
+        ;; Check rename.
+        (file-notify--test-with-events
+            3 3 (lambda (events)
+                  (should (equal '(created changed renamed)
+                                 (mapcar #'cadr events))))
+          (write-region
+           "any text" nil file-notify--test-tmpfile nil 'no-message)
+          (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1)
+          ;; After the rename, we won't get events anymore.
+          (delete-file file-notify--test-tmpfile1))
+
+        ;; Check the global sequence again just to make sure that
+        ;; `file-notify--test-events' has been set correctly.
+        (should (equal (mapcar #'cadr file-notify--test-events)
+                       '(created changed deleted
+                                 created changed deleted
+                                 created changed renamed)))
+
+        (should file-notify--test-results)
+        (dolist (result file-notify--test-results)
+          ;;(message "%s" (ert-test-result-messages result))
+          (when (ert-test-failed-p result)
+            (ert-fail (cadr (ert-test-result-with-condition-condition 
result))))))
+    (file-notify--test-cleanup)))
 
 (file-notify--deftest-remote file-notify-test02-events
   "Check file creation/removal notifications for remote files.")
@@ -313,7 +377,7 @@ This test is skipped in batch mode."
 
       ;; Exit.
       (ignore-errors (kill-buffer buf))
-      (ignore-errors (delete-file file-notify--test-tmpfile)))))
+      (file-notify--test-cleanup))))
 
 (file-notify--deftest-remote file-notify-test03-autorevert
   "Check autorevert via file notification for remote files.
diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el
index 07a183d..7023c94 100644
--- a/test/automated/seq-tests.el
+++ b/test/automated/seq-tests.el
@@ -138,6 +138,16 @@ Evaluate BODY for each created sequence.
     (should-not (seq-some #'test-sequences-oddp seq)))
   (should (seq-some #'null '(1 nil 2))))
 
+(ert-deftest test-seq-find ()
+  (with-test-sequences (seq '(4 3 2 1))
+    (should (= 4 (seq-find #'test-sequences-evenp seq)))
+    (should (= 3 (seq-find #'test-sequences-oddp seq)))
+    (should-not (seq-find (lambda (elt) (> elt 10)) seq)))
+  (should-not (seq-find #'null '(1 nil 2)))
+  (should-not (seq-find #'null '(1 nil 2) t))
+  (should-not (seq-find #'null '(1 2 3)))
+  (should (seq-find #'null '(1 2 3) 'sentinel)))
+
 (ert-deftest test-seq-contains ()
   (with-test-sequences (seq '(3 4 5 6))
     (should (seq-contains seq 3))



reply via email to

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