comparison lisp/utils/uniquify.el @ 134:34a5b81f86ba r20-2b1

Import from CVS: tag r20-2b1
author cvs
date Mon, 13 Aug 2007 09:30:11 +0200
parents 360340f9fd5f
children 3bb7ccffb0c0
comparison
equal deleted inserted replaced
133:b27e67717092 134:34a5b81f86ba
81 81
82 (provide 'uniquify) 82 (provide 'uniquify)
83 83
84 ;;; User-visible variables 84 ;;; User-visible variables
85 85
86 (defvar uniquify-buffer-name-style 'post-forward 86 (defgroup uniquify nil
87 "Unique buffer names dependent on file name"
88 :group 'applications)
89
90
91 (defcustom uniquify-buffer-name-style 'post-forward
87 "*If non-nil, buffer names are uniquified with parts of directory name. 92 "*If non-nil, buffer names are uniquified with parts of directory name.
88 The value determines the buffer name style and is one of `forward', 93 The value determines the buffer name style and is one of `forward',
89 `reverse', `post-forward' (the default), or `post-forward-angle-brackets'. 94 `reverse', `post-forward' (the default), or `post-forward-angle-brackets'.
90 For example, files `/foo/bar/mumble/name' and `/baz/quux/mumble/name' 95 For example, files `/foo/bar/mumble/name' and `/baz/quux/mumble/name'
91 would have the following buffer names in the various styles: 96 would have the following buffer names in the various styles:
92 forward bar/mumble/name quux/mumble/name 97 forward bar/mumble/name quux/mumble/name
93 reverse name\\mumble\\bar name\\mumble\\quux 98 reverse name\\mumble\\bar name\\mumble\\quux
94 post-forward name|bar/mumble name|quux/mumble 99 post-forward name|bar/mumble name|quux/mumble
95 post-forward-angle-brackets name<bar/mumble> name<quux/mumble> 100 post-forward-angle-brackets name<bar/mumble> name<quux/mumble>
96 nil name name<2>") 101 nil name name<2>"
97 102 :type '(radio (const forward)
98 (defvar uniquify-after-kill-buffer-p nil 103 (const reverse)
104 (const post-forward)
105 (const podt-forward-angle-brackets)
106 (const nil))
107 :group 'uniquify)
108
109 (defcustom uniquify-after-kill-buffer-p nil
99 "*If non-nil, rerationalize buffer names after a buffer has been killed. 110 "*If non-nil, rerationalize buffer names after a buffer has been killed.
100 This can be dangerous if Emacs Lisp code is keeping track of buffers by their 111 This can be dangerous if Emacs Lisp code is keeping track of buffers by their
101 names (rather than keeping pointers to the buffers themselves).") 112 names (rather than keeping pointers to the buffers themselves)."
102 113 :type 'boolean
103 (defconst uniquify-ask-about-buffer-names-p nil 114 :group 'uniquify)
115
116 (defcustom uniquify-ask-about-buffer-names-p nil
104 "*If non-nil, permit user to choose names for buffers with same base file. 117 "*If non-nil, permit user to choose names for buffers with same base file.
105 If the user chooses to name a buffer, uniquification is preempted and no 118 If the user chooses to name a buffer, uniquification is preempted and no
106 other buffer names are changed.") 119 other buffer names are changed."
107 120 :type 'boolean
108 (defvar uniquify-min-dir-content 0 121 :group 'uniquify)
109 "*Minimum parts of directory name included in buffer name.") 122
110 123 (defcustom uniquify-min-dir-content 0
111 (defvar uniquify-separator nil 124 "*Minimum parts of directory name included in buffer name."
125 :type 'integer
126 :group 'uniquify)
127
128 (defcustom uniquify-separator nil
112 "*String separator for buffer name components. 129 "*String separator for buffer name components.
113 When `uniquify-buffer-name-style' is `post-forward', separates 130 When `uniquify-buffer-name-style' is `post-forward', separates
114 base file name from directory part in buffer names (default \"|\"). 131 base file name from directory part in buffer names (default \"|\").
115 When `uniquify-buffer-name-style' is `reverse', separates all 132 When `uniquify-buffer-name-style' is `reverse', separates all
116 file name components (default \"\\\").") 133 file name components (default \"\\\")."
117 134 :type '(choice (const nil) string)
118 (defvar uniquify-trailing-separator-p nil 135 :group 'uniquify)
136
137 (defcustom uniquify-trailing-separator-p nil
119 "*If non-nil, add a file name separator to dired buffer names. 138 "*If non-nil, add a file name separator to dired buffer names.
120 If `uniquify-buffer-name-style' is `forward', add the separator at the end; 139 If `uniquify-buffer-name-style' is `forward', add the separator at the end;
121 if it is `reverse', add the separator at the beginning; otherwise, this 140 if it is `reverse', add the separator at the beginning; otherwise, this
122 variable is ignored.") 141 variable is ignored."
142 :type 'boolean
143 :group 'uniquify)
123 144
124 145
125 ;;; Utilities 146 ;;; Utilities
126 147
127 (defmacro uniquify-push (item list) 148 (defmacro uniquify-push (item list)