Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs: force ido-mode to forget history

Tags:

emacs

elisp

I wonder if I can keep ido from not remembering my history and only show completions for files that are in the current directory when I am searching for a file. I understand that this history feature is useful at times, but I often end up editing the incorrect file because I think I am editing file called 'abc.txt' in the current directory but in fact I am editing the file by the same name in another one that I previously visited (often happens when there is not an 'abc.txt' in the current directory, as I mistakenly assume). From reading the ido.el file I thought to set in my .emacs file (also evaluated these expressions in running emacs instance):

(custom-set-variables
 '(ido-enable-last-directory-history nil)
 '(ido-record-commands nil)
)

and deleted a file called .ido.last in ~/, but still it remembers some previous files I've visited before making these changes. How can I purge my previous history, and I am not entirely sure what the difference between the two variables above are but seems to have done the trick to keep ido from remembering files I visit in the future?

Thanks for your help!

like image 676
hatmatrix Avatar asked Sep 03 '09 01:09

hatmatrix


2 Answers

Deleting ~/.ido.last and setting the variables as above appears to keep ido from searching files visited in the past.

Edit: Actually, the full customization for this task would be

(custom-set-variables
 '(ido-enable-last-directory-history nil)
 '(ido-record-commands nil)
 '(ido-max-work-directory-list 0)
 '(ido-max-work-file-list 0))
like image 84
hatmatrix Avatar answered Sep 23 '22 17:09

hatmatrix


This happens to me all the time. Given I am in directory /path/to/dir and I try to edit abc.txt, (ido-find-file) will "helpfully" pop me over to /somewhere/else/abc.txt if /path/to/dir/abc.txt doesn't exist and /somewhere/else/abc.txt does.

In this situtation, CTRL-F in the minibuffer when in the middle of an (ido-find-file) reverts to the usual behavior of (find-file), so I can force Emacs to edit /path/to/dir/abc.txt, dammit.

like image 45
dhruv Avatar answered Sep 22 '22 17:09

dhruv