Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




9.1 Minibuffers for File Names

Sometimes the minibuffer starts out with text in it. For example, when you are supposed to give a file name, the minibuffer starts out containing the default directory, which ends with a slash. This is to inform you which directory the file will be found in if you do not specify a directory.

For example, the minibuffer might start out with these contents:

     Find File: /u2/emacs/src/

where ‘Find File: ’ is the prompt. Typing buffer.c as input specifies the file /u2/emacs/src/buffer.c. To find files in nearby directories, use ..; thus, if you type ../lisp/simple.el, you will get the file named /u2/emacs/lisp/simple.el. Alternatively, you can kill with M-<DEL> the directory names you don't want (see Words).

If you don't want any of the default, you can kill it with C-a C-k. But you don't need to kill the default; you can simply ignore it. Insert an absolute file name, one starting with a slash or a tilde, after the default directory. For example, to specify the file /etc/termcap, just insert that name, giving these minibuffer contents:

     Find File: /u2/emacs/src//etc/termcap

GNU Emacs gives a special meaning to a double slash (which is not normally a useful thing to write): it means, “ignore everything before the second slash in the pair.” Thus, ‘/u2/emacs/src/’ is ignored in the example above, and you get the file /etc/termcap. The ignored part of the file name is dimmed if the terminal allows it; to disable this, turn off file-name-shadow-mode minor mode.

If you set insert-default-directory to nil, the default directory is not inserted in the minibuffer. This way, the minibuffer starts out empty. But the name you type, if relative, is still interpreted with respect to the same default directory.

  Published under the terms of the GNU General Public License Design by Interspire