diff options
| author | Noam Postavsky | 2020-03-21 21:00:08 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2020-03-22 23:06:05 -0400 |
| commit | 8f694831c04b1fb9db81be72afdc1a1101d619c4 (patch) | |
| tree | fc279b189896adb57b8c46ca15b832303a67b3fc /src | |
| parent | 3b7cb5f3ac0fdd5e1a0177cc86b3fc4b420b9e4f (diff) | |
| download | emacs-8f694831c04b1fb9db81be72afdc1a1101d619c4.tar.gz emacs-8f694831c04b1fb9db81be72afdc1a1101d619c4.zip | |
Avoid extra "changed on disk" prompt in save-buffer (Bug#18336)
* src/filelock.c (lock_file): Don't query the user if the current
session already owns the lock.
Diffstat (limited to 'src')
| -rw-r--r-- | src/filelock.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/filelock.c b/src/filelock.c index 73202f0b2c4..2b734ee00d5 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -680,6 +680,9 @@ lock_file (Lisp_Object fn) | |||
| 680 | dostounix_filename (SSDATA (fn)); | 680 | dostounix_filename (SSDATA (fn)); |
| 681 | #endif | 681 | #endif |
| 682 | encoded_fn = ENCODE_FILE (fn); | 682 | encoded_fn = ENCODE_FILE (fn); |
| 683 | if (create_lockfiles) | ||
| 684 | /* Create the name of the lock-file for file fn */ | ||
| 685 | MAKE_LOCK_NAME (lfname, encoded_fn); | ||
| 683 | 686 | ||
| 684 | /* See if this file is visited and has changed on disk since it was | 687 | /* See if this file is visited and has changed on disk since it was |
| 685 | visited. */ | 688 | visited. */ |
| @@ -690,7 +693,8 @@ lock_file (Lisp_Object fn) | |||
| 690 | 693 | ||
| 691 | if (!NILP (subject_buf) | 694 | if (!NILP (subject_buf) |
| 692 | && NILP (Fverify_visited_file_modtime (subject_buf)) | 695 | && NILP (Fverify_visited_file_modtime (subject_buf)) |
| 693 | && !NILP (Ffile_exists_p (fn))) | 696 | && !NILP (Ffile_exists_p (fn)) |
| 697 | && (!create_lockfiles || current_lock_owner (NULL, lfname) != -2)) | ||
| 694 | call1 (intern ("userlock--ask-user-about-supersession-threat"), fn); | 698 | call1 (intern ("userlock--ask-user-about-supersession-threat"), fn); |
| 695 | 699 | ||
| 696 | } | 700 | } |
| @@ -698,10 +702,6 @@ lock_file (Lisp_Object fn) | |||
| 698 | /* Don't do locking if the user has opted out. */ | 702 | /* Don't do locking if the user has opted out. */ |
| 699 | if (create_lockfiles) | 703 | if (create_lockfiles) |
| 700 | { | 704 | { |
| 701 | |||
| 702 | /* Create the name of the lock-file for file fn */ | ||
| 703 | MAKE_LOCK_NAME (lfname, encoded_fn); | ||
| 704 | |||
| 705 | /* Try to lock the lock. FIXME: This ignores errors when | 705 | /* Try to lock the lock. FIXME: This ignores errors when |
| 706 | lock_if_free returns a positive errno value. */ | 706 | lock_if_free returns a positive errno value. */ |
| 707 | if (lock_if_free (&lock_info, lfname) < 0) | 707 | if (lock_if_free (&lock_info, lfname) < 0) |