;ELC ;;; compiled by kwzh@hal.gnu.ai.mit.edu on Mon Apr 17 19:47:31 1995 ;;; from file /gd/gnu/emacs/19.0/lisp/msb.el ;;; emacs version 19.28.90.26. ;;; 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"))) (error "`/gd/gnu/emacs/19.0/lisp/msb.el' was compiled for Emacs 19")) (byte-code "!\fB\fB!\fB" [require cl (((and (boundp (quote server-buffer-clients)) server-buffer-clients (quote multi)) 3030 "Clients (%d)") ((and msb-display-invisible-buffers-p (msb-invisible-buffer-p) (quote multi)) 3090 "Invisible buffers (%d)") ((eq major-mode (quote dired-mode)) 2010 "Dired (%d)" msb-dired-item-handler msb-sort-by-directory) ((eq major-mode (quote Man-mode)) 4090 "Manuals (%d)") ((eq major-mode (quote w3-mode)) 4020 "WWW (%d)") ((or (memq major-mode (quote (rmail-mode rmail-edit-mode vm-summary-mode vm-mode mail-mode))) (memq major-mode (quote (mh-letter-mode mh-show-mode mh-folder-mode))) (memq major-mode (quote (gnus-summary-mode news-reply-mode gnus-group-mode gnus-article-mode gnus-kill-file-mode gnus-browse-killed-mode)))) 4010 "Mail (%d)") ((not buffer-file-name) 4099 "Buffers (%d)") ((quote no-multi) 1099 "Files (%d)")) msb--few-menus current-load-list (((and (boundp (quote server-buffer-clients)) server-buffer-clients (quote multi)) 1010 "Clients (%d)") ((and (boundp (quote vc-mode)) vc-mode (quote multi)) 1020 "Version Control (%d)") ((and buffer-file-name (buffer-modified-p) (quote multi)) 1030 "Changed files (%d)") ((and (get-buffer-process (current-buffer)) (quote multi)) 1040 "Processes (%d)") ((and msb-display-invisible-buffers-p (msb-invisible-buffer-p) (quote multi)) 1090 "Invisible buffers (%d)") ((eq major-mode (quote dired-mode)) 2010 "Dired (%d)" msb-dired-item-handler msb-sort-by-directory) ((eq major-mode (quote Man-mode)) 4030 "Manuals (%d)") ((eq major-mode (quote w3-mode)) 4020 "WWW (%d)") ((or (memq major-mode (quote (rmail-mode rmail-edit-mode vm-summary-mode vm-mode mail-mode))) (memq major-mode (quote (mh-letter-mode mh-show-mode mh-folder-mode))) (memq major-mode (quote (gnus-summary-mode news-reply-mode gnus-group-mode gnus-article-mode gnus-kill-file-mode gnus-browse-killed-mode)))) 4010 "Mail (%d)") ((and (not buffer-file-name) (quote no-multi)) 4099 "Other non-file buffers (%d)") ((and (string-match "/\\.[^/]*$" buffer-file-name) (quote multi)) 3090 "Hidden Files (%d)") ((memq major-mode (quote (c-mode c++-mode))) 3010 "C/C++ Files (%d)") ((eq major-mode (quote emacs-lisp-mode)) 3020 "Elisp Files (%d)") ((eq major-mode (quote latex-mode)) 3030 "LaTex Files (%d)") ((quote no-multi) 3099 "Other files (%d)")) msb--very-many-menus boundp msb--many-menus] 2) #@137 *Non-nil means use separators. The separators will appear between all menus that have a sorting key that differs by this value or more. (defvar msb-separator-diff 100 (#$ . -2852)) #@45 *The sort key for files sorted by directory (defvar msb-files-by-directory-sort-key 0 (#$ . -3039)) #@170 *The maximum number of items in a menu. If this variable is set to 15 for instance, then the submenu will be split up in minor parts, 15 items each. Nil means no limit. (defvar msb-max-menu-items 15 (#$ . -3146)) #@340 *The maximum number of items from different directories. When the menu is of type `file by directory', this is the maximum number of buffers that are clumped togehter from different directories. Set this to 1 if you want one menu per directory instead of clumping them together. If the value is not a number, then the value 10 is used. (defvar msb-max-file-menu-items 10 (#$ . -3366)) #@71 *Where should the menu with the most recently used buffers be placed? (defvar msb-most-recently-used-sort-key -1010 (#$ . -3760)) #@123 *How many buffers should be in the most-recently-used menu. No buffers at all if less than 1 or nil (or any non-number). (defvar msb-display-most-recently-used 15 (#$ . -3897)) #@45 *The title for the most-recently-used menu. (defvar msb-most-recently-used-title "Most recently used (%d)" (#$ . -4081)) #@96 *Function that specifies a number of pixels by which the top menu should be shifted leftwards. (defvar msb-horizontal-shift-function (quote (lambda nil 0)) (#$ . -4208)) #@143 *Show invisible buffers or not. Non-nil means that the buffer menu should include buffers that have names that starts with a space character. (defvar msb-display-invisible-buffers-p nil (#$ . -4385)) #@499 *The appearance of a buffer menu. The default function to call for handling the appearance of a menu item. It should take to arguments, BUFFER and MAX-BUFFER-NAME-LENGTH, where the latter is the max length of all buffer names. The function should return the string to use in the menu. When the function is called, BUFFER is the current buffer. This function is called for items in the variable `msb-menu-cond' that have nil as ITEM-HANDLING-FUNCTION. See `msb-menu-cond' for more information. (defvar msb-item-handling-function (quote msb-item-handler) (#$ . -4592)) #@398 *The order of items in a buffer menu. The default function to call for handling the order of items in a menu item. This function is called like a sort function. The items look like (ITEM-NAME . BUFFER). ITEM-NAME is the name of the item that will appear in the menu. BUFFER is the buffer, this is not necessarily the current buffer. Set this to nil or t if you don't want any sorting (faster). (defvar msb-item-sort-function (quote msb-sort-by-name) (#$ . -5171)) #@97 *Non-nil means that files should be sorted by directory instead of the groups in msb-menu-cond. (defvar msb-files-by-directory nil (#$ . -5644)) #@1990 *List of criterias for splitting the mouse buffer menu. The elements in the list should be of this type: (CONDITION MENU-SORT-KEY MENU-TITLE ITEM-HANDLING-FN ITEM-SORT-FN). When making the split, the buffers are tested one by one against the CONDITION, just like a lisp cond: When hitting a true condition, the other criterias are *not* tested and the buffer name will appear in the menu with the menu-title corresponding to the true condition. If the condition returns the symbol `multi', then the buffer will be added to this menu *and* tested for other menus too. If it returns `no-multi', then the buffer will only be added if it hasn't been added to any other menu. During this test, the buffer in question is the current buffer, and the test is surrounded by calls to `save-excursion' and `save-match-data'. The categories are sorted by MENU-SORT-KEY. Smaller keys are on top. nil means don't display this menu. MENU-TITLE is really a format. If you add %d in it, the %d is replaced with the number of items in that menu. ITEM-HANDLING-FN, is optional. If it is supplied and is a function, than it is used for displaying the items in that particular buffer menu, otherwise the function pointed out by `msb-item-handling-function' is used. ITEM-SORT-FN, is also optional. If it is not supplied, the function pointed out by `msb-item-sort-function' is used. If it is nil, then no sort takes place and the buffers are presented in least-recently-used order. If it is t, then no sort takes place and the buffers are presented in most-recently-used order. If it is supplied and non-nil and not t than it is used for sorting the items in that particular buffer menu. Note1: There should always be a `catch-all' as last element, in this list. That is an element like (t TITLE ITEM-HANDLING-FUNCTION). Note2: A buffer menu appears only if it has at least one buffer in it. Note3: If you have a CONDITION that can't be evaluated you will get an error every time you do \[msb]. (defvar msb-menu-cond msb--very-many-menus (#$ . -5797)) #@56 Hooks to be run after the msb package has been loaded. (defvar msb-after-load-hooks nil (#$ . 7849)) (byte-code "! B! B‡" [boundp msb--last-buffer-menu nil current-load-list msb--error] 2) #@265 Create one string item, concerning BUFFER, for the buffer menu. The item looks like: *% The `*' appears only if the buffer is marked as modified. The `%' appears only if the buffer is read-only. Optional second argument MAXBUF is completely ignored. (defalias 'msb-item-handler #[(buffer &optional maxbuf) " ‚\f\fł$+" [buffer-name buffer-modified-p "*" " " buffer-read-only "%" read-only modified name format "%s%s %s"] 5 (#$ . 8064)]) (defalias 'msb--dired-directory #[nil "; !!:@!! \"" [dired-directory abbreviate-file-name expand-file-name error "Unknown type of `dired-directory' in buffer %s" buffer-name] 3]) #@273 Create one string item, concerning a dired BUFFER, for the buffer menu. The item looks like: *% The `*' appears only if the buffer is marked as modified. The `%' appears only if the buffer is read-only. Optional second argument MAXBUF is completely ignored. (defalias 'msb-dired-item-handler #[(buffer &optional maxbuf) " ‚\f\fł$+" [msb--dired-directory buffer-modified-p "*" " " buffer-read-only "%" read-only modified name format "%s%s %s"] 5 (#$ . 8750)]) #@257 Create one string item for the buffer menu. The item looks like: *%# The `*' appears only if the buffer is marked as modified. The `%' appears only if the buffer is read-only. The `#' appears only version control file (SCCS/RCS). (defalias 'msb-alon-item-handler #[(buffer maxbuf) "\n\"\f! Ƃɂ!+ +̂, 2&" [format "%%%ds %%s%%s%%s %%s" maxbuf buffer-name buffer buffer-modified-p "*" " " buffer-read-only "%" boundp vc-mode "#" buffer-file-name ""] 7 (#$ . 9261)]) #@83 Sorts the items depending on their buffer-name An item look like (NAME . BUFFER). (defalias 'msb-sort-by-name #[(item1 item2) " A!\nA!" [buffer-name item1 item2] 3 (#$ . 9794)]) #@99 Sorts the items depending on their directory. Made for dired. An item look like (NAME . BUFFER). (defalias 'msb-sort-by-directory #[(item1 item2) "Aq )\nAq )" [item1 msb--dired-directory item2] 2 (#$ . 9982)]) #@278 Pop up several menus of buffers for selection with the mouse. This command switches buffers in the window that you clicked on, and selects that window. See the function `mouse-select-buffer' and the variable `msb-menu-cond' for more information about how the menus are split. (defalias 'msb #[(event) " A@)@) ! ! !)!-\f!+ʇ" [selected-window event position window old-window framep select-window mouse-select-buffer buffer switch-to-buffer nil] 3 (#$ . 10209) "e"]) #@130 Return t if optional BUFFER is an "invisible" buffer. If the argument is left out or nil, then the current buffer is considered. (defalias 'msb-invisible-buffer-p #[(&optional buffer) " !GV !H=" [buffer-name buffer 0 32] 2 (#$ . 10711)]) (defalias 'msb--strip-path #[(path) " Ž \" ƔƕO*" [match-data match-data ((store-match-data match-data)) string-match "\\(.+\\)/[^/]+$" path 1 "/"] 3]) (defalias 'msb--init-file-alist #[(list) " \"\"Ɖ \" BC\"," [sort mapcan #[(buffer) " !\n! BC)" [buffer-file-name buffer file-name msb--strip-path] 3] list #[(item1 item2) "@ @" [item1 item2] 2] buffer-alist nil result buffers path append #[(item) " @ A\nBÇ\nB @ AC\f'\fC" [path item buffers nil result] 2]] 4]) (defalias 'msb--choose-file-menu #[(list) " ! ‰ \n \f @ A@AY‰@ G X@GGY@GO A\"A@N G V@ \nւ@AG#AB\n\fB\f@A@AU\n B!A UG GY  GOG GWU GOU\n)ւ*@AG#AB\n\fB\f@A@A,7\ncւd@AG#AB\n\fB\f. " [msb--init-file-alist list nil msb-max-file-menu-items 10 buffers path rest first last-path top-found-p max-clumped-together final-list buffer-alist item new-path tmp-rest found-p 0 t append format "%s/... (%d)" "%s (%d)" msb--strip-path] 10]) (defalias 'msb--create-function-info #[(menu-cond-elt) "! GV 8 !  GV. 80\n  !E E =J L\n GWY! GVl !l C\" GV  ! = C\"\nL\n @ A@ 8 &-" [make-symbol "-msb-buffer-list" list-symbol menu-cond-elt 3 tmp-ih fboundp msb-item-handling-function item-handler 4 msb-item-sort-function tmp-s t sorter error "Wrong format of msb-menu-cond." signal invalid-function nil vector 2] 8]) (defalias 'msb--collect #[(function-info-vector) "\f T GWQ HH!G =8\nG =@ B  = ,b b! +" [nil function-info-list multi-flag result function-info-vector G29200 -1 G29201 fi G29202 eval 1 no-multi multi t error "No catch-all in msb-menu-cond!"] 4]) (put (quote msb--collect) (quote byte-optimizer) (quote byte-compile-inline-expand)) (defalias 'msb--add-to-menu #[(buffer function-info max-buffer-name-length) "HH\f \"\fB\n!BL)" [function-info 0 list-symbol 4 buffer max-buffer-name-length eval] 5]) (defalias 'msb--choose-menu #[(buffer function-info-vector max-buffer-name-length) "?\n!?ŏ" [msb-display-invisible-buffers-p msb-invisible-buffer-p buffer nil (byte-code "q ĉ \n \f\nT\nGWe\nH  H!Y=HY=R \fB\f=\f,ww! ,\")" [buffer mapc #[(function-info) " \n #" [msb--add-to-menu buffer function-info max-buffer-name-length] 4] function-info-vector nil function-info-list multi-flag result G29200 -1 G29201 fi G29202 eval 1 no-multi multi t error "No catch-all in msb-menu-cond!"] 6) ((error (byte-code "?\f!\"!" [msb--error format "In msb-menu-cond, error for buffer `%s'." buffer-name buffer error] 4)))] 3]) (put (quote msb--choose-menu) (quote byte-optimizer) (quote byte-compile-inline-expand)) (defalias 'msb--create-sort-item #[(function-info) " H!? H H> H G\"+ <=7 < \"BB*)" [eval function-info 0 buffer-list 5 2 sort-key sorter format 3 t sort] 6]) (defalias 'msb--most-recently-used-menu #[(max-buffer-name-length) "{V{ A  :[ @q ?2\n=?)Nq\f \")BB\fT\fY[ A,;qG\"wC\"*B" [msb-display-most-recently-used 0 buffer-list buffers n G29203 nil buffer G29204 msb-invisible-buffer-p major-mode dired-mode msb-item-handling-function max-buffer-name-length most-recently-used msb-most-recently-used-title format signal wrong-type-argument] 4]) (defalias 'msb--create-buffer-menu-2 #[nil " \"\f\"\" \" & !\"\f! \nTGWgH!?B?-\"ABB\"!\"!#DC'肥BBC$." [0 nil function-info-vector file-buffers max-buffer-name-length mapc #[(buffer) "\n ?\n\f!G]" [msb-display-invisible-buffers-p msb-invisible-buffer-p max-buffer-name-length buffer-name buffer] 3] buffer-list apply vector mapcar msb--create-function-info msb-menu-cond #[(buffer) "\n!\n B\n\f ?\n!?'ʏ+" [msb-files-by-directory buffer-file-name buffer file-buffers function-info-vector max-buffer-name-length msb-display-invisible-buffers-p msb-invisible-buffer-p nil (byte-code "q ĉ \n \f\nT\nGWe\nH  H!Y=HY=R \fB\f=\f,ww! ,\")" [buffer mapc #[(function-info) " \n #" [msb--add-to-menu buffer function-info max-buffer-name-length] 4] function-info-vector nil function-info-list multi-flag result G29200 -1 G29201 fi G29202 eval 1 no-multi multi t error "No catch-all in msb-menu-cond!"] 6) ((error (byte-code "?\f!\"!" [msb--error format "In msb-menu-cond, error for buffer `%s'." buffer-name buffer error] 4)))] 3] #[(buffer-list) " @ A\"\"BB" [msb-files-by-directory-sort-key buffer-list sort mapcar #[(buffer) "q \n\")B" [buffer msb-item-handling-function max-buffer-name-length] 3] #[(item1 item2) "@ @" [item1 item2] 2]] 6] msb--choose-file-menu menu msb--most-recently-used-menu most-recently-used append G29205 -1 G29206 elt value G29207 msb--create-sort-item others cdr msb--add-separators sort msb-most-recently-used-sort-key #[(elt1 elt2) "@ @W" [elt1 elt2] 2] (keymap "Select Buffer") msb--make-keymap-menu msb-separator-diff separator "---" toggle msb-files-by-directory "*Files by type*" "*Files by directory*" msb--toggle-menu-type] 7]) (defalias 'msb--create-buffer-menu #[nil " Ž +" [match-data match-data ((store-match-data match-data)) msb--create-buffer-menu-2] 1]) (defalias 'msb--toggle-menu-type #[nil "? " [msb-files-by-directory menu-bar-update-buffers] 1 nil nil]) #@215 Pop up several menus of buffers, for selection with the mouse. Returns the selected buffer or nil if no buffer is selected. The way the buffers are split is conveniently handled with the variable `msb-menu-cond'. (defalias 'mouse-select-buffer #[(event) " !  !o!oA@)8)@A@)8)AA@)@)\f  Z D\fD+\" \"@= !@A@ !)@A@;A@\"*" [msb--error msb--last-buffer-menu fboundp frame-or-buffer-changed-p nil msb--create-buffer-menu event choice position posn-x-y posn-window 2 posWind posY posX msb-horizontal-shift-function sit-for 0 100 x-popup-menu toggle msb--toggle-menu-type mouse-select-buffer 3 error "Unknown form for buffer: %s"] 4 (#$ . 16869)]) (defalias 'msb--add-separators #[(sorted-list) "   \")" [msb-separator-diff sorted-list nil last-key mapcan #[(item) " \n@ ZV\n@B\nD\n@\nC" [msb-separator-diff last-key item separator] 3]] 3]) (defalias 'msb--split-menus-2 #[(list mcount result) "G VFÉ W%A@\fBT\f@@P F\f\" B + T # M@@P F\" B ) " [list msb-max-menu-items 0 nil tmp-list sub-name count "..." append mcount keymap result msb--split-menus-2] 6]) (defalias 'msb--split-menus #[(list) " #" [msb--split-menus-2 list 0 nil] 4]) (defalias 'msb--make-keymap-menu #[(raw-menu) "B\"*" [(nil) menu-bar-select-buffer 0 mcount end mapcar #[(sub-menu) "=\nDA\"T@@F !\")" [sub-menu separator "---" mapcar #[(item) "@A !\n\f*BB" [item buffer string buffer-name end] 3] buffers append mcount keymap msb--split-menus] 5] raw-menu] 3]) (defalias 'menu-bar-update-buffers #[(&optional arg) " \"!  lj \n \f \nAi\nG  \"WVW VW\nǡ\n\"*  F AA B#+" [lookup-key current-global-map [menu-bar buffer] fboundp frame-or-buffer-changed-p arg frame-list nil frames-menu buffers-menu frames msb--create-buffer-menu msb--last-buffer-menu frame-length format "Frames (%d)" f-title msb-max-menu-items 1 frame (nil) keymap mapcar #[(frame) "!AÉBEĤ" [frame name frame-parameters nil menu-bar-select-frame] 4] define-key [menu-bar buffer] "Buffers" "Buffers and Frames" msb-separator-diff (separator "---") undefined] 9]) (byte-code "!!!BM!/ >/\"!< #!!\"" [boundp menu-bar-update-hook fboundp frame-or-buffer-changed-p msb--buffer-count 0 current-load-list #[nil " G\nU? )" [buffer-list count msb--buffer-count t] 3] menu-bar-update-buffers add-hook mouse-buffer-menu substitute-key-definition msb current-global-map provide eval-after-load run-hooks msb-after-load-hooks] 4)