🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Thierry Cambon Tue, 12 May 1992 15:18
(none)
#1453
Author: Thierry Cambon
Date: Tue, 12 May 1992 15:18
75 lines
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)
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