telling Icicles to ignore matches when creating a file - emacs

I use Icicles for auto-completion when for example finding a file in emacs. However sometimes I need to create a file with a particular name filename.tex in a directory and the autcomplete automatically finds a file with a similar name filanem_another.tex in another directory (I'm guessing from history).
This is annoying as it prevents making new files using C-x C-f and instead finds a similar file.
How can I ignore Icicles's suggestions?

Please try to provide a step-by-step recipe of what you do. So far, I don't recognize the behavior you describe. What do you mean by "autocompletion" and "Icicles's suggestions", for example?
Also mention whether you have any
Icicles customizations. Best is a recipe that starts from emacs -Q (no init file), saying exactly what to do to reproduce the problem. And please mention your emacs-version.
By default, in Icicle mode C-x C-f is bound to icicle-file. You should be able to enter any file name you like at the prompt; you need not choose any of the completion candidates, and you need not even complete (TAB or S-TAB). (And completion does not complete against the history.) IOW, in these respects C-x C-f should behave the same as in vanilla Emacs.
[To those tempted to complain that this is a comment and not a real answer: I intend to answer the question here, when I get some more info about it.]

Related

How do create a new file that matches an existing file in Emacs Prelude?

In Emacs Prelude, I cannot figure out how to create a new file when a file exists that "matches" the name of the file.
In the example screen capture, I am trying to create a file called spawn.exs in a directory that already contains a file called spawn_basic.exs. When I use C-xC-f to create a new file, emacs is matching spawn.exs to spawn_basic.exs and hitting Enter results in opening spawn_basic.exs instead of creating spawn.exs.
I've tried some workarounds (i.e. using touch to create the file) but I'm looking for a simpler solution that would require only one command. If there is not a command to do this, is there a way to disable the file name matching feature in Prelude? I like most everything else about Prelude compared to vanilla Emacs so I would rather not switch back.
In Prelude, C-x C-f is bound to helm-find-files. It's usually
great, but for this case I don't see a good workaround for bypassing
its match (as you've described).
However, ido-find-file has a similarly friendly completion system,
yet offers a nice solution to bypass the completion. When you type
spawn.exs, open by pressing C-j instead of RET. I think Helm
should do this too (instead of treating them the same), so you might
want to submit a feature request (to match Ido's "verbatim entry").
Ido works well as a find-file replacement, and it's recommended over
Helm for simple cases like this
in Mastering Emacs. So you could
remap it with:
(global-set-key (kbd "C-x C-f") 'ido-find-file)

Emacs command to Find and Open File similar to Eclipse

I've recently switched from using Eclipse to emacs. I'm trying to find a way to emulate eclipse's Ctrl-Shft-r functionality which lets you type in a file name and it begins showing all files in the current workspace that begin with the string you are typing.
C-x C-f seems to handle just tab-completion in the current directory, whereas Eclipse's functionality looked through all sub-directories to find matching files.
I'm looking for something (maybe there's a plugin that does this) that allows you to type the name of folder to look in, and then a partial file and returns back the results in a buffer. Possibly that uses auto-complete to list off matching files with their full paths.
First of all, steer clear of vanilla find-file function (that's the interactive function that is run when you hit C-x C-f). It is very limited, it forces you to hit TAB all the time, and the first thing most people do when switching to emacs is replace find-file with something more powefull.
There're a number of alternatives. ido-mode is one, helm is another. The former is light-weight, fast and comes built-in with emacs. The latter is immensely powerful and strives to be fast, too.
Second of all, there're two ways a recursive file search can usually be done:
directory search - that's when you just search a directory, no surprises here;
project search - that's when you setup a project your're working on, thus making emacs aware of which files are of interest to you right now.
For directory search, ido-find-file and helm-find-file are both viable options. Ido does its search automatically when you pause typing; helm uses (C-u) M-g s to activate grep. See this SO question for more info.
For project search, you need a library to manage your projects. Projectile is great for that. Set it up and use C-c p f or C-c p F to list files in current or all of your projects, respectively. Oh, and projectile uses ido by default, but there is helm support, too.
You're looking for projectile which indexes your project's files. I used it for a while but have recently switched to using helm-recentf
(global-set-key "\C-x\ \C-r" 'helm-recentf)
I have recent files set to a large number. Pretty much anything I've ever opened is a few keystrokes away. This even doubles up as a handy way to switch buffers.
(require 'recentf)
(setq recentf-auto-cleanup 'never)
(recentf-mode 1)
(setq recentf-max-saved-items 200)

open recent files in emacs

I recently upgraded my emacs (version 24.3), but i lost a function that was very convenient, and could not figure out the solution easily by google, so i wish i can get help here (which is always the case when i have problems with computer)
i remember my emacs can find recent file even the file is not in current editing folder.
e.g., i am editing fileA in pathA, and i want to open a fileB that is in PathB/, i just press C-x C-f, type fileB, emacs automaticall find the fileB in PathB, and auto-complete the full path to fileB in the mini buffer. Dont know what package enables such function but it was there before my upgrading.
thanks alot!
this is the key to the issue:
(setq ido-auto-merge-work-directories-length 0)
thanks to all anyway
Sounds like you're using ido, try turn on ido-use-virtual-buffers.
(setq ido-use-virtual-buffers t)
The obvious answer is library recentf.el, which comes with Emacs. See, for example, command recentf-open-files.
But be aware that other, more general-purpose libraries can sometimes extend recentf.el features, making them more useful.
One such is Icicles multi-command icicle-recent-file.
Another is Icicles multi-command icicle-buffer (C-x b by default), which can include recently visited files (with their paths) as candidates for buffer switching. C-x R during completion toggles whether such candidates are included.

Emacs will not visit new file but insists on opening a similar one

The problem is quite simple but frustrating. When I try to visit a new file with C-x C-f which is named basis.m emacs keeps visiting the similar named file haarbasis.m which already exists in the same directory. It keeps prompting me for similar names and I am unable to visit a new empty file. I had recently installed elpy for a python IDE if it makes any difference.
How can I force emacs not to visit a file with C-x C-f unless I explicitly state which file to visit?
elpy loads idomenu which in turn loads ido. What you are describing sounds like ido-powered completion of file names. You can disable it after C-x C-f by pressing C-f.
As Alex mentions the string of packages that brought you to ido-mode, this answer depends on the answer to your statement below, which may be why something is happening to you when you do C-x C-f
When I try to visit a new file...
When your pointer/cursor is at the end of a word, idowill look for a file in the current directory with that name. It may even traverse down the relative path too if it's set up like a file directory structure e.g. show/basis.m
The commentor Jon O says, Even if this is happening C-j will create a new file for you.

How can I open a file in subfolder in dired mode fast?

In dired mode, how can i open the file fastly in the subfolder? I found that after loading dired+', the key 'j' isdired-goto-file'. But I cannot use it in the emacs 24 + Windows 7.
Is there any convenient key to open/find the file in subfolder fast?
thanks.
Personally, I recommend using isearch when you're finding something in a buffer, including dired. I find that the incremental search really help and efficient after I get familiar with it.
You can take a look at 10 Specific Ways to Improve Your Productivity With Emacs. It's tip 4.
As he said:
"It's difficult to overemphasize how powerful this technique is, once you've mastered it."
Your question is not clear to me.
In Dired (including for Dired+), j prompts you for a file name and moves the cursor to that file name in Dired. Does it not do that for you? You say that you cannot use it in Emacs 24 and Windows 7. I use it in Emacs 24 and Windows 7 (and with Dired+) all the time, with no problem.
Please provide more info. What happens when you use j?. What did you expect to happen, and what really happens?
But you speak about "opening" the file. That is not what j does. It is what RET does, when the cursor is on the file name. Does that not work for you?
Perhaps you just want to open a file after being prompted for its name? For that, just use C-x 4 f or C-x C-f.
Not clear. But depending on what you really want, perhaps the answer is here: j, RET, or C-x 4 f.
I think I can understand the question. The platform should not matter.
Pressing j provides the current directory string in the mini-buffer,
making it convenient to write a file-name and tab-complete it. When that
file-name is a sub-directory of the dired directory, one can find files
in that sub-directory.
Now, if a file in that sub-directory is selected and you press RET,
minibuffer informs that mark set, and point stay foot.
I tried C-x C-SPC (pop-global-mark) to see if I would be jumped to
the file found in another buffer, but not so. The mark was set at point.
So this provides no answer but in best case a clarification of the
original question. I could agree it would be nice to be jumped with point on that file in the sub-directory.
I stumbled into this because I wondered what j does in dired mode,
pressing it by mistake.
even though i don't use dired mode,
i just tried dired and j and the mini buffer prompts me the file to open. I use lusty mode for files and buffers. but you can use
open-dribble-file
to open a file from a location