Description of the Mode: diet_mode for the jed editor is an editing mode which, from a supplied data file of nutritional values for about 1200 foods, will calculate and print out the accumulated results of the intake of various nutritional components from your daily diet by parsing the open buffer where you have entered your day's consumption of foods along with their quantities. It will also print out how this intake stacks up to the official recommended intakes of each nutritional component so that the whole, woeful picture of your diet flies right in your face! But that's the starting point for change, right? It should be useful for any of the following objectives: - Get a general picture of the nutritional adequacy of your diet - If shifting to a specific dietary regime, like e.g. a vegan one, it may help to compose your diet so that it fulfills your needs. - It may help you to stay off fad diets, like e.g the Atkins Diet, when you see what such a diet actually does to your organism. - Lose weight Action Keys: In the diet buffer: : Enter values for a new food to the user's data file. : Compare nutritional values of 1-4 foods side by side. : Filter foods by name or category. : Pop up buffer with the calculated nutritional values of your diet. In the results buffer: : pop up a list of foods sorted by max values of the nutrient in the current line. Required Files: - The Jed editor - slsh (SLang shell) On a Debian/Ubuntu system, you will install them with sudo apt install jed slsh On other systems, slsh may be part of the SLang library and thus installed automatically with the jed editor. Installation: This assumes that you have downloaded the archive file, diet_mode.tar.gz, to your home directory and that the jed editor's library files are located in /usr/share/jed/lib. They may be in /usr/local/share/jed/lib, so change accordingly. Step 6) will move a ".jedrc" file to your home directory. If you already have one, then make sure it is not overwritten! 1) cd 2) tar xfv diet_mode.tar.gz 3) sudo mv diet_mode.sl /usr/share/jed/lib/ (edit the values for your weight, height, etc. in the file, "jedrc". See under Customization:) 4) mv -i jedrc .jedrc Note the dot in ".jedrc". Then give your diet file the extension ".diet", e.g. "my.diet", then the mode will be automatically loaded when you read the diet file into the editor. Otherwise, you may load the mode from within jed with -X diet_mode. 5) jed my.diet Customization: In your ~/.jedrc, insert or edit the following lines to match your profile: variable Age = 40; variable Weight = 75; % kilos variable Height = 1.8; % metres variable Gender = "male"; variable PAL = 1.6; The variable "PAL" refers to your (P)hysical (A)ctivity (L)evel and is a factor in calculating your body's daily energy requirement in kJ,. It may be one of 1.4, if you have a sedentary lifestyle both in and out of work. 1.6, if you have a medium activity level 1.8, if you have hard physical work or regular hard exercise. If you have a really, really immobile lifestyle, you may even want to set it to 1.2 Gender may be "male" or "female". Another variable is available for Danish users: variable Diet_Dansk = 1; will use the Danish data file instead of the English. Files: In addition to this README file, the Copyright.txt file and the program extension file, diet_mode.sl, itself, two other (hidden) files are supplied 1) .diet.dat 2) .diet_da.dat 3) .diet_limits.dat The first one, ".diet.dat", is a comma separated value (csv) file with nutritional data for about 1200 foods. The values in this file is the work of the Danish Technical University and is copyrighted. It must only be redistributed with its original data. Please see the Copyright.txt file for more information about this file. The second one is the same as the first, but in a Danish language version for Danish users. The third one, ".diet_limits.dat", is a csv file which contains values for recommended intakes of 34 different nutrients, adjusted for gender and age. It also contains values for upper (possibly toxic) limits and lowest healthy limits for intakes of said nutrients. This file is under the same copyright as the program extension file, i.e. the GPL, version 2 or later, and therefore you are free to edit and redistribute it, if you wish. If you want to edit its values, it is a good idea to use a spreadsheet program which can edit csv files - LibreOffice Calc is one such program. Two other hidden files may be created in your home directory: 1) .diet_user.dat 2) .diet_avg.dat The first one, ".diet_user.dat", is a csv file that will contain values for foods that you add yourself (with ). The second one, ".diet_avg.dat", will record the daily intake values in a csv file of this name. This will happen automatically whenever you exit the editor. These values are the basis for the calculation of the average intake (AI) values that you see in the results buffer. The average is calculated as a rolling average of, at most, the last five consecutive days. If more than 24h has elapsed since today's entered values and the last recorded values in this file, then the values in the file will be reset to today's values and the average calculation start over again. AI values will then be the same as the values for today's intake (TI). Format of the Diet File: The file where you enter your daily diet, must look e.g. like this: bread, white coarse grain 100 tea, ready_to_drink 500 wine, red 250 cheese, firm danbo 30% 50 honey 30 chocolate, milk 50 butter, salt added 25 flounder, raw 400p potato salad 200 That is, the food designations followed by a quantity, which must always be in grams. If no quantity is entered, then it will default to a 100 grams, as the base value for the nutritional specifications in the data file is a 100 grams. So, if you have added your own foods or nutritional supplements (with ) where the values are not based on a base quantity of 100 grams, like e.g. the values from a vitamin pill or the total values of a "Big Mac", you must either specify its quantity as 100 or not specify its quantity at all. If you take two vitamin pills, then enter 200 as the quantity, etc. Also note the 'p' next to the quantity for the flounder. 'p' is a mnemonic for "prepared" and means that this food will be boiled or fried, etc (raw flounder, after all, is only for the tough guys!). Then its nutritional values will be adjusted according to a factor. Always affix the quantity with a 'p' if you intend to boil/fry, etc. the food unless of course the food from the data file is already specified as such. Prefixing a food item with a hash character (#) will leave it out of the calculation. Entering the Food Names in the Diet Buffer: Since the food names must match those in the data file, exactly, then in practical terms it is mandatory that you make use of the mode's completion menu for the food names whenever you enter a food name into the diet file . Type in the first few letters of the food that you want to enter and then hit the key, so if you type in e.g. "apr" and then hit , then a completion menu will pop up with all food names that begin with "apr", "apricot, canned", "apricot, dried", etc. Then type the number that corresponds to your choice to have the food name inserted into the buffer. Always use lowercase letters. Calculate Your Intake and Compare With Official Recommendations: Type to do that. It will pop up the buffer with the results. Reading the Results Buffer: Nutrient names may be colored in either red or orange (or magenta on some displays). The red highlighting of a nutrient means that today's intake (TI) of this nutrient is either above a possibly toxic level or below a minimum healthy value. Therefore special attention should be attached to these values. Orange means that the average intake (AI) is below the recommended intake (RI) The column with the %/RI label shows the average intake as a percentage of the recommended intakes. Even if it shows results of sometimes several hundred percents, you don't have to worry as long as the nutrient is not colored red. If it is colored red, then you should take note. Also remember that the calculations shown in the column labeled, "%/RI" is based on the average intake (AI) over at most the last five consecutive days as a percentage of the recommended intake (RI). This yields a more accurate picture of how healthy your diet is, rather than just basing it on today's intake (TI). The deficiency symptoms listed next to each nutrient are general and will probably not be of any concern most of the time, but your diet may give you a clue if you exhibit some of these symptoms - e.g. fatigue or headaches. Adding a New Food to the Data File: You do that with . You will then be walked through a menu in the mini buffer, where you specify the food's name along with each of its nutritional values. Take note of the units that are shown for each component in the menu and ensure that they correspond to your data. E.g., this mode uses only the kilojoule unit for energy, but often kilocalories (kCal) is used. Declarations of nutritional content on industrial foods are mostly inadequate but you may find nutritional values for compound foods, such as e.g. a coleslaw salad or a cheeseburger by simply googling for it. With these numbers available, you may add them to your data file with . They may not be completely precise but probably good enough for your purposes. List Foods By Largest Value of a Nutrient: Pressing on a line with a nutrient in the results buffer will list foods sorted by the largest values of that nutrient. If you find that your diet consistently is short on e.g. the mineral, iron, then this is a good way to find foods to add to your diet that will help fulfil the requirement for iron. Compare the Nutritional Values of Two Foods, Side by Side: is the key. You may choose between 1 and 4 foods to list. You will be then be presented with prompts for entering the food names. In this case type in the first few letters of the respective foods and type to have a menu pop up where you can pick the food with its number. Note that you use the key here to activate the completion menu, rather than the key. Filter foods by name or category. is reserved for that. You may filter either on whole food categories like e.g. "fruit", to get all items in that category or you may filter by food names that match your search expression. In the list of matching foods, you may hit on any item to get a list of its nutritional values. Sources of Information: - The data file is downloaded from the National Food Institute, Technical University of Denmark, Division for Risk Assessment and Nutrition, https://frida.fooddata.dk/?lang=en - The deficiency symptoms were derived from "The Nutrition Source" webpages of the Harvard T.H. Chan School of Public Health: https://www.hsph.harvard.edu/nutritionsource/ - The nutritional recommendations which are used in this mode are fetched from the Nordic Council's publication, "Nordic Nutrition Recommendations 2012", https://www.norden.org/en/publication/nordic-nutrition-recommendations-2012 - The recommended intakes for the nine essential amino acids were taken from https://globalrph.com/rda-and-ear-recommendations-for-essential-amino-acids/ Copyright: Refer to the supplied file, "Copyright.txt", and take special note of the copyright which applies to the supplied data file. For all other files, the copyleft, GPL, version 2 or later applies, so you may do with them what you want. DISCLAIMER: You use this mode entirely at your own risk. As Margaret Thatcher used to say: "Whatever happens is your own fault"! Contact: Send bug reports or suggestions to Morten Bo Johansen