curl-style.el 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ;;;; Emacs Lisp help for writing curl code. ;;;;
  2. ;;;; $Id: curl-style.el,v 1.7 2004/03/09 22:55:47 bagder Exp $
  3. ;;; The curl hacker's C conventions.
  4. ;;; After loading this file and added the mode-hook you can in C
  5. ;;; files, put something like this to use the curl style
  6. ;;; automatically:
  7. ;;
  8. ;; /* -----------------------------------------------------------------
  9. ;; * local variables:
  10. ;; * eval: (set c-file-style "curl")
  11. ;; * end:
  12. ;; */
  13. ;;
  14. (defconst curl-c-style
  15. '((c-basic-offset . 2)
  16. (c-comment-only-line-offset . 0)
  17. (c-hanging-braces-alist . ((substatement-open before after)))
  18. (c-offsets-alist . ((topmost-intro . 0)
  19. (topmost-intro-cont . 0)
  20. (substatement . +)
  21. (substatement-open . 0)
  22. (statement-case-intro . +)
  23. (statement-case-open . 0)
  24. (case-label . 0)
  25. ))
  26. )
  27. "Curl C Programming Style")
  28. ;; Customizations for all of c-mode, c++-mode, and objc-mode
  29. (defun curl-c-mode-common-hook ()
  30. "Curl C mode hook"
  31. ;; add curl style and set it for the current buffer
  32. (c-add-style "curl" curl-c-style t)
  33. (setq tab-width 8
  34. indent-tabs-mode nil ; Use spaces. Not tabs.
  35. comment-column 40
  36. c-font-lock-extra-types (append '("bool" "CURL" "CURLcode" "ssize_t" "size_t" "socklen_t" "fd_set" "time_t" "curl_off_t" "curl_socket_t"))
  37. )
  38. ;; keybindings for C, C++, and Objective-C. We can put these in
  39. ;; c-mode-base-map because of inheritance ...
  40. (define-key c-mode-base-map "\M-q" 'c-fill-paragraph)
  41. (setq c-recognize-knr-p nil)
  42. )
  43. ;; Set this is in your .emacs if you want to use the c-mode-hook as
  44. ;; defined here right out of the box.
  45. ; (add-hook 'c-mode-common-hook 'curl-c-mode-common-hook)