all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
Cc: jpw@gnu.org, emacs-devel@gnu.org
Subject: Re: Documentation for custom-file - is not (load	custom-file) needed?
Date: Mon, 6 Dec 2004 22:53:00 +0100	[thread overview]
Message-ID: <009401c4dbdd$fb874c60$0200a8c0@sedrcw11488> (raw)
In-Reply-To: jwvoeh7qnde.fsf-monnier+emacs@gnu.org

----- Original Message ----- 
From: "Stefan Monnier" <monnier@iro.umontreal.ca>
To: "Luc Teirlinck" <teirllm@dms.auburn.edu>


> >    You might be right.  It does seem however that the :get and :set
functions
> >    don't need to do anything special.
>
> > The problem with setting the variable with setq instead of through
> > `custom-set-variables' is that various standard things like:
>
> > (put 'custom-file 'saved-value '("~/mycustomfile"))
...
> Sure.  I wasn't arguing against using `load', just pointing out that it
> might not be as important as it seems.  After all, AFAICT changing
> custom-file via Custom itself currently just plain doesn't work and it's
not
> clear at all how to make it work.
>
> This said, it's indeed probably better to tell people to `load' the custom
> file rather than to `setq' the `custom-file' variable (among other things
> because it involves much less magic, and works with Emacs-21.3).

I have another opinion here. I do not believe that custom-file should be
handled like other defcustom variables:

a) I do not think it is good to store it in (custom-set-variables ...) since
that would make it much harder to rename that file because
custom-set-variables would read the old file name.

b) That said custom-file must be set somehow because otherwise saving the
settings will go to .emacs. Then I think (setq custom-file ...) is a good
and simple way.

Along these lines I have written a simple example below where I have renamed
custom-file to custox-file so you can test it without trouble. This simple
example can be expanded to query the user for automatic updating of .emacs
(like I did in the code I proposed below).

If it is scary to do automatic updating of .emacs even when the user is
prompted to accept it I instead propose something like the example below.
There are drawbacks with both methods and if automated update is not used I
believe the prompt screen below must be very clear about that the user needs
to edit .emacs. (I believe it should stand out in some way so the user do
not miss the message.)

Concerning the magic it could be explained in the prompt screen below,
together with instruction to edit .emacs.

- Lennart


(defvar custox-file nil)

(defcustom custox-file nil "docstring"
  :type 'string
  :initialize (lambda (sym val) )
  :get (lambda (sym) (if custox-file custox-file ""))
  :set (lambda (sym val)
  ;; Delete values from .emacs if custox-file is nil
  (when (boundp 'custox-file)
    (unless custox-file
      (message "(custom-save-delete) should be done in this state...")
      (sleep-for 2)))
  (setq custox-file val)
  ;; Show an explanation
  (save-window-excursion
    (save-excursion
      (with-temp-buffer
        (delete-other-windows)
        (princ
  (concat "Some explanation here...\n\n"
   "and maybe run some code to edit .emacs after this ...")
        (current-buffer))
        (switch-to-buffer (current-buffer))
        (read-from-minibuffer "Press any key to continue: " nil
         '(keymap (t . exit-minibuffer)))
        )))
  ;; Avoid storing custox-file since it would interfere with
  ;; the file actually used. If the custox-file is renamed this
  ;; would otherwise cause problems.
  (put 'custox-file 'saved-value nil)
  ))

  reply	other threads:[~2004-12-06 21:53 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-04  1:53 Documentation for custom-file - is not (load custom-file) needed? Lennart Borgman
2004-12-04 23:35 ` Lennart Borgman
2004-12-05 21:52   ` Richard Stallman
2004-12-06  0:24     ` Luc Teirlinck
2004-12-06 14:10       ` Richard Stallman
2004-12-07  2:40         ` Luc Teirlinck
2004-12-08  4:40           ` Richard Stallman
2004-12-06  2:56     ` Luc Teirlinck
2004-12-07  4:23       ` Richard Stallman
2004-12-05 15:50 ` John Paul Wallington
2004-12-05 17:07   ` Lennart Borgman
2004-12-05 17:33     ` Luc Teirlinck
2004-12-05 22:07       ` Lennart Borgman
2004-12-06  0:46         ` Luc Teirlinck
2004-12-06  1:21           ` Lennart Borgman
2004-12-06  4:02             ` Luc Teirlinck
2004-12-06 13:04               ` Stefan
2004-12-06 18:34                 ` Luc Teirlinck
2004-12-06 18:54                   ` Stefan Monnier
2004-12-06 21:53                     ` Lennart Borgman [this message]
2004-12-07  2:34                       ` Luc Teirlinck
2004-12-07  9:39                         ` Kim F. Storm
2004-12-07  3:27                       ` Luc Teirlinck
2004-12-07  2:56                     ` Luc Teirlinck
2004-12-08  4:40                       ` Richard Stallman
2004-12-07  3:50                     ` Luc Teirlinck
2004-12-07  4:23               ` Richard Stallman
2004-12-07  5:39                 ` Luc Teirlinck
2004-12-08  0:44                   ` Lennart Borgman
2004-12-08  4:35                     ` Luc Teirlinck
2004-12-08 17:52                       ` Lennart Borgman
2004-12-08  4:42                     ` Juri Linkov
2004-12-08 13:27                       ` Juri Linkov
2004-12-08 17:52                         ` Lennart Borgman
2004-12-08 18:04                           ` Stefan Monnier
2004-12-08 19:56                             ` Lennart Borgman
2004-12-08 20:20                               ` Stefan Monnier
2004-12-08 22:16                                 ` Lennart Borgman
2004-12-08  4:40                   ` Richard Stallman
2004-12-09  2:20                     ` Luc Teirlinck
2004-12-09  2:24                       ` Luc Teirlinck
2004-12-09 22:06                       ` Richard Stallman
2004-12-10  5:54                         ` Juri Linkov
2004-12-10 15:51                           ` Lennart Borgman
2004-12-10 17:05                             ` Stefan Monnier
2004-12-10 18:36                               ` Lennart Borgman
2004-12-10 20:40                                 ` Stefan Monnier
2004-12-11  1:00                                   ` Lennart Borgman
2004-12-11  3:38                                   ` Luc Teirlinck
2004-12-11  3:56                                   ` Luc Teirlinck
2004-12-11  4:11                                   ` Luc Teirlinck
2004-12-13  3:49                                   ` Luc Teirlinck
2004-12-13  9:01                                     ` Juri Linkov
2004-12-13 15:55                                       ` Luc Teirlinck
  -- strict thread matches above, loose matches on Subject: below --
2004-12-13 19:51 Richard Stallman
2004-12-14  0:34 ` Lennart Borgman
2004-12-14 23:20   ` Richard Stallman
2004-12-14  1:50 ` Luc Teirlinck
2004-12-14 23:20   ` Richard Stallman
2004-12-15  2:51     ` Luc Teirlinck
2004-12-15 23:20       ` Richard Stallman
2004-12-16  0:48         ` Luc Teirlinck
2004-12-16  4:51           ` Luc Teirlinck
2004-12-17  0:54           ` Richard Stallman
2004-12-17  5:41             ` Luc Teirlinck
2004-12-17 13:20               ` Kim F. Storm
2004-12-20 10:56               ` Richard Stallman
2004-12-21  0:48                 ` Luc Teirlinck
2004-12-23  0:53                 ` Luc Teirlinck
2004-12-25 15:13                   ` Richard Stallman
2004-12-26  2:31                     ` Luc Teirlinck
2004-12-14  4:14 ` Luc Teirlinck
2004-12-17 15:31 LENNART BORGMAN
2004-12-23 14:07 LENNART BORGMAN
2004-12-23 18:05 ` Luc Teirlinck
2004-12-28  1:06   ` Lennart Borgman
2004-12-28  4:28     ` Luc Teirlinck
2004-12-28 17:25       ` Richard Stallman
2004-12-23 18:34 ` Luc Teirlinck

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

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

  git send-email \
    --in-reply-to='009401c4dbdd$fb874c60$0200a8c0@sedrcw11488' \
    --to=lennart.borgman.073@student.lu.se \
    --cc=emacs-devel@gnu.org \
    --cc=jpw@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.