all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jonathan Tomer <jktomer@google.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 35497@debbugs.gnu.org
Subject: bug#35497: [PATCH v3] Don't rewrite buffer contents after saving by rename
Date: Thu, 2 May 2019 15:04:02 -0700	[thread overview]
Message-ID: <CAHY_+qx5x7dQDEPf18pm837xaopzAQA0Ok9aAXrfZKUifSHQXg@mail.gmail.com> (raw)
In-Reply-To: <87ftpx5b33.fsf@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 2300 bytes --]

On Thu, May 2, 2019 at 4:50 AM Michael Albinus <michael.albinus@gmx.de>
wrote:

> Jonathan Tomer <jktomer@google.com> writes:
>
> Hi Jonathan,
>
> > +(ert-deftest tramp-test46-file-precious-flag ()
>
> Since this belongs rather to write-region, I would call it
> `tramp-test10-write-region-file-precious-flag', and move it to the
> repsective place in file.
>
> > +  "Check that file-precious-flag is respected with Tramp in use."
> > +  (let* ((temp-file (make-temp-file "emacs"))
> > +         (remote-file (concat "/mock:localhost:" temp-file))
>
> Please don't do this. The mock method does not work everywhere, for
> example on an MS Windows machine.
>
> `file-precious-flag' is handled in the tramp-sh.el handler only. So you
> might start with the test `tramp--test-sh-p', and skip otherwise.
>
> And then you could use the same mechanism like in the other
> tests. Something like this:
>
> --8<---------------cut here---------------start------------->8---
> (ert-deftest tramp-test10-write-region-file-precious-flag ()
>   "Check that `file-precious-flag' is respected with Tramp in use."
>   (skip-unless (tramp--test-enabled))
>   (skip-unless (tramp--test-sh-p))
>
>   (let ((tmp-name (tramp--test-make-temp-name))
>         (advice (lambda (_start _end filename &rest r)
>                   (should-not (string= filename tmp-name)))))
>
>     (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))))
>
>       ;; Cleanup.
>       (ignore-errors (advice-remove 'write-region advice))
>       (ignore-errors (delete-file tmp-name)))))
> --8<---------------cut here---------------end--------------->8---
>
> I haven't tested further, this gives an error for me. Don't know yet,
> whether it is the test definition, or (more likely) a problem in Tramp.
>

Changing let to let* fixes the test. New patch incoming.


>
> Best regards, Michael.
>

[-- Attachment #2: Type: text/html, Size: 3457 bytes --]

  reply	other threads:[~2019-05-02 22:04 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 23:20 bug#35497: [PATCH] Don't rewrite buffer contents after saving by rename Jonathan Tomer
2019-04-30  7:18 ` Michael Albinus
2019-04-30 19:27   ` Jonathan Tomer
2019-04-30 20:47     ` Michael Albinus
2019-04-30 21:10       ` Jonathan Tomer
2019-04-30 21:21         ` Michael Albinus
2019-04-30 22:42           ` Jonathan Tomer
2019-05-01  0:26           ` bug#35497: [PATCH v2] " Jonathan Tomer
2019-05-01 17:48         ` bug#35497: [PATCH] " Eli Zaretskii
2019-05-01 19:29           ` Jonathan Tomer
2019-05-01 19:54             ` Eli Zaretskii
2019-05-01 19:56               ` Jonathan Tomer
2019-05-01 23:02               ` bug#35497: [PATCH v3] " Jonathan Tomer
2019-05-02 11:50                 ` Michael Albinus
2019-05-02 22:04                   ` Jonathan Tomer [this message]
2019-05-02 22:06                   ` bug#35497: [PATCH v4] " Jonathan Tomer
2019-05-03  7:52 ` Michael Albinus
2019-05-03 12:29   ` Eli Zaretskii
2019-05-06 20:45   ` Jonathan Tomer
2019-05-07 14:05     ` Michael Albinus
2019-05-07 23:46       ` Richard Stallman
2019-05-06 20:46   ` bug#35497: [PATCH v5] " Jonathan Tomer
2019-05-06 20:48   ` bug#35497: [PATCH v6] " Jonathan Tomer
2019-05-07 14:03     ` Michael Albinus
2019-05-07 14:10       ` Michael Albinus
2019-05-07 17:25         ` Jonathan Tomer
2019-05-07 17:33         ` bug#35497: [PATCH v7] " Jonathan Tomer
2019-05-08  7:48           ` Michael Albinus
2019-05-08 17:03             ` Jonathan Tomer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHY_+qx5x7dQDEPf18pm837xaopzAQA0Ok9aAXrfZKUifSHQXg@mail.gmail.com \
    --to=jktomer@google.com \
    --cc=35497@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.