open recent files in emacs - 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.

Related

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)

telling Icicles to ignore matches when creating a file

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.]

In EMACS on windows how to keep some files fixed in Recent File List?

In GNU EMACS 24.3, I use recentf to show the recently opened files. I would like to keep certain makefiles so that I do not have to type the whole path whenever I want to switch projects.
Is it possible to make certain files sticky or persistent in the list ?
This is not exactly answering your question, but I think it would serve the same purpose. I bookmark the files I'm using most often.
You can read more about it here: http://www.emacswiki.org/emacs/BookMarks
but in a nutshell: C-x r m bookmarks the currently open file (works on dired buffers too). C-x r b loads the bookmarked file with word completion.
Set the length of the recent files list to a high number. For example:
(setq recentf-max-saved-items 1000)
This way the makefiles won't drop out from the list if you visit them regularly. Also it is useful to keep a long recentf list and use a package which allows you to open files from it with completion. Here you can find some ways to do that: http://www.emacswiki.org/emacs-es/RecentFiles

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

emacs color-theme by buffer

I'm in love with emacs. I don't believe there is anything one can't do with enough effort!
I have just fine working scripts/extensions installed that could be relevant to get my point:
org-mode (with a CAPTURE-TEMPLATE named "Journal")
color-theme (emacswiki)
theme-changer (github)
color-theme-buffer-local (github)
emacs-version: "GNU Emacs 23.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-03-25 on roseapple, modified by Debian"
Whats already working fine
When I'm starting a journal-entry trough my defined shortcut, what happens is the following:
emacs opens a new buffer("CAPTURE-journal.org") in a new window
I edit it
with another keystroke the entry gets refiled to my defined journal.org file
the buffer and the window are then closed automatically
I continue working on the file I worked before
What I want it to do additionally:
the "CAPTURE-journal.org"-buffer in the new window should have a unique color-theme, lets say color-theme-retro-orange
My .emacs with the code snippet I believe should be relevant.
I have no idea how to tackle this task. Where does one begin editing? Are even all tools needed for this listed above?
Seen from scratch: you need a list with color-themes
(setq my-themes (list "color-theme-retro-orange" "second-theme" "third...))
than you need a pointer, storing position used last.
See Emacs Lisp Intro chapter of kill-ring-save
When finished, bind that function at a suitable place, where-from your buffer is opened, resp. load it with the stuff mentioned by OP.
Or create a minor-mode, which will all new buffers provide with this.