home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / functions / make-local.el < prev    next >
Encoding:
Text File  |  1990-07-22  |  1.8 KB  |  52 lines

  1. ;From: gnb@bby.oz (Gregory N. Bond)
  2. ;Newsgroups: comp.emacs
  3. ;Subject: a make-multiple-local-variables function - revert to GNU c style
  4. ;Message-ID: <GNB.89Aug21154541@baby.bby.oz>
  5. ;Date: 21 Aug 89 05:45:41 GMT
  6. ;Distribution: comp
  7. ;Organization: Burdett, Buckeridge and Young Ltd.
  8. ;Lines: 42
  9. ;
  10. ;A quick hack I put together to ease working on GNU C programs.  
  11. ;
  12. ;We use K&R standard indenting locally, so our EMACS is set up for K&R
  13. ;indentation variables.  This is most annoying when working on GNU
  14. ;software which uses a different set of style parameters.  I defined a
  15. ;function to make the style variables local to a buffer, and then set
  16. ;them to the gnu defaults.  It is based on another function for doing
  17. ;multiple make-local-variable calls.
  18. ;
  19. ;I'm an elisp novice, so there may be better ways of doing this...
  20. ;
  21. ;Share and enjoy!
  22. ;
  23. ;Greg.
  24. ;
  25. ;---------8<-------------8<------------
  26. ;
  27. ; Make a stack of variables buffer-local and give them the specified values
  28. ;
  29. (defun make-multiple-local-variables (alist)
  30.   "Given a list ((var value) (var value) ...) make each var a buffer-local 
  31. variable with the value specified."
  32.   (mapcar '(lambda (var) 
  33.          (make-local-variable (car var)) (set (car var) (car (cdr var))))
  34.       alist))
  35.  
  36. ; A function to reset the C style parameters back to standard 
  37. ; GNU C cstyle FOR THIS BUFFER ONLY
  38. ;
  39. (defun c-gnu-style ()
  40.   "Reset the C mode style variables to the standard GNU defaults
  41. for this buffer."
  42.   (interactive)
  43.   (make-multiple-local-variables
  44.       '((c-indent-level 2) (c-continued-statement-offset 2)
  45.         (c-brace-offset 0) (c-brace-imaginary-offset 0)
  46.         (c-argdecl-indent 5) (c-label-offset -2))))
  47.  
  48. ;--
  49. ;Gregory Bond, Burdett Buckeridge & Young Ltd, Melbourne, Australia
  50. ;Internet: gnb@melba.bby.oz.au    non-MX: gnb%melba.bby.oz@uunet.uu.net
  51. ;Uucp: {uunet,pyramid,ubc-cs,ukc,mcvax,prlb2,nttlab...}!munnari!melba.bby.oz!gnb
  52.