unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: floyd@barrow.com (Floyd L. Davidson)
Subject: Re: customize messing up .emacs symlink?
Date: Tue, 02 Mar 2004 07:24:34 -0900	[thread overview]
Message-ID: <87hdx76wu5.fld@barrow.com> (raw)
In-Reply-To: 87u117cmlo.fsf@cs.uga.edu

Ed L Cashin <ecashin@uga.edu> wrote:
>"D. D. Brierton" <darren@dzr-web.com> writes:
>> On Mon, 01 Mar 2004 21:00:51 -0500, Ed L Cashin wrote:
>>
>>> Hi.  I have a .emacs file under version control and symlinked into my
>>> home directory.  Every once in a while, emacs replaces my symlink and
>>> creates a regular file.
>>>
>>> Just now I sent some usenet news and saw a message flash by:
>>>
>>>   Wrote /home/ecashin/.emacs
>>>   Sending news via news.gmane.org using nntp...
>>>   Opening nnimap server on 127.0.0.1...
>>>
>>> The difference between the old .emacs and the impostor is shown
>>> below.  It leads me to suspect that the customize code of the two
>>> emacs versions I use are competing.
>>
>> Put your (two) customizations in (two) separate filesto .emacs. I don't
>> know which two versions of emacs you use.
>
>They are (with formatting addeded) ...
>
>  GNU Emacs 21.2.1
>  (i386-debian-linux-gnu, X toolkit, Xaw3d scroll bars)
>  of 2002-\03-22 on raven, modified by Debian
>
>and
>
>  GNU Emacs 21.2.1
>  (i386-debian-linux-gnu, X toolkit, Xaw3d scroll bars)
>  of 2002-03-22 on raven, modified by Debian

Apparently (unless that is an editing error) the two are the
same.  It appears there is more to this...  as in, you are
talking about two separate machines (but not really two versions
of Emacs) that might be (?) sharing a filesystem which is
network mounted for /home ?  Or else the ~/.emacs is symlinked
to a network mounted file system?

>Maybe it's some add-on that is on one machine and not the other.  I
>ought to do a little more digging and create a bug report.
>
>To me it seems wrong for the default behavior of customize to be like
>this, replacing a symlinked .emacs file with a modified regular file.
>Does anyone know if this feature has been discussed to death already,
>or would it be good to submit a bug report?
>
>> But assuming its Xemacs vs.
>> Emacs, put at the end of your .emacs something like (excuse my probably
>> crappy and very-unlisp-like lisp):
>>
>> (if (string-match "XEmacs" emacs-version)
>>     (load "~/.xemacs.customize.el")
>>   (load "~/.emacs.customize.el"))

That can also be based on finer parts of the version than just
the base name too.  However, it appears that what you need is
something based on the host your process is running on.

  (if (string-match "foo.a" (system-name))
      (load "~/.fooa.custom.el")
     (if  (string-match "foo.b" (system-name))
         (load "~/.foob.custom.el")
        (if  (string-match "foo.c" (system-name))
            (load "~/.fooc.custom.el")
           (if  (string-match "foo.d" (system-name))
               (load "~/.food.custom.el")
              ;; otherwise, this is the default
              (load "~/.fooe.custom.el")))))

Obviously that can be extended or trimmed to match however
large your network happens to be.  It can also be based on
virtually any environment or shell variable you might wish
to use, even one you locally define.

  (if (string-match "foo.a" (getenv "HOSTNAME")))
      (load "~/.fooa.custom.el")
   ...

is essentially the same as using (system-name), and you could
use (getenv "USER") or whatever is needed.

Note that (string-match) is looking for a substring, and is not
concerned with the entire string, so searching for "foo" will
return true in both "foo.com" and "foo.bar.com".  But the
pattern is a regular expression, so you could search for
"^bar.com$" and it would not return true for "foo.bar.com".

>Looks like a good solution for me.
>
>> Each separate customize file will need to have a customization for
>> custom-file in it:
>>
>> (custom-set-variables
>>   ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
>>   ;; Your init file should contain only one such instance.
>>   [...]
>>   '(custom-file "<thisfilename>")
>>   [...]
>
>I think it's mildly offensive that the comment says "don't edit this".

Hmmm... maybe that's what is causing ..., nah, couldn't be,
right?  :-)

--
Floyd L. Davidson           <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)                         floyd@barrow.com

  parent reply	other threads:[~2004-03-02 16:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-02  2:00 customize messing up .emacs symlink? Ed L Cashin
2004-03-02  4:03 ` D. D. Brierton
2004-03-02 15:09   ` Ed L Cashin
2004-03-02 15:36     ` D. D. Brierton
2004-03-02 18:06       ` Ed L Cashin
2004-03-02 16:24     ` Floyd L. Davidson [this message]
2004-03-03  0:55       ` Ed L Cashin
2004-03-03  1:02         ` Jesper Harder
2004-03-02 18:52 ` Kevin Rodgers
2004-03-03  0:59   ` Ed L Cashin

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=87hdx76wu5.fld@barrow.com \
    --to=floyd@barrow.com \
    /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.
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).