;ELC   
;;; compiled by rms@mole.gnu.ai.mit.edu on Mon Oct 30 15:54:06 1995
;;; from file /home/fsf/rms/e19/lisp/uniquify.el
;;; emacs version 19.29.1.2.
;;; bytecomp version FSF 2.10
;;; optimization is on.
;;; this file uses opcodes which do not exist in Emacs 18.

(if (and (boundp 'emacs-version)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.28.90")))
    (error "`uniquify.el' was compiled for Emacs 19.29 or later"))


(provide (quote uniquify))
#@564 *If non-nil, buffer names are uniquified with parts of directory name.
The value determines the buffer name style and is one of 'forward,
'reverse, 'post-forward (the default), or 'post-forward-angle-brackets.
For example, files /foo/bar/mumble/name and /baz/quux/mumble/name
would be in the following buffers:
  forward        bar/mumble/name  quux/mumble/name
  reverse        name\mumble\bar  name\mumble\quux
  post-forward   name|bar/mumble  name|quux/mumble
  post-forward-angle-brackets   name<bar/mumble>  name<quux/mumble>
  nil            name  name<2>
(defvar uniquify-buffer-name-style (quote post-forward) (#$ . -504))
#@215 *If non-nil, rerationalize buffer names after a buffer has been killed.
This can be dangerous if Emacs Lisp code is keeping track of buffers by their
names (rather than keeping pointers to the buffers themselves).
(defvar uniquify-after-kill-buffer-p nil (#$ . -1143))
#@180 *If non-nil, permit user to choose names for buffers with same base file.
If the user chooses to name a buffer, uniquification is preempted and no
other buffer names are changed.
(defconst uniquify-ask-about-buffer-names-p nil (#$ . -1419))
#@63 *Minimum parts of directory pathname included in buffer name.
(defvar uniquify-min-dir-content 0 (#$ . -1666))
#@271 *String separator for buffer name components.
When `uniquify-buffer-name-style' is 'post-forward, separates
base file name from directory part in buffer names (default "|").
When `uniquify-buffer-name-style' is 'reverse, separates all
pathname components (default "\").
(defvar uniquify-separator nil (#$ . -1784))
#@231 *If non-nil, add a pathname separator to dired buffer names.
If `uniquify-buffer-name-style' is 'forward, add the separator at the end;
if it's is 'reverse, add the separator at the beginning; otherwise, this
variable is ignored.
(defvar uniquify-trailing-separator-p nil (#$ . -2106))
(defalias 'uniquify-push '(macro . #[(item list) "À	Â	EE‡" [setq list cons item] 5]))
(defalias 'uniquify-fix-list-base '(macro . #[(a) "À	D‡" [car a] 2]))
(defalias 'uniquify-fix-list-filename '(macro . #[(a) "ÀÁ\nDD‡" [car cdr a] 3]))
(defalias 'uniquify-fix-list-buffer '(macro . #[(a) "ÀÁ‰\nDDD‡" [car cdr a] 4]))
(defalias 'uniquify-cadddr '(macro . #[(a) "ÀÁ‰‰\nDDDD‡" [car cdr a] 5]))
(byte-code "ÀÁ!„ ÂÁBÀÄ!„ ÂÄBÂ‡" [boundp uniquify-non-file-buffer-names nil current-load-list uniquify-possibly-resolvable] 2)
#@200 Makes file buffer names unique by adding segments from pathname.
If `uniquify-min-dir-content' > 0, always pulls that many
pathname elements.  Arguments cause only a subset of buffers to be renamed.
(defalias 'uniquify-rationalize-file-buffer-names #[(&optional newbuffile newbuf) "À‰	Å ‰ƒh @‰=ƒ! É\n!‚% Ë!‰\f…/ Í\f!‰…B \n?†B Í\n!š‰ƒV \fÀF\fB‚^ Ð!CB,A‰„ )Ñ\fÒ\"Ó\f\n\"ˆÔÕ\f\"+‡" [nil uniquify-min-dir-content depth uniquify-non-file-buffer-names fix-list buffer-list buffers buffer newbuf expand-file-name newbuffile uniquify-buffer-file-name bfn file-name-nondirectory rawname deserving buffer-name sort uniquify-filename-sort uniquify-rationalize-a-list mapcar uniquify-unrationalized-buffer] 5 (#$ . 2926) nil])
#@123 Return name of file BUFFER is visiting, or nil if none.
Works on dired buffers as well as ordinary file-visiting buffers.
(defalias 'uniquify-buffer-file-name #[(buffer) "À	!†\f Š	qˆ\n)‡" [buffer-file-name buffer list-buffers-directory] 2 (#$ . 3688)])
(defalias 'uniquify-filename-sort #[(s1 s2) "À	A@\nA@\"‡" [uniquify-filename-lessp s1 s2] 3])
(defalias 'uniquify-filename-lessp #[(s1 s2) "À	!À\n!Åš?…C \f™†C \fš…C Æ	!Æ\n!GÉX?…B GÉX†B ÊËÌOËÌO\"**‡" [file-name-nondirectory s1 s2 s2f s1f "" file-name-directory s2d s1d 1 uniquify-filename-lessp 0 -1] 5])
(defalias 'uniquify-unrationalized-buffer #[(item) "AAA@‡" [item] 1])
(defalias 'uniquify-rationalize-a-list #[(fix-list depth) "ÀÁÀ‰ƒ9 @È	\"‰\fš„( Ê\f	#ˆÀB)A‰„ Ê\f	#,‡" [nil "" uniquify-possibly-resolvable proposed-name old-name conflicting-sublist fix-list item uniquify-get-proposed-name depth uniquify-rationalize-conflicting-sublist] 5])
(defalias 'uniquify-get-proposed-name #[(item depth) "ÀÁ\n@A@ÉVƒJ ÊËÌ!Ì!ÍR\f\"‰ƒJ \fÉUƒ6 É‚9 T\fGGZOS‰‚ ÉUƒT Îƒƒ Ñ\f!ƒƒ Á˜„ƒ Ó=ƒs ÔP‚ƒ Õ=ƒƒ †€ ×PÁ˜„£ Ø=„˜ Ù=ƒ£ ÉGÚZOÁ˜ƒ® ‚ Á˜ƒ¹ ‚ Ó=ƒÇ P‚ Õ=ƒ× Û!P‚ Ø=ƒë †å ÜQ‚ Ù=ƒû ÝÞR‚ ßà\"-‡" [nil "" depth item fn base n extra-string index 0 string-match "\\(^\\|/[^/]*\\)/" regexp-quote "\\'" t uniquify-possibly-resolvable uniquify-trailing-separator-p file-directory-p uniquify-buffer-name-style forward "/" reverse uniquify-separator "\\" post-forward post-forward-angle-brackets 1 uniquify-reverse-components "|" "<" ">" error "Bad value for uniquify-buffer-name-style: %s"] 6])
(defalias 'uniquify-rationalize-conflicting-sublist #[(conflicting-sublist old-name depth) "?†, A„! Á\n\"„! \nÄ˜„ Å@\n\"†, Æ‡…, È	T\"‡" [conflicting-sublist assoc old-name uniquify-non-file-buffer-names "" uniquify-rename-buffer t uniquify-possibly-resolvable uniquify-rationalize-a-list depth] 3])
(defalias 'uniquify-rename-buffer #[(item newname) "AA@\nÃ	!š„ pÄ	qˆÇ\n!ˆqˆ*)È›É ‡" [item buffer newname buffer-name nil uniquify-buffer-name-style unset rename-buffer 3 t] 3])
(defalias 'uniquify-reverse-components #[(instring) "ÀÁ\nG†	 ÄWƒP \nHÉUƒ0 BT‰‚ ÊË\n#†; \f\n\fOB\f)‚ ÍÎ\",‡" [nil 0 instring uniquify-separator "\\" sep len cursor sofar 47 string-match "/" first-slash apply concat] 5])
(byte-code "ÀÁÂÃÄ$ˆÅÁÄ\"ˆÀÆÇÃÄ$ˆÅÆÄ\"‡" [ad-add-advice rename-buffer (rename-buffer-uniquify nil t (advice lambda nil "Uniquify buffer names with parts of directory name." (if (and uniquify-buffer-name-style (ad-get-arg 1)) (progn (if uniquify-after-kill-buffer-p (uniquify-rationalize-file-buffer-names) (uniquify-rationalize-file-buffer-names (uniquify-buffer-file-name (current-buffer)) (current-buffer))) (setq ad-return-value (buffer-name (current-buffer))))))) after nil ad-activate-on create-file-buffer (create-file-buffer-uniquify nil t (advice lambda nil "Uniquify buffer names with parts of directory name." (if uniquify-buffer-name-style (uniquify-rationalize-file-buffer-names (ad-get-arg 0) ad-return-value))))] 5)
#@154 Add `delayed-uniquify-rationalize-file-buffer-names' to `post-command-hook'.
For use on, eg, `kill-buffer-hook', to rationalize *after* buffer deletion.
(defalias 'delay-uniquify-rationalize-file-buffer-names #[nil "…\f 	…\f ÂÃÄ\"‡" [uniquify-buffer-name-style uniquify-after-kill-buffer-p add-hook post-command-hook delayed-uniquify-rationalize-file-buffer-names] 3 (#$ . 6840)])
#@134 Rerationalize buffer names and remove self from `post-command-hook'.
See also `delay-rationalize-file-buffer-names' for hook setter.
(defalias 'delayed-uniquify-rationalize-file-buffer-names #[nil "À ˆÁÂÃ\"‡" [uniquify-rationalize-file-buffer-names remove-hook post-command-hook delayed-uniquify-rationalize-file-buffer-names] 3 (#$ . 7229)])
(add-hook (quote kill-buffer-hook) (quote delay-uniquify-rationalize-file-buffer-names))
