[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Not clobbering bash history
From: |
Juri Linkov |
Subject: |
Re: Not clobbering bash history |
Date: |
Mon, 20 Nov 2023 19:50:39 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
> Just as a complete aside for preventing bash history erasure, I got around
> it like this:
>
> * export HISTCONTROL=ignoreboth # I could also have used erasedups here but
> felt this would be unacceptably slow
Actually this is not quite off-topic. In Emacs, the corresponding option
is 'history-delete-duplicates' that corresponds to 'ignoredups'.
But unfortunately still no option corresponding to 'ignorespace'.
Instead of using such advice
(define-advice add-to-history (:around (ofun history-var newelt &rest args)
ignorespace)
(unless (string-match-p "\\` " newelt)
(apply ofun history-var newelt args)))
maybe 'history-delete-duplicates' should support a new value 'ignorespace'?
> * export HISTSIZE=30000000
> # Yes, it's huge, but I get history going back years
I found that it helps to reduce the size of the shell history
by splitting the history file by different file trees using advice:
(define-advice shell (:around (ofun &rest args) per-tree-history)
(let ((process-environment (copy-sequence process-environment))
(root (locate-dominating-file default-directory ".bash_history")))
(when root
(setenv "HISTFILE" (expand-file-name ".bash_history" root)))
(apply ofun args)))
but no idea how this could be more customizable.
- Re: Turning on savehist-mode by default, (continued)
- Re: Turning on savehist-mode by default, Dmitry Gutov, 2023/11/19
- Re: Turning on savehist-mode by default, Spencer Baugh, 2023/11/19
- Re: Turning on savehist-mode by default, Po Lu, 2023/11/19
- Re: Turning on savehist-mode by default, sbaugh, 2023/11/19
- Re: Turning on savehist-mode by default, Po Lu, 2023/11/19
- Re: Turning on savehist-mode by default, Spencer Baugh, 2023/11/20
- Re: [OT] Not clobbering bash history, brickviking, 2023/11/20
- Re: Not clobbering bash history,
Juri Linkov <=
- Re: [OT] Not clobbering bash history, Richard Stallman, 2023/11/21
- Re: [OT] Not clobbering bash history, Arsen Arsenović, 2023/11/21
- Re: [OT] Not clobbering bash history, Richard Stallman, 2023/11/24
Re: Turning on savehist-mode by default, Richard Stallman, 2023/11/19
Re: Turning on savehist-mode by default, Thanos Apollo, 2023/11/28