emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CUA mode's C-RET binding [was: position on changing defaults?]


From: Juri Linkov
Subject: Re: CUA mode's C-RET binding [was: position on changing defaults?]
Date: Tue, 11 Mar 2008 02:07:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-unknown-linux-gnu)

>> But your changes *are* lost if you do
>>
>> <up>
>> Edit the old entry
>> <down> <up>
>
> Are they lost? How can I tell? I can see them ... ;-)
>
> Or in other words: Please give me an example so I understand.

This means that if your history contains something like "rm -rf /",
and you accidently type `M-! M-p RET', your data are lost ;-)
That's why I suggest putting the following code in .emacs:

;; Remove potentially dangerous commands from the history immediately
(add-hook 'minibuffer-exit-hook
          (lambda ()
            (when (string-match
                   "^rm"
                   (car (symbol-value minibuffer-history-variable)))
              (set minibuffer-history-variable
                   (cdr (symbol-value minibuffer-history-variable))))))

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]