> — Sensible file handling: backups and auto-saves in a cache/ directory, recentf for recent files, clean buffer naming with uniquify
It's crazy to me how out of the box when you edit nginx file at /etc/nginx/sites-enabled/foo it creates another file foo~ there and nginx tries to load that too
When I tried to ask emacs reddit community they started attacking me for changing the default that only I need and fits everyone perfectly.
Still can't believe I'm the only one finding that default amazingly bad.
I would fault nginx here instead. Tilde-suffixed backups is an old convention used by vim and emacs among others. Definitely older than nginx.
The ~foo as backup convention is not part of any standard.
Using hidden files is a stronger convention, e.g. .foo.swp or .foo~.
But nginx's sites-enabled also doesn't filter those.
It's a very simple mechanism that assumes what you put in that directory is a website configuration.
Adding backup files here and there is considered spam, no matter how old it is.
It's the second thing I fix in either Vim or Emacs: Put backup files in a central location. (The first is proper indentation/spacing rules.)
> The ~foo as backup convention is not part of any standard.
Emacs does foo~ by default, not ~foo.
In either case, you're not really supposed to edit files in sites-enabled. That directory is expected to contain symlinks to files in sites-available. I'm not going to say with any certainty that one of the reasons for this indeed is that the pattern (which was used by apache as well - and perhaps other things before it) protects against accidentally reading backup files, but it's not impossible.
So there's definitely a case of holding it wrong if you end up with backup files in that directory.
I liked doing symlinks so the site configuration is with the rest of the site, but that was before containers when it was common to host a bunch of sites on one instance apache or nginx.
> The ~foo as backup convention is not part of any standard. > [...] > It's the second thing I fix in either Vim or Emacs: Put backup files in a central location. (The first is proper indentation/spacing rules.)
Perhaps not a standard, but you yourself admit it's the default behavior.
Though I agree that the simple mechanism acts ... er,... simply, shouldn't it be at the very least aware of the default behavior of common editors?
What standard would that be?
There was no mention of ~foo
Surprised to hear people told you not to change that - one of the earliest bits of advice I got on using emacs is to set the location of those files to a hidden directory in your home folder.
Changing this to save elsewhere is the #1 improvement to Emacs. It bugs me whenever any software creates backups in the same location as the original.
That said, Nginx is also wrong and shouldn't do that.
I was proposing to make default where those files are not created, since Emacs is actually surprisingly great out of the box with no configuration, except for this "little" thing. Apparrently, some people believe it's perfect as it is
It should default to a single location maybe a XDG directory instead of polluting every directory
What happens when you edit multiple files from different folders with the same name?
I tell emacs to create all of the files in "~/.backups", and it names them using the full pathname with "/" replaced with "!". So "~/foo/bar.txt" -> "!home!username!foo!bar.txt~"
I raise you my .DS_store
In a terminal on macOS, to disable writing .DS_Store files to network file shares:
And for removable media:defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUEdefaults write com.apple.desktopservices DSDontWriteUSBStores -bool TRUE
I also set create-lockfiles to nil. I think you can theoretically keep the lockfiles and the clean directory by using lock-file-name-transforms to place the lockfiles somewhere sensible but I didn't bother.
Without this I had to be careful not to acciddentally commit stuff like ".#filename.txt".
(setq backup-directory-alist '(("." . "~/.emacs.d/backups/")))
First thing I do any time I install emacs.
Note that tramp will kvetch if you do this, but it still works fine.
Been using gnu emacs since the 80s and it’s one of the first things I changed. Did you figure it out? If not I can dig up the answer tomorrow.
Yes I’ve added this to hundreds of containers and vms at this point
(setq make-backup-files nil)
Just use tramp mode instead.
The fact it can do multi-hop edits is far too much power for us mere mortals.
(n)vim can also do this, if you've set up an ssh alias in your ssh config for your multi-hop destination you just list it where the hostname would go. e.g.
nvim scp://remotemachine/.config/emacs/init.el
For the same reason you can use sshfs, sftp, and rsync with multi-hop. Gotta love openssh!
It's a very different experience:
- I already have tmux launched, if ssh drops – I can continue
- I don't have to match windows to ssh sessions -- just have them in my tmux
Yes, tmux vastly inferior to tramp.
Tramp runs in your local Emacs and edits files remotely. It can also launch processes remotely and keep track of them.
How does it handle things like LSPs?
emacs users who are hostile to you configuring things, aren't really getting the point IMO :)
They are hostile to me proposing a better (IMO) default
It depends on what you mean by default and whose default.
You can change your own defaults quite easily!
Changing the default setup with emacs that has been shipping for > 30 years is tough.
Getting nginx to ignore a well established pattern by a well established editor seems equally sensible and perhaps more doable. Yes?
By default I mean whatever you get by doing `sudo apt-get install emacs-nox`
I disagree about "tough". Emacs has changed for the better in new releases quite drastically in the last years in my experience.
The list of things emacs users don't get seems to get longer per day so I'm not surprised at the reaction OP got, just disappointed
(but I still think this is on nginx more than emacs - unless they really mean foo~ and not .foo~ )
> The list of things emacs users don't get seems to get...
There are a ton of Emacs users, and it's doesn't make much sense to talk about them as a group like that, no more than if I were to say, "The list of things Windows users don't get..."
there's pros and cons
using the same directory drastically reduces the amount of assumptions about your system's permissions and your own installation (or lack thereof)
old school *nix editors typically do something like emacs and vi typically do, whereas old WinDOS/Mac single-user systems would have an installation file and a cache system-wide, and post NT and OS-X they have roughly the same but in a centralised user directory that is not system-wide, but is located as if it were (different evolution path)
- [deleted]
This was one of the very first things I added to my config over a decade ago:
(setq backup-directory-alist '(("." . ".~")))I won't defend the automatic backup file, because it annoyed me, too.
But it's easy to disable or have them created somewhere else, which is more than you can say for most software lately.
I always disable those auto-backup-files features in any editor I use. Never understood why that was the default-on for so many editors.
It made more sense when running editors over tenuous telnet connections was more common
The kids really have no idea how tenuous computing in general was back in the olden days. Some of the stability issues in the 20th century translated to modern systems would be akin to black smoke coming out of your computer if you happened to have the wrong two programs running at the same time.
I am no kid but screen(1) dates back to 1987 and any wise sysadmin would put that advice on every ~/.login or /etc/motd so the user could run 'screen' at login, some keybinding to detach screen(1) and 'screen -r' on coming back by telnet.
I never used screen back in the day (I was primarily a VMS guy then), but that man page is one of the best-written man pages I’ve come across: informative, friendly and just the right level of detail.
I do too, it’s just that I’ve realised that emacs-nox is awesome container / vm editor out of the box, this backup thing is the only most annoying part (and Ubuntu 22.04 emacs packages expired cert)
It can be handy. It gives you an additional safety net on top of the VCS that runs automatically in the background. It doesn't take much to configure it to your liking, e.g. [1].
[1]: https://gist.github.com/imiric/812398910c59cf00ab43d9172fe42...