Package: debian-policy Version: 4.1.3.0 Severity: normal Policy 11.4 describes the mechanism for determining the user's preferred editor: - check the EDITOR environment variable and use it if set; - (optionally): check the VISUAL environment variable and use it if set; - otherwise, use /usr/bin/editor (which is managed as a dpkg alternative).
It goes on to state that this is what sensible-editor implements (and so a program may invoke sensible-editor and be Policy-compliant). But this is untrue: sensible-editor hasn't behaved like this since late 2010. Its current behaviour is roughly as follows: - check EDITOR and VISUAL as per policy; - if neither is set, check a ~/.selected-editor configuration file; - if that doesn't provide an editor, offer the user a list of editors and record their choice in ~/.selected-editor The rationale for this behaviour is in bug 482774 [1]. The list it provides comes from the dpkg alternatives system, but doesn't indicate which alternative is the one currently selected system-wide. It's apparently in alphabetical order (rather than using alternatives priority). If one of the editors in the list is 'nano', it's annotated with "<---- easiest". The effect is that users see inconsistent behaviour depending on whether the program launching the editor is using sensible-editor or implementing the policy mechanism directly (which in my experience is much more common). They can think they've told the system their preferred editor once, then find it's not used later. Or they can find they normally get an editor they're comfortable with, then on one occasion be presented with a list of unfamiliar names and end up with nano. Ideally I think Policy would permit exactly one of these behaviours, but at any rate what it currently says is untrue so something should change. [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482774