* tabs v spaces in Emacs's source files @ 2008-03-07 4:33 Glenn Morris 2008-03-07 4:44 ` Miles Bader ` (2 more replies) 0 siblings, 3 replies; 20+ messages in thread From: Glenn Morris @ 2008-03-07 4:33 UTC (permalink / raw) To: emacs-devel Is there a convention on whether tabs or spaces should be used to indent Emacs's source files, or is it up to the maintainer of a given file? I don't want to propose one or the other, just ask if there's a standard. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 4:33 tabs v spaces in Emacs's source files Glenn Morris @ 2008-03-07 4:44 ` Miles Bader 2008-03-07 10:19 ` Andreas Schwab 2008-03-08 17:40 ` Richard Stallman 2 siblings, 0 replies; 20+ messages in thread From: Miles Bader @ 2008-03-07 4:44 UTC (permalink / raw) To: Glenn Morris; +Cc: emacs-devel Glenn Morris <rgm@gnu.org> writes: > Is there a convention on whether tabs or spaces should be used to > indent Emacs's source files, or is it up to the maintainer of a given > file? I don't want to propose one or the other, just ask if there's a > standard. Generally it's both. I've noticed some files use mainly spaces, presumably because the original author did, but over time things to fuzz out as people with different settings edit the code. Mostly it doesn't really matter I think.... -Miles -- In New York, most people don't have cars, so if you want to kill a person, you have to take the subway to their house. And sometimes on the way, the train is delayed and you get impatient, so you have to kill someone on the subway. [George Carlin] ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 4:33 tabs v spaces in Emacs's source files Glenn Morris 2008-03-07 4:44 ` Miles Bader @ 2008-03-07 10:19 ` Andreas Schwab 2008-03-07 11:18 ` Juanma Barranquero 2008-03-08 17:40 ` Richard Stallman 2 siblings, 1 reply; 20+ messages in thread From: Andreas Schwab @ 2008-03-07 10:19 UTC (permalink / raw) To: Glenn Morris; +Cc: emacs-devel Glenn Morris <rgm@gnu.org> writes: > Is there a convention on whether tabs or spaces should be used to > indent Emacs's source files, or is it up to the maintainer of a given > file? I don't want to propose one or the other, just ask if there's a > standard. The Emacs source should generally follow the GNU Coding Standards <http://www.gnu.org/prep/standards/>. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 10:19 ` Andreas Schwab @ 2008-03-07 11:18 ` Juanma Barranquero 2008-03-07 12:28 ` Pete Forman 0 siblings, 1 reply; 20+ messages in thread From: Juanma Barranquero @ 2008-03-07 11:18 UTC (permalink / raw) To: Andreas Schwab; +Cc: Glenn Morris, emacs-devel On Fri, Mar 7, 2008 at 11:19 AM, Andreas Schwab <schwab@suse.de> wrote: > The Emacs source should generally follow the GNU Coding Standards > <http://www.gnu.org/prep/standards/>. Where does it say whether to use tabs or spaces? (I never seem to find that section.) Whatever the coding guidelines says, an extremely informal count suggests that of the non-empty lines with start with an indentation >= 8, about 8% of them use spaces in C code, and about 16% use spaces in elisp code. So tab use is most common, but there are enough spaces (we're talking literaly about tens of thousands of lines) to suggest that Miles is right: it doesn't really matter... Juanma ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 11:18 ` Juanma Barranquero @ 2008-03-07 12:28 ` Pete Forman 2008-03-07 14:56 ` Juanma Barranquero 0 siblings, 1 reply; 20+ messages in thread From: Pete Forman @ 2008-03-07 12:28 UTC (permalink / raw) To: emacs-devel "Juanma Barranquero" <lekktu@gmail.com> writes: > On Fri, Mar 7, 2008 at 11:19 AM, Andreas Schwab <schwab@suse.de> wrote: > >> The Emacs source should generally follow the GNU Coding Standards >> <http://www.gnu.org/prep/standards/>. > > Where does it say whether to use tabs or spaces? (I never seem to find > that section.) http://www.gnu.org/prep/standards/html_node/Errors.html#Errors That is talking about compiler messages and column numbers. Working backwards, that implies that source files may contain hard tabs, which are size 8. I did not see anything which says which says whether hard tabs _should_ be used or not. -- Pete Forman -./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent pete.forman@westerngeco.com -./\.- the opinion of Schlumberger or http://petef.22web.net -./\.- WesternGeco. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 12:28 ` Pete Forman @ 2008-03-07 14:56 ` Juanma Barranquero 2008-03-07 15:02 ` Johan Bockgård 0 siblings, 1 reply; 20+ messages in thread From: Juanma Barranquero @ 2008-03-07 14:56 UTC (permalink / raw) To: Pete Forman; +Cc: emacs-devel On Fri, Mar 7, 2008 at 1:28 PM, Pete Forman <pete.forman@westerngeco.com> wrote: > That is talking about compiler messages and column numbers. Working > backwards, that implies that source files may contain hard tabs, which > are size 8. I did not see anything which says which says whether hard > tabs _should_ be used or not. Which, alas, adds no information: in absence of explicit guidelines, it should be safe to assume that either spaces or tabs can be used... Thanks for finding that paragraph, though. Juanma ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 14:56 ` Juanma Barranquero @ 2008-03-07 15:02 ` Johan Bockgård 2008-03-07 15:10 ` Juanma Barranquero 0 siblings, 1 reply; 20+ messages in thread From: Johan Bockgård @ 2008-03-07 15:02 UTC (permalink / raw) To: emacs-devel "Juanma Barranquero" <lekktu@gmail.com> writes: > Which, alas, adds no information: in absence of explicit guidelines, > it should be safe to assume that either spaces or tabs can be used... Is this explicit enough? * Indent each function with `C-M-q' (`indent-sexp') using the default indentation parameters. (info "(elisp) Coding Conventions") -- Johan Bockgård ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 15:02 ` Johan Bockgård @ 2008-03-07 15:10 ` Juanma Barranquero 2008-03-07 17:11 ` Karl Fogel 2008-03-07 17:21 ` Drew Adams 0 siblings, 2 replies; 20+ messages in thread From: Juanma Barranquero @ 2008-03-07 15:10 UTC (permalink / raw) To: emacs-devel On Fri, Mar 7, 2008 at 4:02 PM, Johan Bockgård <bojohan+news@dd.chalmers.se> wrote: > Is this explicit enough? > > * Indent each function with `C-M-q' (`indent-sexp') using the > default indentation parameters. > > (info "(elisp) Coding Conventions") Not really. Even if "default indentation parameters" means using `indent-tabs-mode' set to t, that does not talk about the C code and `c-indent-sexp'. But anyway, the point is that there's a lot of code using spaces. If there's a real interest in using only tabs, I'd suggest start adding indent-tabs-mode cookies to local variables sections. Juanma ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 15:10 ` Juanma Barranquero @ 2008-03-07 17:11 ` Karl Fogel 2008-03-08 0:38 ` Juanma Barranquero ` (2 more replies) 2008-03-07 17:21 ` Drew Adams 1 sibling, 3 replies; 20+ messages in thread From: Karl Fogel @ 2008-03-07 17:11 UTC (permalink / raw) To: Juanma Barranquero; +Cc: emacs-devel "Juanma Barranquero" <lekktu@gmail.com> writes: > But anyway, the point is that there's a lot of code using spaces. If > there's a real interest in using only tabs, I'd suggest start adding > indent-tabs-mode cookies to local variables sections. I very much prefer spaces, because they're diff-safe (for example, in commit emails). With TABs, an unlucky indentation boundary can cause code to jump many display columns to the right, due to the "+"/"-" column along the left edge of the diff. This makes reading diffs of TAB-indented code a dicey game. -Karl ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 17:11 ` Karl Fogel @ 2008-03-08 0:38 ` Juanma Barranquero 2008-03-08 12:58 ` Eli Zaretskii 2008-03-08 21:13 ` Bill Wohler 2 siblings, 0 replies; 20+ messages in thread From: Juanma Barranquero @ 2008-03-08 0:38 UTC (permalink / raw) To: Karl Fogel; +Cc: emacs-devel On Fri, Mar 7, 2008 at 6:11 PM, Karl Fogel <kfogel@red-bean.com> wrote: > I very much prefer spaces, because they're diff-safe (for example, in > commit emails). I do too. I have indent-tabs-mode set to nil, and I have code in my .emacs to detect when I'm editing Emacs source code so it can be locally set to t. Juanma ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 17:11 ` Karl Fogel 2008-03-08 0:38 ` Juanma Barranquero @ 2008-03-08 12:58 ` Eli Zaretskii 2008-03-08 20:52 ` Stefan Monnier 2008-03-08 21:13 ` Bill Wohler 2 siblings, 1 reply; 20+ messages in thread From: Eli Zaretskii @ 2008-03-08 12:58 UTC (permalink / raw) To: Karl Fogel; +Cc: emacs-devel > From: Karl Fogel <kfogel@red-bean.com> > Date: Fri, 07 Mar 2008 12:11:36 -0500 > Cc: emacs-devel@gnu.org > > "Juanma Barranquero" <lekktu@gmail.com> writes: > > But anyway, the point is that there's a lot of code using spaces. If > > there's a real interest in using only tabs, I'd suggest start adding > > indent-tabs-mode cookies to local variables sections. > > I very much prefer spaces, because they're diff-safe (for example, in > commit emails). Whatever people prefer, we should IMO use a consistent indentation rules in Emacs. Personally, I prefer the Emacs defaults, but if the head maintainers prefer a different scheme, I will not object. In any case, the current situation of inconsistent use of spaces and TABs is IMO much worse than any of the consistent alternatives. AFAIU, the GNU Coding Standards call for consistency wrt issues of style: The rest of this section gives our recommendations for other aspects of C formatting style, which is also the default style of the `indent' program in version 1.2 and newer. It corresponds to the options -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob We don't think of these recommendations as requirements, because it causes no problems for users if two different programs have different formatting styles. But whatever style you use, please use it consistently, since a mixture of styles within one program tends to look ugly. If you are contributing changes to an existing program, please follow the style of that program. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-08 12:58 ` Eli Zaretskii @ 2008-03-08 20:52 ` Stefan Monnier 0 siblings, 0 replies; 20+ messages in thread From: Stefan Monnier @ 2008-03-08 20:52 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Karl Fogel, emacs-devel > Whatever people prefer, we should IMO use a consistent indentation > rules in Emacs. space-vs-tabs-vs-aliens doesn't matter, as long as it's indented to the right position. That's my opinion on this matter. > In any case, the current situation of inconsistent use of spaces and > TABs is IMO much worse than any of the consistent alternatives. It's completely irrelevant and a waste of time to even discuss it. Please stop, Stefan ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 17:11 ` Karl Fogel 2008-03-08 0:38 ` Juanma Barranquero 2008-03-08 12:58 ` Eli Zaretskii @ 2008-03-08 21:13 ` Bill Wohler 2008-03-08 23:56 ` Miles Bader 2008-03-09 16:39 ` Richard Stallman 2 siblings, 2 replies; 20+ messages in thread From: Bill Wohler @ 2008-03-08 21:13 UTC (permalink / raw) To: emacs-devel Karl Fogel <kfogel@red-bean.com> writes: > "Juanma Barranquero" <lekktu@gmail.com> writes: >> But anyway, the point is that there's a lot of code using spaces. If >> there's a real interest in using only tabs, I'd suggest start adding >> indent-tabs-mode cookies to local variables sections. > > I very much prefer spaces, because they're diff-safe (for example, in > commit emails). > > With TABs, an unlucky indentation boundary can cause code to jump many > display columns to the right, due to the "+"/"-" column along the left > edge of the diff. This makes reading diffs of TAB-indented code a dicey > game. In addition to generating unreadable diffs, tabbed programs also produce unreadable output in a terminal window or when printed. spaces *= Integer.MAX_VALUE; -- Bill Wohler <wohler@newt.com> http://www.newt.com/wohler/ GnuPG ID:610BD9AD ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-08 21:13 ` Bill Wohler @ 2008-03-08 23:56 ` Miles Bader 2008-03-09 16:39 ` Richard Stallman 1 sibling, 0 replies; 20+ messages in thread From: Miles Bader @ 2008-03-08 23:56 UTC (permalink / raw) To: Bill Wohler; +Cc: emacs-devel Bill Wohler <wohler@newt.com> writes: >> With TABs, an unlucky indentation boundary can cause code to jump many >> display columns to the right, due to the "+"/"-" column along the left >> edge of the diff. This makes reading diffs of TAB-indented code a dicey >> game. > > In addition to generating unreadable diffs, tabbed programs also > produce unreadable output in a terminal window or when printed. Are we done with the silly hyperbole now? -Miles -- Faith, n. Belief without evidence in what is told by one who speaks without knowledge, of things without parallel. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-08 21:13 ` Bill Wohler 2008-03-08 23:56 ` Miles Bader @ 2008-03-09 16:39 ` Richard Stallman 1 sibling, 0 replies; 20+ messages in thread From: Richard Stallman @ 2008-03-09 16:39 UTC (permalink / raw) To: Bill Wohler; +Cc: emacs-devel In addition to generating unreadable diffs, tabbed programs also produce unreadable output in a terminal window or when printed. If you are trying to argue for eliminating tabs in GNU source code, I certainly won't do that, so there is no use arguing for it. Please understand that this question is already decided. ^ permalink raw reply [flat|nested] 20+ messages in thread
* RE: tabs v spaces in Emacs's source files 2008-03-07 15:10 ` Juanma Barranquero 2008-03-07 17:11 ` Karl Fogel @ 2008-03-07 17:21 ` Drew Adams 2008-03-08 13:00 ` Eli Zaretskii 1 sibling, 1 reply; 20+ messages in thread From: Drew Adams @ 2008-03-07 17:21 UTC (permalink / raw) To: emacs-devel I don't know whether the coding standard is strict in preferring TAB characters, or why it would be. And I don't know if it is cast in concrete or is open to suggestions. When we post patches, we generally create them using `diff -c -w' AFAIK, which would seem to suggest an agnostic (or at least a loose) approach to indenting whitespace. FWIW, I prefer to work with code that uses TAB characters only where they are pertinent - e.g. in strings. IOW, I use spaces for indenting. Turning on highlighting of TAB chars then shows me only the places where a TAB character is really important. I like those TABS to stand out; I don't like the noise that comes from TABs used just to indent code. Just one opinion. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 17:21 ` Drew Adams @ 2008-03-08 13:00 ` Eli Zaretskii 2008-03-08 23:19 ` Drew Adams 0 siblings, 1 reply; 20+ messages in thread From: Eli Zaretskii @ 2008-03-08 13:00 UTC (permalink / raw) To: Drew Adams; +Cc: emacs-devel > From: "Drew Adams" <drew.adams@oracle.com> > Date: Fri, 7 Mar 2008 09:21:55 -0800 > > When we post patches, we generally create them > using `diff -c -w' AFAIK, which would seem to suggest an agnostic (or at > least a loose) approach to indenting whitespace. Actually, you should drop the -w when you generate patches, because it causes trouble for Patch (unless the -l switch to Patch is used, which is easily forgotten). ^ permalink raw reply [flat|nested] 20+ messages in thread
* RE: tabs v spaces in Emacs's source files 2008-03-08 13:00 ` Eli Zaretskii @ 2008-03-08 23:19 ` Drew Adams 2008-03-09 2:40 ` Stefan Monnier 0 siblings, 1 reply; 20+ messages in thread From: Drew Adams @ 2008-03-08 23:19 UTC (permalink / raw) To: 'Eli Zaretskii'; +Cc: emacs-devel > > When we post patches, we generally create them > > using `diff -c -w' AFAIK, which would seem to suggest an > > agnostic (or at least a loose) approach to indenting whitespace. > > Actually, you should drop the -w when you generate patches, because it > causes trouble for Patch (unless the -l switch to Patch is used, which > is easily forgotten). Really? I seem to recall someone mentioning here that -c -w was what was preferred. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-08 23:19 ` Drew Adams @ 2008-03-09 2:40 ` Stefan Monnier 0 siblings, 0 replies; 20+ messages in thread From: Stefan Monnier @ 2008-03-09 2:40 UTC (permalink / raw) To: Drew Adams; +Cc: 'Eli Zaretskii', emacs-devel >> > When we post patches, we generally create them >> > using `diff -c -w' AFAIK, which would seem to suggest an >> > agnostic (or at least a loose) approach to indenting whitespace. >> >> Actually, you should drop the -w when you generate patches, because it >> causes trouble for Patch (unless the -l switch to Patch is used, which >> is easily forgotten). > Really? I seem to recall someone mentioning here that -c -w was what was > preferred. I generally prefer "-u -w" when it's a patch for review. And "-u" when it's a request to apply the patch. Stefan ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: tabs v spaces in Emacs's source files 2008-03-07 4:33 tabs v spaces in Emacs's source files Glenn Morris 2008-03-07 4:44 ` Miles Bader 2008-03-07 10:19 ` Andreas Schwab @ 2008-03-08 17:40 ` Richard Stallman 2 siblings, 0 replies; 20+ messages in thread From: Richard Stallman @ 2008-03-08 17:40 UTC (permalink / raw) To: Glenn Morris; +Cc: emacs-devel Is there a convention on whether tabs or spaces should be used to indent Emacs's source files, or is it up to the maintainer of a given file? I don't want to propose one or the other, just ask if there's a standard. You may as well always tabs, since they save space, and avoiding them in any one file does no good. Texinfo files are an exception; they are input for TeX so they should not have tabs. Texinfo mode takes care of that. ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2008-03-09 16:39 UTC | newest] Thread overview: 20+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-03-07 4:33 tabs v spaces in Emacs's source files Glenn Morris 2008-03-07 4:44 ` Miles Bader 2008-03-07 10:19 ` Andreas Schwab 2008-03-07 11:18 ` Juanma Barranquero 2008-03-07 12:28 ` Pete Forman 2008-03-07 14:56 ` Juanma Barranquero 2008-03-07 15:02 ` Johan Bockgård 2008-03-07 15:10 ` Juanma Barranquero 2008-03-07 17:11 ` Karl Fogel 2008-03-08 0:38 ` Juanma Barranquero 2008-03-08 12:58 ` Eli Zaretskii 2008-03-08 20:52 ` Stefan Monnier 2008-03-08 21:13 ` Bill Wohler 2008-03-08 23:56 ` Miles Bader 2008-03-09 16:39 ` Richard Stallman 2008-03-07 17:21 ` Drew Adams 2008-03-08 13:00 ` Eli Zaretskii 2008-03-08 23:19 ` Drew Adams 2008-03-09 2:40 ` Stefan Monnier 2008-03-08 17:40 ` Richard Stallman
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.