bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#35497: [PATCH v6] Don't rewrite buffer contents after saving by rena


From: Michael Albinus
Subject: bug#35497: [PATCH v6] Don't rewrite buffer contents after saving by rename
Date: Tue, 07 May 2019 16:03:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Jonathan Tomer <address@hidden> 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.





reply via email to

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