Skip to content

Instantly share code, notes, and snippets.

@naghbIQtIqHom
Last active December 31, 2015 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naghbIQtIqHom/7911699 to your computer and use it in GitHub Desktop.
Save naghbIQtIqHom/7911699 to your computer and use it in GitHub Desktop.
In order to install tc in Windows without Network or behind proxy with authentic, I write these scripts. Bushu Gōsē Henkan doesn't work. If you know the reason, show me it. All files are put a top directory in the extracted tc-master or cloned from github. To execute install.bat, just double click this batchfile or call in the cmd.exe.
set |findstr ^EMACS= >nul 2>nul
if NOT {%ERRORLEVEL%} == {0} set EMACS=emacs.exe
set |findstr ^LISPDIR= >nul 2>nul
if NOT {%ERRORLEVEL%} == {0} set LISPDIR=%USERPROFILE%\tc\lisp
set |findstr ^DATADIR= >nul 2>nul
if NOT {%ERRORLEVEL%} == {0} set DATADIR=%USERPROFILE%\tc\tcode
set SRCDIR=%~dp0
echo current is %BATCHDIR%.
xcopy /Y /Q lisp "%LISPDIR%\"
xcopy /Y /Q mazegaki "%DATADIR%\"
copy etc\bushu.rev "%DATADIR%\"
copy etc\symbol.rev "%DATADIR%\"
"%EMACS%" -q -batch --no-site-file -chdir "%SRCDIR%\." -l mktc.el
cd "%DATADIR%"
set |findstr ^CD= >nul 2>nul
if NOT {%ERRORLEVEL%} == {0} set CD="%DATADIR%"
"%EMACS%" -q -batch --no-site-file -chdir "%DATADIR%" -l mk-mzdic
cd "%LISPDIR%"
"%EMACS%" -q -batch --no-site-file -chdir "%LISPDIR%" -l "%SRCDIR%replace.el"
cd "%SRCDIR%"
set LISPDIRSLASH=%LISPDIR:\=/%
@echo Emacs for Windows ならば
@echo %APPDATA%\.emacs.d\init.el
@echo gnupack の emacs ならば
@echo [gnupack installed dir]/home/.emacs.d/init.el
@echo に追加して下さい。
@echo (setq load-path (cons "%LISPDIRSLASH%" load-path))
@echo (require 'tc-setup)
Pause
(setq lispdir (getenv "LISPDIR"))
(setq dir (getenv "DATADIR"))
(setq load-path (cons lispdir load-path))
(require 'tc)
(unless (file-exists-p tcode-init-file-name)
(let (mybuffer)
(setq mybuffer (find-file tcode-init-file-name))
(insert ";;; -*-emacs-lisp-*- This file is automatically created\n")
(insert (format "(setq tcode-data-directory \"%s\")\n" (file-name-as-directory dir)))
(insert (format "(setq tcode-default-input-method \"%s\")\n"
(or tcode-current-package
tcode-default-input-method)))
(insert ";(setq tcode-key-layout \"qwerty-jis-shift\")\n")
(save-buffer)
(kill-buffer mybuffer)))
(defun replace-tcode-site-data-directory ()
"/usr/local/share/tc/ を置き換える"
(let (mybuffer)
(setq lispdir (getenv "LISPDIR"))
(setq tc-data-directory (getenv "DATADIR"))
(setq tc-pre-el (concat (file-name-as-directory lispdir) "tc-pre.el"))
(setq tc-tcode (file-name-as-directory tc-data-directory))
(setq mybuffer (find-file tc-pre-el))
(goto-char (point-min))
(search-forward-regexp "^(defconst tcode-site-data-directory ")
(let ((from-string "/usr/local/share/tc/")
(to-string (file-name-as-directory tc-data-directory)))
(if (search-forward from-string nil t)
(replace-match to-string nil t)))
(save-buffer)
(kill-buffer mybuffer)))
(replace-tcode-site-data-directory)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment