unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 31558@debbugs.gnu.org
Subject: bug#31558: 27.0; `custom-file' settings messed up by Emacs 27
Date: Wed, 23 May 2018 08:47:38 -0700 (PDT)	[thread overview]
Message-ID: <e2dfa786-78a3-4ba7-92ff-4a8342bc3ee3@default> (raw)
In-Reply-To: <87fu2ih1dg.fsf@gmx.de>

> >> Maybe you put at the beginning of your custom file
> >> (or (locate-library "tramp") (provide 'tramp))
> >
> > Yes, I guess that would work and is better than nothing,
> > but it seems wrong to tell Emacs that something has
> > been provided that has not. ;-)
> >
> > Worse than style or ugliness, though, is that there
> > might be code here or there that tests
> > (featurep 'tramp) and acts accordingly.  That code
> > surely will be led astray by such a hack.
> 
> We're spaeking about Emacs < 22. How many such Emacsen are in use today,
> which also use packages checking for Tramp?

Yes, I said at the outset:

  Admittedly, this is probably not a problem that others
  will run into often.  But it is quite annoying for me.

I end up trying to remember to do this immediately after
saving any (!) user option in Emacs 26+: Open my
`custom-file' and delete the offending parts of the sexp.
Otherwise, when I later open Emacs 20 I get the error.

But when you say "which also use packages checking for
Tramp", what it really comes down to is being able to
use the same `custom-file' (which has only stuff that is
inserted automatically by Emacs) with multiple Emacs
releases (in this case including Emacs 20).

> > Seems like there should be a way for Tramp and
> > Customize to collaborate to produce a conditional
> > sexp that does not require tramp unconditionally.
> > E.g., one that tests (at time of evaluating
> > `custom-set-variables') whether Tramp is even
> > included in the Emacs version.
> >
> > Or maybe somehow just use a soft-require - the
> > equivalent of (require 'tramp nil t)?  Would that
> > work for Tramp, if it were possible for
> > `custom-set-variables'?
> >
> > Seems like something is missing from Emacs for
> > such cases.  A library wants to ensure that it is
> > loaded before evaluating a sexp that sets one of
> > its user options.  But if loading the library is
> > impossible then setting the variable is benign,
> > so a soft-require is all that is really needed.
> 
> If there were such a possibility I would consider it.

Can we perhaps consider this bug report as a request
for such an enhancement?

> But it must already exist for Emacsen < 22;

No, I don't think so.  (But I'm not sure what you mean.)
It would be enough that such a mechanism exists for
Emacs 26+ or whatever.

> I doubt we will change them if it's not possible yet.

Isn't it already possible to DTRT here (use a soft-require
instead of a hard-require)?

Can't Tramp, for example, just use a :set, or an :initialize,
function that does a soft-require, instead of using :require,
which puts a hard-require into `custom-file'?

Something like this, for example:

(defcustom tramp-verbose 3
  "..."
  :group 'tramp
  :type 'integer
  :set (lambda (sym val)
         (when (require 'tramp nil t)
           (custom-set-default sym val)))
  :initialize 'custom-initialize-set)

> And given the low likelihood plus the existing workaround,
> I believe it is not worth to spend time for this. Sorry.

I think the defcustom above would fit the bill, and it
would require no time to implement.  It just sets the
variable normally, but only if Tramp can first be loaded.

It does nothing is Tramp is not available.
(boundp 'tramp-verbose) returns nil in that case.

(Am I missing something?)





  reply	other threads:[~2018-05-23 15:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 19:04 bug#31558: 27.0; `custom-file' settings messed up by Emacs 27 Drew Adams
2018-05-23  9:07 ` Michael Albinus
2018-05-23 14:07   ` Drew Adams
2018-05-23 14:50     ` Michael Albinus
2018-05-23 15:47       ` Drew Adams [this message]
2018-05-23 18:05         ` Michael Albinus
2018-05-23 18:15           ` Drew Adams
2018-05-23 18:22             ` Michael Albinus
2018-05-23 19:17               ` Drew Adams
2018-05-24 12:43                 ` Michael Albinus
2018-05-24 13:47                   ` Drew Adams
2018-05-24 13:56                     ` Michael Albinus
2018-05-24 14:44                       ` Drew Adams
2018-05-24 14:59                         ` Michael Albinus
2018-05-24 15:03                           ` Drew Adams
2018-05-29  8:11                             ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2dfa786-78a3-4ba7-92ff-4a8342bc3ee3@default \
    --to=drew.adams@oracle.com \
    --cc=31558@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).