# editor: Prevent auto save formatting on read only files \(\#62921\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/907ed09c9f4476caf250e6ce4bbffb23b4622f3b)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 907ed09c9f4476caf250e6ce4bbffb23b4622f3b

Requested commit: 907ed09c9f4476caf250e6ce4bbffb23b4622f3b

Commit: 907ed09c9f4476caf250e6ce4bbffb23b4622f3b

Tree: a61cb61ff3e3f64003cafdb30b9f271870c87a47

Author: Matei Oprea

Committer: GitHub

## Message

```
editor: Prevent auto save formatting on read only files (#62921)

# Objective

Read-only marked files in zed could still be affected by format on save
feature. This PR fixes that.
FIXES #62899 

## Solution

These changes add an early return on Editor's `Item::save`
implementation so neither formatting nor the write to disk occurs.

## Testing

I've tested by reproducing the issue in the original ticket. 

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed read-only files being formatted and saved when `format_on_save`
is enabled

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
```

## Parents

- [ec18126b1dbd32b089e51d7edee1e20b3bd53637](https://git.cafe/gitcafe/zed/commit/ec18126b1dbd32b089e51d7edee1e20b3bd53637?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/907ed09c9f4476caf250e6ce4bbffb23b4622f3b?format=markdown)
