Gedit keeps saying a file "has been externally modified"

I keep getting the following popup from gedit

The file “~/mnt/folder/file.txt” has been externally modified.
If you save it, all the external changes could be lost. Save it anyway?
[Save Anyway]
[Don’t Save]

when I have not made any external changes. I know that I have not made any such changes because (a) the file is not open anywhere else and (b) I just saved the file two seconds ago.

Sometimes, I could go through the routine of hitting the “Save” button, seeing the popup, and hitting “Save Anyway” several times in a row.

More facts:

  • My Manjaro is the stable branch.
  • My Manjaro runs in a virtual machine (in VMware), and the files in question are in a Windows 11 location.
  • I do not seem to get the same problem with a file saved in a Manjaro location. (This I say from having experimented just now: Even though I am at present having the problem with all files in a Windows location, I cannot replicate it with a file in Manjaro. But I suppose this result is not as reliable as that from long observation.)
  • The problem may have become worse after the 2024-05-29 update. Since then, I get it about every two or three days. Once I “get” it, I can count on seeing the popup every time I try to save. If I go through the “routine” as above, the popup may cease to appear after two to four iterations. But if I wait for ten seconds and try to save again, I will see the popup again. Rebooting seems to fix the problem temporarily.
  • Before 2024-05-29 update, I might have got the problem once a week or month or at any rate so infrequently that I paid it no attention.

Any insight on how I might fix it?

This seems to describe typical behaviour from gedit, as far as I recall.

I have a similar experience occasionally with (example) Kate, where the opening of a file in memory causes an instance to be created (in lieu of possibly saving subsequent edits) and one must choose to whether to save or discard it, when closing.

You might consider using another editor; for example geany;

sudo pacman -S geany geany-plugins

…as an alternative, depending on your needs.

Thank you. geany is very nice.

Would you know which line would be the background color in the conf file such as this: https://raw.githubusercontent.com/geany/geany-themes/master/colorschemes/abc-dark.conf

The link above is the first theme from this page: Themes | Geany

ADDED LATER

I was able to find it. It’s second color item in this segment, i.e. #1C1C1C in the example. I am leaving this comment for anybody who might chance to look for the same info.

[named_styles]

default=#dbdbdb;#1C1C1C;false;false

Not from memory, even though I played with a few custom themes in older versions; though I imagine it’s this line:

default=#dbdbdb;#1C1C1C;false;false

…with the background first (a light grey) and the foregound second (charcoal-ish)… or vice-versa.

Speaking of older [theme] versions this page has a few notes to consider.

If you like darker themes, this one seems popular lately:

Cheers.

1 Like

Thanks again.

Would you also know how to indent only the first line of wrapped lines of a single paragraph?

It would look like this (although the following is not a single paragraph).

  It is a period of civil war.
Rebel spaceships, striking
from a hidden base, have won
their first victory against
the evil Galactic Empire.

I tried Edit > Preferences > Auto-Indent Mode = None, but that wasn’t it.

ADDED LATER

I found the solution

  1. sudo nano /usr/share/geany/filedefs/filetypes.common
  2. Change line_wrap_indent=0;1; to line_wrap_indent=0;0;

Also ~/.config/geany/filedefs/filetypes.README says:

Copy files from /usr/share/geany/filedefs to this directory to overwrite them.

And so you could do that so that all your edits (settings) are somewhere in your home directory.

I suspect Geany does not allow that type of fine-grained control, being that it’s primarily focused as a coding tool. If you want an editor for general writing, perhaps one of the markdown based apps would be more suitable.

An advantage would be that layout and general theming of a document is often achieved using only (basic) CSS; or plugins. I personally use Obsidian for many projects from simple note-taking through to complex articles.

sudo pacman -S obsidian

GhostWriter is another useful application; markdown based; with powerful export capability when coupled with pandoc. One can craft the original document in markdown and then export using standard or custom templates to PDF, TeX, HTML; even Word/Writer document formats.

sudo pacman -S pandoc ghostwriter

I hope this helps. Cheers.

1 Like

INDENTING IN GEANY

But I found out how! Following steps are for anybody landing here with the same question.

  1. Note that ~/.config/geany/filedefs/filetypes.README says: “Copy files from /usr/share/geany/filedefs to this directory to overwrite them.” Therefore copy to user’s config folder
 cp /usr/share/geany/filedefs/filetypes.common ~/.config/geany/filedefs/
  1. Open in text editor
nano ~/.config/geany/filedefs/filetypes.common
  1. Change line: From line_wrap_indent=0;1; to line_wrap_indent=0;0;


“EXTERNALLY MODIFIED” WARNING

SUMMARY: None of the “solutions” below worked for me.

On an app’s erroneously warning that a file has been externally modified, I found the following post on Mousepad.

https://forum.xfce.org/viewtopic.php?id=16999

It goes somewhat into the why. Again for anyone landing here looking for the same. As for two of the particular solutions suggested there (disable monitoring or enable reading), neither of them worked for me. Also, I wouldn’t want to disable monitoring if it meant that when a file has indeed been modified externally I would get no warning.

The link above leads to other links, which suggest adding actimeo=0 to the mount command, for example:

https://askubuntu.com/a/709006

I don’t know what the two trailing zeros are about in:

//qnap/share /data  cifs noauto,user,username=qnap,uid=1000,gid=1000,actimeo=0 0 0

For my experiment, I ended that portion of my line at actimeo=0. The result is as follows. (Success means that I don’t get “externally modification.” Failure means that I do get it.)

  • Gedit: Success for a day. Fails the next. (Since I don’t do anything different from day to day, I don’t see why it takes a day to fail. Sleeping and waking the VM, or actually the computer in which the VM resides, I did on day 1 as well.)
  • Mousepad: Fail. (Moreover if a document loaded in Mousepad is actually edited elsewhere, Mousepad does not warn me it has been externally modified–nor show me the new contents–but simply loses the ability to save the document. This app is unusable.)

On actimeo=0 I found this (from https://docs.oracle.com/cd/E19253-01/816-5166/mount-nfs-1m/index.html):

Setting actimeo=0 disables attribute caching on the client. This means that every reference to attributes is satisfied directly from the server though file data is still cached. While this guarantees that the client always has the latest file attributes from the server, it has an adverse effect on performance through additional latency, network load, and server load.