GNU bug report logs -
#35497
[PATCH] Don't rewrite buffer contents after saving by rename
Previous Next
Reported by: Jonathan Tomer <jktomer <at> google.com>
Date: Mon, 29 Apr 2019 23:32:01 UTC
Severity: normal
Tags: patch
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
Message #68 received at 35497 <at> debbugs.gnu.org (full text, mbox):
Jonathan Tomer <jktomer <at> google.com> writes:
> +(ert-deftest tramp-test10-write-region-file-precious-flag ()
> + "Check that `file-precious-flag' is respected with Tramp in use."
> + :tags '(:unstable)
> + (skip-unless (tramp--test-enabled))
> + (skip-unless (tramp--test-sh-p))
> +
> + (let* ((tmp-name (tramp--test-make-temp-name))
> + written-files
> + (advice (lambda (_start _end filename &rest _r)
> + (push filename written-files))))
> +
> + (unwind-protect
> + (with-current-buffer (find-file-noselect tmp-name)
> + ;; Write initial contents. Adapt `visited-file-modtime'
> + ;; in order to suppress confirmation.
> + (insert "foo")
> + (write-region nil nil tmp-name)
> + (set-visited-file-modtime)
> + ;; Run the test.
> + (advice-add 'write-region :before advice)
> + (setq-local file-precious-flag t)
> + (insert "bar")
> + (should (null (save-buffer)))
> + (should-not (cl-member tmp-name written-files :test #'string=))
I believe a closing parenthesis ")" is missing.
> + ;; Cleanup.
> + (ignore-errors (advice-remove 'write-region advice))
> + (ignore-errors (delete-file tmp-name))))))
Best regards, Michael.
This bug report was last modified 6 years and 72 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.