1264 |
(defun te-create-terminfo () |
(defun te-create-terminfo () |
1265 |
"Create and compile a terminfo entry for the virtual terminal. This is kept |
"Create and compile a terminfo entry for the virtual terminal. This is kept |
1266 |
in the directory specified by `te-terminfo-directory'." |
in the directory specified by `te-terminfo-directory'." |
1267 |
(if (and system-uses-terminfo |
(when (and system-uses-terminfo |
1268 |
(not (file-exists-p (concat te-terminfo-directory |
(not (file-exists-p (concat te-terminfo-directory |
1269 |
(substring te-terminal-name-prefix 0 1) |
(substring te-terminal-name-prefix 0 1) |
1270 |
"/" te-terminal-name)))) |
"/" te-terminal-name)))) |
1271 |
(let ( (terminfo |
(let ( (terminfo |
1272 |
(concat |
(concat |
1273 |
;; The first newline avoids trouble with ncurses. |
;; The first newline avoids trouble with ncurses. |
1278 |
"dch=^Pd%p1%'\\s'%+%c, dch1=^Pd!, dl=^P^K%p1%'\\s'%+%c," |
"dch=^Pd%p1%'\\s'%+%c, dch1=^Pd!, dl=^P^K%p1%'\\s'%+%c," |
1279 |
"dl1=^P^K!, ed=^PC, el=^Pc, home=^P=\\s\\s," |
"dl1=^P^K!, ed=^PC, el=^Pc, home=^P=\\s\\s," |
1280 |
"ich=^P_%p1%'\\s'%+%c, ich1=^P_!, il=^P^O%p1%'\\s'%+%c," |
"ich=^P_%p1%'\\s'%+%c, ich1=^P_!, il=^P^O%p1%'\\s'%+%c," |
1281 |
|
;; The last newline avoids trouble with ncurses. |
1282 |
"il1=^P^O!, ind=^P\\n, nel=\\n,\n")) |
"il1=^P^O!, ind=^P\\n, nel=\\n,\n")) |
1283 |
;; The last newline avoids trouble with ncurses. |
;; This is the desired name for the source file. |
1284 |
(file-name (concat te-terminfo-directory te-terminal-name ".tif")) ) |
(file-name (concat te-terminfo-directory te-terminal-name ".tif")) ) |
1285 |
(make-directory te-terminfo-directory t) |
(make-directory te-terminfo-directory t) |
1286 |
(save-excursion |
(let ((temp-file |
1287 |
(set-buffer (create-file-buffer file-name)) |
(make-temp-file (expand-file-name "tif" te-terminfo-directory)))) |
1288 |
(insert terminfo) |
;; Store the source file under a random temp name. |
1289 |
(write-file file-name) |
(with-temp-file temp-file |
1290 |
(kill-buffer nil) |
(insert terminfo)) |
1291 |
) |
;; Rename it to the desired name. |
1292 |
(let ( (process-environment |
;; We use this roundabout approach |
1293 |
(cons (concat "TERMINFO=" |
;; to avoid any risk of writing a name that |
1294 |
(directory-file-name te-terminfo-directory)) |
;; was michievouslyt set up as a symlink. |
1295 |
process-environment)) ) |
(rename-file temp-file file-name)) |
1296 |
|
;; Now compile that source to make the binary that the |
1297 |
|
;; programs actually use. |
1298 |
|
(let ((process-environment |
1299 |
|
(cons (concat "TERMINFO=" |
1300 |
|
(directory-file-name te-terminfo-directory)) |
1301 |
|
process-environment))) |
1302 |
(set-process-sentinel (start-process "tic" nil "tic" file-name) |
(set-process-sentinel (start-process "tic" nil "tic" file-name) |
1303 |
'te-tic-sentinel)))) |
'te-tic-sentinel)))) |
1304 |
(directory-file-name te-terminfo-directory) |
(directory-file-name te-terminfo-directory)) |
|
) |
|
1305 |
|
|
1306 |
(defun te-create-termcap () |
(defun te-create-termcap () |
1307 |
"Create a termcap entry for the virtual terminal" |
"Create a termcap entry for the virtual terminal" |