summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Lassieur <clement.lassieur@parrot.com>2018-04-04 16:02:37 +0200
committerClément Lassieur <clement.lassieur@parrot.com>2018-04-04 16:08:15 +0200
commit540967e946bfd4cd281dd819593afd0060159871 (patch)
treef2e5ae0b0da4222e156cd109e45aeb7376ddc5a9
parentc84800ed6a7403288567013a09f8e1e4d65b6c43 (diff)
downloadparrot-540967e946bfd4cd281dd819593afd0060159871.tar.gz
style: automatically detect style with dtrt-indent-mode
-rw-r--r--parrot-style.el59
-rw-r--r--parrot.el5
2 files changed, 13 insertions, 51 deletions
diff --git a/parrot-style.el b/parrot-style.el
index 05c2b23..8099a48 100644
--- a/parrot-style.el
+++ b/parrot-style.el
@@ -1,53 +1,14 @@
;;; -*- lexical-binding: t -*-
-(setq parrot-old-style-list
- '(
- "BLEproxy/Sources/APP_Network.h"
- "BLEproxy/Sources/Hardware"
- "Blues"
- "DragonProg/Sources/features/acquisition_control"
- "DragonProg/Sources/features/behaviour/ardrone3"
- "DragonProg/Sources/features/blackbox"
- "DragonProg/Sources/features/commands"
- "DragonProg/Sources/features/debug_ckcm"
- "DragonProg/Sources/features/demo_sequencer"
- "DragonProg/Sources/features/mario"
- "DragonProg/Sources/features/mass_storage"
- "DragonProg/Sources/features/mavlink_flightplans"
- "DragonProg/Sources/features/navdata/navdata_academy.c"
- "DragonProg/Sources/features/navdata/navdata_academy.h"
- "DragonProg/Sources/features/network_monitor"
- "DragonProg/Sources/features/roadplan"
- "DragonProg/Sources/features/sound"
- "DragonProg/Sources/features/temperature"
- "DragonProg/Sources/features/timers"
- "DragonProg/Sources/features/video"
- "DragonProg/Sources/features/vision"
- "DragonProg/Sources/main.c"
- "DragonProg/Sources/platform/ardrone3"
- "DragonProg/Sources/tools/fifo_tools/fifo_management.c"
- "DragonProg/Sources/tools/generic_report.c"
- "DragonProg/Testbenches/check_sensors"
- "libARDiscovery/"
- "libARNetwork/Sources/"
- "libColibry/Sources/controllers/"
- "libColibry/Sources/logic/"
- "libColibry/Sources/shared/"
- "libHAL/Sources/GPIOs/HAL_VBUS_monitor.c"
- "libHAL/Sources/GPIOs/HAL_jpsumo_gpios.c"
- "libHAL/Sources/HAL.c"
- "libHAL/Sources/HAL_V4L2_i_camif.c"
- "libHAL/Sources/HAL_share_acquisition.c"
- "libHAL/Sources/HAL_thread_ultrasound.c"
- "libHAL/Sources/HAL_ultrasound.c"
- "libHAL/Sources/HAL_v4l2_utils.c"
- "libHAL/Sources/Motors"
- "libHAL/Sources/Thread_Sensors/HAL_thread_ms5607.c"
- "libHAL/Sources/Video_Cams"
- "libNavdata/Sources/"
- "libVision2/"
- "libhardware/hardware.c"
- "PAL"
- ))
+;;;###autoload
+(defun oe-find-code-style ()
+ (interactive)
+ (dtrt-indent-mode)
+ (pcase (list indent-tabs-mode tab-width c-basic-offset)
+ (`(t 8 8) (c-set-style "linux"))
+ (`(nil ,_ 4) (progn (c-set-style "k&r")
+ (setq c-basic-offset 4)))
+ (t (error "unknown style")))
+ (whitespace-mode))
(provide 'parrot-style)
diff --git a/parrot.el b/parrot.el
index 88de4af..d415ebd 100644
--- a/parrot.el
+++ b/parrot.el
@@ -5,14 +5,15 @@
;;
;; You can also evaluate (parrot-update-autoloads) to generate the autoloads
;; file manually.
+;;
+;; For automatic style detection, add:
+;; (add-hook 'c-mode-common-hook 'oe-find-code-style)
(setq parrot-load-path (concat (file-name-directory (if load-in-progress
load-file-name
(buffer-file-name)))))
(push parrot-load-path load-path)
-(require 'parrot-style)
-
(defgroup parrot nil
"Parrot tools for Emacs."
:group 'tools)