emacs-diffs
[Top][All Lists]
Advanced

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

feature/android ce63f592f57: Merge remote-tracking branch 'origin/master


From: Po Lu
Subject: feature/android ce63f592f57: Merge remote-tracking branch 'origin/master' into feature/android
Date: Tue, 25 Jul 2023 20:08:40 -0400 (EDT)

branch: feature/android
commit ce63f592f579e8963a3e7f44b31c7df50fb0cdba
Merge: b7de14b56fa 65834b8f8d5
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 doc/emacs/trouble.texi |  2 +-
 lisp/files-x.el        |  5 ++++-
 lisp/userlock.el       | 17 ++++++++++++-----
 src/character.c        |  2 +-
 src/keyboard.c         |  4 ++--
 5 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index bccdea72b19..d2e8ac3452a 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -706,7 +706,7 @@ produced by typing those commands.
 for the detailed raw data.  Reporting the facts is straightforward,
 but many people strain to posit explanations and report them instead
 of the facts.  If the explanations are based on guesses about how
-Emacs is implemented, they night not be useful; meanwhile, lacking the
+Emacs is implemented, they might not be useful; meanwhile, lacking the
 facts, we will have no real information about the bug.  If you want to
 actually @emph{debug} the problem, and report explanations that are
 more than guesses, that is useful---but please include the raw facts
diff --git a/lisp/files-x.el b/lisp/files-x.el
index 9b1a7a17902..3ba7632d253 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -136,7 +136,10 @@ Intended to be used in the `interactive' spec of
              (eq new-value not-value)
              (not (equal old-value new-value)))
       (message "%s" (substitute-command-keys
-                    "For this change to take effect revisit file using 
\\[revert-buffer]")))))
+                     (if (and (stringp buffer-file-name)
+                              (file-exists-p buffer-file-name))
+                        "For this change to take effect revisit file using 
\\[revert-buffer]"
+                       "For this change to take effect use 
\\[normal-mode]"))))))
 
 (defun modify-file-local-variable (variable value op &optional interactive)
   "Modify file-local VARIABLE in Local Variables depending on operation OP.
diff --git a/lisp/userlock.el b/lisp/userlock.el
index 562bc0a0a9f..96de17d54fd 100644
--- a/lisp/userlock.el
+++ b/lisp/userlock.el
@@ -110,10 +110,11 @@ You can <\\`q'>uit; don't modify this file."))
 
 (defun userlock--check-content-unchanged (filename)
   (with-demoted-errors "Unchanged content check: %S"
-    ;; Even tho we receive `filename', we know that `filename' refers to the 
current
-    ;; buffer's file.
-    (cl-assert (equal (expand-file-name filename)
-                      (expand-file-name buffer-file-truename)))
+    ;; Even tho we receive `filename', we know that `filename' refers
+    ;; to the current buffer's file.
+    (cl-assert (or (null buffer-file-truename) ; temporary buffer
+                   (equal (expand-file-name filename)
+                          (expand-file-name buffer-file-truename))))
     ;; Note: rather than read the file and compare to the buffer, we could save
     ;; the buffer and compare to the file, but for encrypted data this
     ;; wouldn't work well (and would risk exposing the data).
@@ -135,7 +136,13 @@ You can <\\`q'>uit; don't modify this file."))
                          (compare-buffer-substrings
                           buf start end
                           (current-buffer) (point-min) (point-max))))))
-          (set-visited-file-modtime)
+          ;; We know that some buffer visits FILENAME, because our
+          ;; caller (see lock_file) verified that.  Thus, we set the
+          ;; modtime in that buffer, to cater to use case where the
+          ;; file is about to be written to from some buffer that
+          ;; doesn't visit any file, like a temporary buffer.
+          (with-current-buffer (get-file-buffer (file-truename filename))
+            (set-visited-file-modtime))
           'unchanged)))))
 
 ;;;###autoload
diff --git a/src/character.c b/src/character.c
index ae153a579d6..9389e1c0098 100644
--- a/src/character.c
+++ b/src/character.c
@@ -470,7 +470,7 @@ used for non-Latin and other unusual characters (such as 
emoji) is
 ignored as well, as are display properties and invisible text.
 For these reasons, the results are not generally reliable;
 for accurate dimensions of text as it will be displayed,
-use `window-text-pixel-size' instead.
+use `string-pixel-width' or `window-text-pixel-size' instead.
 usage: (string-width STRING &optional FROM TO)  */)
   (Lisp_Object str, Lisp_Object from, Lisp_Object to)
 {
diff --git a/src/keyboard.c b/src/keyboard.c
index f60b5c95654..ee42b821dfa 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -11659,8 +11659,8 @@ the command loop or by `read-key-sequence'.
 The value is always a vector.  */)
   (void)
 {
-  return Fvector (this_command_key_count
-                 - this_single_command_key_start,
+  ptrdiff_t nkeys = this_command_key_count - this_single_command_key_start;
+  return Fvector (nkeys < 0 ? 0 : nkeys,
                  (XVECTOR (this_command_keys)->contents
                   + this_single_command_key_start));
 }



reply via email to

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