Fix last change.
[bpt/emacs.git] / lisp / uniquify.el
CommitLineData
5246db4e 1;;; uniquify.el --- unique buffer names dependent on file name
4c61f92c 2
284b3043 3;; Copyright (c) 1989, 1995, 1996, 1997, 2001 Free Software Foundation, Inc.
4c61f92c
KH
4
5;; Author: Dick King <king@reasoning.com>
2ad02767 6;; Maintainer: FSF
284b3043 7;; Keywords: files
4c61f92c
KH
8;; Created: 15 May 86
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
b578f267
EN
23;; along with GNU Emacs; see the file COPYING. If not, write to the
24;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25;; Boston, MA 02111-1307, USA.
4c61f92c
KH
26
27;;; Commentary:
28
29;; Emacs's standard method for making buffer names unique adds <2>, <3>,
30;; etc. to the end of (all but one of) the buffers. This file replaces
31;; that behavior, for buffers visiting files and dired buffers, with a
5246db4e 32;; uniquification that adds parts of the file name until the buffer names
4c61f92c
KH
33;; are unique. For instance, buffers visiting /u/mernst/tmp/Makefile and
34;; /usr/projects/zaphod/Makefile would be named Makefile|tmp and
35;; Makefile|zaphod, respectively (instead of Makefile and Makefile<2>).
36;; Other buffer name styles are also available.
37
4219b27b
RS
38;; To use this file, do (require 'uniquify)
39;; and set uniquify-buffer-name-style to one of its non-nil alternative values.
40
4c61f92c
KH
41;; For other options, see "User-visible variables", below.
42
d7993a1c
RS
43;; A version of uniquify.el that works under Emacs 18, Emacs 19, XEmacs,
44;; and InfoDock is available from the maintainer.
4c61f92c 45
bc2e0aae
KH
46;; Doesn't work under NT when backslash is used as a path separator (forward
47;; slash path separator works fine). To fix, check system-type against
48;; 'windows-nt, write a routine that breaks paths down into components.
49;; (Surprisingly, there isn't one built in.)
50
4c61f92c
KH
51;;; Change Log:
52
53;; Originally by Dick King <king@reasoning.com> 15 May 86
54;; Converted for Emacs 18 by Stephen Gildea <gildea@lcs.mit.edu>
55;; Make uniquify-min-dir-content 0 truly non-invasive. gildea 23 May 89
56;; Some cleanup. uniquify-min-dir-content default 0. gildea 01 Jun 89
57;; Don't rename to "". Michael Ernst <mernst@theory.lcs.mit.edu> 15 Jun 94
58;; Add kill-buffer-hook. Kenneth Manheimer <ken.manheimer@nist.gov> 09 May 95
59;; Add advice for rename-buffer and create-file-buffer, handle dired buffers,
60;; kill-buffer-rationalize-buffer-names-p, documentation. mernst 24 May 95
61;; Remove free variables, fix typos. mernst 5 Jun 95
62;; Efficiently support Emacs 19.27 & earlier. ken.manheimer, mernst 10 Jun 95
63;; Rename user options to "uniquify-...", add uniquify-reverse-dir-content-p,
64;; add uniquify-ask-about-buffer-names-p. king, mernst 13 Jun 95
65;; Prefix functions by "uniquify-..."; rename mnemonic-buffer-names to
66;; uniquify-buffer-name-style; add 'forward and 'post-forward-angle-brackets
67;; styles; remove uniquify-reverse-dir-content-p; add
68;; uniquify-trailing-separator-p. mernst 4 Aug 95
bc2e0aae
KH
69;; Don't call expand-file-name on nil. mernst 7 Jan 96
70;; Check whether list-buffers-directory is bound. mernst 11 Oct 96
71;; Ignore non-file non-dired buffers. Colin Rafferty <craffert@ml.com> 3 Mar 97
4ddd2beb
RS
72;; Use last component, not "", for file name of directories. mernst 27 Jun 97
73;; Use directory-file-name; code cleanup. mernst 6 Sep 97
9a9c6f9f
RS
74;; Add uniquify-ignore-buffers-re.
75;; Andre Srinivasan <andre@visigenic.com> 9 Sep 97
f4eda05f
SM
76;; Add uniquify-list-buffers-directory-modes
77;; Stefan Monnier <monnier@cs.yale.edu> 17 Nov 2000
4126f5b7 78;; Algorithm and data structure changed to reduce consing with lots of buffers
b2f1b848 79