Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 52 lines (46 sloc) 1.797 kb
57e61e3 Daniel Stenberg This is the new Emacs style for curl hacking, based on work written by
authored
1 ;;;; Emacs Lisp help for writing curl code. ;;;;
2 ;;;; $Id$
3
4 ;;; The curl hacker's C conventions.
0e60a11 Daniel Stenberg better comments, added some more variable types we use in the font-lock
authored
5 ;;; See the sample.emacs file on how this file can be made to take
6 ;;; effect automatically when editing curl source files.
57e61e3 Daniel Stenberg This is the new Emacs style for curl hacking, based on work written by
authored
7
8 (defconst curl-c-style
9 '((c-basic-offset . 2)
10 (c-comment-only-line-offset . 0)
11 (c-hanging-braces-alist . ((substatement-open before after)))
12 (c-offsets-alist . ((topmost-intro . 0)
13 (topmost-intro-cont . 0)
14 (substatement . +)
15 (substatement-open . 0)
16 (statement-case-intro . +)
17 (statement-case-open . 0)
18 (case-label . 0)
19 ))
20 )
21 "Curl C Programming Style")
22
39af394 Daniel Stenberg removed tabs and trailing whitespace from source
authored
23 (defun curl-code-cleanup ()
24 "no docs"
25 (interactive)
26 (untabify (point-min) (point-max))
27 (delete-trailing-whitespace)
28 )
29
57e61e3 Daniel Stenberg This is the new Emacs style for curl hacking, based on work written by
authored
30 ;; Customizations for all of c-mode, c++-mode, and objc-mode
31 (defun curl-c-mode-common-hook ()
32 "Curl C mode hook"
33 ;; add curl style and set it for the current buffer
34 (c-add-style "curl" curl-c-style t)
35 (setq tab-width 8
36 indent-tabs-mode nil ; Use spaces. Not tabs.
37 comment-column 40
4191741 Daniel Stenberg Curl_addrinfo is another typedef we use frequently
authored
38 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"))
57e61e3 Daniel Stenberg This is the new Emacs style for curl hacking, based on work written by
authored
39 )
40 ;; keybindings for C, C++, and Objective-C. We can put these in
41 ;; c-mode-base-map because of inheritance ...
42 (define-key c-mode-base-map "\M-q" 'c-fill-paragraph)
39af394 Daniel Stenberg removed tabs and trailing whitespace from source
authored
43 (define-key c-mode-base-map "\M-m" 'curl-code-cleanup)
57e61e3 Daniel Stenberg This is the new Emacs style for curl hacking, based on work written by
authored
44 (setq c-recognize-knr-p nil)
bd3aba5 Daniel Stenberg The kill trailing whitespace needs to be set better as this way it takes
authored
45 ;;; (add-hook 'write-file-hooks 'delete-trailing-whitespace t)
c090fdb Daniel Stenberg automatically delete trailing white space on save in curl-mode
authored
46 (setq show-trailing-whitespace t)
57e61e3 Daniel Stenberg This is the new Emacs style for curl hacking, based on work written by
authored
47 )
48
49 ;; Set this is in your .emacs if you want to use the c-mode-hook as
50 ;; defined here right out of the box.
51 ; (add-hook 'c-mode-common-hook 'curl-c-mode-common-hook)
Something went wrong with that request. Please try again.