daniela-s...@gmx.it writes:
>> Sent: Sunday, November 29, 2020 at 5:46 AM >> From: "Jean Louis" <bugs@gnu.support> >> To: daniela-s...@gmx.it >> Cc: "Org-Mode mailing list" <emacs-orgmode@gnu.org> >> Subject: Re: Adding Org Files to org-agenda-files >> >> * daniela-s...@gmx.it <daniela-s...@gmx.it> [2020-11-29 02:30]: >> > > What you see as a problem some see as a solution. For instance, it >> > > depends how many >> > > org-files you want to add to the agenda. Some users including me have 2 >> > > or three files in org-agenda-files so I never interact with this >> > > variable directly. >> > >> > I have many and they change quite frequently, depending on project. >> > So often torture emacs hard. Have sent a bug-report about it. Keen >> > for a change to go through. >> >> You may customize any Emacs variables yourself. Just define your >> agenda files yourself in your init file. Then do: >> >> {M-x customize-variables RET org-agenda-files RET} and erase what you >> find there. >> >> Anything before the `custom' section in your init file will be then >> defined by you and not by the built in system. >> >> In that case you should take care as user over time not to use >> org-agenda-file-to-front command as that would again start adding >> agend files to init file. Then just use your own settings. >> >> As long as you have your own settings hard coded you may erase the >> variable org-agenda-files > > That worries me because I do not want to change the behaviuor of Emacs > for users. Otherwise when people ask for help they will become confused. Just a small clarification on the above directions. If you have *both* a settings in your emacs init file for org-agenda-files using (setq org-agenda-files...) and you have a line in your (custom ...) section, you should remove one of them to avoid confusion. In general, what is in the custom section will take preference as it is usually loaded last. If your going to remove the one in the custom section, run M-x customize-variable <ret> org-agenda-files <ret> and then select the options under the 'state' button to 'Erase Customisation', don't just erase the values in the 'Value Menu' box. I'm not sure if I would classify the problem you ran into as a bug or user error. Emacs has 2 main ways to customise behaviour. either you can do it manually using things like (setq ...) in your init file, *OR* you can use the customize interface to make the changes using a high level 'widget' base UI. This all works pretty well unless you try to use both methods to customise the same thing. In your case, the correct way to update the org-agenda-files list was to edit your init file, remove the reference to the missing file and then re-evaluae the variable. this is because you have decided to manage that variable yourself using setq. The other alternative is to remove the setq setting from your init file and then set your agenda file list using customize. The critical point is not to use both - one or the other. Many people will use a combination of some things set by hand in their init file and other things set using the customise interface. This is fine but you must ensure you don't use both for the same thing. In your case, because you are not use to configuring Emacs manually, I would strongly recommend you stick to using the customise interface. Later, when your more use to customising Emacs, you can move to doing your customisation in your init file by hand (if you want/need to - many never do and just use the customisation interface). The customisation interface is great when your not use to Elisp and don't yet know how to re-evaluate expressions etc. I know lots of users where the only thing in their init file is the custom section. All of their customisation is done using the custom interface and they are never required to write a single line of elisp. The org-agenda-files variable is also a little more complicated than most configuration variables because org allows you to add/remove files from that list interactively as well. For these interactive changes to persist across sessions, Emacs has to store them somewhere and it uses the custom section of your init file to do this. It cannot update your manual setting with setq because that would require parsing and modifying user controlled/written configuration code, which can be very complicated and could be spread over many different files (some people with large complex manual configurations will break them up into separate files and include them using (reqire...) or load. This makes updating such settings very dangerous. On the other hand, the custom section is managed by Emacs and not modified by hand, so it can store the updated list in that section safely, which means the changes will persist across sessions. for this reason, I would recommend using custom to set/modify your agenda file list and copletely delete the (setq org-agenda-files...) from your init file. You might still consider how this works to be a bug because the way it works is confusing. However, it is very difficult for Emacs to deal with the situation where you have both manual configuration and custom section configuration for the same thing. Emacs does what I think is the sane things - gives priority to the custom section (actually, this can also be changed, but lets not go down another rabbit hole). -- Tim Cross