Closed Bug 1590131 Opened 5 months ago Closed 5 months ago

Add *correct/proper* emacs mode line to *.cpp and *.h files in the C-C TB source tree.

Categories

(MailNews Core :: General, enhancement)

enhancement
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 72.0

People

(Reporter: ishikawa, Assigned: ishikawa)

Details

Attachments

(1 file)

Now that C-C source tree has been reformatted according to google-like style using clang-format, we want correct Emacs mode line for C++ source files.

Right now, we have the following modelines under, say, comm/mailnews:
I search for them and sort them and print the number of occurrences.
(The one I listed in dev-apps-thunderbird mailing list showed more than the following due to a slightly relaxed file name pattern match.)

find mailnews -type f -name ".[cph]" -print | xargs fgrep -h -- '--' | sort | uniq -c
1 /
-- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 --
1 C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -- /
1 # -
- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -
-
1 /* -- Mode:
1 /
-- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -- /
2 /
-- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -- /
15 /
-- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 --
261 /* -- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -- /
4 /
-- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -- /
2 /
-- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 --
85 /* -- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -- /
4 /
-- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 --
119 /* -- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -- /
18 /
-- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -- /
1 /
-- Mode: C; tab-width: 4 --
8 /* -- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 --
92 /* -- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -- /
1 /
-- Mode: idl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 --
1 print '''/* -- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -- */

(Actually, the pattern [cph]* ought to be [cph][cph]*: I am listing a bit too many files..)

I THINK the correct mode line is indeed the most popular

/* -- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -- */

There are python and IDL generated files, it seems and I will keep them untouched.

I think I will work on mailnews directory most in the rest of the year, and so I will modify only the files under that directory. Other directories (except for ldap) seem to be under better control in this regard.

The attached patch only touches the files under comm/mailnews subdirectory, but I believe this is enough for now.

The patch has been submitted for tryserver and it builds there. (It builds under my local linux environment, too, of course.)

https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=6c8dd913d9a0bd9f37ec5918c00ba2636e2dc6ee

A few test errors reported are visible also on other people's jobs. So I am not worried.
E.g.: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=ca4db600d0db143e23a66cf39e38b1490a5d7e34

The patch here is simply the comment only changes.

TIA

Assignee: nobody → ishikawa
Comment on attachment 9103015 [details] [diff] [review]
Correct emacs mode line for the latest clang-format coding style

Review of attachment 9103015 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks, I'll get this landed.
Attachment #9103015 - Flags: review+
Keywords: checkin-needed
Target Milestone: --- → Thunderbird 72.0
Comment on attachment 9103015 [details] [diff] [review]
Correct emacs mode line for the latest clang-format coding style

Review of attachment 9103015 [details] [diff] [review]:
-----------------------------------------------------------------

I'll fix the following issues before landing this.

::: mailnews/mime/src/mimeunty.cpp
@@ +1,1 @@
> +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */

Since these are all C++ files, I think we should add Mode: C++. I'll fix this.

::: mailnews/mime/src/modmimee.h
@@ +1,5 @@
>  /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
>  /* This Source Code Form is subject to the terms of the Mozilla Public
>   * License, v. 2.0. If a copy of the MPL was not distributed with this
>   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
> +/* 

Trailing space here. I'll fix it.

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/65b0b80b1b8f
Correct emacs mode line in C++ files. r=jorgk

Status: NEW → RESOLVED
Closed: 5 months ago
Keywords: checkin-needed
Resolution: --- → FIXED

Thank you!

Component: Untriaged → General
Product: Thunderbird → MailNews Core
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/74bd1f64906a
Follow-up: Reformat. rs=reformat
You need to log in before you can comment on or make changes to this bug.