Article View: gnu.epoch.misc
Article #1316easy way to switch buffers ?
From: Marc Andreessen
Date: Thu, 09 Jul 1992 04:53
Date: Thu, 09 Jul 1992 04:53
74 lines
2624 bytes
2624 bytes
The following code will do so, if you have the xmenu client (from
comp.sources.x):
;;;
;;; xmenu.el
;;; provide an interface to Richard Hess' xmenu for xemacs & epoch
;;;
;;; part of the code is taken from the x-buffer-menu function in x-mouse.el
;;; and from the Epoch FAQ example by Philippe Bondono
;;;
;;; Control-mouse-left will pop up a menu in the current window
;;; with two submenus (submenus and entries can be added in the
;;; sp macro below)
;;;
;;; Thierry Cambon (T.Cambon@frcl.bull.fr)
;;;
(defun create-buffer-menu-entry (buffer)
(concat buffer "=" "switch-to-buffer " buffer))
(defun create-buffer-menu-entry-list ()
(mapcar 'create-buffer-menu-entry
(let ((tail (buffer-list))
head)
(while tail
(let ((elt (car tail)))
(if (not (string-match "^ "
(buffer-name elt)))
(setq head (cons
(format
"%s"
(buffer-name elt))
head))))
(setq tail (cdr tail)))
(reverse head))))
(defun interpret-output (process output)
(let ((com (read-from-string output)))
(if (>= (cdr com) (length output))
(funcall (car com))
(funcall (car com) (substring output (cdr com) -1)))))
(defmacro sp-old ()
(` (start-process "xmenu" nil
"/usr/local/bin/xmenu" "-heading" "Epoch Menu"
"-menu" "Tools"
"Undo=undo"
"Dired=dired-other-screen"
"-unem"
"-menu" "Buffers"
(,@ (create-buffer-menu-entry-list))
"-unem")))
(defmacro sp ()
(` (start-process "xmenu" nil
"/usr/local/bin/xmenu" "-heading" "Epoch Buffers"
(,@ (create-buffer-menu-entry-list)) )))
(defun make-menu (arg)
(interactive)
(set-process-filter (sp)
'interpret-output))
(global-set-mouse mouse-left mouse-control 'make-menu)
Hope this helps,
Marc
--
Marc Andreessen
Epoch Development Team
University of Illinois at Urbana-Champaign
marca@ncsa.uiuc.edu
Technical Details
Message-ID:
<9207091853.AA07506@wintermute.ncsa.uiuc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ncsa.uiuc.edu!marcaReferences:
<1992Jul9.131312.28104@cbfsb.cb.att.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc7ee,a80d935280124478 X-Google-Attributes: gidfc7ee,public X-Google-ArrivalTime: 1992-07-09 06:06:28 PST Newsgroups: gnu.epoch.misc Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ncsa.uiuc.edu!marca From: marca@ncsa.uiuc.edu (Marc Andreessen) Subject: easy way to switch buffers ? Message-ID: <9207091853.AA07506@wintermute.ncsa.uiuc.edu> Sender: daemon@cis.ohio-state.edu Organization: GNUs Not Usenet References: <1992Jul9.131312.28104@cbfsb.cb.att.com> Distribution: gnu Date: Thu, 9 Jul 1992 04:53:25 GMT Lines: 75