Article View: gnu.epoch.misc
Article #1453(none)
From: Thierry Cambon
Date: Tue, 12 May 1992 15:18
Date: Tue, 12 May 1992 15:18
75 lines
2866 bytes
2866 bytes
Hi,
This is an extension to the FAQ example (method #4 in the MENUS section) by
Philippe Bondono (I think) which provide a popup menu of buffers for
selection with the mouse. I don't know if this has been done before, so
if someone did (may be using another method) please let me know.
I am not a elisp guru and if there is a more simple way to write the
following code, let me know too.
------------------------------------------------- Thierry CAMBON
Phone : (1) 30.80.69.34 BULL.S.A
Fax : (1) 30.80.74.79 Rue Jean Jaures B.P.68
Email : T.Cambon@frcl.bull.fr 78340 Les Clayes sous Bois FRANCE
------------------ cut here -----------------------------------------------
;;;
;;; 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 ()
(` (start-process "xmenu" nil
"/platine/cambon/bin/xmenu" "-heading" "Epoch Menu"
"-menu" "Tools"
"Undo=undo"
"Dired=dired-other-screen"
"-unem"
"-menu" "Buffers"
(,@ (create-buffer-menu-entry-list))
"-unem")))
(defun make-menu (arg)
(interactive)
(set-process-filter (sp)
'interpret-output))
(global-set-mouse mouse-left mouse-control 'make-menu)
Technical Details
Message-ID:
<9205121518.AA04156@platine.edps.bull.fr>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!frcl.bull.FR!T.CAmbonShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc7ee,e07d71df1ab5c6fa,start X-Google-Attributes: gidfc7ee,public X-Google-ArrivalTime: 1992-05-12 04:24:40 PST Newsgroups: gnu.epoch.misc Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!frcl.bull.FR!T.CAmbon From: T.CAmbon@frcl.bull.FR (Thierry Cambon) Subject: (none) Message-ID: <9205121518.AA04156@platine.edps.bull.fr> Sender: daemon@cis.ohio-state.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 12 May 1992 15:18:38 GMT Lines: 75