emacs-diffs
[Top][All Lists]
Advanced

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

master 04bba4a28f 1/2: Merge from origin/emacs-28


From: Po Lu
Subject: master 04bba4a28f 1/2: Merge from origin/emacs-28
Date: Sat, 29 Jan 2022 07:39:26 -0500 (EST)

branch: master
commit 04bba4a28f959cb202e7fb993b619c7358084ec3
Merge: a85e9d7641 611736f3bc
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge from origin/emacs-28
    
    611736f3bc Remove debug logging
    ddba3c3dba Fix error in filelock.c
    
    # Conflicts:
    #       src/filelock.c
---
 src/filelock.c | 74 +++++++++++++++++++++++++++++++---------------------------
 src/nsterm.m   | 19 ---------------
 2 files changed, 39 insertions(+), 54 deletions(-)

diff --git a/src/filelock.c b/src/filelock.c
index eb8d9ab5e0..7dfdd5ddec 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -658,6 +658,7 @@ make_lock_file_name (Lisp_Object fn)
 static Lisp_Object
 lock_file (Lisp_Object fn)
 {
+  char *lfname = NULL;
   lock_info_type lock_info;
 
   /* Don't do locking while dumping Emacs.
@@ -666,47 +667,46 @@ lock_file (Lisp_Object fn)
   if (will_dump_p ())
     return Qnil;
 
-  /* If the file name has special constructs in it,
-     call the corresponding file name handler.  */
-  Lisp_Object handler;
-  handler = Ffind_file_name_handler (fn, Qlock_file);
-  if (!NILP (handler))
+  if (create_lockfiles)
     {
-      return call2 (handler, Qlock_file, fn);
+      /* Create the name of the lock-file for file fn */
+      Lisp_Object lock_filename = make_lock_file_name (fn);
+      if (NILP (lock_filename))
+       return Qnil;
+      lfname = SSDATA (ENCODE_FILE (lock_filename));
     }
 
-  Lisp_Object lock_filename = make_lock_file_name (fn);
-  if (NILP (lock_filename))
-    return Qnil;
-  char *lfname = SSDATA (ENCODE_FILE (lock_filename));
-
   /* See if this file is visited and has changed on disk since it was
      visited.  */
   Lisp_Object subject_buf = get_truename_buffer (fn);
   if (!NILP (subject_buf)
       && NILP (Fverify_visited_file_modtime (subject_buf))
       && !NILP (Ffile_exists_p (fn))
-      && current_lock_owner (NULL, lfname) != I_OWN_IT)
+      && !(lfname && (current_lock_owner (NULL, lfname) != I_OWN_IT)))
     call1 (intern ("userlock--ask-user-about-supersession-threat"), fn);
 
-  /* Try to lock the lock.  FIXME: This ignores errors when
-     lock_if_free returns an errno value.  */
-  if (lock_if_free (&lock_info, lfname) == ANOTHER_OWNS_IT)
+  /* Don't do locking if the user has opted out.  */
+  if (lfname)
     {
-      /* Someone else has the lock.  Consider breaking it.  */
-      Lisp_Object attack;
-      char *dot = lock_info.dot;
-      ptrdiff_t pidlen = lock_info.colon - (dot + 1);
-      static char const replacement[] = " (pid ";
-      int replacementlen = sizeof replacement - 1;
-      memmove (dot + replacementlen, dot + 1, pidlen);
-      strcpy (dot + replacementlen + pidlen, ")");
-      memcpy (dot, replacement, replacementlen);
-      attack = call2 (intern ("ask-user-about-lock"), fn,
-                     build_string (lock_info.user));
-      /* Take the lock if the user said so.  */
-      if (!NILP (attack))
-       lock_file_1 (lfname, 1);
+      /* Try to lock the lock.  FIXME: This ignores errors when
+        lock_if_free returns a positive errno value.  */
+      if (lock_if_free (&lock_info, lfname) == ANOTHER_OWNS_IT)
+       {
+         /* Someone else has the lock.  Consider breaking it.  */
+         Lisp_Object attack;
+         char *dot = lock_info.dot;
+         ptrdiff_t pidlen = lock_info.colon - (dot + 1);
+         static char const replacement[] = " (pid ";
+         int replacementlen = sizeof replacement - 1;
+         memmove (dot + replacementlen, dot + 1, pidlen);
+         strcpy (dot + replacementlen + pidlen, ")");
+         memcpy (dot, replacement, replacementlen);
+         attack = call2 (intern ("ask-user-about-lock"), fn,
+                         build_string (lock_info.user));
+         /* Take the lock if the user said so.  */
+         if (!NILP (attack))
+           lock_file_1 (lfname, 1);
+       }
     }
   return Qnil;
 }
@@ -760,12 +760,16 @@ If the option `create-lockfiles' is nil, this does 
nothing.  */)
   (Lisp_Object file)
 {
 #ifndef MSDOS
-  /* Don't do locking if the user has opted out.  */
-  if (create_lockfiles)
-    {
-      CHECK_STRING (file);
-      lock_file (file);
-    }
+  CHECK_STRING (file);
+
+  /* If the file name has special constructs in it,
+     call the corresponding file name handler.  */
+  Lisp_Object handler;
+  handler = Ffind_file_name_handler (file, Qlock_file);
+  if (!NILP (handler))
+    return call2 (handler, Qlock_file, file);
+
+  lock_file (file);
 #endif /* MSDOS */
   return Qnil;
 }
diff --git a/src/nsterm.m b/src/nsterm.m
index a3c7b55218..55e29b1644 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7933,25 +7933,6 @@ not_in_argv (NSString *arg)
 
   NSRect dstRect = NSMakeRect (dest.x, dest.y, NSWidth (srcRect),
                                NSHeight (srcRect));
-  NSRect frame = [self frame];
-
-  /* TODO: This check is an attempt to debug a rare graphical glitch
-     on macOS and should be removed before the Emacs 28 release.  */
-  if (!NSContainsRect (frame, srcRect)
-      || !NSContainsRect (frame, dstRect))
-    {
-      NSLog (@"[EmacsView copyRect:to:] Attempting to copy to or "
-             "from an area outside the graphics buffer.");
-      NSLog (@"  Frame: (%f, %f) %f×%f",
-             NSMinX (frame), NSMinY (frame),
-             NSWidth (frame), NSHeight (frame));
-      NSLog (@"  Source: (%f, %f) %f×%f",
-             NSMinX (srcRect), NSMinY (srcRect),
-             NSWidth (srcRect), NSHeight (srcRect));
-      NSLog (@"  Destination: (%f, %f) %f×%f",
-             NSMinX (dstRect), NSMinY (dstRect),
-             NSWidth (dstRect), NSHeight (dstRect));
-    }
 
 #ifdef NS_IMPL_COCOA
   if ([self wantsLayer])



reply via email to

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