emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/replace-region-contents 33f710e: Merge branch 'ori


From: Tassilo Horn
Subject: [Emacs-diffs] scratch/replace-region-contents 33f710e: Merge branch 'origin/master' into scratch/replace-region-contents
Date: Sat, 16 Feb 2019 13:58:50 -0500 (EST)

branch: scratch/replace-region-contents
commit 33f710ede5184d523dbb1dc8e318153e5d1ad7b6
Merge: 9046959 5c158d1
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Merge branch 'origin/master' into scratch/replace-region-contents
---
 admin/notes/emba                       |  64 +++++++++++
 doc/lispref/syntax.texi                |  11 +-
 doc/misc/eww.texi                      |   4 +
 etc/NEWS                               |  13 +++
 lisp/emacs-lisp/rx.el                  |   7 ++
 lisp/erc/erc-dcc.el                    |  11 +-
 lisp/gnus/mm-decode.el                 |   2 +-
 lisp/gnus/mm-view.el                   |  10 +-
 lisp/gnus/mml.el                       |   6 +-
 lisp/ls-lisp.el                        |  10 +-
 lisp/minibuffer.el                     |  46 ++++----
 lisp/net/eww.el                        |  20 +++-
 lisp/net/tramp-adb.el                  |  17 ++-
 lisp/progmodes/cc-engine.el            |   2 -
 lisp/progmodes/compile.el              |  97 ++++++----------
 lisp/startup.el                        |  48 ++++----
 lisp/textmodes/conf-mode.el            |   8 +-
 lisp/textmodes/ispell.el               |   9 +-
 src/data.c                             |  10 ++
 src/lread.c                            |  16 ++-
 src/w32.c                              |  24 +++-
 test/lisp/emacs-lisp/rx-tests.el       |   6 +-
 test/lisp/textmodes/conf-mode-tests.el | 204 +++++++++++++++++++++++++++++++++
 test/src/data-tests.el                 |  18 +++
 24 files changed, 507 insertions(+), 156 deletions(-)

diff --git a/admin/notes/emba b/admin/notes/emba
new file mode 100644
index 0000000..cb0dbc4
--- /dev/null
+++ b/admin/notes/emba
@@ -0,0 +1,64 @@
+-*- mode: outline; coding: utf-8 -*-
+
+Copyright (C) 2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
+NOTES FOR EMACS CONTINUOUS BUILD ON EMBA
+
+A continuous build for Emacs can be found at
+<https://emba.gnu.org/emacs/emacs>, a Gitlab instance.  It watches the
+Emacs git repository and starts a pipeline (jobset) if there are new
+changes.  This happens for all Emacs branches.
+
+* Mail notifications
+
+In addition to the web interface, emba can send notifications by email
+when a job fails.  It sends notifications about test status to
+<address@hidden>.
+
+If you want to receive these notifications, please subscribe at
+<https://lists.gnu.org/mailman/listinfo/emacs-buildstatus>.
+
+Alternatively, these notifications can be read via gmane at
+<nntp+news.gmane.org:gmane.emacs.buildstatus>.
+
+The messages contain a URL to the log file of the failed job, like
+<https://emba.gnu.org/emacs/emacs/-/jobs/739/raw>.
+
+* Emacs jobset
+
+The Emacs jobset is defined in the Emacs source tree, file
+'.gitlab-ci.yml'.  It could be adapted for every Emacs branch, see
+<https://emba.gnu.org/help/ci/yaml/README.md>.
+
+Every job runs in a Debian docker container.  It uses the local clone
+of the Emacs git repository to perform a bootstrap and test of Emacs.
+This could happen for several jobs with changed configuration, compile
+and test parameters.
+
+* Emba configuration
+
+The emba configuration files are hosted on
+<https://gitlab.com/emacs-ci/emba-ansible>.
+
+* Identifying emba
+
+Lisp packages, Makefiles, scripts, and other software could determine
+whether they run on emba by checking for the environment variable
+EMACS_EMBA_CI.
+
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index a960eea..25b9b35 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -556,8 +556,8 @@ the current syntax table in the usual way.
 
 @defvar parse-sexp-lookup-properties
 If this is address@hidden, the syntax scanning functions, like
address@hidden, pay attention to syntax text properties.
-Otherwise they use only the current syntax table.
address@hidden, pay attention to @code{syntax-table} text
+properties.  Otherwise they use only the current syntax table.
 @end defvar
 
 @defvar syntax-propertize-function
@@ -927,9 +927,9 @@ nicely.
 
 @defvar multibyte-syntax-as-symbol
 If this variable is address@hidden, @code{scan-sexps} treats all
address@hidden characters as symbol constituents regardless
-of what the syntax table says about them.  (However, text properties
-can still override the syntax.)
address@hidden characters as symbol constituents regardless of
+what the syntax table says about them.  (However, @code{syntax-table
+}text properties can still override the syntax.)
 @end defvar
 
 @defopt parse-sexp-ignore-comments
@@ -939,7 +939,6 @@ whitespace by the functions in this section and by 
@code{forward-sexp},
 @code{scan-lists} and @code{scan-sexps}.
 @end defopt
 
address@hidden parse-sexp-lookup-properties
 The behavior of @code{parse-partial-sexp} is also affected by
 @code{parse-sexp-lookup-properties} (@pxref{Syntax Properties}).
 
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index d7dc328..8dc58e8 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -85,6 +85,10 @@ searched via @code{eww-search-prefix}.  The default search 
engine is
 either prefix the file name with @code{file://} or use the command
 @kbd{M-x eww-open-file}.
 
+  If you invoke @code{eww} with a prefix argument, as in @address@hidden
+M-x eww}}, it will create a new EWW buffer instead of reusing the
+default one, which is normally called @file{*eww*}.
+
 @findex eww-quit
 @findex eww-reload
 @findex eww-copy-page-url
diff --git a/etc/NEWS b/etc/NEWS
index 73332a8..0cafbaa 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -661,6 +661,11 @@ and its value has been changed to Duck Duck Go.
 ** eww/shr
 
 +++
+*** The 'eww' command can now create a new EWW buffer.
+Invoking the command with a prefix argument will cause it to create a
+new EWW buffer for the URL instead of reusing the default one.
+
++++
 *** The 'd' ('eww-download') command now falls back to current page's URL.
 If this command is invoked with no URL at point, it now downloads the
 current page instead of signaling an error.
@@ -1096,6 +1101,14 @@ subexpression.
 When there is no menu for a mode, display the mode name after the
 indicator instead of just the indicator (which is sometimes cryptic).
 
+** rx
+
+---
+*** rx now handles raw bytes in character alternatives correctly,
+when given in a string.  Previously, '(any "\x80-\xff")' would match
+characters U+0080...U+00FF.  Now the expression matches raw bytes in
+the 128...255 range, as expected.
+
 
 * New Modes and Packages in Emacs 27.1
 
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index b229903..715cd60 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -429,6 +429,13 @@ Only both edges of each range is checked."
     ;; set L list of all ranges
     (mapc (lambda (e) (cond ((stringp e) (push e str))
                            ((numberp e) (push (cons e e) l))
+                            ;; Ranges between ASCII and raw bytes are split,
+                            ;; to prevent accidental inclusion of Unicode
+                            ;; characters later on.
+                            ((and (<= (car e) #x7f)
+                                  (>= (cdr e) #x3fff80))
+                             (push (cons (car e) #x7f) l)
+                             (push (cons #x3fff80 (cdr e)) l))
                            (t (push e l))))
          args)
     ;; condense overlapped ranges in L
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 8a40b14..2849e25 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -979,17 +979,20 @@ rather than every 1024 byte block, but nobody seems to 
care."
     (let ((inhibit-read-only t)
           received-bytes)
       (goto-char (point-max))
-      (insert (string-make-unibyte str))
+      (if str
+          (insert (string-make-unibyte str)))
 
       (when (> (point-max) erc-dcc-receive-cache)
         (erc-dcc-append-contents (current-buffer) erc-dcc-file-name))
-      (setq received-bytes (+ (buffer-size) erc-dcc-byte-count))
+      (setq received-bytes (buffer-size))
+      (if erc-dcc-byte-count
+          (setq received-bytes (+ received-bytes erc-dcc-byte-count)))
 
       (and erc-dcc-verbose
            (erc-display-message
             nil 'notice erc-server-process
             'dcc-get-bytes-received
-            ?f (file-name-nondirectory buffer-file-name)
+            ?f (file-name-nondirectory (buffer-name))
             ?b (number-to-string received-bytes)))
       (cond
        ((and (> (plist-get erc-dcc-entry-data :size) 0)
@@ -997,7 +1000,7 @@ rather than every 1024 byte block, but nobody seems to 
care."
         (erc-display-message
          nil '(notice error) 'active
          'dcc-get-file-too-long
-         ?f (file-name-nondirectory buffer-file-name))
+         ?f (file-name-nondirectory (buffer-name)))
         (delete-process proc))
        (t
         (process-send-string
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 80a2e50..2a769fc 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -763,7 +763,7 @@ MIME-Version header before proceeding."
         (mb enable-multibyte-characters)
         beg)
     (goto-char (point-min))
-    (search-forward-regexp "^\n" nil t)
+    (search-forward-regexp "^\n" nil 'move) ;; There might be no body.
     (setq beg (point))
     (with-current-buffer
           (generate-new-buffer " *mm*")
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index cf41c45..b0d88d8 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -370,10 +370,12 @@
          (enriched-decode (point-min) (point-max))))
       (mm-handle-set-undisplayer
        handle
-       `(lambda ()
-          (let ((inhibit-read-only t))
-           (delete-region ,(copy-marker (point-min) t)
-                          ,(point-max-marker))))))))
+       (if (= (point-min) (point-max))
+          #'ignore
+        `(lambda ()
+           (let ((inhibit-read-only t))
+             (delete-region ,(copy-marker (point-min) t)
+                            ,(point-max-marker)))))))))
 
 (defun mm-insert-inline (handle text)
   "Insert TEXT inline from HANDLE."
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index cf79ca1..be62685 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -982,8 +982,10 @@ If HANDLES is non-nil, use it instead reparsing the 
buffer."
   (unless handles
     (setq handles (mm-dissect-buffer t)))
   (goto-char (point-min))
-  (search-forward "\n\n" nil t)
-  (delete-region (point) (point-max))
+  (if (search-forward "\n\n" nil 'move)
+      (delete-region (point) (point-max))
+    ;; No content in the part that is the sole part of this message.
+    (insert (if (bolp) "\n" "\n\n")))
   (if (stringp (car handles))
       (mml-insert-mime handles)
     (mml-insert-mime handles t))
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index c00dd29..1f2c468 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -475,9 +475,13 @@ not contain `d', so that a full listing is expected."
                       (ls-lisp-classify-file file fattr)
                     file)
                   fattr (file-attribute-size fattr)
-                                 switches time-index))
-       (message "%s: doesn't exist or is inaccessible" file)
-       (ding) (sit-for 2)))))          ; to show user the message!
+                   switches time-index))
+        ;; Emulate what we do on Posix hosts when we call access-file
+        ;; in insert-directory.
+       (signal 'file-error
+                (list "Reading directory"
+                      "Directory doesn't exist or is inaccessible"
+                      file))))))
 
 (declare-function dired-read-dir-and-switches "dired" (str))
 (declare-function dired-goto-next-file "dired" ())
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index cdbd4b3..7413be4 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3042,21 +3042,16 @@ PATTERN is as returned by 
`completion-pcm--string->pattern'."
            (when (string-match-p regex c) (push c poss)))
          (nreverse poss))))))
 
-(defvar flex-score-falloff -1.5
+(defvar flex-score-match-tightness 100
   "Controls how the `flex' completion style scores its matches.
 
-Value is a number whose sign and amplitude have subtly different
-effects.  Positive values make the scoring formula value matches
-scattered along the string, while negative values make the
-formula value tighter matches.  I.e \"foo\" matches both strings
-\"barfoobaz\" and \"fabrobazo\", which are of equal length, but
-only a negative value will score the former higher than the
-second.
-
-The absolute value of this variable controls the relative order
-of different-length strings matched by the same pattern .  Its
-effect is not completely understood yet, so feel free to play
-around with it.")
+Value is a positive number.  Values smaller than one make the
+scoring formula value matches scattered along the string, while
+values greater than one make the formula value tighter matches.
+I.e \"foo\" matches both strings \"barbazfoo\" and \"fabrobazo\",
+which are of equal length, but only a value greater than one will
+score the former (which has one \"hole\") higher than the
+latter (which has two).")
 
 (defun completion-pcm--hilit-commonality (pattern completions)
   (when completions
@@ -3092,10 +3087,10 @@ around with it.")
                 ;; score 1.  The formula takes the form of a quotient.
                 ;; For the numerator, we use the number of +, i.e. the
                 ;; length of the pattern.  For the denominator, it
-                ;; counts the number of - in each such group,
-                ;; exponentiates that number to `flex-score-falloff',
-                ;; adds it to the total, adds one to the final sum,
-                ;; and then multiples by the length of the string.
+                ;; sums (1+ (/ (grouplen - 1)
+                ;; flex-score-match-tightness)) across all groups of
+                ;; -, sums one to that total, and then multiples by
+                ;; the length of the string.
                 (score-numerator 0)
                 (score-denominator 0)
                 (last-b 0)
@@ -3103,22 +3098,27 @@ around with it.")
                  (lambda (a b)
                    "Update score variables given match range (A B)."
                    (setq
-                    score-numerator   (+ score-numerator (- b a))
-                    score-denominator (+ score-denominator
-                                         (expt (- a last-b)
-                                               flex-score-falloff))
+                    score-numerator   (+ score-numerator (- b a)))
+                   (unless (= a last-b)
+                     (setq
+                      score-denominator (+ score-denominator
+                                           1
+                                           (/ (- a last-b 1)
+                                              flex-score-match-tightness
+                                              1.0))))
+                   (setq
                     last-b              b))))
-           (funcall update-score 0 start)
+           (funcall update-score start start)
            (while md
              (funcall update-score start (car md))
              (put-text-property start (pop md)
                                 'font-lock-face 'completions-common-part
                                 str)
              (setq start (pop md)))
+           (funcall update-score len len)
            (put-text-property start end
                               'font-lock-face 'completions-common-part
                               str)
-           (funcall update-score start end)
            (if (> (length str) pos)
                (put-text-property pos (1+ pos)
                                   'font-lock-face 'completions-first-difference
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 555b3bd..d37a481 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -247,21 +247,29 @@ This list can be customized via `eww-suggest-uris'."
     (nreverse uris)))
 
 ;;;###autoload
-(defun eww (url)
+(defun eww (url &optional arg)
   "Fetch URL and render the page.
 If the input doesn't look like an URL or a domain name, the
-word(s) will be searched for via `eww-search-prefix'."
+word(s) will be searched for via `eww-search-prefix'.
+
+If called with a prefix ARG, use a new buffer instead of reusing
+the default EWW buffer."
   (interactive
    (let* ((uris (eww-suggested-uris))
          (prompt (concat "Enter URL or keywords"
                          (if uris (format " (default %s)" (car uris)) "")
                          ": ")))
-     (list (read-string prompt nil 'eww-prompt-history uris))))
+     (list (read-string prompt nil 'eww-prompt-history uris)
+           (prefix-numeric-value current-prefix-arg))))
   (setq url (eww--dwim-expand-url url))
   (pop-to-buffer-same-window
-   (if (eq major-mode 'eww-mode)
-       (current-buffer)
-     (get-buffer-create "*eww*")))
+   (cond
+    ((eq arg 4)
+     (generate-new-buffer "*eww*"))
+    ((eq major-mode 'eww-mode)
+     (current-buffer))
+    (t
+     (get-buffer-create "*eww*"))))
   (eww-setup-buffer)
   ;; Check whether the domain only uses "Highly Restricted" Unicode
   ;; IDNA characters.  If not, transform to punycode to indicate that
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 22f2c5f..4fba4e1 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -677,11 +677,22 @@ But handle the case, if the \"test\" command is not 
available."
                        (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
                        (tramp-compat-time-equal-p time tramp-time-dont-know))
                    (current-time)
-                 time)))
+                 time))
+         (quoted-name (tramp-shell-quote-argument localname)))
+      ;; Older versions of toybox 'touch' mishandle nanoseconds and/or
+      ;; trailing "Z", so fall back on plain seconds if nanoseconds+Z
+      ;; fails.  Also, fall back on old POSIX 'touch -t' if 'touch -d'
+      ;; (introduced in POSIX.1-2008) fails.
       (tramp-adb-send-command-and-check
-       v (format "touch -d %s %s"
+       v (format (concat "touch -d %s %s 2>/dev/null || "
+                        "touch -d %s %s 2>/dev/null || "
+                        "touch -t %s %s")
+                (format-time-string "%Y-%m-%dT%H:%M:%S.%NZ" time t)
+                quoted-name
                 (format-time-string "%Y-%m-%dT%H:%M:%S" time t)
-                (tramp-shell-quote-argument localname))))))
+                quoted-name
+                (format-time-string "%Y%m%d%H%M.%S" time t)
+                quoted-name)))))
 
 (defun tramp-adb-handle-copy-file
   (filename newname &optional ok-if-already-exists keep-date
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index b4c1289..071efbc 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -152,8 +152,6 @@
 (cc-require-when-compile 'cc-langs)
 (cc-require 'cc-vars)
 
-(eval-when-compile (require 'cl))
-
 
 ;; Make declarations for all the `c-lang-defvar' variables in cc-langs.
 
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 581a98d..c3ff576 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -43,23 +43,20 @@
 ;;;###autoload
 (defcustom compilation-mode-hook nil
   "List of hook functions run by `compilation-mode'."
-  :type 'hook
-  :group 'compilation)
+  :type 'hook)
 
 ;;;###autoload
 (defcustom compilation-start-hook nil
   "Hook run after starting a new compilation process.
 The hook is run with one argument, the new process."
-  :type 'hook
-  :group 'compilation)
+  :type 'hook)
 
 ;;;###autoload
 (defcustom compilation-window-height nil
   "Number of lines in a compilation window.
 If nil, use Emacs default."
   :type '(choice (const :tag "Default" nil)
-                integer)
-  :group 'compilation)
+                integer))
 
 (defvar compilation-filter-hook nil
   "Hook run after `compilation-filter' has inserted a string into the buffer.
@@ -526,7 +523,7 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = 
\\([0-9]+\\)\\)?"
   "Alist of values for `compilation-error-regexp-alist'.")
 
 (defcustom compilation-error-regexp-alist
-  (mapcar 'car compilation-error-regexp-alist-alist)
+  (mapcar #'car compilation-error-regexp-alist-alist)
   "Alist that specifies how to match errors in compiler output.
 On GNU and Unix, any string is a valid filename, so these
 matchers must make some common sense assumptions, which catch
@@ -581,8 +578,7 @@ listed text properties PROP# are given values VAL# as well."
   :type '(repeat (choice (symbol :tag "Predefined symbol")
                         (sexp :tag "Error specification")))
   :link `(file-link :tag "example file"
-                   ,(expand-file-name "compilation.txt" data-directory))
-  :group 'compilation)
+                   ,(expand-file-name "compilation.txt" data-directory)))
 
 ;;;###autoload(put 'compilation-directory 'safe-local-variable 'stringp)
 (defvar compilation-directory nil
@@ -642,7 +638,6 @@ If this is buffer-local in the destination buffer, Emacs 
obeys
 that value, otherwise it uses the value in the *compilation*
 buffer.  This enables a major-mode to specify its own value."
   :type 'boolean
-  :group 'compilation
   :version "20.4")
 
 (defcustom compilation-read-command t
@@ -653,15 +648,13 @@ Note that changing this to nil may be a security risk, 
because a
 file might define a malicious `compile-command' as a file local
 variable, and you might not notice.  Therefore, `compile-command'
 is considered unsafe if this variable is nil."
-  :type 'boolean
-  :group 'compilation)
+  :type 'boolean)
 
 ;;;###autoload
 (defcustom compilation-ask-about-save t
   "Non-nil means \\[compile] asks which buffers to save before compiling.
 Otherwise, it saves all modified buffers without asking."
-  :type 'boolean
-  :group 'compilation)
+  :type 'boolean)
 
 (defcustom compilation-save-buffers-predicate nil
   "The second argument (PRED) passed to `save-some-buffers' before compiling.
@@ -675,7 +668,6 @@ of `my-compilation-root' here."
           (const :tag "Default (save all file-visiting buffers)" nil)
           (const :tag "Save all buffers" t)
           function)
-  :group 'compilation
   :version "24.1")
 
 ;;;###autoload
@@ -684,8 +676,7 @@ of `my-compilation-root' here."
 Elements should be directory names, not file names of directories.
 The value nil as an element means to try the default directory."
   :type '(repeat (choice (const :tag "Default" nil)
-                        (string :tag "Directory")))
-  :group 'compilation)
+                        (string :tag "Directory"))))
 
 ;;;###autoload
 (defcustom compile-command (purecopy "make -k ")
@@ -705,8 +696,7 @@ You might also use mode hooks to specify it in certain 
modes, like this:
                            (file-name-sans-extension buffer-file-name))))))))
 
 It's often useful to leave a space at the end of the value."
-  :type 'string
-  :group 'compilation)
+  :type 'string)
 ;;;###autoload(put 'compile-command 'safe-local-variable (lambda (a) (and 
(stringp a) (or (not (boundp 'compilation-read-command)) 
compilation-read-command))))
 
 ;;;###autoload
@@ -715,7 +705,6 @@ It's often useful to leave a space at the end of the value."
 This only affects platforms that support asynchronous processes (see
 `start-process'); synchronous compilation processes never accept input."
   :type 'boolean
-  :group 'compilation
   :version "22.1")
 
 ;; A weak per-compilation-buffer hash indexed by (FILENAME . DIRECTORY).  Each
@@ -741,7 +730,6 @@ This list is temporarily prepended to `process-environment' 
prior to
 starting the compilation process."
   :type '(repeat (string :tag "ENVVARNAME=VALUE"))
   :options '(("LANG=C"))
-  :group 'compilation
   :version "24.1")
 
 ;; History of compile commands.
@@ -750,19 +738,16 @@ starting the compilation process."
 (defface compilation-error
   '((t :inherit error))
   "Face used to highlight compiler errors."
-  :group 'compilation
   :version "22.1")
 
 (defface compilation-warning
   '((t :inherit warning))
   "Face used to highlight compiler warnings."
-  :group 'compilation
   :version "22.1")
 
 (defface compilation-info
   '((t :inherit success))
   "Face used to highlight compiler information."
-  :group 'compilation
   :version "22.1")
 
 ;; The next three faces must be able to stand out against the
@@ -774,13 +759,11 @@ starting the compilation process."
     (((class color) (min-colors 8)) (:foreground "red"))
     (t (:inverse-video t :weight bold)))
   "Face for Compilation mode's \"error\" mode line indicator."
-  :group 'compilation
   :version "24.3")
 
 (defface compilation-mode-line-run
   '((t :inherit compilation-warning))
   "Face for Compilation mode's \"running\" mode line indicator."
-  :group 'compilation
   :version "24.3")
 
 (defface compilation-mode-line-exit
@@ -790,19 +773,16 @@ starting the compilation process."
     (((class color)) (:foreground "green" :weight bold))
     (t (:weight bold)))
   "Face for Compilation mode's \"exit\" mode line indicator."
-  :group 'compilation
   :version "24.3")
 
 (defface compilation-line-number
   '((t :inherit font-lock-keyword-face))
   "Face for displaying line numbers in compiler messages."
-  :group 'compilation
   :version "22.1")
 
 (defface compilation-column-number
   '((t :inherit font-lock-doc-face))
   "Face for displaying column numbers in compiler messages."
-  :group 'compilation
   :version "22.1")
 
 (defcustom compilation-message-face 'underline
@@ -811,7 +791,6 @@ Faces `compilation-error-face', `compilation-warning-face',
 `compilation-info-face', `compilation-line-face' and
 `compilation-column-face' get prepended to this, when applicable."
   :type 'face
-  :group 'compilation
   :version "22.1")
 
 (defvar compilation-error-face 'compilation-error
@@ -844,7 +823,6 @@ Faces `compilation-error-face', `compilation-warning-face',
 (defcustom compilation-auto-jump-to-first-error nil
   "If non-nil, automatically jump to the first error during compilation."
   :type 'boolean
-  :group 'compilation
   :version "23.1")
 
 (defvar compilation-auto-jump-to-next nil
@@ -867,7 +845,6 @@ info, are considered errors."
   :type '(choice (const :tag "Skip warnings and info" 2)
                 (const :tag "Skip info" 1)
                 (const :tag "No skip" 0))
-  :group 'compilation
   :version "22.1")
 
 (defun compilation-set-skip-threshold (level)
@@ -891,7 +868,6 @@ Visited messages are ones for which the file, line and 
column have been jumped
 to from the current content in the current compilation buffer, even if it was
 from a different message."
   :type 'boolean
-  :group 'compilation
   :version "22.1")
 
 (defun compilation-type (type)
@@ -1425,17 +1401,17 @@ to `compilation-error-regexp-alist' if RULES is nil."
                              file line end-line col end-col (or type 2) fmt))
 
             (when (integerp file)
-              (setq type (if (consp type)
-                             (compilation-type type)
-                           (or type 2)))
-              (compilation--note-type type)
-
-              (compilation--put-prop
-               file 'font-lock-face
-               (symbol-value (aref [compilation-info-face
-                                    compilation-warning-face
-                                    compilation-error-face]
-                                   type))))
+              (let ((this-type (if (consp type)
+                                   (compilation-type type)
+                                 (or type 2))))
+                (compilation--note-type type)
+
+                (compilation--put-prop
+                 file 'font-lock-face
+                 (symbol-value (aref [compilation-info-face
+                                      compilation-warning-face
+                                      compilation-error-face]
+                                     this-type)))))
 
             (compilation--put-prop
              line 'font-lock-face compilation-line-face)
@@ -1583,7 +1559,7 @@ If the optional argument `edit-command' is non-nil, the 
command can be edited."
       (setq command (compilation-read-command (or (car compilation-arguments)
                                                  command)))
       (if compilation-arguments (setcar compilation-arguments command)))
-    (apply 'compilation-start (or compilation-arguments (list command)))))
+    (apply #'compilation-start (or compilation-arguments (list command)))))
 
 (defcustom compilation-scroll-output nil
   "Non-nil to scroll the *compilation* buffer window as output appears.
@@ -1597,8 +1573,7 @@ point on its location in the *compilation* buffer."
   :type '(choice (const :tag "No scrolling" nil)
                 (const :tag "Scroll compilation output" t)
                 (const :tag "Stop scrolling at the first error" first-error))
-  :version "20.3"
-  :group 'compilation)
+  :version "20.3")
 
 
 (defun compilation-buffer-name (name-of-mode mode-command name-function)
@@ -1622,8 +1597,7 @@ Otherwise, construct a buffer name from NAME-OF-MODE."
   "If t, always kill a running compilation process before starting a new one.
 If nil, ask to kill it."
   :type 'boolean
-  :version "24.3"
-  :group 'compilation)
+  :version "24.3")
 
 ;;;###autoload
 (defun compilation-start (command &optional mode name-function 
highlight-regexp)
@@ -1802,11 +1776,11 @@ Returns the compilation buffer created."
               (when compilation-always-kill
                 (set-process-query-on-exit-flag proc nil))
 
-              (set-process-sentinel proc 'compilation-sentinel)
+              (set-process-sentinel proc #'compilation-sentinel)
               (unless (eq mode t)
                 ;; Keep the comint filter, since it's needed for proper
                ;; handling of the prompts.
-               (set-process-filter proc 'compilation-filter))
+               (set-process-filter proc #'compilation-filter))
              ;; Use (point-max) here so that output comes in
              ;; after the initial text,
              ;; regardless of where the user sees point.
@@ -2114,7 +2088,7 @@ by replacing the first word, e.g., 
`compilation-scroll-output' from
       (let (revert-buffer-function)
        (revert-buffer ignore-auto noconfirm))
     (if (or noconfirm (yes-or-no-p (format "Restart compilation? ")))
-       (apply 'compilation-start compilation-arguments))))
+       (apply #'compilation-start compilation-arguments))))
 
 (defvar compilation-current-error nil
   "Marker to the location from where the next error will be found.
@@ -2150,7 +2124,7 @@ Optional argument MINOR indicates this is called from
   ;; It's generally preferable to use after-change-functions since they
   ;; can be subject to combine-after-change-calls, but if we do that, we risk
   ;; running our hook after font-lock, resulting in incorrect refontification.
-  (add-hook 'before-change-functions 'compilation--flush-parse nil t)
+  (add-hook 'before-change-functions #'compilation--flush-parse nil t)
   ;; Also for minor mode, since it's not permanent-local.
   (add-hook 'change-major-mode-hook #'compilation--remove-properties nil t)
   (if minor
@@ -2162,7 +2136,7 @@ Optional argument MINOR indicates this is called from
 (defun compilation--unsetup ()
   ;; Only for minor mode.
   (font-lock-remove-keywords nil (compilation-mode-font-lock-keywords))
-  (remove-hook 'before-change-functions 'compilation--flush-parse t)
+  (remove-hook 'before-change-functions #'compilation--flush-parse t)
   (kill-local-variable 'compilation--parsed)
   (compilation--remove-properties)
   (font-lock-flush))
@@ -2175,8 +2149,7 @@ When Compilation Shell minor mode is enabled, all the
 error-parsing commands of the Compilation major mode are
 available but bound to keys that don't collide with Shell mode.
 See `compilation-mode'."
-  nil " Shell-Compile"
-  :group 'compilation
+  :lighter " Shell-Compile"
   (if compilation-shell-minor-mode
       (compilation-setup t)
     (compilation--unsetup)))
@@ -2188,8 +2161,7 @@ See `compilation-mode'."
 When Compilation minor mode is enabled, all the error-parsing
 commands of Compilation major mode are available.  See
 `compilation-mode'."
-  nil " Compilation"
-  :group 'compilation
+  :lighter " Compilation"
   (if compilation-minor-mode
       (compilation-setup t)
     (compilation--unsetup)))
@@ -2379,7 +2351,7 @@ looking for the next message."
                                                'compilation-message))
            (setq pt (compilation-next-single-property-change
                       pt 'compilation-message nil
-                                                 (line-end-position)))
+                     (line-end-position)))
            (or (setq msg (get-text-property pt 'compilation-message))
                (setq pt (point)))))
       (setq last (compilation--loc->file-struct loc))
@@ -2397,7 +2369,7 @@ looking for the next message."
                          "Moved back before first %s" (point-min))))
     (goto-char pt)
     (or msg
-       (error "No %s here" compilation-error))))
+       (user-error "No %s here" compilation-error))))
 
 (defun compilation-previous-error (n)
   "Move point to the previous error in the compilation buffer.
@@ -2585,7 +2557,6 @@ compilation output window; an arrow in the left fringe 
points to
 the current message.  If nil and there is no left fringe, the message
 displays at the top of the window; there is no arrow."
   :type '(choice integer (const :tag "No window scrolling" nil))
-  :group 'compilation
   :version "22.1")
 
 (defsubst compilation-set-window (w mk)
@@ -2679,7 +2650,7 @@ and overlay is highlighted between MK and END-MK."
                    (numberp next-error-highlight))
                ;; We want highlighting: delete overlay on next input.
                (add-hook 'pre-command-hook
-                         'compilation-goto-locus-delete-o)
+                         #'compilation-goto-locus-delete-o)
              ;; We don't want highlighting: delete overlay now.
              (delete-overlay compilation-highlight-overlay))
            ;; We want highlighting for a limited time:
@@ -2699,7 +2670,7 @@ and overlay is highlighted between MK and END-MK."
   (if (timerp next-error-highlight-timer)
       (cancel-timer next-error-highlight-timer))
   (remove-hook 'pre-command-hook
-              'compilation-goto-locus-delete-o))
+              #'compilation-goto-locus-delete-o))
 
 (defun compilation-find-file (marker filename directory &rest formats)
   "Find a buffer for file FILENAME.
diff --git a/lisp/startup.el b/lisp/startup.el
index f2410f6..a9b58c5 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -60,8 +60,7 @@ string or function value that this variable has."
          (const     :tag "Remember Mode notes buffer" remember-notes)
          (function  :tag "Function")
          (const     :tag "Lisp scratch buffer" t))
-  :version "23.1"
-  :group 'initialization)
+  :version "23.1")
 
 (defvaralias 'inhibit-splash-screen 'inhibit-startup-screen)
 (defvaralias 'inhibit-startup-message 'inhibit-startup-screen)
@@ -71,8 +70,7 @@ string or function value that this variable has."
 
 This is for use in your personal init file (but NOT site-start.el),
 once you are familiar with the contents of the startup screen."
-  :type 'boolean
-  :group 'initialization)
+  :type 'boolean)
 
 (defvar startup-screen-inhibit-startup-screen nil)
 
@@ -101,18 +99,15 @@ instead:
 Thus, someone else using a copy of your init file will see the
 startup message unless he personally acts to inhibit it."
   :type '(choice (const :tag "Don't inhibit")
-                (string :tag "Enter your user name, to inhibit"))
-  :group 'initialization)
+                (string :tag "Enter your user name, to inhibit")))
 
 (defcustom inhibit-default-init nil
   "Non-nil inhibits loading the `default' library."
-  :type 'boolean
-  :group 'initialization)
+  :type 'boolean)
 
 (defcustom inhibit-startup-buffer-menu nil
   "Non-nil inhibits display of buffer list when more than 2 files are loaded."
-  :type 'boolean
-  :group 'initialization)
+  :type 'boolean)
 
 (defvar command-switch-alist nil
   "Alist of command-line switches.
@@ -336,8 +331,7 @@ is due to historical reasons, and does not reflect its 
purpose very well.)")
 
 (defcustom initial-major-mode 'lisp-interaction-mode
   "Major mode command symbol to use for the initial `*scratch*' buffer."
-  :type 'function
-  :group 'initialization)
+  :type 'function)
 
 (defvar init-file-user nil
   "Identity of user whose init file is or was read.
@@ -376,7 +370,6 @@ it visible in the relevant context.  However, actually 
customizing it
 is not allowed, since it would not work anyway.  The only way to set
 this variable usefully is to set it while building and dumping Emacs."
   :type '(choice (const :tag "none" nil) string)
-  :group 'initialization
   :initialize #'custom-initialize-default
   :set (lambda (_variable _value)
          (error "Customizing `site-run-file' does not work")))
@@ -886,7 +879,7 @@ If STYLE is nil, display appropriately for the terminal."
           (when standard-display-table
             (aset standard-display-table char nil)))))))
 
-(defun load-user-init-file
+(defun startup--load-user-init-file
     (filename-function &optional alternate-filename-function load-defaults)
   "Load a user init-file.
 FILENAME-FUNCTION is called with no arguments and should return
@@ -913,11 +906,17 @@ init-file, or to a default value if loading is not 
possible."
               ;; the name of the file that it loads into
               ;; `user-init-file'.
               (setq user-init-file t)
-              (load init-file-name 'noerror 'nomessage)
+              (load (if (equal (file-name-extension init-file-name)
+                               "el")
+                        (file-name-sans-extension init-file-name)
+                      init-file-name)
+                    'noerror 'nomessage)
 
               (when (and (eq user-init-file t) alternate-filename-function)
-                (load (funcall alternate-filename-function)
-                      'noerror 'nomessage))
+                (let ((alt-file (funcall alternate-filename-function)))
+                  (and (equal (file-name-extension alt-file) "el")
+                       (setq alt-file (file-name-sans-extension alt-file)))
+                  (load alt-file 'noerror 'nomessage)))
 
               ;; If we did not find the user's init file, set
               ;; user-init-file conclusively.  Don't let it be
@@ -1164,10 +1163,14 @@ please check its value")
                          :error))))
 
   ;; Load the early init file, if found.
-  (load-user-init-file
+  (startup--load-user-init-file
    (lambda ()
      (expand-file-name
-      "early-init"
+      ;; We use an explicit .el extension here to force
+      ;; startup--load-user-init-file to set user-init-file to "early-init.el",
+      ;; with the .el extension, if the file doesn't exist, not just
+      ;; "early-init" without an extension, as it does for ".emacs".
+      "early-init.el"
       (file-name-as-directory
        (concat "~" init-file-user "/.emacs.d")))))
   (setq early-init-file user-init-file)
@@ -1304,7 +1307,7 @@ please check its value")
          (load site-run-file t t)))
 
     ;; Load that user's init file, or the default one, or none.
-    (load-user-init-file
+    (startup--load-user-init-file
      (lambda ()
        (cond
         ((eq system-type 'ms-dos)
@@ -1477,8 +1480,7 @@ settings will be marked as \"CHANGED outside of 
Customize\"."
   "Initial documentation displayed in *scratch* buffer at startup.
 If this is nil, no message will be displayed."
   :type '(choice (text :tag "Message")
-                (const :tag "none" nil))
-  :group 'initialization)
+                (const :tag "none" nil)))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1632,13 +1634,13 @@ Each element in the list should be a list of strings or 
pairs
 
 
 (defgroup fancy-splash-screen ()
+  ;; FIXME: Do we really need this group with a single custom var?
   "Fancy splash screen when Emacs starts."
   :version "21.1"
   :group 'initialization)
 
 (defcustom fancy-splash-image nil
   "The image to show in the splash screens, or nil for defaults."
-  :group 'fancy-splash-screen
   :type '(choice (const :tag "Default" nil)
                 (file :tag "File")))
 
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index ad79ca4..ad9f60f 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -1,4 +1,4 @@
-;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files
+;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files  
-*- lexical-binding: t; -*-
 
 ;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
@@ -281,10 +281,10 @@ whitespace.")
 ;; If anybody can figure out how to get the same effect by configuring
 ;; `align', I'd be glad to hear.
 (defun conf-align-assignments (&optional arg)
-  (interactive "P")
   "Align the assignments in the buffer or active region.
 In Transient Mark mode, if the mark is active, operate on the
 contents of the region.  Otherwise, operate on the whole buffer."
+  (interactive "P")
   (setq arg (if arg
                (prefix-numeric-value arg)
              conf-assignment-column))
@@ -323,7 +323,7 @@ contents of the region.  Otherwise, operate on the whole 
buffer."
 
 (defun conf-quote-normal (arg)
   "Set the syntax of \\=' and \" to punctuation.
-With prefix arg, only do it for \\=' if 1, or only for \" if 2.
+With prefix ARG, only do it for \\=' if 1, or only for \" if 2.
 This only affects the current buffer.  Some conf files use quotes
 to delimit strings, while others allow quotes as simple parts of
 the assigned value.  In those files font locking will be wrong,
@@ -442,7 +442,7 @@ See also `conf-space-mode', `conf-colon-mode', 
`conf-javaprop-mode',
     (run-mode-hooks 'conf-mode-hook)))
 
 (defun conf-mode-initialize (comment &optional font-lock)
-  "Initializations for sub-modes of conf-mode.
+  "Initializations for sub-modes of `conf-mode'.
 COMMENT initializes `comment-start' and `comment-start-skip'.
 The optional arg FONT-LOCK is the value for FONT-LOCK-KEYWORDS."
   (set (make-local-variable 'comment-start) comment)
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index f3436c6..cc8ec26 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1107,12 +1107,19 @@ dictionary from that list was found."
                                 null-device
                                 t
                                 nil
+                                 "-D"
+                                 ;; Use -a to prevent Hunspell from
+                                 ;; trying to initialize its
+                                 ;; curses/termcap UI, which causes it
+                                 ;; to crash or fail to start in some
+                                 ;; MS-Windows ports.
+                                 "-a"
                                  ;; Hunspell 1.7.0 (and later?) won't
                                  ;; show LOADED DICTIONARY unless
                                  ;; there's at least one file argument
                                  ;; on the command line.  So we feed
                                  ;; it with the null device.
-                                "-D" null-device)
+                                null-device)
            (buffer-string))
          "[\n\r]+"
          t))
diff --git a/src/data.c b/src/data.c
index 92a1062..65f2b0f 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1958,6 +1958,16 @@ Instead, use `add-hook' and specify t for the LOCAL 
argument.  */)
        (current_buffer,
         Fcons (Fcons (variable, XCDR (blv->defcell)),
                BVAR (current_buffer, local_var_alist)));
+
+      /* If the symbol forwards into a C variable, then load the binding
+         for this buffer now, to preserve the invariant that forwarded
+         variables must always hold the value corresponding to the
+         current buffer (they are swapped eagerly).
+         Otherwise, if C code modifies the variable before we load the
+         binding in, then that new value would clobber the default binding
+         the next time we unload it.  See bug#34318.  */
+      if (blv->fwd)
+        swap_in_symval_forwarding (sym, blv);
     }
 
   return variable;
diff --git a/src/lread.c b/src/lread.c
index ff9b754..6389e3e 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1070,14 +1070,15 @@ This uses the variables `load-suffixes' and 
`load-file-rep-suffixes'.  */)
   return Fnreverse (lst);
 }
 
-/* Returns true if STRING ends with SUFFIX */
+/* Return true if STRING ends with SUFFIX.  */
 static bool
 suffix_p (Lisp_Object string, const char *suffix)
 {
   ptrdiff_t suffix_len = strlen (suffix);
   ptrdiff_t string_len = SBYTES (string);
 
-  return string_len >= suffix_len && !strcmp (SSDATA (string) + string_len - 
suffix_len, suffix);
+  return (suffix_len <= string_len
+         && strcmp (SSDATA (string) + string_len - suffix_len, suffix) == 0);
 }
 
 static void
@@ -1932,13 +1933,10 @@ readevalloop (Lisp_Object readcharfun,
   Lisp_Object macroexpand = intern ("internal-macroexpand-for-load");
 
   if (NILP (Ffboundp (macroexpand))
-      /* Don't macroexpand in .elc files, since it should have been done
-        already.  We actually don't know whether we're in a .elc file or not,
-        so we use circumstantial evidence: .el files normally go through
-        Vload_source_file_function -> load-with-code-conversion
-        -> eval-buffer.  */
-      || EQ (readcharfun, Qget_file_char)
-      || EQ (readcharfun, Qget_emacs_mule_file_char))
+      || (STRINGP (sourcename) && suffix_p (sourcename, ".elc")))
+    /* Don't macroexpand before the corresponding function is defined
+       and don't bother macroexpanding in .elc files, since it should have
+       been done already.  */
     macroexpand = Qnil;
 
   if (MARKERP (readcharfun))
diff --git a/src/w32.c b/src/w32.c
index c75a4f9..197f6dd 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2091,7 +2091,29 @@ getpwnam (char *name)
     return pw;
 
   if (xstrcasecmp (name, pw->pw_name))
-    return NULL;
+    {
+      /* Mimic what init_editfns does with these environment
+        variables, so that the likes of ~USER is recognized by
+        expand-file-name even if $LOGNAME gives a name different from
+        the real username produced by the process token.  */
+      char *logname = getenv ("LOGNAME");
+      char *username = getenv ("USERNAME");
+      if ((logname || username)
+         && xstrcasecmp (name, logname ? logname : username) == 0)
+       {
+         static struct passwd alias_user;
+         static char alias_name[PASSWD_FIELD_SIZE];
+
+         memcpy (&alias_user, &dflt_passwd, sizeof dflt_passwd);
+         alias_name[0] = '\0';
+         strncat (alias_name, logname ? logname : username,
+                  PASSWD_FIELD_SIZE - 1);
+         alias_user.pw_name = alias_name;
+         pw = &alias_user;
+       }
+      else
+       return NULL;
+    }
 
   return pw;
 }
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index f15e101..e14feda 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -53,7 +53,11 @@
   ;; Range of raw characters, multibyte.
   (should (equal (string-match-p (rx (any "Å\211\326-\377\177"))
                                  "XY\355\177\327")
-                 2)))
+                 2))
+  ;; Split range; \177-\377ÿ should not be optimised to \177-\377.
+  (should (equal (string-match-p (rx (any "\177-\377" ?ÿ))
+                                 "ÿA\310B")
+                 0)))
 
 (ert-deftest rx-pcase ()
   (should (equal (pcase "a 1 2 3 1 1 b"
diff --git a/test/lisp/textmodes/conf-mode-tests.el 
b/test/lisp/textmodes/conf-mode-tests.el
new file mode 100644
index 0000000..3eefc8f
--- /dev/null
+++ b/test/lisp/textmodes/conf-mode-tests.el
@@ -0,0 +1,204 @@
+;;; conf-mode-tests.el --- Test suite for conf mode  -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
+
+;; Author: J. Alexander Branham <address@hidden>
+;; Keywords: internal
+
+;; This file is part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+(require 'conf-mode)
+(require 'ert)
+
+(ert-deftest conf-test-align-assignments ()
+  "Test for `conf-align-assignments'."
+  (with-temp-buffer
+    (insert "foo: bar\nbar: baz")
+    (conf-colon-mode)
+    (conf-align-assignments)
+    (should (equal (buffer-string)
+                   "foo:                       bar\nbar:                       
baz"))))
+
+(ert-deftest conf-test-font-lock ()
+  (with-temp-buffer
+    (insert "foo: bar\nbar: baz")
+    (conf-colon-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (goto-char (point-min))
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "bar")
+    (should-not (face-at-point))))
+
+(ert-deftest conf-test-windows-mode ()
+  (with-temp-buffer
+    ;; from `conf-windows-mode' docstring:
+    (insert "[ExtShellFolderViews]
+Default={5984FFE0-28D4-11CF-AE66-08002B2E1262}
+{5984FFE0-28D4-11CF-AE66-08002B2E1262}={5984FFE0-28D4-11CF-AE66-08002B2E1262}
+
+[{5984FFE0-28D4-11CF-AE66-08002B2E1262}]
+PersistMoniker=file://Folder.htt")
+    (goto-char (point-min))
+    (conf-windows-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (search-forward "ExtShell")
+    (should (equal (face-at-point) 'font-lock-type-face))
+    (search-forward "Defau")
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (forward-line)
+    (beginning-of-line)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (forward-line 2)
+    (should-not (face-at-point))
+    (forward-char)
+    (should (equal (face-at-point) 'font-lock-type-face))))
+
+(ert-deftest conf-test-javaprop-mode ()
+  (with-temp-buffer
+    ;; From `conf-javaprop-mode' docstring
+    (insert "// another kind of comment
+/* yet another */
+
+name:value
+name=value
+name value
+x.1 =
+x.2.y.1.z.1 =
+x.2.y.1.z.2.zz =")
+    (goto-char (point-min))
+    (conf-javaprop-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-comment-delimiter-face))
+    (forward-char 3)
+    (should (equal (face-at-point) 'font-lock-comment-face))
+    (search-forward "*")
+    (should (equal (face-at-point) 'font-lock-comment-delimiter-face))
+    (while (search-forward "nam" nil t)
+      (should (equal (face-at-point) 'font-lock-variable-name-face))
+      (search-forward "val")
+      (should-not (face-at-point)))
+    (while (re-search-forward "a-z" nil t)
+      (backward-char)
+      (should (equal (face-at-point) 'font-lock-variable-name-face))
+      (re-search-forward "[0-0]" nil t)
+      (backward-char)
+      (should (equal (face-at-point) 'font-lock-constant-face)))))
+
+(ert-deftest conf-test-space-mode ()
+  ;; From `conf-space-mode' docstring.
+  (with-temp-buffer
+    (insert "image/jpeg                        jpeg jpg jpe
+image/png                      png
+image/tiff                     tiff tif
+")
+    (goto-char (point-min))
+    (conf-space-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (forward-char 15)
+    (should-not (face-at-point))))
+
+(ert-deftest conf-test-colon-mode ()
+  ;; From `conf-colon-mode' docstring.
+  (with-temp-buffer
+    (insert "<Multi_key> <exclam> <exclam>             : \"\\241\"     
exclamdown
+<Multi_key> <c> <slash>                        : \"\\242\"     cent")
+    (goto-char (point-min))
+    (conf-colon-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "24")
+    (should (equal (face-at-point) 'font-lock-string-face))
+    (forward-line)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))))
+
+(ert-deftest conf-test-ppd-mode ()
+  ;; From `conf-ppd-mode' docstring.
+  (with-temp-buffer
+    (insert "*DefaultTransfer: Null
+*Transfer Null.Inverse: \"{ 1 exch sub }\"")
+    (goto-char (point-min))
+    (conf-ppd-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "Nul")
+    (should-not (face-at-point))))
+
+(ert-deftest conf-test-xdefaults-mode ()
+  ;; From `conf-xdefaults-mode' docstring.
+  (with-temp-buffer
+    (insert "*background:                      gray99
+*foreground:                   black")
+    (goto-char (point-min))
+    (conf-xdefaults-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "gray")
+    (should-not (face-at-point))))
+
+(ert-deftest conf-test-toml-mode ()
+  ;; From `conf-toml-mode' docstring.
+  (with-temp-buffer
+    (insert "\[entry]
+value = \"some string\"")
+    (goto-char (point-min))
+    (conf-toml-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should-not (face-at-point))
+    (forward-char)
+    (should (equal (face-at-point) 'font-lock-type-face))
+    (forward-line)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "som")
+    (should (equal (face-at-point) 'font-lock-string-face))))
+
+(ert-deftest conf-test-desktop-mode ()
+  ;; From `conf-desktop-mode' dostring.
+  (with-temp-buffer
+    (insert "  [Desktop Entry]
+       Name=GNU Image Manipulation Program
+       Name[oc]=Editor d'imatge GIMP
+       Exec=gimp-2.8 %U
+       Terminal=false")
+    (goto-char (point-min))
+    (conf-desktop-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (search-forward "Desk")
+    (should (equal (face-at-point) 'font-lock-type-face))
+    (search-forward "Nam")
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (forward-char 2)
+    (should-not (face-at-point))
+    (search-forward "[")
+    (should (equal (face-at-point) 'font-lock-constant-face))))
+
+
+
+(provide 'conf-mode-tests)
+
+;;; conf-mode-tests.el ends here
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index bc77a7b..a9d48e2 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -669,4 +669,22 @@ comparing the subr with a much slower lisp implementation."
   (should (= (lsh -1 -1) most-positive-fixnum))
   (should-error (lsh (1- most-negative-fixnum) -1)))
 
+(ert-deftest data-tests-make-local-forwarded-var () ;bug#34318
+  ;; Boy, this bug is tricky to trigger.  You need to:
+  ;; - call make-local-variable on a forwarded var (i.e. one that
+  ;;   has a corresponding C var linked via DEFVAR_(LISP|INT|BOOL))
+  ;; - cause the C code to modify this variable from the C side of the
+  ;;   forwarding, but this needs to happen before the var is accessed
+  ;;   from the Lisp side and before we switch to another buffer.
+  ;; The trigger in bug#34318 doesn't exist any more because the C code has
+  ;; changes.  Instead I found the trigger below.
+  (with-temp-buffer
+    (setq last-coding-system-used 'bug34318)
+    (make-local-variable 'last-coding-system-used)
+    ;; This should set last-coding-system-used to `no-conversion'.
+    (decode-coding-string "hello" nil)
+    (should (equal (list last-coding-system-used
+                         (default-value 'last-coding-system-used))
+                   '(no-conversion bug34318)))))
+
 ;;; data-tests.el ends here



reply via email to

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