Subject: bug#9481: 24.0.50; emacs_dir behavior too cumbersome for use within msys

From: CRLF0710 <[email-masked]>
Date: Mon, 12 Sep 2011 16:01:44 +0800

Hello.

emacs_dir is a special environment variable on Win32. If Emacs.exe is
located in a "bin/" directory, it will be calculated, which is not a
desired behavior at all times.

One might want to use it in msys and organize the emacs files in a way
similiar to that of *nix systems. To fulfill this, one might want to
set emacs_dir to the *:/share/emacs/<version>/ directory. This works
unless the emacs.exe is in the *:/bin directory(in fact any directory
which is not with the name "bin" or "i386").

in src/w32.c, the existing code

>  _snprintf (buf, sizeof (buf)-1, "emacs_dir=%s", modname);
>  _putenv (strdup (buf));

will override this settings directly, but i think to modify the
env_vars[] array, which is a copy of dflt_envvars[],
should be the correct behavior.

something like:
>    for (i = 0; i < N_ENV_VARS; i++)
>    {
>      if(strcmp(env_vars[i].name, "emacs_dir")==0)
>      {
>        env_vars[i].def_value = <somewhere on stack>;
>      }
>    }
may solve this.

In GNU Emacs 24.0.50.1 (i386-mingw-nt6.1.7601)
 of 2011-04-11 on SHAN-PC
Windowing system distributor `Microsoft Corp.', version 6.1.7601
configured using `configure --with-gcc (3.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: CHS
  value of $XMODIFIERS: nil
  locale-coding-system: cp936
  default enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  recentf-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o <tab> r t - e m <tab> b <tab> <return>

Recent messages:
Loading recentf...done
Loading d:/home/CrLFWorkshop/.recentf...done
Cleaning up the recentf list...done (0 removed)
Ido mode enabled
Loading d:/progra~1/emacs/site-lisp/proofgeneral/generic/proof-site.el
(source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Load-path shadows:
d:/Program Files/Emacs/site-lisp/emacs-jabber-0.8.0/compat/sha1 hides
d:/Program Files/Emacs/lisp/sha1
d:/Program Files/Emacs/site-lisp/emacs-jabber-0.8.0/compat/hex-util
hides d:/Program Files/Emacs/lisp/hex-util
d:/Program Files/Emacs/site-lisp/emms/tq hides d:/Program
Files/Emacs/lisp/emacs-lisp/tq
d:/Program Files/Emacs/site-lisp/emacs-w3m/attic/rfc2368 hides
d:/Program Files/Emacs/lisp/mail/rfc2368

Features:
(shadow mail-extr message rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev
mail-utils gmm-utils mailheader emacsbug help-mode view multi-term term
ehelp electric proof-site proof-autoloads pg-vars lyric-mode
emms-bookmarks emms-lastfm-client emms-lastfm-scrobbler w3m doc-view
jka-compr image-mode timezone w3m-hist w3m-fb bookmark-w3m w3m-ems
w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util xml parse-time
emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort
emms-last-played emms-player-xine emms-player-mpd tq emms-playing-time
emms-streams emms-tag-editor format-spec emms-info-metaflac emms-mark
emms-mode-line emms-cache emms-info-ogginfo emms-info-mp3info emms-info
later-do emms-playlist-mode emms-player-vlc emms-player-mplayer
emms-source-playlist emms-lyrics emms-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-util url-parse
auth-source eieio assoc gnus-util password-cache url-vars mm-util
mail-prsvr mailcap time-date emms-source-file locate dired
emms-player-simple hl-line emms-setup emms emms-compat jabber-autoloads
anything warnings ido inferior-slime inf-lisp info-look info
slime-autodoc advice advice-preload slime-parse slime-autoloads slime
byte-opt bytecomp byte-compile cconv macroexp derived help-fns edmacro
kmacro easy-mmode hideshow pp comint ring hyperspec thingatpt browse-url
cl cc-mode cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs regexp-opt recentf tree-widget wid-edit easymenu
cus-start cus-load china-util tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 disp-table ls-lisp w32-win w32-vars
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer button faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process multi-tty
emacs)
--
Wir müssen wissen; wir werden wissen!
CrLF.0710