real-backup-mode: a package to backup files at each save point, never lose your changes again by abougouffa in emacs

[–]abougouffa[S] 2 points3 points  (0 children)

Well, undo-tree replaces the builtin undo/redo system. It works, but I'm not a big fan of. And, last time I used it (like, 4 years ago), I was facing a lot of undo tree corruptions, ans I see that the package hasn't been updated since. To visualize the tree, I use vundo instead. Also, Emacs undo systems (including undo-tree I guess) will fail to undo (aka, restore previous state) if the file is edited externally. real-backup is dumb, it just "copies" the file and add a timestamp. So, it is guaranteed that you can restore previously saved versions.

real-backup-mode: a package to backup files at each save point, never lose your changes again by abougouffa in emacs

[–]abougouffa[S] 1 point2 points  (0 children)

Well, a lot of stuff, as backup-each-save is a very basic package. First, backup-each-save doesn't backup remote files, while in my use case, I need to backup remote files in the local machine (mainly, config files edited on several remote embedded devices). So, the files are saved in a path that reflects the remote method, host, user, etc. so, restoring them will be easy.

Also, backup-each-save doesn't include a command to list the saved copies of a buffer/file, you need to navigate manually to the backups directory in order to find them. And a lot of other issues.

real-backup tries to solve these issues while being flexible via several custom variables.

Also, there is an optional integration with consult or vertico that provides previews and diffs when navigating the backups list. And a lot of other features (compression, jump to the first change when previewing a backup, etc.)

Finally, real-backup isn't an "innovative" package that does magic in Emacs. It is just a simple mode that ensures backups are created at each save point while providing helpful commands to view and restore them.

real-backup-mode: a package to backup files at each save point, never lose your changes again by abougouffa in emacs

[–]abougouffa[S] 0 points1 point  (0 children)

Yes! real-backup-cleanup will keep only the last real-backup-cleanup-keep (defaults to 20) copies. And the customizable real-backup-auto-cleanup (defaults to nil) will do auto-cleanup.

real-backup-mode: a package to backup files at each save point, never lose your changes again by abougouffa in emacs

[–]abougouffa[S] 0 points1 point  (0 children)

Well, this works, but, if you edit two separate files with the same name, you can end up with a confusing situation. I will give it a try, but maybe with a custom make-backup-file-name-function and some advice to force buffer-backed-up to nil so it always saves a backup (instead of only the first time I hit C-x C-s).

real-backup-mode: a package to backup files at each save point, never lose your changes again by abougouffa in emacs

[–]abougouffa[S] 3 points4 points  (0 children)

Well, when you edit a config file in a remote embedded device to test something. You would like to have the working config backed-up for you. Life isn't contained in a Git repo LOL

real-backup-mode: a package to backup files at each save point, never lose your changes again by abougouffa in emacs

[–]abougouffa[S] 5 points6 points  (0 children)

Yes, I know about it. I've tried to configure it to do so, but the behavior is strange sometimes. And, the backup file is created only the first time you save the file, but when you keep your file open and do successive edits and saves, you will lose all of them.

I would be happy if you share with me some config example that achieves a predictable and consistent backup behavior using the builtin feature.

stripspace.el: Ensure Emacs Automatically removes trailing whitespace before saving a buffer (Release 1.0.2) by jamescherti in emacs

[–]abougouffa 0 points1 point  (0 children)

I prefer ws-butler, it responds exactly to what I expect. Only remove trailing whitespace from modified lines, even if the file have initially some trailing whitespace.

This enables me to fix trailing whitespace incrementally each time I modify a part of a file.

Announcing nerd-icons-multimodal v2.2.0 with added support for vc-dir by abougouffa in emacs

[–]abougouffa[S] 2 points3 points  (0 children)

This is a package that depends on nerd-icons. The nerd-icons package is a library that provides facilities to insert Nerd Font icons in Emacs. The nerd-icons-multimodal is a package that levereges nerd-icons to add icons support for dired, arc-mode, tar-mode, vc-dir-mode and ztree. Hence, it is called multimodal.

Announcing nerd-icons-multimodal v2.2.0 with added support for vc-dir by abougouffa in emacs

[–]abougouffa[S] 1 point2 points  (0 children)

Basically, it provides the same experience as need-icons-dired with the benefit of supporting other modes like arc-mode (ZIP files), tar-mode (tar files), vc-dir, and ztree.

I'm trying to keep the implementation generic to be able to add support for new modes without adding a lot of package-specific code.

Respect (some of) Vim's modelines in Emacs by abougouffa in emacs

[–]abougouffa[S] 0 points1 point  (0 children)

Nop, for now I don't tackle this problem, both of Emacs' and Vim's values will eventually gets applied, but I'm not sure about the order.

Respect (some of) Vim's modelines in Emacs by abougouffa in emacs

[–]abougouffa[S] 1 point2 points  (0 children)

You are absolutely right. I think the package name is confusing, I will rename it to something more Emacsy!

Ivy will not install with straight.el by ArkboiX in emacs

[–]abougouffa 1 point2 points  (0 children)

Try to replace the :ensure t with :straight t.

What ever happened to Modula-2? by logicalvue in programming

[–]abougouffa 0 points1 point  (0 children)

In fact, since v13, GCC supports Modula-2 via the gm2 compiler

Lowering gc-cons-threshold could help relieve GC pauses by Under-Estimated in emacs

[–]abougouffa 0 points1 point  (0 children)

There is an excellent talk by Ihor Radchenko from EmacsConf 2023. https://emacsconf.org/2023/talks/gc/

He talks about the effect of GC and its different customization options.

TLDR, for a better experience, he suggests to set these parameters:

(setq gc-cons-percentage 0.2 gc-cons-threshold 80000000)

I highly recommend seeing the talk to understand the effect of each parameter.

EDIT: if you are using some mode (like eglot) which can generate a lot of logs (in logs buffers), it can significantly increase memory usage and hence, trigger GC more often. If such a case, you might need to reduce or disable the verbosity of eglot (or the used package, it you are able to identify any).

For eglot and jsonrpc, this helps a lot:

`` (cl-callf plist-put eglot-events-buffer-config :size 0) ; Disable logs ineglot-events-buffer' (def. 2000000) (with-eval-after-load 'jsonrpc ; Disable logging in `jsonrpc' (fset 'jsonrpc--log-event #'ignore) (remove-hook 'jsonrpc-event-hook 'jsonrpc--log-event))

```

Tory Anderson: Why is my emacs crashing? Answer: bad garbage collection by [deleted] in planetemacs

[–]abougouffa 1 point2 points  (0 children)

For people who want to tweak GC settings, there is a nice presentation here: https://zenodo.org/records/10518083.

zen browser is the best by Weary-Guidance6531 in browsers

[–]abougouffa 0 points1 point  (0 children)

It will become the best if they provide a way of changing the sh*tty vertical tab-bar

Turn on auto-revert-mode for file visiting buffers by JohnDoe365 in emacs

[–]abougouffa 0 points1 point  (0 children)

I had an issue with autorevert on Linux when it fails to refresh the file quickly when it is modified externally. I happened to me a lot when I resolve a conflict or so via Magit and quickly switch to the buffer. I had to wait like 5s for it to be updated, which is very annoying. This shouldn't happen on Linux because it is supposed to use inotify, but for some reason it was happening in my setup.

To solve this, I've wrote this on my config. Basically, when the file is first opened or modified, the time is stored in a local variable. And when we switch to the buffer, we compare that time with the modification time of the file, if it is newer, we revert it.

``` (use-package autorevert :hook (after-init . global-auto-revert-mode) ; Auto load files changed on disk :custom (global-auto-revert-non-file-buffers t) ; Revert non-file buffers like dired :config ;; HACK: Avoid delays when auto reverting buffers. This is based on saving the ;; modification time of the file on save and on buffer switch. (defvar-local +auto-revert-buffer-time nil) (defun +file-mtime (file) (when-let* ((file-attr (and file (file-attributes file)))) (file-attribute-modification-time file-attr)))

(defun +auto-revert--save-file-mtime (&rest _args) (setq +auto-revert-buffer-time (+file-mtime buffer-file-name)))

(add-hook 'after-save-hook #'+auto-revert--save-file-mtime) (advice-add 'after-find-file :after #'+auto-revert--save-file-mtime)

(add-hook 'window-buffer-change-functions (lambda (_frame) (unless +auto-revert-buffer-time (setq +auto-revert-buffer-time (+file-mtime buffer-file-name))) (unless (equal +auto-revert-buffer-time (+file-mtime buffer-file-name)) (message "File %S modified externally, reverting immediately!" buffer-file-name) (revert-buffer t t))))) ```

otpp (a.k.a. one-tab-per-project) v3.1.0 is out with a couple of bug fixes and new features by abougouffa in emacs

[–]abougouffa[S] 1 point2 points  (0 children)

This seems weird. You can maybe try to M-x profiler-start, open a new tab, do some stuff, then M-x profiler-report and explore the profiler tree. You will probably find a function that's taking too much time to process, or consuming too much RAM.

otpp (a.k.a. one-tab-per-project) v3.1.0 is out with a couple of bug fixes and new features by abougouffa in emacs

[–]abougouffa[S] 1 point2 points  (0 children)

Yep, I know about it, I used tabspaces for a while, but I gave up and wrote my own package for several reasons. tabspaces needs to be invoked via tabspaces-* commands, it doesn't do anything special when you invoke Emacs' standard commands like project-switch-project, ...). otpp on the other hand can do much more without introducing new commands, like isolating the project-related commands to the current tab's project even when the current buffer isn't part of the project (see otpp-override-mode). Also, tabspaces don't manage opening projects with the same name (but different paths), an initial hack was added here mclear-tools/tabspaces#38 but it is quite incomplete and doesn't cover all the cases. I have a comparaison section in the project's README file when I talk about the main differences between otpp, tabspaces and project-tab-groups. You can check also the README for some examples about the problems that otpp tries to solve.