2003-01-23 07:00:02 +01:00
|
|
|
;;;; Emacs Lisp help for writing curl code. ;;;;
|
|
|
|
;;;; $Id$
|
|
|
|
|
|
|
|
;;; The curl hacker's C conventions.
|
2004-03-24 23:24:03 +01:00
|
|
|
;;; See the sample.emacs file on how this file can be made to take
|
|
|
|
;;; effect automatically when editing curl source files.
|
2003-01-23 07:00:02 +01:00
|
|
|
|
|
|
|
(defconst curl-c-style
|
|
|
|
'((c-basic-offset . 2)
|
|
|
|
(c-comment-only-line-offset . 0)
|
|
|
|
(c-hanging-braces-alist . ((substatement-open before after)))
|
|
|
|
(c-offsets-alist . ((topmost-intro . 0)
|
|
|
|
(topmost-intro-cont . 0)
|
|
|
|
(substatement . +)
|
|
|
|
(substatement-open . 0)
|
|
|
|
(statement-case-intro . +)
|
|
|
|
(statement-case-open . 0)
|
|
|
|
(case-label . 0)
|
|
|
|
))
|
|
|
|
)
|
|
|
|
"Curl C Programming Style")
|
|
|
|
|
2004-10-06 09:50:18 +02:00
|
|
|
(defun curl-code-cleanup ()
|
|
|
|
"no docs"
|
|
|
|
(interactive)
|
|
|
|
(untabify (point-min) (point-max))
|
|
|
|
(delete-trailing-whitespace)
|
|
|
|
)
|
|
|
|
|
2003-01-23 07:00:02 +01:00
|
|
|
;; Customizations for all of c-mode, c++-mode, and objc-mode
|
|
|
|
(defun curl-c-mode-common-hook ()
|
|
|
|
"Curl C mode hook"
|
|
|
|
;; add curl style and set it for the current buffer
|
|
|
|
(c-add-style "curl" curl-c-style t)
|
|
|
|
(setq tab-width 8
|
|
|
|
indent-tabs-mode nil ; Use spaces. Not tabs.
|
|
|
|
comment-column 40
|
2004-06-29 20:45:52 +02:00
|
|
|
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" "in_addr_t" "CURLSHcode" "CURLMcode" "Curl_addrinfo"))
|
2003-01-23 07:00:02 +01:00
|
|
|
)
|
|
|
|
;; keybindings for C, C++, and Objective-C. We can put these in
|
|
|
|
;; c-mode-base-map because of inheritance ...
|
|
|
|
(define-key c-mode-base-map "\M-q" 'c-fill-paragraph)
|
2004-10-06 09:50:18 +02:00
|
|
|
(define-key c-mode-base-map "\M-m" 'curl-code-cleanup)
|
2003-01-23 07:00:02 +01:00
|
|
|
(setq c-recognize-knr-p nil)
|
2004-05-19 10:16:08 +02:00
|
|
|
;;; (add-hook 'write-file-hooks 'delete-trailing-whitespace t)
|
2004-05-17 08:54:20 +02:00
|
|
|
(setq show-trailing-whitespace t)
|
2003-01-23 07:00:02 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
;; Set this is in your .emacs if you want to use the c-mode-hook as
|
|
|
|
;; defined here right out of the box.
|
|
|
|
; (add-hook 'c-mode-common-hook 'curl-c-mode-common-hook)
|