Thread View: gnu.epoch.misc
1 messages
1 total messages
Started by Brian L. Kahn
Tue, 09 Jun 1992 18:36
Mouse interface for buffer list
Author: Brian L. Kahn
Date: Tue, 09 Jun 1992 18:36
Date: Tue, 09 Jun 1992 18:36
73 lines
2929 bytes
2929 bytes
Here's a bit of code that I've found to be a real nice interface for
the buffer list. This creates a window at the bottom of the screen
with a buffer list in it, invoked by clicking on any modeline with the
middle mouse button. Mouse clicks in buff-ed call up the buffers.
----------snip snip----------
;;; buff-ed mouse interface for epoch
;;; Brian L. Kahn, blk@mitre.org, Tue Jun 9 12:25:16 1992
(defmacro funct (args &rest body)
"Returns an instant, nameless, interactive function with ARGS and BODY."
(` (function (lambda (, args) (interactive) (,@ body )))))
;;; from sun-mouse.el
(defmacro eval-in-window (window &rest forms)
"Switch to WINDOW, evaluate FORMS, return to original window."
(` (let ((OriginallySelectedWindow (selected-window)))
(unwind-protect
(progn
(select-window (, window))
(,@ forms))
(select-window OriginallySelectedWindow)))))
(defun shrink-window-to-buffer (&optional window)
"Shrinks current window or WINDOW to fit buffer, if buffer is smaller."
(eval-in-window
(or window (selected-window))
(let ((buffSize (1+ (count-lines (point-min)(point-max)))))
(if (< buffSize (window-height))
(shrink-window (- (window-height) buffSize))
))))
(defun buffer-menu-sized (&optional args)
"Buffer menu, sized to fit."
(interactive)
(list-buffers)
(shrink-window-to-buffer (get-buffer-window "*Buffer List*"))
)
(setq buffer-menu-mode-hook
(funct ()
(local-set-mouse mouse-left mouse-down
'mouse::set-point)
(local-set-mouse mouse-middle mouse-down
(funct (args)
(mouse::set-point args)
(Buffer-menu-1-window)))
(local-set-mouse mouse-right mouse-down
(funct (args)
(mouse::set-point args)
(Buffer-menu-other-window)))
(local-set-mouse mouse-left mouse-up ())
(local-set-mouse mouse-middle mouse-up ())
(local-set-mouse mouse-right mouse-up ())
(message
"[left]-Select [middle]-Full Screen [right]-Split Screen")))
(global-set-mouse mouse-mode-middle mouse-down 'buffer-menu-sized)
--
B< Brian Kahn blk@security.mitre.org "may the farce be with you"
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads