home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / alt / lucidem / help / 417 < prev    next >
Encoding:
Text File  |  1992-09-11  |  2.3 KB  |  65 lines

  1. x-gateway: rodan.UU.NET from help-lucid-emacs to alt.lucid-emacs.help; Fri, 11 Sep 1992 22:38:14 EDT
  2. From: dmason%plg.uwaterloo.ca@lucid.com (Dave Mason)
  3. Subject: Re: 19.3 installation on decstation/ultrix4.2 with native cc
  4. Message-ID: <92Sep11.223453edt.28714@plg.uwaterloo.ca>
  5. Date: Fri, 11 Sep 1992 22:34:50 -0400
  6. Newsgroups: alt.lucid-emacs.help
  7. Path: sparky!uunet!wendy-fate.uu.net!help-lucid-emacs
  8. Sender: help-lucid-emacs-request@lucid.com
  9. Lines: 54
  10.  
  11.  Here is some better menubar Buffers functions that you might want to
  12. include in the distribution.
  13.  
  14.     ../Dave
  15.  
  16. -------------------------------
  17. (add-menu-item  '("Buffers" "Change to...") "" nil t)
  18. (add-menu-item  '("Buffers" "Save...") "" nil t)
  19. (add-menu-item  '("Buffers" "Delete...") "" nil t)
  20. (add-menu-item  '("Buffers") "Save All Buffers" 'save-some-buffers t)
  21. (add-menu-item  '("Buffers") "List All Buffers" 'list-buffers t)
  22.  
  23. (defun build-buffers-each (buffer-menu func buffers)
  24.   (let (name)
  25.     (if (not buffer-menu)
  26.     nil
  27.       ;;(if (> (length buffers) 10)
  28.       ;;    (setcdr (nthcdr 10 buffers) nil))
  29.       (setq buffers
  30.         (mapcar (function
  31.              (lambda (buffer)
  32.                (if (setq name (format-buffers-menu-line buffer))
  33.                (vector name
  34.                  (list func (buffer-name buffer))
  35.                  t))))
  36.             buffers))
  37.       ;; slightly (only slightly) more efficient to not install the menubar
  38.       ;; if it hasn't visibly changed.
  39.       (if (equal buffers (cdr buffer-menu))
  40.       t  ; return t meaning "no change"
  41.     (setcdr buffer-menu buffers)
  42.     ;; return the now-modified menubar to install.
  43.     ))))
  44.  
  45. (defun build-buffers-menu-hook (nothing)
  46.   "For use as a value of activate-menubar-hook.
  47. This function changes the contents of the \"Buffers\" menu to correspond
  48. to the current set of buffers.  You can control how the text of the menu
  49. items are generated by redefining the function `format-buffers-menu-line'."
  50.   (let ((buffers (buffer-list)))
  51.     (build-buffers-each (car (find-menu-item current-menubar 
  52.                          '("Buffers" "Change to...")))
  53.             'switch-to-buffer
  54.             buffers)
  55.     (build-buffers-each (car (find-menu-item current-menubar 
  56.                          '("Buffers" "Save...")))
  57.             'save-buffer
  58.             buffers)
  59.     (build-buffers-each (car (find-menu-item current-menubar 
  60.                          '("Buffers" "Delete...")))
  61.             'kill-buffer
  62.             buffers)
  63.     )
  64.   nil)
  65.