2017-09-14 5:10 GMT+09:00 Bram Moolenaar <b...@moolenaar.net>: > > Kazunobu Kuriyama wrote: > > > 2017-09-05 18:16 GMT+09:00 Kazunobu Kuriyama < > kazunobu.kuriy...@gmail.com>: > > > > > 2017-09-05 5:24 GMT+09:00 Bram Moolenaar <b...@moolenaar.net>: > > > > > >> > > >> Kazunobu Kuriyama wrote: > > >> > > >> > The purpose of this patch is to make it easier for devs to write > tests > > >> > having branch conditions for macOS. > > >> > > > >> > So far, to cover all possible builds for macOS, the correct > condition is > > >> > "has('mac') || has('osx')". Yet, unfortunately, it has been > something > > >> easy > > >> > to forget. > > >> > > > >> > This issue itself was discussed last May in the context of an > argument > > >> on > > >> > discontinuation of the support for the Carbon GUI, and we reached an > > >> > agreement approving the proposed change in feature list items to > address > > >> > the issue (IIRC). > > >> > > > >> > In conjunction with that, I wrote a document on mac-darwin-ffeature > and > > >> > sent a patch for that to vim_dev. While the patch was included, I > > >> somehow > > >> > forgot to send out a patch for the mentioned change. > > >> > > > >> > Having seen the test included with Patch 8.0.1049 failed with > non-darwin > > >> > builds, I remembered what I forgot. > > >> > > > >> > Attached is a patch for the proposed change. It is made against > HEAD. > > >> > > > >> > Briefly, with the proposed patch, the relevant feature list items > will > > >> > change from: > > >> > > > >> > mac Any Macintosh version of Vim, but not all OS X. > > >> > macunix Compiled for OS X, with |mac-darwin-feature| > > >> > osx Compiled for OS X, with or w/o |mac-darwin-feature| > > >> > > > >> > to: > > >> > > > >> > mac Any Macintosh version of Vim > > >> > macunix Compiled for OS X, with |mac-darwin-feature| > > >> > osx Compiled for OS X, without |mac-darwin-feature| > > >> > > >> I think the "osx" here is very confusing. It should just mean "any > > >> version of OS X". > > >> > > > > > > Agreed. With my new patch attached to this email, has('osx') always > > > returns 1 regardless of whether the darwin feature is compiled in, if > Vim > > > was built on macOS. > > > > > > > > >> For the others: Is it clear how to add a check for a specific version, > > >> no matter if Vim is before or after this change? > > >> > > > > > > With the modification mentioned above, I think it will get clearer if > the > > > change is included. With it, we'll have > > > > > > mac Any Macintosh version of Vim > > > osx Any macOS version of Vim > > > macdarwin Compiled for macOS with |mac-darwin-feature| > > > macunix (ditto) > > > > > > > > >> > > >> I'm not sure why "mac" was "not all OS X"? What was excluded, and did > > >> anybody rely on that? It's certainly easier to understand. > > >> > > > > > > I'm not, either. Though it may sound a joke, it is the fact that > > > has('mac') of the system-installed Vim returns 0 on macOS, since the > darwin > > > feature is not compiled in. Probably, they don't like to see what they > > > think the Vi text editor dependent on an Objective-C runtime to support > > > GUI. In fact, +clipboard is implemented with the NSPasteboard class > which > > > belongs to AppKit, the GUI part of the Cocoa framework. > > > > > > I guess, when the feature was included, there was a reasonable > expectation > > > that non-darwin build would soon disappear, thereby people might have > > > thought the feature would prevail and thus no need to let 'mac' cover > all > > > possible builds...I don't know. Anyway, I think it's a good chance to > > > address the issue on this occasion. > > > > > > > > >> > > >> Perhaps it makes sense to add "macdarwin". It's still a bit confusing > > >> compared to "macunix", and redundant. But it's useful for code where > > >> the darwin feature is required. > > >> > > > > > > I like the idea. I added 'macdarwin' to the feature list and revised > some > > > part of the test suite and the documents accordingly. I hope now you > can > > > see easily whether the addition is worth having. > > > > > > Best regards, > > > Kazunobu > > > > > > > > Hi Bram, > > > > Have you made a decision what to do with the patch? Since it hasn't even > > been listed in the todo list so far, I'm wondering what has happened to > > it. While I'm still open to further review and improvement, since I > can't > > see any obvious deficiency in it, I don't know what to do next. I'd be > > happy if you would look into it at your convenience. > > It's in my local copy of the todo list. I need to take another look, > but it's probably OK to include now. >
Since the patch isn't meant for a hot fix for users' convenience, it's fine to me to work for it steadily without haste. Rather, if you find anything doubtful with it, please stop inclusion and ask me for improvement. Let's get it right all at once on this occasion. For convenience, let me recap the points of the patch: 1. For all Vim on Mac, let has('mac') return 1. Currently, non-darwin Vim returns 0. 2. To attain the above, define MACOS_X for all builds on macOS. Currently, it is defined __only if__ MACOS_X_UNIX is defined (vim.h:97), and this counter-intuitive transposition is the root cause of the headache. 3. Stop using MACOS_X as a substitute of MACOS_X_UNIX. Use the latter specifically and explicitly only if/when a given code path uses any of the functions of os_macosx.m or os_mac_conv.c, i.e, the darwin feature. For concrete examples, please refer to lines 306 and 315 of the proposed patch mac-feature-list.updated.patch. 4. With the patch, MACOS will be defined for all builds on any of Mac; MACOS_X for all builds on macOS; MACOS_X_UNIX only for darwin-feature enabled builds. Those constant macros will correspond to 'mac', 'osx', and 'macunix', respectively. 5. Add an new feature list item called 'macdarwin'. It's a synonym of 'macunix'. But with this addiction, people can see the correspondence between --disable-darwin at configure and has('macdarwin') at runtime quite easily in comparison with the current pair --disable-dawrin and has('macunix'). Kazunobu > -- > hundred-and-one symptoms of being an internet addict: > 113. You are asked about a bus schedule, you wonder if it is 16 or 32 bits. > > /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net > \\\ > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ > \\\ > \\\ an exciting new programming language -- http://www.Zimbu.org > /// > \\\ help me help AIDS victims -- http://ICCF-Holland.org > /// > -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.