home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / j6217.zip / j.ini < prev   
Lisp/Scheme  |  1996-02-17  |  20KB  |  532 lines

  1. ; -*- mode:emacs-lisp;comment-column:48 -*-
  2.  
  3. (global-set-key 0 #\q '(kill-j))
  4. (calc-screen-size)
  5. ;(spawn P_WAIT '("mode.com" "100,40")) (calc-screen-size)
  6.  
  7. ;
  8. ; Define variables
  9. ; ================
  10. ;
  11. (setq back-top-margin 2)
  12. (setq back-bottom-margin 1)
  13. (setq back-side-margin 1)
  14. (setq default-sort-type ST_NAME)
  15.  
  16. (setq dialog-attribute (| (<< C_BLUE 4) C_LWHITE))
  17. (setq selector-active-item-attribute (| (<< C_WHITE 4) C_LYELLOW))
  18. (setq selector-item-attribute (| (<< C_WHITE 4) C_BLACK))
  19.  
  20. ;
  21. ; Define functions
  22. ; ================
  23. ;
  24. (defun hidden-file-p (fname atr)        ; reserved name.
  25.     (or (!= 0 (& atr A_HIDDEN))
  26.     (string-tail= fname "~")
  27.     (and (= #\. (char fname 0)) (not (string= ".." fname)))))
  28.  
  29. (defun decide-file-color (fname atr)        ; reserved name.
  30.   (let ((fore C_LWHITE) (back C_BLACK))
  31.     (cond ((!= 0 (& atr A_RONLY)) (setq fore C_LYELLOW))
  32.       ((!= 0 (& atr A_DIR)) (setq fore C_LGREEN))
  33.       ((archive-p fname) (setq fore C_LCYAN))
  34.       ((string-tail= fname ".exe" ".com" ".bat" ".cmd") (setq fore C_LMAGENTA))
  35.       ((hidden-file-p fname atr) (setq fore C_WHITE))
  36.       ((string= fname "core") (setq fore C_LRED)))
  37.     (cons fore back)))
  38.  
  39. (defun archive-p (fname)            ; reserved name.
  40.   (string-tail= fname ".lzh" ".zip"))
  41.  
  42. (defun redraw-all ()                ; reserved name.
  43.   (window-clear 2)
  44.   (redraw 0)
  45.   (redraw 1)
  46.   (window-set-attribute 2 (| (<< C_GREEN 4) C_LWHITE))
  47.   (window-print 2 0 0 "==== " (subseq (get-version) 0 17) " ====")
  48.   (window-set-attribute 2 (| (<< C_BLACK 4) C_LWHITE)))
  49.  
  50. (defun reload-redraw ()
  51.   (reload 0)
  52.   (reload 1)
  53.   (redraw-all))
  54.  
  55. (defun toggle-display-all-files ()
  56.   (toggle-display-all-flag)
  57.   (reload)
  58.   (redraw))
  59.  
  60. (defun go-root ()
  61.   (go (subseq (get-this-path) 0 3)))
  62.  
  63. (defun go-parent ()
  64.   (and (< 3 (length (get-this-path)))
  65.        (go (omit-period (concat (add-last-sep (get-this-path)) "..")))))
  66.  
  67. (defun go-drive (drive)
  68.   (go (getcwd1 drive)))
  69.  
  70. (defun mint-arrow-left ()
  71.   (if (= 0 (get-active-window)) (go-parent)
  72.     (other-window)))
  73. (defun mint-arrow-right ()
  74.   (if (= 1 (get-active-window)) (go-parent)
  75.     (other-window)))
  76.  
  77. (defun select-all-files ()
  78.   (let ((i 0) (fl t))
  79.     (clear-select)
  80.     (while fl
  81.       (setq fl (get-nth-file-name-attribute i))
  82.       (and fl
  83.        (= 0 (& A_DIR (second fl)))
  84.        (select i))
  85.       (setq i (1+ i)))))
  86. (defun select-all ()
  87.   (let ((i 0) (fl t))
  88.     (clear-select)
  89.     (while fl
  90.       (setq fl (get-nth-file-name i))
  91.       (and fl
  92.        (or (string= (basename fl) "..")
  93.            (select i)))
  94.       (setq i (1+ i)))))
  95.  
  96. (defun rename-copy (src destdir)
  97.   (let ((p (center-position 50 4)) w ret (n (basename src)) c r st (job t))
  98.     (setq r (if (= 0 (get-active-window)) -10 10))
  99.     (while job
  100.       (setq w (new-window (+ r (car p)) (cdr p) 50 4 dialog-attribute))
  101.       (window-print w 2 0 "Rename copy: " src)
  102.       (setq c (strrchr n #\.))
  103.       (setq c (if c c (length n)))
  104.       (setq ret (read-line w 3 2 44 n c))
  105.       (delete-window w)
  106.       (if ret (progn
  107.         (setq ret (concat (add-last-sep destdir) ret))
  108.         (setq *quiet-error* t)
  109.         (setq st (stat ret))
  110.         (setq *quiet-error* nil)
  111.         (if st (message ret " already exists.")
  112.           (progn
  113.             (copy-file src ret)
  114.             (setq job nil))))))))
  115. (defun selective-copy (src destdir)
  116.   (let* ((dest (concat (add-last-sep destdir) (basename src)))
  117.      st sel sts)
  118.     (setq *quiet-error* t)
  119.     (setq st (stat dest))
  120.     (setq *quiet-error* nil)
  121.     (cond ((directory-p src)
  122.        (mkdir dest)
  123.        (setq sel (readdir src))
  124.        (while sel
  125.          (selective-copy (concat (add-last-sep src) (car sel)) dest)
  126.          (setq sel (cdr sel))))
  127.       (st
  128.        (setq sel (selector (if (= 0 (get-active-window)) (concat "Copy: " src " -> " destdir)
  129.                  (concat "Copy: " destdir " <- " src))
  130.                    '((#\u "  Update     " 0)
  131.                  (#\o "  Overwrite  " 1)
  132.                  (#\r "  Rename     " 2)
  133.                  (#\n "  Not copy   " 3))))
  134.        (cond ((= sel 0) (setq sts (stat src)) (if (and sts (< (fourth st) (fourth sts))) (copy-file src dest)))
  135.          ((= sel 1) (copy-file src dest))
  136.          ((= sel 2) (rename-copy src destdir))))
  137.       (t (copy-file src dest)))))
  138. (defun copy-to (dest)
  139.   (cond ((= 0 (get-number-of-selected)) (selective-copy (get-name-on-cursor) dest))
  140.     (t (let ((sel (get-selected-list)))
  141.          (while sel
  142.            (selective-copy (car sel) dest)
  143.            (setq sel (cdr sel))))))
  144.   (reload-redraw))
  145.  
  146. (defun move-to (dest)
  147.   (cond ((= 0 (get-number-of-selected))
  148.      (rename (get-name-on-cursor) (concat (add-last-sep dest) (basename (get-name-on-cursor)))))
  149.     (t (let ((li (get-selected-list)))
  150.          (while li
  151.            (rename (car li) (concat (add-last-sep dest) (basename (car li))))
  152.            (setq li (cdr li))))))
  153.   (reload-redraw))
  154.  
  155. (defun get-file-attribute (name)
  156.   (sixth (stat name)))
  157. (defun get-file-size (name)
  158.   (second (stat name)))
  159. (defun directory-p (name)
  160.   (!= 0 (& (get-file-attribute name) A_DIR)))
  161. (defun read-only-p (name)
  162.   (!= 0 (& (get-file-attribute name) A_RONLY)))
  163. (defun chmod-r (name)
  164.   (chmod name (& (get-file-attribute name) (~ A_RONLY))))
  165.  
  166. ;
  167. ; Dialogs
  168. ; =======
  169. ;     
  170. (defun center-position (dx dy)
  171.   (cons (/ (- (car (get-screen-size)) dx) 2)
  172.     (/ (- (cdr (get-screen-size)) dy) 2)))
  173.  
  174. (defun confirm-message (str)
  175.   (let ((x (car (get-screen-size))) w)
  176.     (setq w (new-window (/ x 4) 4 (/ x 2) 8 dialog-attribute))
  177.     (window-print w 2 1 str)
  178.     (get-key)
  179.     (delete-window w)))
  180.  
  181. (defun y-or-n-p (str)
  182.   (let ((x (car (get-screen-size))) w k (ret nil))
  183.     (setq w (new-window (/ x 4) 4 (/ x 2) 8 dialog-attribute))
  184.     (window-print w 2 1 str " (y/n)?")
  185.     (while (null ret)
  186.       (setq k (get-key))
  187.       (cond ((or (= #\Y k) (= #\y k) (= K_RETURN k)) (setq ret 1))
  188.         ((or (= #\N k) (= #\n k) (= K_ESC k)) (setq ret 2))))
  189.     (delete-window w)
  190.     (= ret 1)))
  191.  
  192. (defun eval-expression ()
  193.   (let ((p (center-position 50 3)) w ret r)
  194.     (setq w (new-window (car p) (cdr p) 50 3 dialog-attribute))
  195.     (window-print w 2 1 "Eval:")
  196.     (setq ret (read-line w 7 1 42))
  197.     (delete-window w)
  198.     (if ret (eval (lisp-parser ret)))))
  199.  
  200. (defun edit-command-line (type)
  201.   (let ((p (center-position 60 3)) w ret r)
  202.     (setq w (new-window (car p) (cdr p) 60 3 dialog-attribute))
  203.     (window-print w 2 0 "Command line:")
  204.     (setq ret (cond ((= 0 type)
  205.              (read-line w 2 1 56 (concat (get-name-on-cursor) " ") (1+ (length (get-name-on-cursor)))))
  206.             ((= 1 type)
  207.              (read-line w 2 1 56 (concat " " (get-name-on-cursor)) 0))))
  208.     (delete-window w)
  209.     ret))
  210.  
  211. (defun remove-file (name)
  212.   (if (read-only-p name)
  213.       (and (y-or-n-p (concat name " is read-only.\n      Remove"))
  214.        (chmod-r name)
  215.        (remove name))
  216.     (remove name)))
  217. (defun remove-1 (name)
  218.   (cond ((directory-p name)
  219.      (and (y-or-n-p (concat "Remove " name )) (rm-fr name)))
  220.     (t (remove-file name))))
  221. (defun remove-dialog ()
  222.   (if (in-archive-p)
  223.       (message "You are in archive.")
  224.     (progn
  225.       (cond ((= 0 (get-number-of-selected))
  226.          (if (directory-p (get-name-on-cursor))
  227.          (remove-1 (get-name-on-cursor))
  228.            (and (y-or-n-p (concat "Remove " (get-name-on-cursor))) (remove-file (get-name-on-cursor)))))
  229.         ((y-or-n-p "Remove selected files")
  230.          (mapcar 'remove-1 (get-selected-list))))
  231.       (reload)
  232.       (redraw))))
  233.  
  234. (defun make-directory-dialog ()
  235.   (if (in-archive-p)
  236.       (message "You are in archive.")
  237.     (let ((p (center-position 50 4)) w ret r togo)
  238.       (setq r (if (= 0 (get-active-window)) -10 10))
  239.       (setq w (new-window (+ r (car p)) (cdr p) 50 4 dialog-attribute))
  240.       (window-print w 2 0 "Make new directory: " (get-this-path))
  241.       (setq ret (read-line w 3 2 (- 50 6)))
  242.       (delete-window w)
  243.       (if ret (progn
  244.         (setq ret (string-split ret))
  245.         (setq togo (if (= 1 (length ret)) (first ret) nil))
  246.         (while ret
  247.           (mkdir (concat (add-last-sep (get-this-path)) (car ret)))
  248.           (setq ret (cdr ret)))
  249.         (and togo
  250.              (go (concat (add-last-sep (get-this-path)) togo)))
  251.         (reload) (redraw))))))
  252.  
  253. (defun rename-dialog ()
  254.   (if (in-archive-p)
  255.       (message "You are in archive.")
  256.     (let ((p (center-position 50 4)) w ret (n (basename (get-name-on-cursor))) c r)
  257.       (setq r (if (= 0 (get-active-window)) -10 10))
  258.       (setq w (new-window (+ r (car p)) (cdr p) 50 4 dialog-attribute))
  259.       (window-print w 2 0 "Rename: " (get-name-on-cursor))
  260.       (setq c (strrchr n #\.))
  261.       (setq c (if c c (length n)))
  262.       (setq ret (read-line w 3 2 44 n c))
  263.       (delete-window w)
  264.       (if ret (progn
  265.         (setq ret (concat (add-last-sep (get-this-path)) ret))
  266.         (or (string= (get-name-on-cursor) ret)
  267.             (rename (get-name-on-cursor) ret))
  268.         (reload)
  269.         (redraw))))))
  270.  
  271. (defun duplicate-dialog ()
  272.   (if (or (in-archive-p) (directory-p (get-name-on-cursor)))
  273.       (message "Can't duplicate.")
  274.     (let ((p (center-position 50 4)) w ret (n (basename (get-name-on-cursor))) c r)
  275.       (setq r (if (= 0 (get-active-window)) -10 10))
  276.       (setq w (new-window (+ r (car p)) (cdr p) 50 4 dialog-attribute))
  277.       (window-print w 2 0 "Duplicate: " (get-name-on-cursor))
  278.       (setq c (strrchr n #\.))
  279.       (setq c (if c c (length n)))
  280.       (setq ret (read-line w 3 2 44 n c))
  281.       (delete-window w)
  282.       (if ret (progn
  283.         (setq ret (concat (add-last-sep (get-this-path)) ret))
  284.         (or (string= (get-name-on-cursor) ret)
  285.             (stat ret)
  286.             (copy-file (get-name-on-cursor) ret))
  287.         (reload)
  288.         (redraw))))))
  289.  
  290. (defun chmod-print1 (w n attr cur)
  291.   (let ((inv (| (>> dialog-attribute 4) (<< (& 0x0f dialog-attribute) 4))))
  292.     (window-set-attribute w dialog-attribute)
  293.     (cond ((= n 0)
  294.        (window-print w 0 3 "  Read only:  off  on")
  295.        (window-set-attribute w (if (= n cur) 0xe1 inv))
  296.        (if (!= 0 (& attr A_RONLY)) (window-print w 19 3 "on") (window-print w 14 3 "off")))
  297.       ((= n 1)
  298.        (window-print w 0 4 "  Hidden:     off  on")
  299.        (window-set-attribute w (if (= n cur) 0xe1 inv))
  300.        (if (!= 0 (& attr A_HIDDEN)) (window-print w 19 4 "on") (window-print w 14 4 "off")))
  301.       ((= n 2)
  302.        (window-print w 0 5 "  System:     off  on")
  303.        (window-set-attribute w (if (= n cur) 0xe1 inv))
  304.        (if (!= 0 (& attr A_SYSTEM)) (window-print w 19 5 "on") (window-print w 14 5 "off")))
  305.       ((= n 3)
  306.        (window-print w 0 6 "  Archive:    off  on")
  307.        (window-set-attribute w (if (= n cur) 0xe1 inv))
  308.        (if (!= 0 (& attr A_ARCHIVE)) (window-print w 19 6 "on") (window-print w 14 6 "off")))
  309.       (t (message "chmod-dialog: internal error.")))))
  310. (defun chmod-dialog ()
  311.   (if (in-archive-p)
  312.       (message "You are in archive.")
  313.     (let ((p (center-position 30 8)) w ret (job t) k
  314.       (attr (gemod (get-name-on-cursor))) (cur 0) r)
  315.       (setq r (if (= 0 (get-active-window)) -10 10))
  316.       (setq w (new-window (+ r (car p)) (cdr p) 30 8 dialog-attribute))
  317.       (window-print w 0 0 "Change attributes: ")
  318.       (window-print w 2 1 (get-name-on-cursor))
  319.       (chmod-print1 w 0 attr 0)
  320.       (chmod-print1 w 1 attr 0)
  321.       (chmod-print1 w 2 attr 0)
  322.       (chmod-print1 w 3 attr 0)
  323.       (while job
  324.     (setq k (get-key))
  325.     (cond ((or (= k K_ESC) (= k K_CTRL_G)) (setq cur nil job nil))
  326.           ((= k K_RETURN) (setq job nil))
  327.           ((and (or (= k K_UP) (= k K_CTRL_P)) (< 0 cur))
  328.            (chmod-print1 w cur attr -1)
  329.            (setq cur (1- cur))
  330.            (chmod-print1 w cur attr cur))
  331.           ((and (or (= k K_DOWN) (= k K_CTRL_N)) (> 3 cur))
  332.            (chmod-print1 w cur attr -1)
  333.            (setq cur (1+ cur))
  334.            (chmod-print1 w cur attr cur))
  335.           ((or (= k #\ ) (= k K_CTRL_F) (= k K_CTRL_B) (= k K_LEFT) (= k K_RIGHT))
  336.            (setq attr (^ attr (eval (nth cur '(A_RONLY A_HIDDEN A_SYSTEM A_ARCHIVE)))))
  337.            (chmod-print1 w cur attr cur))
  338.           ((= k #\r)
  339.            (chmod-print1 w cur attr -1)
  340.            (setq cur 0 attr (^ attr A_RONLY))
  341.            (chmod-print1 w cur attr cur))
  342.           ((= k #\h)
  343.            (chmod-print1 w cur attr -1)
  344.            (setq cur 1 attr (^ attr A_HIDDEN))
  345.            (chmod-print1 w cur attr cur))
  346.           ((= k #\s)
  347.            (chmod-print1 w cur attr -1)
  348.            (setq cur 2 attr (^ attr A_SYSTEM))
  349.            (chmod-print1 w cur attr cur))
  350.           ((= k #\a)
  351.            (chmod-print1 w cur attr -1)
  352.            (setq cur 3 attr (^ attr A_ARCHIVE))
  353.            (chmod-print1 w cur attr cur))))
  354.       (if cur (progn
  355.         (chmod (get-name-on-cursor) attr)
  356.         (reload)
  357.         (redraw)))
  358.       (delete-window w))))
  359.  
  360. (defun max (dat)
  361.   (cond ((= 1 (length dat)) (first dat))
  362.     ((<= 2 (length dat)) (let ((m (max (cdr dat)))) (if (< (first dat) m) m (first dat))))
  363.     (t 0)))
  364. (defun selector-print (dat y w atr)
  365.   (window-set-attribute w atr)
  366.   (window-print w 2 (+ 2 y) (second (nth y dat))))
  367. (defun selector-search-key (dat k)
  368.   (cond ((null dat) nil)
  369.     ((= k (caar dat)) 0)
  370.     (t (let (ret)
  371.          (setq ret (selector-search-key (cdr dat) k))
  372.          (if ret (1+ ret) nil)))))
  373. (defun selector (title dat)
  374.   (let* ((len (length dat))
  375.      (dx (+ 4 (max (mapcar 'length (cons title (mapcar 'second dat))))))
  376.      (dy (+ 3 len))
  377.      (p (center-position dx dy))
  378.      (w (new-window (car p) (cdr p) dx dy dialog-attribute))
  379.      (cur 0) (i 0) (job t) k)
  380.     (window-print w 1 0 title)            ;make window
  381.     (while (< i len)                ;initial draw
  382.       (selector-print dat i w (if (= i cur) selector-active-item-attribute selector-item-attribute))
  383.       (setq i (1+ i)))
  384.     (while job                    ;key loop
  385.       (setq k (get-key))
  386.       (cond ((or (= k K_ESC) (= k K_CTRL_G)) (setq cur nil job nil))
  387.         ((= k K_RETURN) (setq job nil))
  388.         ((and (or (= k K_UP) (= k K_CTRL_P)) (< 0 cur))
  389.          (selector-print dat cur w selector-item-attribute)
  390.          (setq cur (1- cur))
  391.          (selector-print dat cur w selector-active-item-attribute))
  392.         ((and (or (= k K_DOWN) (= k K_CTRL_N)) (> (1- len) cur))
  393.          (selector-print dat cur w selector-item-attribute)
  394.          (setq cur (1+ cur))
  395.          (selector-print dat cur w selector-active-item-attribute))
  396.         (t (setq i (selector-search-key dat k))
  397.            (if i (progn (selector-print dat cur w selector-item-attribute)
  398.                 (setq cur i job nil)
  399.                 (selector-print dat cur w selector-active-item-attribute))))))
  400.     (if cur (setq cur (eval (third (nth cur dat)))))
  401.     (delete-window w)
  402.     cur))
  403.  
  404. (defun sort-dialog ()
  405.   (selector "Sort:"
  406.         '((#\n "n Name (A-Za-z)  " (sort ST_NAME))
  407.           (#\i "i Name (Aa-Zz)   " (sort ST_NAMEIGNORECASE))
  408.           (#\e "e Extension      " (sort ST_EXTENSION))
  409.           (#\t "t Timestamp      " (sort ST_TIMESTAMP))
  410.           (#\l "l Length         " (sort ST_LENGTH))))
  411.   (redraw))
  412.  
  413. ;
  414. ; User environment dependent
  415. ; ==========================
  416. ;
  417. (defun change-drive ()
  418.   (selector "Change drive:"
  419.         '((#\a " A: FAT  floppy disk                " (go-drive #\A))
  420.           (#\c " C: FAT  MS-DOS 6.2/V & Windows3.1J " (go-drive #\C))
  421.           (#\d " D: FAT                             " (go-drive #\D))
  422.           (#\e " E: HPFS OS/2 Warp J                " (go-drive #\E))
  423.           (#\f " F: HPFS                            " (go-drive #\F))
  424.           (#\g " G:      CD-ROM                     " (go-drive #\G)))))
  425.  
  426. (defun go-from-list ()
  427.   (selector "Change directory:"
  428.         '((#\a " Archives   E:/arc              " (go "E:/arc"))
  429.           (#\b " Binaries   E:/usr/local/bin    " (go "E:/usr/local/bin"))
  430.           (#\c " cond work  E:/home/kent/p/cond " (go "E:/home/kent/p/cond"))
  431.           (#\d " Downloaded E:/down             " (go "E:/down"))
  432.           (#\h " Home                           " (go (delete-last-sep (getenv "HOME"))))
  433.           (#\j " j work     E:/home/kent/p/win  " (go "E:/home/kent/p/win"))
  434.           (#\m " Music data E:/mud              " (go "E:/mud"))
  435.           (#\p " Programs   E:/home/kent/p      " (go "E:/home/kent/p"))
  436.           (#\t " Temporary  E:/tmp              " (go "E:/tmp"))
  437.           (#\z " zsh work   E:/home/kent/zsh    " (go "E:/home/kent/zsh")))))
  438.            
  439. (defun execute ()
  440.   (cond ((or (directoryp-on-cursor) (archive-p (get-v-name-on-cursor)))
  441.      (go (get-v-name-on-cursor)))
  442.     (t (let ((n (get-name-on-cursor)) cl)
  443.          (cond ((string-tail= n ".exe" ".com")
  444.             (setq cl (edit-command-line 0))
  445.             (if cl (progn (system cl)
  446.                   (redraw-all))))
  447.            ((string-tail= n ".cmd")
  448.             (setq cl (edit-command-line 0))
  449.             (if cl (progn (spawn P_WAIT (list "cmd" "/c" cl))
  450.                   (redraw-all))))
  451.            ((string-tail= n ".jpg" ".gif" ".pi" ".pic" ".p2" ".mag")
  452.             (spawn P_DETACH (list "ib" n)))
  453.            ((string-tail= n ".mid" ".rcp" ".r36" ".mid.gz" ".rcp.gz" ".r36.gz")
  454.             (spawn P_DETACH (list "cond" "-r" "-gsreset" n)))
  455.            ((string-tail= n ".htm" ".html")
  456.             (spawn P_DETACH (list "explore" n)))
  457.            (t (spawn P_WAIT (list "less" n)) (redraw-all)))
  458.          (next-line)))))
  459. (defun execute2 ()
  460.   (let ((n (get-name-on-cursor)))
  461.     (cond ((string-tail= n ".lzh")
  462.        (spawn P_WAIT (list "lha" "x" n (add-last-sep (get-that-path))))
  463.        (reload-redraw))
  464.       ((string-tail= n ".zip")
  465.        (spawn P_WAIT (list "unzip" n "-d" (add-last-sep (get-that-path))))
  466.        (reload-redraw))
  467.       ((string-tail= n ".gz")
  468.        (setq n (basename n))
  469.        (setq n (concat (add-last-sep (get-that-path)) (subseq n 0 (- (length n) 3))))
  470.        (system "gzip -dc " (get-name-on-cursor) " > " n)
  471.        (copy-time (get-name-on-cursor) n)
  472.        (reload-redraw))
  473.       (t (spawn P_WAIT (list "less" n)) (redraw-all)))
  474.     (next-line)))
  475.  
  476. ;
  477. ;  Key bindings
  478. ;  ============
  479. ;
  480. (global-set-key 0 K_TAB '(other-window))
  481. (global-set-key 0 #\. '(go-parent))
  482. (global-set-key 0 #\/ '(go-root))
  483. (global-set-key 0 #\o '(go (get-that-path)))
  484. (global-set-key 0 #\O '(progn (other-window) (go (get-that-path)) (other-window)))
  485. (global-set-key 0 K_RIGHT '(mint-arrow-right))
  486. (global-set-key 0 K_CTRL_F '(mint-arrow-right))
  487. (global-set-key 0 K_LEFT '(mint-arrow-left))
  488. (global-set-key 0 K_CTRL_B '(mint-arrow-left))
  489. (global-set-key 0 #\c '(copy-to (get-that-path)))
  490. (global-set-key 0 #\m '(move-to (get-that-path)))
  491. (global-set-key 0 #\k '(remove-dialog))
  492. (global-set-key 0 #\d '(change-drive))
  493. (global-set-key 0 #\z '(go-from-list))
  494. (global-set-key 0 K_CTRL_L '(redraw-all))
  495.  
  496. (global-set-key 0 K_RETURN '(execute))
  497. (global-set-key 0 K_ALT_RETURN '(execute2))
  498. (global-set-key 0 #\e '(progn (spawn P_WAIT (list "vi" (get-name-on-cursor))) (reload-redraw)))
  499. (global-set-key 0 #\E '(let ((cl (edit-command-line 1))) (if cl (system cl))))
  500. (global-set-key 0 #\l '(progn (spawn P_WAIT (list "less" (get-name-on-cursor))) (redraw-all)))
  501. (global-set-key 0 #\  '(progn (select) (next-line)))
  502. (global-set-key 0 K_CTRL_SPACE '(clear-select))
  503. (global-set-key 0 #\a '(select-all-files))
  504. (global-set-key 0 #\A '(select-all))
  505. (global-set-key 0 K_CTRL_A '(chmod-dialog))
  506. (global-set-key 0 #\s '(sort-dialog))
  507. (global-set-key 0 #\n '(make-directory-dialog))
  508. (global-set-key 0 #\r '(rename-dialog))
  509. (global-set-key 0 #\D '(duplicate-dialog))
  510. (global-set-key 0 K_ALT_A '(toggle-display-all-files))
  511. (global-set-key 0 K_INS '(progn (reload) (redraw)))
  512. (global-set-key 0 K_CTRL_N '(next-line))
  513. (global-set-key 0 K_DOWN '(next-line))
  514. (global-set-key 0 K_CTRL_P '(previous-line))
  515. (global-set-key 0 K_UP '(previous-line))
  516. (global-set-key 0 #\< '(beginning-of-buffer))
  517. (global-set-key 0 #\> '(end-of-buffer))
  518. (global-set-key 0 K_CTRL_V '(scroll-up))
  519. (global-set-key 0 K_PAGEDOWN '(scroll-up))
  520. (global-set-key 0 K_CTRL_Z '(scroll-down))
  521. (global-set-key 0 K_PAGEUP '(scroll-down))
  522.  
  523. (global-set-key 0 K_ESC '(progn (set-prefix 2) (message " ESC ")))
  524. (global-set-key 0 K_CTRL_X '(progn (set-prefix 1) (message " C-x ")))
  525. (global-set-key 1 #\o '(other-window))        ;C-x o
  526. (global-set-key 1 K_CTRL_C '(kill-j))        ;C-x C-c
  527. (global-set-key 2 K_ESC '(eval-expression))    ;ESC ESC
  528.  
  529.  
  530.  
  531. ; ------------------- end
  532.