From patchwork Fri Dec 16 19:40:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tremblay X-Patchwork-Id: 18522 Received: (qmail 76644 invoked by alias); 16 Dec 2016 19:41:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 76497 invoked by uid 89); 16 Dec 2016 19:40:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=BAYES_50, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:Unknown_Domain, H*r:Symantec, HX-Envelope-From:sk:antoine, Hx-languages-length:1962 X-HELO: usplmg20.ericsson.net Received: from usplmg20.ericsson.net (HELO usplmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Dec 2016 19:40:49 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by (Symantec Mail Security) with SMTP id 52.08.29529.4B844585; Fri, 16 Dec 2016 21:04:07 +0100 (CET) Received: from elxa4wqvvz1.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.90) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 16 Dec 2016 14:40:44 -0500 From: Antoine Tremblay To: CC: Antoine Tremblay Subject: [PATCH v2] Set emacs default mode for the GDB directory to C++ Date: Fri, 16 Dec 2016 14:40:33 -0500 Message-ID: <20161216194033.18756-1-antoine.tremblay@ericsson.com> In-Reply-To: <20161216192932.11323-1-antoine.tremblay@ericsson.com> References: <20161216192932.11323-1-antoine.tremblay@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes * In this v2: I forgot I needed to add to the safe-local-variable-values list rather than just set it.. this version fixes that.. Since GDB has switched to C++ but the file names are still .c emacs does not load the proper mode when opening files in the gdb directory. This patch fixes that by enabling c++ mode. This patch also fixes indentation tweaks as discussed in this thread: https://sourceware.org/ml/gdb-patches/2016-12/msg00074.html Indent with gdb-code-style.el included and the .dir-locals.el is as such: namespace TestNameSpace { class test { public: test test() {} int m_a; }; struct teststruct { int a; } } gdb/ChangeLog: * .dir-locals.el: Set c++ mode for the directory and set indent properly. * gdb-code-style.el: Set c-set-offset 'innamespace as a safe value to be used in .dir-locals.el. --- gdb/.dir-locals.el | 7 ++++++- gdb/gdb-code-style.el | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gdb/.dir-locals.el b/gdb/.dir-locals.el index fbd9309aef..8ac52393fc 100644 --- a/gdb/.dir-locals.el +++ b/gdb/.dir-locals.el @@ -20,5 +20,10 @@ (indent-tabs-mode . t))) (nil . ((bug-reference-url-format . "http://sourceware.org/bugzilla/show_bug.cgi?id=%s"))) (c-mode . ((c-file-style . "GNU") - (indent-tabs-mode . t))) + (mode . c++) + (indent-tabs-mode . t) + (tab-width . 8) + (c-basic-offset . 2) + (eval . (c-set-offset 'innamespace [0])) + )) ) diff --git a/gdb/gdb-code-style.el b/gdb/gdb-code-style.el index 6099c1d4b8..2864072b93 100644 --- a/gdb/gdb-code-style.el +++ b/gdb/gdb-code-style.el @@ -74,4 +74,9 @@ ) (add-hook 'c-mode-common-hook 'gdb-comment-hook) +;; Set c-set-offset 'innamespace as a safe value to be used in .dir-locals.el. +(setq safe-local-variable-values + (cons safe-local-variable-values + '((eval c-set-offset 'innamespace [0]) + (c-offsets-alist (innamespace .[0]))))) ;;; gdb-code-style.el ends here