|
From: | Ergus |
Subject: | Re: C style alist question? |
Date: | Thu, 11 Apr 2019 03:16:59 +0200 |
User-agent: | NeoMutt/20180716 |
(I send to both mailing lists because it is related with a previous thread, but the right destination for this mail is the devels mailing list) Hi guys: The issue I was facing with indentations was related actually with the fact that once an offset is set (for example in the init file) it is ignored in some cases by c-set-style because it is not "from style" anymore. Does it makes sense (or is not too difficult) to provide an option (or a parameter in c-set-style) that allows the user to overwrite all the previous offsets with the values from the new style, in spite of if it is not "from style"? Maybe it already exist? Another question: Actually emacs C indentation with tabs follows the following policy: It add as many tabs as possible and then align with spaces until the desired column is reached. ==================== -------> is a tab . is a space ==================== ``` int function(int var1, ------->.....double b, ------->.....double c) { ------->for (int i = 0; i < 10; ++i) ------->------->myprintf ("%d\n", ------->------->------->..i); } ``` But other common policies around are: 1) add only tabs (and ignore the small mismatch in some cases) int function(int var1, ------->double b, ------->double c) { ------->for (int i = 0; i < 10; ++i) ------->------->myprintf ("%d\n", ------->------->------->i); } 2) Use tabs (but only for indentation) and spaces to align int function(int var1, .............double b) { ------->for (int i = 0; i < 10; ++i) ------->------->myprintf ("%d\n", ------->------->..........i); } The last one is specially useful in C++ where templates and long type names usually forces to break functions and expressions (and templated types inside functions declarations) on multiple lines; because they keep the alignment in different editors (or different emacs with different tab-width). Is it some variable/policy or method to produce 1 or 2 with what is already there?? Thanks in advance, Ergus. On Sat, Apr 06, 2019 at 09:48:19AM +0300, Eli Zaretskii wrote:
Date: Sat, 6 Apr 2019 05:26:38 +0200 From: Ergus <spacibba@aol.com> I usually edit code in two styles; the linux kernel style and now the emacs style. But I have seen that there are some mismatches between the style alists and the "official" styles.Sorry, I don't understand what are "style alists" and the "official styles". Please elaborate on that.For example: When I open an emacs' C source code I see details like the fill-column is 70 instead of 78. In the kernel style the indent-tabs-mode is not set to t.Our style is defined by the .dir-locals.el file you see in the repository. indent-tabs-mode is t only in Emacs Lisp mode.So, is it possible to fix this in order to bring a better and easier user initial experience with the right default values?Fix how? Change our style? I think that'd be a hard change to sell, because the current defaults were discussed several times and are a kind of compromise between different preferences, but you need to raise this on emacs-devel, not here.
[Prev in Thread] | Current Thread | [Next in Thread] |