;;; msb.el --- Customizable buffer-selection with multiple menus.
-;; Copyright (C) 1993, 1994, 1995, 1997 Lars Lindberg
-;; <Lars.G.Lindberg@capgemini.se>
-;; <Lars.G.Lindberg@mailbox.swipnet.se>
+;; Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
;; Author: Lars Lindberg <Lars.G.Lindberg@capgemini.se>
;; Created: 8 Oct 1993
;;;
;; Home directory for the current user
-(defvar msb--home-path
+(defvar msb--home-dir
(condition-case nil
(substitute-in-file-name "$HOME")
;; If $HOME isn't defined, use nil
(and (> (length (buffer-name buffer)) 0)
(eq ?\ (aref (buffer-name buffer) 0))))
-;; Strip one hierarchy level from the end of PATH.
-(defun msb--strip-path (path)
+;; Strip one hierarchy level from the end of DIR.
+(defun msb--strip-dir (dir)
(save-match-data
(cond
- ((string-match "^\\([^/]*/.+/\\)[^/]+$" path)
- (substring path (match-beginning 1) (match-end 1)))
- ((string-match "^\\([^/]*/\\)" path)
- (substring path (match-beginning 1) (match-end 1)))
+ ((string-match "^\\([^/]*/.+/\\)[^/]+$" dir)
+ (substring dir (match-beginning 1) (match-end 1)))
+ ((string-match "^\\([^/]*/\\)" dir)
+ (substring dir (match-beginning 1) (match-end 1)))
(t
- (error "msb: Path '%s' has an unrecognized format" path)))))
+ (error "msb: Directory `%s' has an unrecognized format" dir)))))
;; Create an alist with all buffers from LIST that lies under the same
;; directory will be in the same item as the directory string.
(let ((file-name (expand-file-name (buffer-file-name buffer)))) =
;LGL 971218
(when file-name
- (list (cons (msb--strip-path file-name) buffer))))))
+ (list (cons (msb--strip-dir file-name) buffer))))))
list)
(function (lambda (item1 item2)
(string< (car item1) (car item2)))))))
;; Format a suitable title for the menu item.
(defun msb--format-title (top-found-p path number-of-items)
(let ((new-path path))
- (when (and msb--home-path
- (string-match (concat "^" msb--home-path) path))
+ (when (and msb--home-dir
+ (string-match (concat "^" msb--home-dir) path))
(setq new-path (concat "~/"
(substring path (match-end 0)))))
(format (if top-found-p "%s... (%d)" "%s (%d)")
rest tmp-rest))
;; Now see if we can clump more buffers together if we go up
;; one step in the file hierarchy.
- (setq path (msb--strip-path path)
+ (setq path (msb--strip-dir path)
buffers (cdr first))
(when (and last-path
(or (and (>= (length path) (length last-path))