libssh2
/
libssh2-style.el
52 строки · 2.1 Кб
1;;;; Emacs Lisp help for writing libssh2 code. ;;;;
2;;; Copyright (C) The libssh2 project and its contributors.
3;;; SPDX-License-Identifier: BSD-3-Clause
4
5;;; The libssh2 hacker's C conventions.
6;;; See the sample.emacs file on how this file can be made to take
7;;; effect automatically when editing libssh2 source files.
8
9(defconst libssh2-c-style
10'((c-basic-offset . 4)
11(c-comment-only-line-offset . 0)
12(c-hanging-braces-alist . ((substatement-open before after)))
13(c-offsets-alist . ((topmost-intro . 0)
14(topmost-intro-cont . 0)
15(substatement . +)
16(substatement-open . 0)
17(statement-case-intro . +)
18(statement-case-open . 0)
19(case-label . 0)
20))
21)
22"Libssh2 C Programming Style")
23
24(defun libssh2-code-cleanup ()
25"tabify and delete trailing whitespace"
26(interactive)
27(untabify (point-min) (point-max))
28(delete-trailing-whitespace)
29)
30
31;; Customizations for all of c-mode, c++-mode, and objc-mode
32(defun libssh2-c-mode-common-hook ()
33"Libssh2 C mode hook"
34;; add libssh2 style and set it for the current buffer
35(c-add-style "libssh2" libssh2-c-style t)
36(setq tab-width 8
37indent-tabs-mode nil ; Use spaces, not tabs.
38comment-column 40
39c-font-lock-extra-types (append '("libssh2_int64_t" "LIBSSH2_USERAUTH_KBDINT_PROMPT" "LIBSSH2_SESSION" "LIBSSH2_CHANNEL" "ssize_t" "size_t" "uint32_t" "LIBSSH2_LISTENER" "LIBSSH2_POLLFD"))
40)
41;; keybindings for C, C++, and Objective-C. We can put these in
42;; c-mode-base-map because of inheritance ...
43(define-key c-mode-base-map "\M-q" 'c-fill-paragraph)
44(define-key c-mode-base-map "\M-m" 'libssh2-code-cleanup)
45(setq c-recognize-knr-p nil)
46;;; (add-hook 'write-file-hooks 'delete-trailing-whitespace t)
47(setq show-trailing-whitespace t)
48)
49
50;; Set this is in your .emacs if you want to use the c-mode-hook as
51;; defined here right out of the box.
52; (add-hook 'c-mode-common-hook 'libssh2-c-mode-common-hook)
53