emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 6662938 2/4: Merge from origin/emacs-26


From: Glenn Morris
Subject: [Emacs-diffs] master 6662938 2/4: Merge from origin/emacs-26
Date: Mon, 29 Apr 2019 12:13:06 -0400 (EDT)

branch: master
commit 666293861985480bc658f9fa399009027bc39f1e
Merge: f1a3a7d 0e8d452
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Merge from origin/emacs-26
    
    0e8d452 ; * doc/lispref/nonascii.texi (Coding System Basics): Fix gra...
    25a2ff7 ; Add missing space in custom.texi
    9ec18fb * admin/admin.el (set-version): Check for increase in version...
    93912ba Be more careful about indent-sexp going over eol (Bug#35286)
---
 admin/admin.el                          |  8 ++++----
 doc/emacs/custom.texi                   |  2 +-
 doc/lispref/nonascii.texi               |  2 +-
 lisp/emacs-lisp/lisp-mode.el            | 22 ++++++++++++++--------
 test/lisp/emacs-lisp/lisp-mode-tests.el | 28 ++++++++++++++++++++++++++++
 5 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/admin/admin.el b/admin/admin.el
index 030bd54..d3a477f 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -138,10 +138,10 @@ Root must be the root of an Emacs source tree."
                               (if (eq 2 (length newversion)) 0 1))))
          (majorbump (and oldversion (not (equal oldmajor newmajor))))
          (minorbump (and oldversion (not majorbump)
-                         (or (not (equal (cadr oldversion)
-                                         (cadr newversion)))
-                             (and (equal (cadr oldversion) (cadr newversion))
-                                  (equal (nth 2 newversion) 50)))))
+                         (or (not (equal (cadr oldversion) (cadr newversion)))
+                             ;; Eg 26.2 -> 26.2.50.
+                             (and (> (length newversion)
+                                     (length oldversion))))))
          (newsfile (expand-file-name "etc/NEWS" root))
          (oldnewsfile (expand-file-name (format "etc/NEWS.%s" oldmajor) root)))
     (unless (> (length newversion) 2)   ; pretest or release candidate?
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index c649c17..22e352e 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -1331,7 +1331,7 @@ On MS-DOS, the name of this file should be 
@file{_dir-locals.el}, due
 to limitations of the DOS filesystems.  If the filesystem is limited
 to 8+3 file names, the name of the file will be truncated by the OS to
 @file{_dir-loc.el}.
-}in a directory.  Whenever Emacs visits any file in that directory or
+} in a directory.  Whenever Emacs visits any file in that directory or
 any of its subdirectories, it will apply the directory-local variables
 specified in @file{.dir-locals.el}, as though they had been defined as
 file-local variables for that file (@pxref{File Variables}).  Emacs
diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi
index 9c64c3c..47206a4 100644
--- a/doc/lispref/nonascii.texi
+++ b/doc/lispref/nonascii.texi
@@ -1049,7 +1049,7 @@ is like @code{undecided}, but it prefers to choose 
@code{utf-8} when
 possible.
 
   In general, a coding system doesn't guarantee roundtrip identity:
-decoding a byte sequence using coding system, then encoding the
+decoding a byte sequence using a coding system, then encoding the
 resulting text in the same coding system, can produce a different byte
 sequence.  But some coding systems do guarantee that the byte sequence
 will be the same as what you originally decoded.  Here are a few
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 4c7a8be..fa6dc98 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1210,19 +1210,25 @@ ENDPOS is encountered."
                     ;; Get error now if we don't have a complete sexp
                     ;; after point.
                     (save-excursion
+                      (forward-sexp 1)
                       (let ((eol (line-end-position)))
-                        (forward-sexp 1)
                         ;; We actually look for a sexp which ends
                         ;; after the current line so that we properly
                         ;; indent things like #s(...).  This might not
                         ;; be needed if Bug#15998 is fixed.
-                        (condition-case ()
-                            (while (and (< (point) eol) (not (eobp)))
-                              (forward-sexp 1))
-                          ;; But don't signal an error for incomplete
-                          ;; sexps following the first complete sexp
-                          ;; after point.
-                          (scan-error nil)))
+                        (when (and (< (point) eol)
+                                   ;; Check if eol is within a sexp.
+                                   (> (nth 0 (save-excursion
+                                               (parse-partial-sexp
+                                                (point) eol)))
+                                      0))
+                          (condition-case ()
+                              (while (< (point) eol)
+                                (forward-sexp 1))
+                            ;; But don't signal an error for incomplete
+                            ;; sexps following the first complete sexp
+                            ;; after point.
+                            (scan-error nil))))
                       (point)))))
     (save-excursion
       (while (let ((indent (lisp-indent-calc-next parse-state))
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el 
b/test/lisp/emacs-lisp/lisp-mode-tests.el
index a637074..6363244 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -136,6 +136,34 @@ noindent\" 3
     (indent-sexp)
     (should (equal (buffer-string) "(())"))))
 
+(ert-deftest indent-sexp-stop-before-eol-comment ()
+  "`indent-sexp' shouldn't look for more sexps after an eol comment."
+  ;; See https://debbugs.gnu.org/35286.
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (let ((str "() ;;\n  x"))
+      (insert str)
+      (goto-char (point-min))
+      (indent-sexp)
+      ;; The "x" is in the next sexp, so it shouldn't get indented.
+      (should (equal (buffer-string) str)))))
+
+(ert-deftest indent-sexp-stop-before-eol-non-lisp ()
+  "`indent-sexp' shouldn't be too agressive in non-Lisp modes."
+  ;; See https://debbugs.gnu.org/35286#13.
+  (with-temp-buffer
+    (prolog-mode)
+    (let ((str "\
+x(H) -->
+    {y(H)}.
+a(A) -->
+    b(A)."))
+      (insert str)
+      (search-backward "{")
+      (indent-sexp)
+      ;; There's no line-spanning sexp, so nothing should be indented.
+      (should (equal (buffer-string) str)))))
+
 (ert-deftest lisp-indent-region ()
   "Test basics of `lisp-indent-region'."
   (with-temp-buffer



reply via email to

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