{"action":"created","issue":{"url":"https://api.github.com/repos/magit/magit/issues/3460","repository_url":"https://api.github.com/repos/magit/magit","labels_url":"https://api.github.com/repos/magit/magit/issues/3460/labels{/name}","comments_url":"https://api.github.com/repos/magit/magit/issues/3460/comments","events_url":"https://api.github.com/repos/magit/magit/issues/3460/events","html_url":"https://github.com/magit/magit/issues/3460","id":326816102,"node_id":"MDU6SXNzdWUzMjY4MTYxMDI=","number":3460,"title":"Initial value of magit-auto-revert-mode set by package autoload, early-init.el, etc.","user":{"login":"cmccloud","id":7864650,"node_id":"MDQ6VXNlcjc4NjQ2NTA=","avatar_url":"https://avatars1.githubusercontent.com/u/7864650?v=4","gravatar_id":"","url":"https://api.github.com/users/cmccloud","html_url":"https://github.com/cmccloud","followers_url":"https://api.github.com/users/cmccloud/followers","following_url":"https://api.github.com/users/cmccloud/following{/other_user}","gists_url":"https://api.github.com/users/cmccloud/gists{/gist_id}","starred_url":"https://api.github.com/users/cmccloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmccloud/subscriptions","organizations_url":"https://api.github.com/users/cmccloud/orgs","repos_url":"https://api.github.com/users/cmccloud/repos","events_url":"https://api.github.com/users/cmccloud/events{/privacy}","received_events_url":"https://api.github.com/users/cmccloud/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-27T13:22:06Z","updated_at":"2018-05-31T17:21:10Z","closed_at":null,"author_association":"NONE","body":"I ran into the issue that some others are also having when using `diff-hl`, and spent some time trying to figure out why my configuration was starting up with both global-auto-revert-mode and magit-auto-revert-mode.\r\n\r\nThe initial value of `magit-auto-revert-mode` is set by the following expression:\r\n`(and (with-no-warnings magit-revert-buffers) (not global-auto-revert-mode) (not noninteractive))`\r\n\r\nIt isn't clear to me whether the guard which checks for the value of `global-auto-revert-mode` is, by itself, enough to keep Emacs out of a bad state when that value has to be set before the autoload. In my case, using Emacs 26.1, it meant that I had to load my `custom-file` before the call to `package-initialize`. Which I was already doing, as it turned out. Where I noticed the issue was when I switched to a emacs build on --HEAD.\r\n\r\nEmacs 27.0.50 introduces `early-init.el` and `package-quickstart`.\r\n```\r\n** Emacs can now be configured using an early init file.\r\nThe file is called 'early-init.el', in 'user-emacs-directory'.  It is\r\nloaded very early in the startup process: before graphical elements\r\nsuch as the tool bar are initialized, and before the package manager\r\nis initialized.  The primary purpose is to allow customizing how the\r\npackage system is initialized given that initialization now happens\r\nbefore loading the regular init file (see below).\r\n```\r\nSo now, the user has to set the value of `global-auto-revert-mode` even earlier in order for the initial value of `magit-auto-revert-mode` to be set to nil by the autoload. \r\n\r\nI'm not sure what the best long term solution is, but maybe think about also checking the value of `global-auto-revert-mode` in the `magit-auto-revert--init-kludge`, at least for now. Since this runs on the `after-init-hook` at the earliest, it gives the user more leeway in setting `global-auto-revert-mode` without `magit-auto-revert-mode` being enabled as well. Explicitly setting the value of `magit-auto-revert-mode` to nil works fine as well.\r\n\r\nObserved on: \r\nMagit 20180522.507, Git 2.17.0, Emacs 27.0.50, darwin\r\nMagit 20180522.507, Git 2.17.0, Emacs 26.1, darwin\r\n"},"comment":{"url":"https://api.github.com/repos/magit/magit/issues/comments/393608081","html_url":"https://github.com/magit/magit/issues/3460#issuecomment-393608081","issue_url":"https://api.github.com/repos/magit/magit/issues/3460","id":393608081,"node_id":"MDEyOklzc3VlQ29tbWVudDM5MzYwODA4MQ==","user":{"login":"tarsius","id":25046,"node_id":"MDQ6VXNlcjI1MDQ2","avatar_url":"https://avatars2.githubusercontent.com/u/25046?v=4","gravatar_id":"","url":"https://api.github.com/users/tarsius","html_url":"https://github.com/tarsius","followers_url":"https://api.github.com/users/tarsius/followers","following_url":"https://api.github.com/users/tarsius/following{/other_user}","gists_url":"https://api.github.com/users/tarsius/gists{/gist_id}","starred_url":"https://api.github.com/users/tarsius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarsius/subscriptions","organizations_url":"https://api.github.com/users/tarsius/orgs","repos_url":"https://api.github.com/users/tarsius/repos","events_url":"https://api.github.com/users/tarsius/events{/privacy}","received_events_url":"https://api.github.com/users/tarsius/received_events","type":"User","site_admin":false},"created_at":"2018-05-31T17:21:10Z","updated_at":"2018-05-31T17:21:10Z","author_association":"MEMBER","body":"> It isn't clear to me whether the guard which checks for the value of `global-auto-revert-mode` is, by itself, enough to keep Emacs out of a bad state when that value has to be set before the autoload.\r\n\r\nI don't think it is, that code is evaluated when the rest of the mode definition is evaluated, so it is always possible to turn on `global-auto-revert-mode` \"too late\". But at least as far as Magit is concerned that shouldn't put Emacs in a \"bad state\". It just means that `magit-turn-on-auto-revert-mode-if-desired` is called needlessly, I think.\r\n\r\n> In my case, using Emacs 26.1, it meant that I had to load my `custom-file` before the call to `package-initialize`. Which I was already doing, as it turned out.\r\n\r\nI don't know whether that is sufficiently documented or even generally agreed upon, but I think it is necessary for `custom-set-variables` to be run before loading the packages that are being customized.\r\n\r\n> Emacs 27.0.50 introduces `early-init.el` and `package-quickstart`.\r\n\r\nIf that is something that hasn't been taken into account when the `early-init.el` stuff was implemented, then it should be discussed as soon as possible I think. Could you bring that up on the mailing-list please? (It would probably be better to find another example instead of this particularly convoluted case.)\r\n\r\n> I'm not sure what the best long term solution is, but maybe think about also checking the value of `global-auto-revert-mode` in the `magit-auto-revert--init-kludge`, at least for now.\r\n\r\nWe could do something like that, but could you please first describe what breaks if we don't? "}}
{"actor":{"display_login":"tarsius"}}