commit 24987908857f6cc5e25f17638db45a73f32603a3 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Fri Sep 11 10:56:18 2015 +0300 Fix NS build with --enable-checking='glyphs' * src/nsfns.m (unwind_create_frame): Make the preprocessor conditionals for referencing 'dpyinfo' consistent throughout the function. (Bug#21426) diff --git a/src/nsfns.m b/src/nsfns.m index 89b9f7c..9c805ac 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1009,7 +1009,7 @@ unwind_create_frame (Lisp_Object frame) x_free_frame_resources (f); free_glyphs (f); -#ifdef GLYPH_DEBUG +#if defined GLYPH_DEBUG && defined ENABLE_CHECKING /* Check that reference counts are indeed correct. */ eassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount); #endif commit 8aa0386420f9d982b99568f27a5953dfc737640e Author: Nicolas Petton Date: Thu Sep 10 23:49:56 2015 +0200 Add seq-find This function is similar to `seq-some' but returns the found element. In the cases where nil can be the found element, a sentinel optional argument can be provided to avoid ambiguities. * lisp/emacs-lisp/seq.el (seq-find): New function. * test/automated/seq-tests.el (test-seq-find): Add tests for `seq-find'. * doc/lispref/sequences.texi (Sequence Functions): Add documentation for seq-find. 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 +@defun seq-find predicate sequence &optional sentinel + This function returns the first element for which @var{predicate} +returns non-@code{nil} in @var{sequence}. If no element matches +@var{predicate}, @var{sentinel} is returned if non-@code{nil}, +@code{nil} otherwise. + +Note that this function has an ambiguity if the found element is +@code{nil}, and if no @var{sentinel} is specified, as it cannot be +known if an element was found or not. + +@example +@group +(seq-find #'numberp ["abc" 1 nil]) +@result{} 1 +@end group +@group +(seq-find #'numberp ["abc" "def"]) +@result{} nil +@end group +@end example +@end defun + @defun seq-every-p predicate sequence This function returns non-@code{nil} if applying @var{predicate} to every element of @var{sequence} returns non-@code{nil}. 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/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)) commit 5a92d97802e095c541a644bdaca00755942af821 Author: Tassilo Horn Date: Thu Sep 10 21:11:18 2015 +0200 Document file-notify--test-with-events. * test/automated/file-notify-tests.el (file-notify--test-with-events): Add docstring. diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el index 9831afd..99b0ebc 100644 --- a/test/automated/file-notify-tests.el +++ b/test/automated/file-notify-tests.el @@ -247,6 +247,8 @@ TIMEOUT is the maximum time to wait for, in seconds." (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)) commit 5f334658668eef0fd3c11d24167437fbd5cb3fc1 Author: Michael Albinus Date: Thu Sep 10 20:01:33 2015 +0200 Report used native library in file-notify-tests.el * test/automated/file-notify-tests.el (tramp-get-remote-gvfs-monitor-dir) (tramp-get-remote-inotifywait): Declare them. (file-notify-test00-availability): Print used native library. diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el index eee8ee3..9831afd 100644 --- a/test/automated/file-notify-tests.el +++ b/test/automated/file-notify-tests.el @@ -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 @@ -136,6 +139,23 @@ 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))) commit 76093858d236b2134dd5db214d22a2b208c2992c Author: Mark Oteiza Date: Mon Sep 7 18:01:00 2015 -0400 lisp/mpc.el (mpc--proc-connect): use file-name-absolute-p diff --git a/lisp/mpc.el b/lisp/mpc.el index 3600b08..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) commit 2cf2b19985c4b3989a6ab9acfb247e2dc823669d Author: Mark Oteiza Date: Mon Sep 7 17:57:46 2015 -0400 lisp/mpc.el (mpc-file-local-copy): check for absolute path diff --git a/lisp/mpc.el b/lisp/mpc.el index 205c94b..3600b08 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -909,7 +909,8 @@ 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)) + (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") commit 2a79268725c2d5602e9bc4a512bee7510bfbfa18 Author: Mark Oteiza Date: Mon Sep 7 17:56:06 2015 -0400 lisp/mpc.el (mpc-file-local-copy): check more config locations diff --git a/lisp/mpc.el b/lisp/mpc.el index b7c19a9..205c94b 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -910,7 +910,11 @@ If PLAYLIST is t or nil or missing, use the main playlist." ;; 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")) + (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))) commit 0fafb582957135a16a9603c420e992dc46a50544 Author: Eli Zaretskii Date: Thu Sep 10 20:39:02 2015 +0300 Improve documentation of categories * doc/lispref/syntax.texi (Categories): Clarify the example of using define-category and modify-category-entry. (Bug#21448) 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 +@samp{bidi-class} 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)) commit cdb0ae37ab925b79b379fdfa780f57dad8607a3c Author: Paul Eggert Date: Thu Sep 10 10:10:54 2015 -0700 Revert some stray curved quotes I missed earlier Problem reported by David Kastrup in: http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00440.html * lisp/international/mule-cmds.el (leim-list-header): Use format-message with an ASCII-only format. 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/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/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)))))) commit a1cd8c96cad685912749efb395593524b199c536 Author: Paul Eggert Date: Thu Sep 10 09:52:42 2015 -0700 Prefer NUMBERP to spelling it out * src/editfns.c (styled_format): * src/frame.h (NUMVAL): * src/image.c (parse_image_spec): * src/lisp.h (CHECK_NUMBER_OR_FLOAT) (CHECK_NUMBER_OR_FLOAT_COERCE_MARKER): * src/process.c (Fsignal_process): * src/xdisp.c (calc_pixel_width_or_height, on_hot_spot_p): * src/xfaces.c (check_lface_attrs): * src/xselect.c (x_fill_property_data, x_send_client_event): Use NUMBERP rather than INTEGERP || FLOATP. 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 d2d3856..71630ed 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2736,7 +2736,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) \ @@ -2744,7 +2744,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 1a5be59..bb31697 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -24063,7 +24063,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) @@ -24115,7 +24115,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); @@ -29062,7 +29062,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"); commit b0030269c9ca1263498341d51bbfc5387f489ab7 Author: Paul Eggert Date: Thu Sep 10 08:49:14 2015 -0700 ; Spelling fix 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 commit a6a1333e7e34a63bce4177ff5100ff92ab51e8a6 Author: Tassilo Horn Date: Thu Sep 10 17:18:15 2015 +0200 Improve file-notify-tests * test/automated/file-notify-tests.el: Use lexical-binding (file-notify--test-cleanup): New function. (file-notify-test00-availability, file-notify-test01-add-watch) (file-notify-test02-events, file-notify-test03-autorevert): Use it. (file-notify--test-with-events): New macro. (file-notify-test02-events): Use it. diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el index 2c6f916..eee8ee3 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. @@ -62,6 +62,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) @@ -120,7 +139,7 @@ being the result.") (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 +177,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 +202,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 +226,18 @@ 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) + (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 +254,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 +355,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. commit f962c5d6472804f788cdd54631bcc46aab5f59ce Author: Paul Eggert Date: Thu Sep 10 02:43:59 2015 -0700 Add patch-sending instructions to git-workflow From a suggestion by Mitchel Humpherys in: http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00421.html * admin/notes/git-workflow (Sending patches): New section. diff --git a/admin/notes/git-workflow b/admin/notes/git-workflow index d1d105a..40dfa6b 100644 --- a/admin/notes/git-workflow +++ b/admin/notes/git-workflow @@ -46,6 +46,24 @@ top of that. Then say git push +Sending patches +=============== + +If you lack push access or would like feedback before pushing a patch, +you can send a patch file as a bug report. After committing your +change locally, do: + +git format-patch -1 + +This creates a file 0001-DESCRIPTION.patch containing the patch, where +DESCRIPTION comes from the first line of your patch's commit message. +You can attach the patch file to email that you send to +bug-gnu-emacs@gnu.org. You can also configure git to email patches +directly (see ) and do: + +git send-email --to=bug-gnu-emacs@gnu.org 0001-DESCRIPTION.patch + + Backporting to emacs-24 ======================= commit 6ee7eabb5dbdf39f2d7471c9e42fc90c315e6a9f Author: Paul Eggert Date: Thu Sep 10 02:39:13 2015 -0700 Port to GIFLIB 5.0.6 and later Problem reported by Mitchel Humpherys in: http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00420.html * src/image.c (HAVE_GIFERRORSTRING) [HAVE_GIF]: New macro. (GifErrorString, init_gif_functions) [HAVE_GIF && WINDOWSNT]: (gif_load) [HAVE_GIF]: Use it. diff --git a/src/image.c b/src/image.c index 85cf801..2aa01e4 100644 --- a/src/image.c +++ b/src/image.c @@ -7499,6 +7499,12 @@ gif_image_p (Lisp_Object object) # define GIFLIB_MAJOR 4 # endif +/* GifErrorString is declared to return char const * when GIFLIB_MAJOR + and GIFLIB_MINOR indicate 5.1 or later. Do not bother using it in + earlier releases, where either it returns char * or GIFLIB_MINOR + may be incorrect. */ +# define HAVE_GIFERRORSTRING (5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)) + # ifdef WINDOWSNT /* GIF library details. */ @@ -7514,7 +7520,9 @@ DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *)); # else DEF_DLL_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *)); DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *, int *)); -DEF_DLL_FN (char *, GifErrorString, (int)); +# endif +# if HAVE_GIFERRORSTRING +DEF_DLL_FN (char const *, GifErrorString, (int)); # endif static bool @@ -7529,7 +7537,7 @@ init_gif_functions (void) LOAD_DLL_FN (library, DGifSlurp); LOAD_DLL_FN (library, DGifOpen); LOAD_DLL_FN (library, DGifOpenFileName); -# if GIFLIB_MAJOR >= 5 +# if HAVE_GIFERRORSTRING LOAD_DLL_FN (library, GifErrorString); # endif return 1; @@ -7641,20 +7649,19 @@ gif_load (struct frame *f, struct image *img) /* Open the GIF file. */ #if GIFLIB_MAJOR < 5 gif = DGifOpenFileName (SSDATA (encoded_file)); - if (gif == NULL) - { - image_error ("Cannot open `%s'", file); - return 0; - } #else gif = DGifOpenFileName (SSDATA (encoded_file), &gif_err); +#endif if (gif == NULL) { +#if HAVE_GIFERRORSTRING image_error ("Cannot open `%s': %s", file, build_string (GifErrorString (gif_err))); +#else + image_error ("Cannot open `%s'", file); +#endif return 0; } -#endif } else { @@ -7672,20 +7679,19 @@ gif_load (struct frame *f, struct image *img) #if GIFLIB_MAJOR < 5 gif = DGifOpen (&memsrc, gif_read_from_memory); - if (!gif) - { - image_error ("Cannot open memory source `%s'", img->spec); - return 0; - } #else gif = DGifOpen (&memsrc, gif_read_from_memory, &gif_err); +#endif if (!gif) { +#if HAVE_GIFERRORSTRING image_error ("Cannot open memory source `%s': %s", img->spec, build_string (GifErrorString (gif_err))); +#else + image_error ("Cannot open memory source `%s'", img->spec); +#endif return 0; } -#endif } /* Before reading entire contents, check the declared image size. */ @@ -7980,8 +7986,8 @@ gif_load (struct frame *f, struct image *img) if (gif_close (gif, &gif_err) == GIF_ERROR) { -#if 5 <= GIFLIB_MAJOR - char *error_text = GifErrorString (gif_err); +#if HAVE_GIFERRORSTRING + char const *error_text = GifErrorString (gif_err); if (error_text) image_error ("Error closing `%s': %s",