File: frama-c-recommended.el

package info (click to toggle)
frama-c 20161101%2Bsilicon%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,324 kB
  • ctags: 35,695
  • sloc: ml: 200,142; ansic: 31,465; makefile: 2,334; sh: 1,643; lisp: 259; python: 85; asm: 26
file content (120 lines) | stat: -rw-r--r-- 5,313 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                                                        ;
;  This file is part of Frama-C.                                         ;
;                                                                        ;
;  Copyright (C) 2007-2016                                               ;
;    CEA (Commissariat à l'énergie atomique et aux énergies              ;
;         alternatives)                                                  ;
;                                                                        ;
;  you can redistribute it and/or modify it under the terms of the GNU   ;
;  Lesser General Public License as published by the Free Software       ;
;  Foundation, version 2.1.                                              ;
;                                                                        ;
;  It is distributed in the hope that it will be useful,                 ;
;  but WITHOUT ANY WARRANTY; without even the implied warranty of        ;
;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         ;
;  GNU Lesser General Public License for more details.                   ;
;                                                                        ;
;  See the GNU Lesser General Public License version 2.1                 ;
;  for more details (enclosed in the file licenses/LGPLv2.1).            ;
;                                                                        ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; *** Recommended Emacs settings for Frama-C developers ***
;;
;; This file should be loaded in the beginning of your .emacs file.
;;
;; 1. Include the directory containing this file in your Emacs load path;
;; 2. Load this file as a library.
;;
;; You can do so by adding these lines in the beginning of your ~/.emacs file:
;;
;; (add-to-list 'load-path "path/to/this/file/")
;; (load-library "frama-c-recommended")
;;
;; Note: 'frama-c-init.el' and 'frama-c-dev.el' must also be in the load path.

;; ***** Initialization and configuration settings *****
(load-library "frama-c-init")
(load-library "frama-c-dev")

;; MELPA helps with the installation of several Emacs packages
(safe-require package
  (add-to-list 'package-archives
    '("melpa-stable" . "https://stable.melpa.org/packages/"))
)

;; ***** OCaml settings *****
;;
;; Load Tuareg (OCaml mode for Emacs) if installed
(safe-load-library "tuareg-site-file")

;; ***** End of OCaml settings *****


;; ***** Miscellaneous settings *****
;;
;; fill-column-indicator adds a vertical line to help enforce the
;; 80-characters-per-line rule
;; Note: in some specific configurations (e.g. KDE, maximized window),
;; this library may interfere with window redrawing when using e.g. some
;; merlin functions. Try deactivating this extension if you have problems.
(safe-require fill-column-indicator
  (setq-default fill-column 80)
  (setq fci-rule-color "#8f8f8f")
  (add-hook 'tuareg-mode-hook 'fci-mode t)
)

;; Disable insertion of tabs for indentation everywhere but in Makefiles
;; (Emacs always inserts tabs in Makefiles, regardless of this option)
(setq-default indent-tabs-mode nil)

;; Disable overwrite mode, which is rarely used nowadays and can be annoying
;; when enabled accidentally
(global-unset-key [insert])

;; redo+ (needs to be installed via ELPA) enables a somewhat "standard"
;; undo/redo mechanism, similar to most modern applications;
;; these key settings bind Ctrl+Z and Ctrl+Shift+Z to undo/redo, respectively
(safe-require redo+
  (global-set-key (kbd "C-z") 'undo-only)
  (global-set-key (kbd "C-S-z") 'redo)
  ; Avoid accidental minimization when pressing pressing C-z just after a 'C-x'
  (global-unset-key (kbd "C-x C-z"))
)

;; This hook removes trailing whitespace, which should always be avoided
;; Note that, if applied to an existing file with trailing whitespace, this
;; will remove it in *every* line. This can generate large diffs and is not
;; always ideal. For new files, however, this should be on by default.
;(add-hook 'before-save-hook 'delete-trailing-whitespace)

;; Require a final newline in a file in order to avoid confusing some tools
;; (also helps 'git diff')
(setq require-final-newline t)

;; whitespace-mode, when activated, displays several kinds of possibly
;; undesirable whitespace.
;; The settings below enable display of tabs, empty lines at the end of
;; the file, and the most important one: trailing spaces
;; It is also possible to use whitespace-mode to highlight long lines
;; (over 80 characters, or the width that you prefer), but they are
;; not activated in these settings.
(global-whitespace-mode 1)
(setq whitespace-style '(face empty tabs trailing))

;; Terminal Settings
;; (related to colors in compilation mode; see MR frama-c/frama-c!300)
(safe-require ansi-color
  (defun my-colorize-compilation-buffer ()
    (ansi-color-apply-on-region (point-min) (point-max))
    (goto-char (point-min))
    (while (search-forward "\x0d" nil t)
      (delete-region (line-beginning-position) (point)))
    (goto-char (point-min))
    (while (search-forward "\x1b[K" nil t)
      (replace-match ""))
    (goto-char (point-min))
    )
  (add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer)
)