Message ID | 20200302123123.13921-1-andrew.burgess@embecosm.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 30241 invoked by alias); 2 Mar 2020 12:31:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 30229 invoked by uid 89); 2 Mar 2020 12:31:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=*h X-HELO: mail-wr1-f51.google.com Received: from mail-wr1-f51.google.com (HELO mail-wr1-f51.google.com) (209.85.221.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Mar 2020 12:31:31 +0000 Received: by mail-wr1-f51.google.com with SMTP id v4so12332296wrs.8 for <gdb-patches@sourceware.org>; Mon, 02 Mar 2020 04:31:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ySIfTpDMyGOE69jY96xycOFMsM+jxagHo0IHM704pbQ=; b=akz5ibv+h7nuCYLlJ3UGMoumVD1QJeBZlJG2AOQ5iVZBIEW9HEx46oWd7QP7Uv0hdi aKKyzxDPk2xU6ecMCTwXFVi7cHX8+4HfsbaLK3UsbYFvpFGEI2svqUcthDw7Jb5hEPNn umu6ddyk40DWxVqgKNaVV2bsVG6M5jQaD0hPAA2BZ3sI1k7D8g22Jlqbz4D1wg632wkm 0AXnQbNVDWpQGjM/l0hzG0st2k2aScIAKE6+lhHHIGKLtW21VhVP0NvZrwAoR1qNClVk UXH18j2rDu9tq7pNSiU20hd6CemDr3gCrDFKnbJ4PcSKbWswif6OHKNSQQPuTRbiwGRF DQUw== Return-Path: <andrew.burgess@embecosm.com> Received: from localhost ([212.69.42.53]) by smtp.gmail.com with ESMTPSA id i4sm15183632wmd.23.2020.03.02.04.31.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Mar 2020 04:31:26 -0800 (PST) From: Andrew Burgess <andrew.burgess@embecosm.com> To: gdb-patches@sourceware.org Cc: Andrew Burgess <andrew.burgess@embecosm.com> Subject: [PATCHv2] gdbserver: Add .dir-locals.el file Date: Mon, 2 Mar 2020 12:31:23 +0000 Message-Id: <20200302123123.13921-1-andrew.burgess@embecosm.com> In-Reply-To: <BYAPR11MB3030F2DF420DBF609C29D890C4E70@BYAPR11MB3030.namprd11.prod.outlook.com> References: <BYAPR11MB3030F2DF420DBF609C29D890C4E70@BYAPR11MB3030.namprd11.prod.outlook.com> X-IsSubscribed: yes |
Commit Message
Andrew Burgess
March 2, 2020, 12:31 p.m. UTC
Baris, Good spot on the *.h files, I hadn't considered them. I did look breifly at how I might change the mode only for *.h files, but couldn't see anything obvious, and as we don't currently have any *.c files I just restored the c-mode to c++-mode setting. Thanks, Andrew --- Copy the .dir-locls.el file from gdb/ to gdbserver/ so that we get the GNU style when editing these files in Emacs. I initially wanted to remove the (c-mode . ((mode . c++))) that switches c-mode files into c++-mode as we store C++ code in *.cc files in the gdbserver/ directory, unlike gdb/ where we use *.c, however, I was forgetting about the header files - we still use *.h for our C++ header files, so for now I left the settings in place to open all C files in c++-mode. The copyright date in the new file is left as for gdb/.dir-locals.el, as the new file is a copy of the old with just one new comment added, this is inline with this rule: https://sourceware.org/gdb/wiki/ContributionChecklist#Copyright_Header gdbserver/ChangeLog: * .dir-locals.el: New file. --- gdbserver/.dir-locals.el | 39 +++++++++++++++++++++++++++++++++++++++ gdbserver/ChangeLog | 4 ++++ 2 files changed, 43 insertions(+) create mode 100644 gdbserver/.dir-locals.el
Comments
On 3/2/20 12:31 PM, Andrew Burgess wrote: > Baris, > > Good spot on the *.h files, I hadn't considered them. I did look > breifly at how I might change the mode only for *.h files, but > couldn't see anything obvious, and as we don't currently have any *.c > files I just restored the c-mode to c++-mode setting. > > Thanks, > Andrew > > > --- > > Copy the .dir-locls.el file from gdb/ to gdbserver/ so that we get the > GNU style when editing these files in Emacs. I think we want this in gdbsupport/ as well? Since this is now just a plain copy with no modifications, can't we source the original file instead of copying it? Thanks, Pedro Alves
* Pedro Alves <palves@redhat.com> [2020-03-02 14:06:46 +0000]: > On 3/2/20 12:31 PM, Andrew Burgess wrote: > > Baris, > > > > Good spot on the *.h files, I hadn't considered them. I did look > > breifly at how I might change the mode only for *.h files, but > > couldn't see anything obvious, and as we don't currently have any *.c > > files I just restored the c-mode to c++-mode setting. > > > > Thanks, > > Andrew > > > > > > --- > > > > Copy the .dir-locls.el file from gdb/ to gdbserver/ so that we get the > > GNU style when editing these files in Emacs. > > I think we want this in gdbsupport/ as well? > > Since this is now just a plain copy with no modifications, can't we > source the original file instead of copying it? I'm not aware of a way to import one .dir-locals from another, I did some searching and couldn't find anything promising. Given that would you accept 3 copies of the file? Thanks, Andrew
On 3/2/20 5:08 PM, Andrew Burgess wrote: > * Pedro Alves <palves@redhat.com> [2020-03-02 14:06:46 +0000]: > >> On 3/2/20 12:31 PM, Andrew Burgess wrote: >>> Baris, >>> >>> Good spot on the *.h files, I hadn't considered them. I did look >>> breifly at how I might change the mode only for *.h files, but >>> couldn't see anything obvious, and as we don't currently have any *.c >>> files I just restored the c-mode to c++-mode setting. >>> >>> Thanks, >>> Andrew >>> >>> >>> --- >>> >>> Copy the .dir-locls.el file from gdb/ to gdbserver/ so that we get the >>> GNU style when editing these files in Emacs. >> >> I think we want this in gdbsupport/ as well? >> >> Since this is now just a plain copy with no modifications, can't we >> source the original file instead of copying it? > > I'm not aware of a way to import one .dir-locals from another, I did > some searching and couldn't find anything promising. > Let's ask an Emacs maintainer. Eli, what's the best way to handle this? > Given that would you accept 3 copies of the file? Thanks, Pedro Alves
> Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org> > From: Pedro Alves <palves@redhat.com> > Date: Mon, 2 Mar 2020 17:34:20 +0000 > > > I'm not aware of a way to import one .dir-locals from another, I did > > some searching and couldn't find anything promising. > > > > Let's ask an Emacs maintainer. > > Eli, what's the best way to handle this? Put a single file in the parent directory of those 3, I think.
On 3/2/20 5:58 PM, Eli Zaretskii wrote: >> Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org> >> From: Pedro Alves <palves@redhat.com> >> Date: Mon, 2 Mar 2020 17:34:20 +0000 >> >>> I'm not aware of a way to import one .dir-locals from another, I did >>> some searching and couldn't find anything promising. >>> >> >> Let's ask an Emacs maintainer. >> >> Eli, what's the best way to handle this? > > Put a single file in the parent directory of those 3, I think. Good point. This would affect all projects in the top level, though perhaps the file is right for all of them. OOC, if we wanted to say, source "../gdb/.dir-locals.el" from a gdbserver/.dir-locals.el file, would it be possible? I guess a symlink would do too. Except that might not work as nicely on Windows filesystems. Thanks, Pedro Alves
> Cc: andrew.burgess@embecosm.com, gdb-patches@sourceware.org > From: Pedro Alves <palves@redhat.com> > Date: Mon, 2 Mar 2020 18:12:53 +0000 > > > Put a single file in the parent directory of those 3, I think. > > Good point. This would affect all projects in the top level, > though perhaps the file is right for all of them. You can arrange for the settings to affect only some of the subdirectories, the Emacs manual shows an example of that. > OOC, if we wanted to say, source "../gdb/.dir-locals.el" from > a gdbserver/.dir-locals.el file, would it be possible? .dir-locals.el supports 'eval' forms, so you could in principle do anything there. But my advice is to stick to simplicity, for reasons of speed of visiting files, if nothing else. Also, maintaining such a tricky file would need an Emacs expert, something that is not guaranteed (although currently we have several on board). > I guess a symlink would do too. Except that might not work > as nicely on Windows filesystems. IME, symlinks in versioned directories are a PITA.
* Eli Zaretskii <eliz@gnu.org> [2020-03-02 21:19:18 +0200]: > > Cc: andrew.burgess@embecosm.com, gdb-patches@sourceware.org > > From: Pedro Alves <palves@redhat.com> > > Date: Mon, 2 Mar 2020 18:12:53 +0000 > > > > > Put a single file in the parent directory of those 3, I think. > > > > Good point. This would affect all projects in the top level, > > though perhaps the file is right for all of them. > > You can arrange for the settings to affect only some of the > subdirectories, the Emacs manual shows an example of that. I took a look at the examples, and, if I understand correctly I would need to do something like: (("gdb/" . ((tcl-mode . (... settings ...)) (nil . (... settings ...)) (c-mode . (... settings ...)) (c++-mode . (... settings ...)))) ("gdbserver/" . ((tcl-mode . (... settings ...)) (nil . (... settings ...)) (c-mode . (... settings ...)) (c++-mode . (... settings ...)))) ("gdbsupport/" . ((tcl-mode . (... settings ...)) (nil . (... settings ...)) (c-mode . (... settings ...)) (c++-mode . (... settings ...))))) As there's no easy way (I think) to define a list of settings then apply them to multiple directories. Given how rarely the .dir-locals files change, my instinct is to just add two new copies, and possibly ensure that all three versions of the file have a big comment saying "remember to update the other versions of this file located in ......". Thoughts welcome, thanks, Andrew > > > OOC, if we wanted to say, source "../gdb/.dir-locals.el" from > > a gdbserver/.dir-locals.el file, would it be possible? > > .dir-locals.el supports 'eval' forms, so you could in principle do > anything there. But my advice is to stick to simplicity, for reasons > of speed of visiting files, if nothing else. Also, maintaining such a > tricky file would need an Emacs expert, something that is not > guaranteed (although currently we have several on board). > > > I guess a symlink would do too. Except that might not work > > as nicely on Windows filesystems. > > IME, symlinks in versioned directories are a PITA.
> Date: Thu, 5 Mar 2020 15:12:32 +0000 > From: Andrew Burgess <andrew.burgess@embecosm.com> > Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org > > > > > Put a single file in the parent directory of those 3, I think. > > > > > > Good point. This would affect all projects in the top level, > > > though perhaps the file is right for all of them. > > > > You can arrange for the settings to affect only some of the > > subdirectories, the Emacs manual shows an example of that. > > I took a look at the examples, and, if I understand correctly I would > need to do something like: Yes, I think this is correct. > Given how rarely the .dir-locals files change, my instinct is to just > add two new copies, and possibly ensure that all three versions of the > file have a big comment saying "remember to update the other versions > of this file located in ......". I'm okay with that as well, if people prefer it.
On 3/5/20 3:26 PM, Eli Zaretskii wrote: >> Date: Thu, 5 Mar 2020 15:12:32 +0000 >> From: Andrew Burgess <andrew.burgess@embecosm.com> >> Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org >> >>>>> Put a single file in the parent directory of those 3, I think. >>>> >>>> Good point. This would affect all projects in the top level, >>>> though perhaps the file is right for all of them. >>> >>> You can arrange for the settings to affect only some of the >>> subdirectories, the Emacs manual shows an example of that. >> >> I took a look at the examples, and, if I understand correctly I would >> need to do something like: > > Yes, I think this is correct. Thanks for exploring this. > >> Given how rarely the .dir-locals files change, my instinct is to just >> add two new copies, and possibly ensure that all three versions of the >> file have a big comment saying "remember to update the other versions >> of this file located in ......". > > I'm okay with that as well, if people prefer it. Yes, let's do that. Thanks, Pedro Alves
diff --git a/gdbserver/.dir-locals.el b/gdbserver/.dir-locals.el new file mode 100644 index 00000000000..29c3d69869e --- /dev/null +++ b/gdbserver/.dir-locals.el @@ -0,0 +1,39 @@ +;; Emacs settings. +;; Copyright (C) 2012-2020 Free Software Foundation, Inc. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. + +;; This program 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 General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +( + (tcl-mode . ((tcl-indent-level . 4) + (tcl-continued-indent-level . 4) + (indent-tabs-mode . t))) + (nil . ((bug-reference-url-format . "http://sourceware.org/bugzilla/show_bug.cgi?id=%s"))) + ;; We store C++ headers in files matching *.h, which is usually for C + ;; headers, so here we arrange to switch all c-mode files into c++-mode. + (c-mode . ((c-file-style . "GNU") + (mode . c++) + (indent-tabs-mode . t) + (tab-width . 8) + (c-basic-offset . 2) + (eval . (c-set-offset 'innamespace 0)) + )) + (c++-mode . ((eval . (when (fboundp 'c-toggle-comment-style) + (c-toggle-comment-style 1))) + (indent-tabs-mode . t) + (tab-width . 8) + (c-file-style . "GNU") + (c-basic-offset . 2) + (eval . (c-set-offset 'innamespace 0)) + )) +)