Re: [Wireshark-dev] modelines
On Wed, Sep 28, 2011 at 01:51:05AM +, Chris Maynard wrote: however, I am wondering if 8 is simply used more than 4 because that's what the Wireshark modeline generation tool happens to default to, I believe the GNU standard is for an 8 space tabstop, but now I can't find a reference to back up that claim. Hence the inquiry about adding setq tab-width, [and implicitly indent-tabs-mode too). As more and more modelines get added, I was just thinking that it might be nice to have as many common editors covered as reasonably possible instead of adding some now and having to go back again to add more later. Can modelines be at the top of a file? The boiler plate copyright notice from doc/README.developer might be a good place to put it. I really like the modelines too; I guess I'm also lazy. Or prefer to work smarter than harder :) ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe
Re: [Wireshark-dev] modelines
Stephen Fisher wrote: Can modelines be at the top of a file? Yes, for vim (and I assume others). That's where I usually put them. The boiler plate copyright notice from doc/README.developer might be a good place to put it. I think that's a good approach. It may also be useful to think about settings for indent since we're on the topic. I don't have a strong view on what the settings should be, but something generally in line with the majority of existing Wireshark code would be useful IMHO. Ed ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe
Re: [Wireshark-dev] modelines
Chris Maynard wrote: Stephen Fisher steve@... writes: Since I started coding for Wireshark in 2006, the convention wisdom (as I understood it) has always been to stick with the formatting method that the file already has, whatever that may be. Right, but what if there's a file already consistently using tabs throughout, but with no current modelines? (Example: packet-igmp.c) What value to use for the tabstop, for example? It would seem that tabstop=8 is preferred, judging by the number of epan/dissectors/packet-*.c files using that value (54) as opposed to using tabstop=4 (3); however, I am wondering if 8 is simply used more than 4 because that's what the Wireshark modeline generation tool happens to default to, so I just wanted to check if that was in fact the recommendation or if it was just a somewhat arbitrary choice, and if arbitrary, then what the actual recommendation would be. I'll argue that *tab*stops should be 8 until someone shows me how to tell all the various terminal programs I end up using that the file I'm currently looking at (in 'less' or 'grep' or plain old 'cat') that the file in question is using an alternative tabstop. (Or until I'm blue in the face or dead or whatever ;-).) (I don't have strong opinions on the shiftwidth/indentsize. But tabstops should be 8. At least in my opinion ;-).) ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe
Re: [Wireshark-dev] modelines
On 9/28/2011 4:57 PM, Jeff Morriss wrote: I'll argue that *tab*stops should be 8 until someone shows me how to tell all the various terminal programs I end up using that the file I'm currently looking at (in 'less' or 'grep' or plain old 'cat') that the file in question is using an alternative tabstop. (Or until I'm blue in the face or dead or whatever ;-).) +5 ! ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe
Re: [Wireshark-dev] modelines
On Sep 28, 2011, at 2:21 PM, Bill Meier wrote: On 9/28/2011 4:57 PM, Jeff Morriss wrote: I'll argue that *tab*stops should be 8 until someone shows me how to tell all the various terminal programs I end up using that the file I'm currently looking at (in 'less' or 'grep' or plain old 'cat') that the file in question is using an alternative tabstop. (Or until I'm blue in the face or dead or whatever ;-).) +5 ! +10^(10^100) The UNIX tty driver, the default tab settings you get from e.g. tset, and the default tab settings in most if not all UN*X terminal emulators do 8-space tabs. (Xcode didn't get the memo, which is why http://www.opensource.apple.com/source/autofs/autofs-207/autofs.xcodeproj/project.pbxproj has a bunch of entries that say indentWidth = 8.) ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe
Re: [Wireshark-dev] modelines
Guy Harris guy@... writes: On Sep 28, 2011, at 2:21 PM, Bill Meier wrote: On 9/28/2011 4:57 PM, Jeff Morriss wrote: I'll argue that *tab*stops should be 8 until someone shows me how to tell all the various terminal programs I end up using that the file I'm currently looking at (in 'less' or 'grep' or plain old 'cat') that the file in question is using an alternative tabstop. (Or until I'm blue in the face or dead or whatever .) +5 ! +10^(10^100) The UNIX tty driver, the default tab settings you get from e.g. tset, and the default tab settings in most if not all UN*X terminal emulators do 8-space tabs. (Xcode didn't get the memo, which is why http://www.opensource.apple.com/source/autofs/autofs-207/autofs.xcodeproj/project.pbxproj has a bunch of entries that say indentWidth = 8.) Gerald has a table of official coding standards posted at http://www.wireshark.org/tools/modelines.html, and it looks like in the Microsoft world, 4 is the standard. But no matter, I took a chance that the defaults generated from that online tool were the preferred settings, so that's what I used in the r39178 commit to README.developer. Those defaults, by the way, are: shiftwidth=4 tabstop=8 and expandtab. In case those settings aren't actually preferred then we might want to decide quickly what we do want and make the change(s) soon before lots of people start submitting dissectors using that as the standard. - Chris ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe
Re: [Wireshark-dev] modelines
On Sep 28, 2011, at 6:14 PM, Chris Maynard wrote: Gerald has a table of official coding standards posted at http://www.wireshark.org/tools/modelines.html, and it looks like in the Microsoft world, 4 is the standard. ...but I think it can be changed to the UN*X standard in a global setting (unlike a certain IDE that runs on a certain UNIX system but that defaults to a non-UN*X setting and has no such global setting, grumble grumble). See, for example, the long discussion on the link for Microsoft Visual Studio 2010 and the complaints from people who need to be able to read the code on UN*X and VMS systems. I'm also not sure they're the same type of standard; there are standards within a project that say all code for this project must use these settings and there are settings within an IDE that default to some particular values. Most of the standards there are, I'm guessing, the first type; the ones for MSVC etc. seem to be of the second type. Perhaps their use means that they end up being standards of the first type for, say, various components of {Windows, Office, MSVC, etc.}, but that's another matter. ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe
[Wireshark-dev] modelines
A couple of questions/thoughts on modelines[1]: 1) Should emacs (and other) modelines be added to the generated modelines at [1], e.g., setq as mentioned by Zawinski[2]? 2) In the absence of any other user preference, what is the Wireshark recommendation on modeline settings, if any? The following seems to be the default settings generated at [1], so am I right to assume that would be the recommendation - at least for files with all (or mostly) spaces and tabs? /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=4 tabstop=8 expandtab: * :indentSize=4:tabSize=8:noTabs=true: */ And for files with all (or mostly) tabs instead of spaces, would the recommendation be to stick with tabs and adjust the modelines above slightly as follows: /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 4 * tab-width: 8 * indent-tabs-mode: t * End: * * vi: set shiftwidth=4 tabstop=8 noexpandtab: * :indentSize=4:tabSize=8:noTabs=false: */ Thanks. - Chris [1] http://www.wireshark.org/tools/modelines.html [2] http://www.jwz.org/doc/tabs-vs-spaces.html ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe
Re: [Wireshark-dev] modelines
On Tue, Sep 27, 2011 at 06:57:15PM +, Chris Maynard wrote: 2) In the absence of any other user preference, what is the Wireshark recommendation on modeline settings, if any? The following seems to be the default settings generated at [1], so am I right to assume that would be the recommendation - at least for files with all (or mostly) spaces and tabs? Since I started coding for Wireshark in 2006, the convention wisdom (as I understood it) has always been to stick with the formatting method that the file already has, whatever that may be. Emacs is pretty good about keeping the same indentation as the line above the one you're inserting, although it may differ in spaces vs. tabs. I'm one of the few fans of actual tabs. Whatever the preference, I think having mode lines is a great choice so we don't have to bother (we can be lazy) changing our editor/remembering to format it a certain way to keep it consistent :). ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe
Re: [Wireshark-dev] modelines
Stephen Fisher steve@... writes: Since I started coding for Wireshark in 2006, the convention wisdom (as I understood it) has always been to stick with the formatting method that the file already has, whatever that may be. Right, but what if there's a file already consistently using tabs throughout, but with no current modelines? (Example: packet-igmp.c) What value to use for the tabstop, for example? It would seem that tabstop=8 is preferred, judging by the number of epan/dissectors/packet-*.c files using that value (54) as opposed to using tabstop=4 (3); however, I am wondering if 8 is simply used more than 4 because that's what the Wireshark modeline generation tool happens to default to, so I just wanted to check if that was in fact the recommendation or if it was just a somewhat arbitrary choice, and if arbitrary, then what the actual recommendation would be. Emacs is pretty good about keeping the same indentation as the line above the one you're inserting, although it may differ in spaces vs. tabs. Hence the inquiry about adding setq tab-width, [and implicitly indent-tabs-mode too). As more and more modelines get added, I was just thinking that it might be nice to have as many common editors covered as reasonably possible instead of adding some now and having to go back again to add more later. I'm one of the few fans of actual tabs. Whatever the preference, I think having mode lines is a great choice so we don't have to bother (we can be lazy) changing our editor/remembering to format it a certain way to keep it consistent :). I really like the modelines too; I guess I'm also lazy. ___ Sent via:Wireshark-dev mailing list wireshark-dev@wireshark.org Archives:http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe