Support XDG-based init directory
authorSteve Youngs <steve@sxemacs.org>
Tue, 5 May 2015 03:55:39 +0000 (13:55 +1000)
committerSteve Youngs <steve@sxemacs.org>
Tue, 5 May 2015 03:55:39 +0000 (13:55 +1000)
* xdg-init:
  XDG init -- Doc updates.
  XDG Compliant init directory.

23 files changed:
PROBLEMS
configure.ac
etc/sample.init.el
etc/sxemacs.1
info/lispref/display.texi
info/lispref/os.texi
info/lispref/postgresql.texi
info/new-users-guide/custom1.texi
info/sxemacs-faq.texi
info/sxemacs/cmdargs.texi
info/sxemacs/custom.texi
info/sxemacs/startup.texi
info/sxemacs/sxemacs.texi
lisp/Makefile.am
lisp/ffi/ffi-magic.el
lisp/files.el
lisp/info.el
lisp/issue-tracker.el
lisp/menubar-items.el
lisp/package-admin.el
lisp/site-start.el [new file with mode: 0644]
lisp/startup.el
modules/configure.ac

index 8e5d09e..bcebee8 100644 (file)
--- a/PROBLEMS
+++ b/PROBLEMS
@@ -8,11 +8,24 @@ following idiosyncrasies:
 
 ** User init file (C-h v user-init-file)
 
-SXEmacs searches for its init file in `~/.sxemacs/init.el'.
-Symlinking your old ~/.xemacs directory should be enough to get you up
-and running.
+SXEmacs looks for user init files in `user-init-directory'.  The
+preferred directory is: ${XDG_CONFIG_HOME}/sxemacs but it can fall
+back to the old ~/.sxemacs directory.
 
-    $ ln -s ~/.xemacs ~/.sxemacs RET
+The search order is:
+
+    ${XDG_CONFIG_HOME}/sxemacs
+    ${HOME}/.config/sxemacs    # if $XDG_CONFIG_HOME is not set
+    ${HOME}/.sxemacs           # if other dirs don't exist
+
+You can also force the use of ~/.sxemacs regardless of the existence
+of the XDG dir/var by setting $SXE_USE_LEGACY environment variable to
+a non-nil value.
+
+If you're coming from XEmacs, symlinking your old ~/.xemacs directory
+to a SXEmacs location should be enough to get you up and running:
+
+    $ ln -svfn ${HOME}/.xemacs ${XDG_CONFIG_HOME}/sxemacs
 
 BTW, unlike XEmacs, SXEmacs doesn't attempt to "migrate" your old init
 file or Gnu/Emacs .emacs file.
index 598f3e4..766f76f 100644 (file)
@@ -178,7 +178,7 @@ OG_ARG_WITH([package-prefix],
        AS_HELP_STRING([--with-package-prefix=PATH],
                [What to use as a prefix to the system-wide package
                directories.  It doesn't affect the package directories
-               under ~/.sxemacs, and is totally ignored if
+               under the user's home directory, and is totally ignored if
                --with-package-path is set.
                Normally, you would not need to set this.]),
        [none], [None], [og_any],
index d1007f6..f9f283a 100644 (file)
 ;;    (sxemacs)Entering Emacs, and in (custom), then point to them
 ;;    instead of going into detail here.
 
-;;; This is a sample init file.  It can be used without modification as
-;;; your init.el. In SXEmacs, this file is located in the ~/.sxemacs/
-;;; subdirectory and is called init.el.  Other files are also located
-;;; here, such as custom-${USER}.el (the auto-generated file containing
-;;; Customization options that you saved when using
-;;; Options->Save Options).
+;;; This is a sample init file.  It can be used without modification
+;;; as your init.el. In SXEmacs, this file, called `init.el', is
+;;; located in the directory defined in the `user-init-directory'
+;;; variable.  It normally defaults to `${XDG_CONFIG_HOME}/sxemacs',
+;;; or `${HOME}/.config/sxemacs' if the XDG environment isn't set.
+;;; Historically, this file was located in `~/.sxemacs', and indeed,
+;;; that directory is still supported.
+
+;;; To find out exactly where your SXEmacs would look for your init.el
+;;; file, do...
+;;;
+;;;   M-: user-init-directory RET
+
+;;; Other files are also located here, such as custom-${USER}.el (the
+;;; auto-generated file containing Customization options that you
+;;; saved when using Options->Save Options).
 
 ;;; Changes to your init.el file will not take effect until the next
 ;;; time you start up SXEmacs, unless you load it explicitly with
 ;;;
-;;;   M-x load-file RET ~/.sxemacs/init.el RET
+;;;   M-x load-file RET
+;;;
+;;; You'll then be prompted for a file name, give it the full path
+;;; to your init.el and hit `RET'
 
 ;;; The language that this file (and most other SXEmacs init files) is
 ;;; written in is called "Emacs Lisp" or more commonly "elisp".
 
 ;; 1. It runs the normal hook `before-init-hook'.
 ;; 2. It loads the library `site-start' (by default `site-start.el').
-;; 3. It loads the init file (by default `~/.sxemacs/init.el').
-;; 4. It loads the custom file (by default `~/.sxemacs/custom-${USER}.el').
+;; 3. It loads the init file (by default `${XDG_CONFIG_HOME}/sxemacs/init.el').
+;; 4. It loads the custom file (by default `${XDG_CONFIG_HOME}/sxemacs/custom-${USER}.el').
 ;; 5. It loads the library `default' (by default `default.el').
 ;; 6. It runs the normal hook `after-init-hook'.
 
index cd66f6f..a96625b 100644 (file)
@@ -622,8 +622,14 @@ CTRL-SHIFT-left    Make a selection, delete it, and insert it at point.
 .ti -\w'CTRL-SHIFT-middle'u+4n
 META-left      Make a rectangular selection.
 .SH FILES
-Lisp code is read at startup from the user's init file,
-\fB$HOME/.sxemacs/init.el\fP.
+Lisp code is read at startup from the user's init file, which can be
+one of:
+
+\fB${XDG_CONFIG_HOME}/sxemacs/init.el\fP
+
+\fB${HOME}/.config/sxemacs/init.el\fP
+
+\fB${HOME}/.sxemacs/init.el\fP
 
 /usr/local/share/info - files for the Info documentation browser
 (a subsystem of
@@ -790,7 +796,6 @@ FAQ (Frequently Asked Questions) can be found at the Web site just listed.
 A possibly out-of-date version is also accessible through the Info system
 inside of \fISXEmacs\fP.
 .PP
-The latest version of \fISXEmacs\fP can be downloaded using anonymous
-FTP from
+The latest version of \fISXEmacs\fP can be downloaded from
 .PP
-ftp://ftp.sxemacs.org/pub/sxemacs/
+http://downloads.sxemacs.org/
index 3b4b5d4..bf50402 100644 (file)
@@ -370,7 +370,7 @@ in a separate buffer, and include an explanatory message that may span
 across several lines.  Here is an example of how a warning is displayed:
 
 @example
-(1) (initialization/error) An error has occurred while loading ~/.sxemacs/init.el:
+(1) (initialization/error) An error has occurred while loading ~/.config/sxemacs/init.el:
 
 Symbol's value as variable is void: bogus-variable
 
index 3c37451..27f596b 100644 (file)
@@ -82,14 +82,16 @@ It loads the library @file{site-start}, unless the option
 @cindex @file{site-start.el}
 
 @item
-It loads the file @file{~/.sxemacs/init.el} unless @samp{-q} was
-specified on the command line.  This is not done in @samp{-batch} mode,
-though.  The @samp{-u} option can specify the user name whose home
-directory should be used instead of @file{~}.
-
-If the directory @file{~/.sxemacs} or @file{init.el} in there does not
-exist, SXEmacs tries to read @file{init.el} in @file{~/.xemacs}.
-If this also fails, it looks for a @file{~/.emacs}.
+It loads the file @file{$XDG_CONFIG_HOME/sxemacs/init.el} unless
+@samp{-q} was specified on the command line.  This is not done in
+@samp{-batch} mode, though.  The @samp{-u} option can specify the
+user name whose @file{init.el} should be loaded instead@footnote{Note
+that file and directory permissions may very well hamper the use of
+@samp{-u}.}.
+
+If the environment variable, @var{XDG_CONFIG_HOME}, is not set,
+SXEmacs will try @file{~/.config/sxemacs}, and if that directory
+does not exist, try @file{~/.sxemacs}.
 @cindex @file{init.el}
 
 @item
@@ -175,14 +177,44 @@ message for someone else.
 @cindex @file{init.el}
 
   When you start SXEmacs, it normally attempts to load the file
-@file{init.el} from your @file{.sxemacs} directory in your home
-directory.  This file, if it exists, must contain Lisp code.  It is
-called your @dfn{init file}.  The command line switches @samp{-q} and
-@samp{-u} affect the use of the init file; @samp{-q} says not to load an
-init file, and @samp{-u} says to load a specified user's init file
-instead of yours.
+@file{init.el} from the directory set in @code{user-init-directory}.
+This file, if it exists, must contain Lisp code.  It is called your
+@dfn{init file}.  The command line switches @samp{-q} and @samp{-u}
+affect the use of the init file; @samp{-q} says not to load an init
+file, and @samp{-u} says to load a specified user's init file instead of
+yours.
 @xref{Entering SXEmacs,,,sxemacs, The SXEmacs User's Manual}.
 
+@cindex init directory
+@defvar user-init-directory
+This variable contains the name of the directory where a user's init
+files and customisations are stored.  In the past, this was hard-coded
+to @file{~/.sxemacs}, but today the default is normally
+@file{$XDG_CONFIG_HOME/sxemacs}, or @file{~/.config/sxemacs} if the
+environment variable, @var{XDG_CONFIG_HOME} is not set.  If neither,
+@file{$XDG_CONFIG_HOME/sxemacs}, nor @file{~/.config/sxemacs} exists,
+and @file{~/.sxemacs} does exist, then @file{~/.sxemacs} will be used.
+
+If no candidates for @code{user-init-directory} exist SXEmacs will
+create a new directory at @file{$XDG_CONFIG_HOME/sxemacs}, or
+@file{~/.config/sxemacs} if @var{XDG_CONFIG_HOME} is unset.
+@end defvar
+
+The location of the init directory can be overridden through one of
+two methods@enddots{}
+
+@enumerate
+@item
+Using the @samp{-user-init-directory} command line option, which
+allows the user to set the init directory to any location, providing
+that file and directory permissions allow access.
+@item
+Setting the environment variable, @var{SXE_USE_LEGACY}, which forces
+SXEmacs to use the legacy init directory, @file{~/.sxemacs} regardless
+of the existence of a @var{XDG_CONFIG_HOME} based init directory.
+@end enumerate
+
+
 @cindex default init file
   A site may have a @dfn{default init file}, which is the library named
 @file{default.el}.  SXEmacs finds the @file{default.el} file through the
index 23ee08e..e94a44e 100644 (file)
@@ -52,11 +52,13 @@ With this installation you can try to create a database @samp{test}:
 /usr/local/pgsql/bin/psql test
 @end example
 
-
+@c LOL, maybe one day. Oh, and we don't have ftp. --SY
+@ignore
 If you have installed SXEmacs from one of the binary kits on
 (@url{ftp://ftp.sxemacs.org/}), or are using an SXEmacs binary from
 your favourite distributor, you may have SXEmacs PostgreSQL support
 by default.  @code{M-x describe-installation} will tell you if you do.
+@end ignore
 
 If you are building SXEmacs from source, you need to install PostgreSQL
 first (see above example).  On some systems, PostgreSQL will come
index 703f3ea..89141a8 100644 (file)
@@ -5,20 +5,21 @@
 @cindex customize
 @findex eval-region
 
-When you start Emacs, it reads the file @file{~/.sxemacs/init.el} in the
-@file{.sxemacs/} subdirectory of your home directory. You can use this
-file to initialize and customize Emacs to your liking. This file should
-contain lisp-code. You can customize your @file{init.el} file to create
-new menus, disable menus, change key bindings, enable a minor mode,
-etc. Any kind of customization affects only a particular Emacs job that
-you do them in. If you want to save your customizations `permanently'
+When you start SXEmacs, it reads the file @file{init.el} in the
+@code{user-init-directory} (@pxref{Init File,,,lispref,SXEmacs Lisp Reference
+Manual}). You can use this file to initialize and customize SXEmacs to
+your liking. This file should contain lisp-code. You can customize
+your @file{init.el} file to create new menus, disable menus, change
+key bindings, enable a minor mode, etc. Any kind of customization
+affects only a particular SXEmacs job that you do them in. If you want
+to save your customizations `permanently'
 i.e. for future use also, you have to put it in your @samp{init.el}
 file. After you make changes to your @file{init.el} file and save it, the
-changes will be effective only after you start Emacs again i.e. for a
-new Emacs process. To try out some of the examples in this section,
+changes will be effective only after you start SXEmacs again i.e. for a
+new SXEmacs process. To try out some of the examples in this section,
 highlight that region and evaluate the region by giving the command
 @kbd{M-x eval-region}. You will be able to see the results of your
-customizations in that Emacs session only (@pxref{Lisp
+customizations in that SXEmacs session only (@pxref{Lisp
 Eval,,,sxemacs,SXEmacs User's Manual}).
 
 @comment  node-name,  next,  previous,  up
@@ -32,9 +33,9 @@ Eval,,,sxemacs,SXEmacs User's Manual}).
 @cindex key bindings
 @cindex keystrokes
 
-  Most of Emacs commands use key
+  Most of SXEmacs commands use key
 sequences. @xref{Keystrokes,,,sxemacs,SXEmacs User's Manual}, for more
-information about Keys and Commands. In Emacs, the keys themselves carry
+information about Keys and Commands. In SXEmacs, the keys themselves carry
 no meaning unless they are bound to a function. For example, @kbd{C-n}
 moves the cursor to the next line because its bound to the function
 @b{next-line}. Similarly, @kbd{C-p} moves to the previous line because
@@ -68,7 +69,7 @@ in the syntax stated above. Here, @samp{nil} stands for @samp{false}
 which means disable a command or turn off a feature. If you want to
 enable a command or turn on a particular feature use @samp{t}
 which stands for @samp{true}.  For example, if you do not wish @kbd{C-x
-C-c} to @samp{Exit Emacs} you can type the following expression in your
+C-c} to @samp{Exit SXEmacs} you can type the following expression in your
 @file{init.el} file:
 
 @example
@@ -78,7 +79,7 @@ C-c} to @samp{Exit Emacs} you can type the following expression in your
 @noindent
 You might want to have this statement in your @file{init.el} file because
 its easy to hit this command by mistake and it could be annoying to exit
-Emacs unintentionally. There is an @b{Exit Emacs} option in the @b{File
+Emacs unintentionally. There is an @b{Exit SXEmacs} option in the @b{File
 menu} which you might want to use instead. To make a particular key
 undefined you can also use:
 
@@ -198,7 +199,7 @@ Execute Last Macro      C-xe
 
 @noindent
 @b{Replace String} will now execute the function
-@code{replace-string}. Select this menu item. Emacs will prompt you for
+@code{replace-string}. Select this menu item. SXEmacs will prompt you for
 a string name to be replaced. Type a
 string and hit @key{RET}. Now type a new string to replace the old
 string and hit @key{RET}. All occurrences of the old string will be
index 05f69de..cefc94f 100644 (file)
@@ -509,26 +509,24 @@ versions of Unix in existence.
 @node Q1.0.2
 @unnumberedsec Q1.0.2: What is the current version of SXEmacs?
 
-SXEmacs 22.1.4 is the latest released version.
-The current development line will become 22.1.5.
+SXEmacs 22.1.15 is the latest released version.
+The current development line will become 22.1.16.
 
 
 @node Q1.0.3
 @unnumberedsec Q1.0.3: Where can I find it?
 
-The canonical source can be found via anonymous FTP at:
+The canonical source can be found on the web at:
 
 @example
-@uref{ftp://ftp.sxemacs.org/sxemacs/}
+@uref{http://downloads.sxemacs.org/}
 @end example
 
-There are also snapshots of the current development line available.
-However, the preferred method to obtain such ``snapshots'' is via tla
-(GNU arch):
+Occasionally there are also snapshots of the current development line
+available.  These can be found at:
 
 @example
-tla register-archive http://arch.sxemacs.org/2006
-tla get steve@@sxemacs.org--2006/sxemacs--main--22.1.5 sxemacs
+@uref{http://downloads.sxemacs.org/snapshots/}
 @end example
 
 
@@ -766,7 +764,7 @@ TeX, you can generate your own manual from the SXEmacs sources.
 HTML and Postscript versions of SXEmacs manuals are available from the
 SXEmacs web site at @uref{http://www.sxemacs.org}.
 @c are they?
-
+@c HTML are, but they may be a little out of date. --SY
 
 @node Q1.1.1
 @unnumberedsec 1.1: Policies
@@ -1253,23 +1251,16 @@ Real Unicode support will be introduced in SXEmacs 22.2.
 @unnumberedsec 1.4: Getting Started, Backing up & Recovery
 @unnumberedsec Q1.4.1: What is an @file{init.el} or @file{.emacs} and is there a sample one?
 
-The @file{init.el} or @file{.emacs} file is used to customise SXEmacs
-to your tastes.  The preferred location for the init
-file is @file{~/.sxemacs/init.el}.  We still accept the older location
-@file{~/.emacs}, but the first time you run it, it will ask to migrate
-your file to the new location.
-If you answer yes, the file will be moved, and a "compatibility"
-@file{.emacs} file will be placed in the old location so that you can
-still run older versions of XEmacs, or versions of GNU Emacs, which
-expect the old location.  The @file{.emacs} file present is just a
-stub that loads the real file in @file{~/.sxemacs/init.el}.
+The @file{init.el} file is used to customise SXEmacs to your tastes.
+The preferred location for the init file is
+@file{$XDG_CONFIG_HOME/sxemacs/init.el} (@pxref{Init File,,,lispref,SXEmacs
+Lisp Reference Manual}).
 
 No two init files are alike, nor are they expected to be alike, but
 that's the point.  The SXEmacs distribution contains an excellent
 starter example in the @file{etc/} directory called
 @file{sample.init.el}.  Copy this file from there to
-@file{~/.sxemacs/init.el}, where @samp{~} means your home directory,
-of course.  Then edit it to suit.
+@file{$XDG_CONFIG_HOME/sxemacs/init.el}, then edit it to suit.
 
 You may bring the @file{sample.init.el} file into a SXEmacs buffer
 from the menubar.  The menu entry is always under the @samp{Samples}
index 6608988..f17db76 100644 (file)
@@ -4,11 +4,11 @@
 @cindex arguments (from shell)
 
   SXEmacs supports command line arguments you can use to request
-various actions when invoking Emacs.  The commands are for compatibility
+various actions when invoking SXEmacs.  The commands are for compatibility
 with other editors and for sophisticated activities.  If you are using
 SXEmacs under the X window system, you can also use a number of
 standard Xt command line arguments. Command line arguments are not usually
-needed for editing with Emacs; new users can skip this section.
+needed for editing with SXEmacs; new users can skip this section.
 
   Many editors are designed to be started afresh each time you want to
 edit.  You start the editor to edit one file; then exit the editor.  The
@@ -17,16 +17,16 @@ start the editor again.  Under these circumstances, it makes sense to use a
 command line argument to say which file to edit.
 
   The recommended way to use SXEmacs is to start it only once, just
-after you log in, and do all your editing in the same Emacs process.
+after you log in, and do all your editing in the same SXEmacs process.
 Each time you want to edit a file, you visit it using the existing
-Emacs.  Emacs creates a new buffer for each file, and (unless you kill
-some of the buffers) Emacs eventually has many files in it ready for
-editing.  Usually you do not kill the Emacs process until you are about
-to log out.  Since you usually read files by typing commands to Emacs,
-command line arguments for specifying a file when Emacs is started are seldom
+SXEmacs.  SXEmacs creates a new buffer for each file, and (unless you kill
+some of the buffers) SXEmacs eventually has many files in it ready for
+editing.  Usually you do not kill the SXEmacs process until you are about
+to log out.  Since you usually read files by typing commands to SXEmacs,
+command line arguments for specifying a file when SXEmacs is started are seldom
 needed.
 
-  Emacs accepts command-line arguments that specify files to visit,
+  SXEmacs accepts command-line arguments that specify files to visit,
 functions to call, and other activities and operating modes.  If you
 are running SXEmacs under the X window system, a number of standard Xt
 command line arguments are available, as well as a few X parameters
@@ -82,7 +82,7 @@ Insert the contents of @var{file} into the current buffer.  This is like
 what @kbd{M-x insert-buffer} does; @xref{Misc File Ops}.
 
 @item -kill
-Exit from Emacs without asking for confirmation.  Always the last
+Exit from SXEmacs without asking for confirmation.  Always the last
 argument processed, no matter where it appears in the command line.
 
 @item -version
@@ -123,19 +123,19 @@ implies the @samp{-nw} option, documented below.
 
 @cindex batch mode
 @item -batch
-Run Emacs in @dfn{batch mode}, which means that the text being edited is
+Run SXEmacs in @dfn{batch mode}, which means that the text being edited is
 not displayed and the standard Unix interrupt characters such as
-@kbd{C-z} and @kbd{C-c} continue to have their normal effect.  Emacs in
+@kbd{C-z} and @kbd{C-c} continue to have their normal effect.  SXEmacs in
 batch mode outputs to @code{stderr} only what would normally be printed
 in the echo area under program control.
 
-Batch mode is used for running programs written in Emacs Lisp from shell
+Batch mode is used for running programs written in SXEmacs Lisp from shell
 scripts, makefiles, and so on.  Normally the @samp{-l} switch or
 @samp{-f} switch will be used as well, to invoke a Lisp program to do
 the batch processing.
 
 @samp{-batch} implies @samp{-q} (do not load an init file).  It also
-causes Emacs to kill itself after all command switches have been
+causes SXEmacs to kill itself after all command switches have been
 processed.  In addition, auto-saving is not done except in buffers for
 which it has been explicitly requested.
 
@@ -165,7 +165,7 @@ SXEmacs as a server (e.g. for gnuserv screens or external client widgets).
 
 @item -no-init-file
 @itemx -q
-Do not load your Emacs init file.  @xref{Init File}.
+Do not load your SXEmacs init file.  @xref{Init File}.
 
 @item -no-site-file
 Do not load the site-specific init file @file{lisp/site-start.el}.
@@ -182,19 +182,18 @@ concerning the package system, @xref{Startup Paths}.)
 This is equivalent to @samp{-q -no-site-file -no-early-packages}.
 
 @item -user-init-file @var{file}
-Load @var{file} as your Emacs init file instead of
-@file{~/.sxemacs/init.el}.
+Load @var{file} as your SXEmacs init file instead of the default
+@file{$XDG_CONFIG_HOME/sxemacs/init.el}.
 
 @item -user-init-directory @var{directory}
-Use @var{directory} as the location of your early package hierarchies
-and the various user-specific initialization files.
+Use @var{directory} as the location of your initialization files.
 
 @item -user @var{user}
 @itemx -u @var{user}
-Equivalent to @samp{-user-init-file ~@var{user}/.sxemacs/init.el
--user-init-directory ~@var{user}/.sxemacs}, or @samp{-user-init-file
-~@var{user}/.emacs -user-init-directory ~@var{user}/.sxemacs}, whichever
-init file comes first.  @xref{Init File}.
+Attempt to load @var{user} init instead of your own.  There is no
+privilege escalation going on, the SXEmacs process is still owned by
+you, not @var{user}.  In fact, using this option is often hindered by
+file and directory permissions. YMMV.  @xref{Init File}.
 
 @end table
 
@@ -213,7 +212,7 @@ sxemacs *.c
 @end example
 
 @noindent
-passes each @code{.c} file as a separate argument to Emacs, so that
+passes each @code{.c} file as a separate argument to SXEmacs, so that
 Emacs visits each file (@pxref{Visiting}).
 
   Here is an advanced example that assumes you have a Lisp program file
@@ -225,12 +224,12 @@ sxemacs -batch foo.c -l hack-c-program -f save-buffer -kill > log
 @end example
 
 @noindent
-Here Emacs is told to visit @file{foo.c}, load @file{hack-c-program.el}
+Here SXEmacs is told to visit @file{foo.c}, load @file{hack-c-program.el}
 (which makes changes in the visited file), save @file{foo.c} (note that
 @code{save-buffer} is the function that @kbd{C-x C-s} is bound to), and
 then exit to the shell from which the command was executed.  @samp{-batch}
 guarantees there will be no problem redirecting output to @file{log},
-because Emacs will not assume that it has a display terminal to work
+because SXEmacs will not assume that it has a display terminal to work
 with.
 
 @subsection Command Line Arguments (for SXEmacs Under X)
@@ -303,7 +302,7 @@ Use the geometry (window size and/or position) specified by @var{spec}.
 Start up iconified.
 
 @item -rv
-Bring up Emacs in reverse video.
+Bring up SXEmacs in reverse video.
 
 @item -name @var{name}
 Use the resource manager resources specified by @var{name}.
@@ -311,6 +310,6 @@ The default is to use the name of the program (@code{argv[0]}) as
 the resource manager name.
 
 @item -xrm
-Read something into the resource database for this invocation of Emacs only.
+Read something into the resource database for this invocation of SXEmacs only.
 
 @end table
index c6bd6dd..6373a72 100644 (file)
@@ -1539,17 +1539,19 @@ and some English to explain that string if necessary.
 @node Init File
 @section The Init File
 @cindex init file
+@cindex init directory
 @cindex Emacs initialization file
 @cindex key rebinding, permanent
 @cindex rebinding keys, permanently
 
-  When you start SXEmacs, it normally loads @file{.sxemacs/init.el}
-in your home directory.  This file, if it exists, should contain Lisp
-code.  It is called your initialization file or @dfn{init file}.  Use
-the command line switch @samp{-q} to tell SXEmacs whether to load an init
-file (@pxref{Entering Emacs}).  Use the command line switch
-@samp{-user-init-file} (@pxref{Command Switches}) to tell Emacs to load
-a different file instead of @file{~/.sxemacs/init.el}.
+  When you start SXEmacs, it normally loads @file{init.el}
+in your @code{user-init-directory} (@pxref{Init File,,,lispref,SXEmacs
+Lisp Reference Manual}).  This file, if it exists, should contain
+Lisp code.  It is called your initialization file or @dfn{init file}.
+Use the command line switch @samp{-q} to tell SXEmacs whether to load
+an init file (@pxref{Entering Emacs}).  Use the command line switch
+@samp{-user-init-file} (@pxref{Command Switches}) to tell Emacs to
+load a different file instead.
 
 When the init file is read, the variable @code{user-init-file} says
 which init file was loaded.
@@ -1563,7 +1565,7 @@ first; if it sets @code{inhibit-default-init} non-@code{nil}, then
 @file{default} is not loaded.
 
   If you have a large amount of code in your init file, you should
-byte-compile it to @file{~/.sxemacs/init.elc}.
+byte-compile it to @file{init.elc}.
 
 @menu
 * Init Syntax::     Syntax of constants in Emacs Lisp.
index 2702868..6a1fc59 100644 (file)
@@ -1,3 +1,4 @@
+@c FIXME -- some of the paths here are out of date and wrong.
 @node Startup Paths, Packages, Command Switches, Top
 @comment  node-name,  next,  previous,  up
 @section How SXEmacs finds Directories and Files
index 36e4f59..4973427 100644 (file)
@@ -686,10 +686,7 @@ You need not ask for permission to do so, or tell any one else; just copy
 it.
 
 If you have access to the Internet, you can get the latest version of
-SXEmacs from the anonymous FTP server @file{ftp.sxemacs.org} in the directory
-@file{/pub/sxemacs}.  It can also be found at numerous other archive
-sites around the world; check the file @file{etc/DISTRIB} in an SXEmacs
-distribution for the latest known list.
+SXEmacs from our download site at @uref{http://downloads.sxemacs.org}.
 
 
 @unnumberedsec Getting Other Versions of Emacs
index e3a3bbd..3276074 100644 (file)
@@ -96,13 +96,14 @@ corelispels =                                                               \
        page.el paragraphs.el paths.el picture.el printer.el            \
        process.el rect.el regexp-opt.el register.el replace.el         \
        resize-minibuffer.el scrollbar.el select.el shadow.el simple.el \
-       sound.el specifier.el subr.el symbol-syntax.el symbols.el       \
-       syntax.el text-mode.el text-props.el toolbar-items.el           \
-       toolbar.el tty-init.el undo-stack.el userlock.el version.el     \
-       view-less.el wid-browse.el wid-edit.el widget.el                \
-       window-xemacs.el window.el x-color.el x-compose.el x-faces.el   \
-       x-font-menu.el x-init.el x-iso8859-1.el x-misc.el x-mouse.el    \
-       x-scrollbar.el x-select.el x-win-sun.el x-win-xfree86.el
+       site-start.el sound.el specifier.el subr.el symbol-syntax.el    \
+        symbols.el syntax.el text-mode.el text-props.el                 \
+       toolbar-items.el toolbar.el tty-init.el undo-stack.el           \
+       userlock.el version.el view-less.el wid-browse.el wid-edit.el   \
+       widget.el window-xemacs.el window.el x-color.el x-compose.el    \
+       x-faces.el x-font-menu.el x-init.el x-iso8859-1.el x-misc.el    \
+       x-mouse.el x-scrollbar.el x-select.el x-win-sun.el              \
+       x-win-xfree86.el
 
 ffilispels =                                                           \
        ffi/ffi-curl.el ffi/ffi-gcrypt.el ffi/ffi-libc.el               \
index 408cdaf..d10b77f 100644 (file)
@@ -43,8 +43,8 @@
 ;;    and single-minded.  It will only use the default magic db and
 ;;    doesn't allow use of any of file(1)'s options.
 ;;
-;;    (magic:file-type "~/.sxemacs/init.el")
-;;     => "Lisp/Scheme program text"
+;;    (magic:file-type (expand-file-name "about.el" lisp-directory))
+;;     => "Lisp/Scheme program, ISO-8859 text"
 
 ;;; Todo:
 ;;
index c36b101..ea5ac23 100644 (file)
@@ -1259,9 +1259,9 @@ from the end of the file name anything that matches one of these regexps.")
   nil ; set by command-line
   "File name including directory of user's initialization file.
 
-This normally defaults to \"~/.sxemacs/init.el\", if you are a XEmacs
-user you can get up and running quickly by symlinking \"~/.sxemacs\"
-to your old \"~/.xemacs\" directory.")
+This normally defaults to \"${XDG_CONFIG_HOME}/sxemacs/init.el\", if
+you are a XEmacs user you can get up and running quickly by symlinking
+your old \"~/.xemacs\" directory.")
 
 (defun set-auto-mode (&optional just-from-file-name)
   "Select major mode appropriate for current buffer.
index e15974e..d805f63 100644 (file)
@@ -2522,10 +2522,10 @@ which returns to Info mode for browsing.
 (defun Info-annotate (arg)
   "Add a personal annotation to the current Info node.
  Only you will be able to see this annotation.  Annotations are stored
-in the file \"~/.sxemacs/info.notes\" by default.  If point is inside
-an existing annotation, edit that annotation.  A prefix argument
-specifies which annotations file (from `Info-annotations-path') is to
-be edited; default is 1."
+in the file \"info.notes\" in your `user-init-directory' by default.  If
+point is inside an existing annotation, edit that annotation.  A prefix
+argument specifies which annotations file (from `Info-annotations-path')
+is to be edited; default is 1."
   (interactive "p")
   (setq arg (1- arg))
   (if (or (< arg 0) (not (nth arg Info-annotations-path)))
index be60010..59e03ff 100644 (file)
@@ -143,7 +143,7 @@ Turn off this help buffer permanently by adding:
 
 \t \(setq report-sxemacs-bug-no-explanations t\)
 
-To your ~/.sxemacs/init.el")
+To your `user-init-file'")
 
 (defun report-sxemacs-bug-help ()
   "Display the help buffer for `report-sxemacs-bug'."
index b73d1b6..9299c28 100644 (file)
@@ -1555,7 +1555,8 @@ See also `menu-split-long-menu'."
       ["Edit I%_nit File"
        ;; #### there should be something that holds the name that the init
        ;; file should be created as, when it's not present.
-       (progn (find-file (or user-init-file "~/.sxemacs/init.el"))
+       (progn (find-file (or user-init-file
+                            (expand-file-name "init.el" user-init-directory)))
              (or (eq major-mode 'emacs-lisp-mode)
                  (emacs-lisp-mode)))]
       ["%_Save Options to Custom File" customize-save-customized]
index f45c667..09aeee7 100644 (file)
@@ -257,7 +257,8 @@ all else fails.  As a side effect of installing packages under
   (if (and pkg-dir
           (file-writable-p (directory-file-name pkg-dir)))
       pkg-dir
-    ;; If the user want her packages under ~/.sxemacs/, do so.
+    ;; If the user want her packages in her $HOME, do so.  Currently,
+    ;; that means in `user-init-directory'.
     (let ((type (package-get-info package 'category)))
       (if package-get-install-to-user-init-directory
          (progn
diff --git a/lisp/site-start.el b/lisp/site-start.el
new file mode 100644 (file)
index 0000000..c8955a6
--- /dev/null
@@ -0,0 +1,58 @@
+;;; site-start.el --- Site-wide customisations
+;;                    that must be loaded before the user's init files
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Up until now (May, 2015), user-init-directory had always been
+;; hard-coded to ~/.sxemacs.  Today we take a more "dynamic"
+;; approach and support $XDG_CONFIG_HOME as well.  Unfortunately,
+;; that flexibility has consequences.  This snippet deals with
+;; those consequences. --SY
+(when (zerop (length user-init-directory))
+
+  ;; Compute the init directory location
+  (setq user-init-directory (find-user-init-directory))
+
+  ;; Make sure the load-path includes any packages the user may have
+  ;; in their local setup.
+  (unless inhibit-early-packages
+    (startup-setup-paths emacs-roots user-init-directory))
+
+  ;; There could possibly now be some more auto-autoloads to load from
+  ;; the user's local packages.
+  (unless inhibit-autoloads
+    (unless inhibit-early-packages
+      (packages-load-package-auto-autoloads early-package-load-path)))
+
+  ;; emodules ?
+
+  ;; Reset the lisp init.d directory
+  (setq lisp-initd-dir
+       (file-name-as-directory
+        (paths-construct-path (list user-init-directory
+                                    lisp-initd-basename))))
+
+  ;; Lastly, warn the user if multiple candidates for user-init-directory
+  ;; were found.
+  (let* ((legacy (expand-file-name "~/.sxemacs"))
+        (xdg (expand-file-name "sxemacs"
+                               (getenv "XDG_CONFIG_HOME")))
+        (fback (paths-construct-path
+                (list (user-home-directory) ".config" "sxemacs")))
+        (dirs (remove-duplicates
+               (list legacy xdg fback) :test #'string=))
+        (ndirs (count-if #'file-directory-p dirs)))
+    (when (> ndirs 1)
+      (lwarn 'multi-initd nil
+       "Multiple init directories found:
+%S
+
+Currently using: %s
+
+See `display-warning-suppressed-classes' to suppress this warning"
+       dirs user-init-directory))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Site-specific additions go here.
+
+
+;;; End site-start.el
index 1004d5f..81e668d 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc.
 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc.
 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
-;; Copyright (C) 2004 - 2012 Steve Youngs
+;; Copyright (C) 2004 - 2015 Steve Youngs
 
 ;; Maintainer: SXEmacs Development Team
 ;; Keywords: internal, dumped
@@ -92,17 +92,41 @@ the user's init file.")
 (defvar emacs-roots nil
   "List of plausible roots of the SXEmacs hierarchy.")
 
-(defvar user-init-directory-base ".sxemacs"
-  "Base of directory where user-installed init files may go.")
-
-(defvar user-init-directory
-  (file-name-as-directory
-   (paths-construct-path (list "~" user-init-directory-base)))
+(defun find-user-init-directory ()
+  "Find the user's init directory.
+
+If no init directory currently exists, this will return:
+\"$XDG_CONFIG_HOME/sxemacs\", which falls back to
+\"~/.config/sxemacs\" if $XDG_CONFIG_HOME is not set in the user's
+environment.
+
+If the legacy init directory, \"~/.sxemacs\" exists, return that.
+
+If both the legacy directory and the XDG-based directory exist, return
+the XDG-based directory unless $SXE_USE_LEGACY is set in the user's
+environment."
+  (let* ((legacy (getenv "SXE_USE_LEGACY"))
+        (xdg (getenv "XDG_CONFIG_HOME"))
+        (xdgdir (or (and xdg
+                         (paths-construct-path
+                          (list xdg "sxemacs")))
+                    (paths-construct-path
+                     (list (user-home-directory) ".config" "sxemacs"))))
+        (legacydir (paths-construct-path
+                    (list (user-home-directory) ".sxemacs")))
+        (locations (list xdgdir legacydir)))
+    (if legacy
+       (file-name-as-directory legacydir)
+      (catch 'found
+       (dolist (dir locations)
+         (and (paths-file-readable-directory-p dir)
+              (throw 'found (file-name-as-directory dir))))
+       (file-name-as-directory xdgdir)))))
+
+(defvar user-init-directory ""
   "Directory where user-installed init files may go.
 
-This defaults to \"~/.sxemacs\".  Old XEmacs users can get up and
-running quickly by symlinking \"~/.sxemacs\" to their existing
-\"~/.xemacs\" directory.")
+See: `find-user-init-directory'.")
 
 (defvar user-init-file-base-list '("init.elc" "init.el")
   "List of allowed init files in the user's init directory.
@@ -115,13 +139,13 @@ The first one found takes precedence.")
 
 (defvar site-start-file "site-start"
   "File containing site-wide run-time initializations.
-This file is loaded at run-time before `~/.sxemacs/init.el'.  It
+This file is loaded at run-time before `user-init-file'.  It
 contains inits that need to be in place for the entire site, but
 which, due to their higher incidence of change, don't make sense to
 load into SXEmacs' dumped image.  Thus, the run-time load order is:
 
   1. file described in this variable, if non-nil;
-  2. `~/.sxemacs/init.el';
+  2. `user-init-file';
   3. `/path/to/sxemacs/lisp/default.el'.
 
 Don't use the `site-start.el' file for things some users may not like.
@@ -224,6 +248,7 @@ In addition, the")
   -user-init-file <file> Use <file> as init file.
   -user-init-directory <directory> Use <directory> as init directory.
   -user <user>          Load user's init file instead of your own.
+                        Probably not a wise thing to do.
   -u <user>             Same as -user.\n")
    (let ((l command-switch-alist)
          (insert (lambda (&rest x)
@@ -498,10 +523,14 @@ Type ^H^H^H (Control-h Control-h Control-h) to get more help options.\n")
        ((or (string= arg "-u")
            (string= arg "-user"))
        (let* ((user (pop args))
-              (home-user (concat "~" user)))
-         (setq user-init-directory (file-name-as-directory
-                                    (paths-construct-path
-                                     (list home-user user-init-directory-base))))
+              (home-user (concat "~" user))
+              (xdgdir (paths-construct-path
+                       (list home-user ".config" "sxemacs")))
+              (legacydir (paths-construct-path (list home-user ".sxemacs")))
+              (dir-user (or (and (file-directory-p xdgdir)
+                                 (file-name-as-directory xdgdir))
+                            (file-name-as-directory legacydir))))
+         (setq user-init-directory dir-user)
          (setq user-init-file
                (find-user-init-file user-init-directory))
          (setq custom-file
index 6b1fa8f..fcacee8 100644 (file)
@@ -2,7 +2,7 @@ dnl SXEmacs emodules configure script
 dnl -------------------------------------------------------------------------
 
 AC_PREREQ(2.59)
-AC_INIT([SXEmacs modules], [22.1.6],[http://issues.sxemacs.org/])
+AC_INIT([SXEmacs modules], [22.1.15],[http://issues.sxemacs.org/])
 AC_CONFIG_HEADERS([config.emods.h])
 AC_LANG(C)