I would be nice, to run a 'eselect editor update' if a package from app-editors is removed. Thanks to hyphoon from #gentoo. see also: https://bugs.gentoo.org/18537
This could potentially be implemented in pkg_postrm in the ebuild. Personally, I don't use "eselect editor", and would prefer NOT to have the nano ebuild invoke it automatically every time I unmerge nano.
The only package attempting such a thing is sys-apps/moreutils which calls "eselect editor update" in pkg_postinst (see bug 604630). The update action will check if the currently selected target is valid (and do nothing in this case), otherwise it will go through EDITOR_LIST="nano ed emacs ex vi xemacs" in order and select the first available target. Similar for "eselect visual" where the list is "nano emacs vi xemacs". I am not entirely sure if calling it from an ebuild is a good thing. Except for listing nano first, the list doesn't express any preferences and is in alphabetical order. So, I tend to say that ebuilds shouldn't try to guess the user's preferences there, because the result may be worse than leaving the variable alone. Maybe pkg_postrm of nano could just test for [[ ${EDITOR##*/} == nano ]] and output a warning that the user needs to update the variable? (Same for ${VISUAL} I guess.)
(In reply to Ulrich Müller from comment #2) > Maybe pkg_postrm of nano could just test for [[ ${EDITOR##*/} == nano ]] and > output a warning that the user needs to update the variable? (Same for > ${VISUAL} I guess.) That would be helpful.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6f0a95daae18c8bb7c99acd1a3430651e2d6ca75 commit 6f0a95daae18c8bb7c99acd1a3430651e2d6ca75 Author: Ulrich Müller <ulm@gentoo.org> AuthorDate: 2022-06-29 07:38:13 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2022-06-29 09:09:09 +0000 app-editors/nano: Warn in pkg_postrm about updating EDITOR Closes: https://bugs.gentoo.org/819342 Signed-off-by: Ulrich Müller <ulm@gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/26133 Signed-off-by: Sam James <sam@gentoo.org> app-editors/nano/nano-6.3.ebuild | 9 +++++++++ 1 file changed, 9 insertions(+)