|
|
@@ -1106,181 +1106,6 @@ found, otherwise returns nil." |
|
|
|
(add-to-list 'auto-mode-alist |
|
|
|
'("tox\\.ini\\'" . conf-unix-mode)) |
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;; python |
|
|
|
|
|
|
|
(when (autoload-eval-lazily 'python '(python-mode) |
|
|
|
(defvar python-mode-map (make-sparse-keymap)) |
|
|
|
(define-key python-mode-map (kbd "C-c C-e") 'my-python-run-as-command) |
|
|
|
(define-key python-mode-map (kbd "C-c C-b") 'my-python-display-python-buffer) |
|
|
|
(define-key python-mode-map (kbd "C-m") 'newline-and-indent) |
|
|
|
|
|
|
|
(defvar inferior-python-mode-map (make-sparse-keymap)) |
|
|
|
(define-key inferior-python-mode-map (kbd "<up>") 'comint-previous-input) |
|
|
|
(define-key inferior-python-mode-map (kbd "<down>") 'comint-next-input) |
|
|
|
) |
|
|
|
(set-variable 'python-python-command (or (executable-find "python3") |
|
|
|
(executable-find "python"))) |
|
|
|
;; (defun my-python-run-as-command () |
|
|
|
;; "" |
|
|
|
;; (interactive) |
|
|
|
;; (shell-command (concat python-python-command " " buffer-file-name))) |
|
|
|
(defun my-python-display-python-buffer () |
|
|
|
"" |
|
|
|
(interactive) |
|
|
|
(defvar python-buffer nil) |
|
|
|
(set-window-text-height (display-buffer python-buffer |
|
|
|
t) |
|
|
|
7)) |
|
|
|
(add-hook 'inferior-python-mode-hook |
|
|
|
(lambda () |
|
|
|
(my-python-display-python-buffer)))) |
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;; gauche-mode |
|
|
|
;; http://d.hatena.ne.jp/kobapan/20090305/1236261804 |
|
|
|
;; http://www.katch.ne.jp/~leque/software/repos/gauche-mode/gauche-mode.el |
|
|
|
|
|
|
|
;; NOTE: This gauche-mode returns 404. |
|
|
|
;; There is another gosh-mode, so for now I submitted a recipe for that into |
|
|
|
;; github.com/10sr/emacs-lisp/p. I'll add setup for that later. |
|
|
|
|
|
|
|
(when nil (and '(fetch-library |
|
|
|
"http://www.katch.ne.jp/~leque/software/repos/gauche-mode/gauche-mode.el" |
|
|
|
t) |
|
|
|
(autoload-eval-lazily 'gauche-mode '(gauche-mode run-scheme) |
|
|
|
(defvar gauche-mode-map (make-sparse-keymap)) |
|
|
|
(defvar scheme-mode-map (make-sparse-keymap)) |
|
|
|
(define-key gauche-mode-map |
|
|
|
(kbd "C-c C-z") 'run-gauche-other-window) |
|
|
|
(define-key scheme-mode-map |
|
|
|
(kbd "C-c C-c") 'scheme-send-buffer) |
|
|
|
(define-key scheme-mode-map |
|
|
|
(kbd "C-c C-b") 'my-scheme-display-scheme-buffer))) |
|
|
|
(let ((s (executable-find "gosh"))) |
|
|
|
(set-variable 'scheme-program-name s) |
|
|
|
(set-variable 'gauche-program-name s)) |
|
|
|
|
|
|
|
(defvar gauche-program-name nil) |
|
|
|
(defvar scheme-buffer nil) |
|
|
|
|
|
|
|
(defun run-gauche-other-window () |
|
|
|
"Run gauche on other window" |
|
|
|
(interactive) |
|
|
|
(switch-to-buffer-other-window |
|
|
|
(get-buffer-create "*scheme*")) |
|
|
|
(run-gauche)) |
|
|
|
|
|
|
|
(defun run-gauche () |
|
|
|
"run gauche" |
|
|
|
(interactive) |
|
|
|
(run-scheme gauche-program-name) |
|
|
|
) |
|
|
|
|
|
|
|
(defun scheme-send-buffer () |
|
|
|
"" |
|
|
|
(interactive) |
|
|
|
(scheme-send-region (point-min) (point-max)) |
|
|
|
(my-scheme-display-scheme-buffer) |
|
|
|
) |
|
|
|
|
|
|
|
(defun my-scheme-display-scheme-buffer () |
|
|
|
"" |
|
|
|
(interactive) |
|
|
|
(set-window-text-height (display-buffer scheme-buffer |
|
|
|
t) |
|
|
|
7)) |
|
|
|
|
|
|
|
(add-hook 'scheme-mode-hook |
|
|
|
(lambda () |
|
|
|
nil)) |
|
|
|
|
|
|
|
(add-hook 'inferior-scheme-mode-hook |
|
|
|
(lambda () |
|
|
|
;; (my-scheme-display-scheme-buffer) |
|
|
|
)) |
|
|
|
(setq auto-mode-alist |
|
|
|
(cons '("\.gosh\\'" . gauche-mode) auto-mode-alist)) |
|
|
|
(setq auto-mode-alist |
|
|
|
(cons '("\.gaucherc\\'" . gauche-mode) auto-mode-alist)) |
|
|
|
) |
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;; term mode |
|
|
|
|
|
|
|
;; (setq multi-term-program shell-file-name) |
|
|
|
(when (autoload-eval-lazily 'multi-term) |
|
|
|
(set-variable 'multi-term-switch-after-close nil) |
|
|
|
(set-variable 'multi-term-dedicated-select-after-open-p t) |
|
|
|
(set-variable 'multi-term-dedicated-window-height 20)) |
|
|
|
|
|
|
|
(when (autoload-eval-lazily 'term '(term ansi-term) |
|
|
|
(defvar term-raw-map (make-sparse-keymap)) |
|
|
|
;; (define-key term-raw-map "\C-xl" 'term-line-mode) |
|
|
|
;; (define-key term-mode-map "\C-xc" 'term-char-mode) |
|
|
|
(define-key term-raw-map (kbd "<up>") 'scroll-down-line) |
|
|
|
(define-key term-raw-map (kbd "<down>") 'scroll-up-line) |
|
|
|
(define-key term-raw-map (kbd "<right>") 'scroll-up) |
|
|
|
(define-key term-raw-map (kbd "<left>") 'scroll-down) |
|
|
|
(define-key term-raw-map (kbd "C-p") 'term-send-raw) |
|
|
|
(define-key term-raw-map (kbd "C-n") 'term-send-raw) |
|
|
|
(define-key term-raw-map "q" 'my-term-quit-or-send-raw) |
|
|
|
;; (define-key term-raw-map (kbd "ESC") 'term-send-raw) |
|
|
|
(define-key term-raw-map [delete] 'term-send-raw) |
|
|
|
(define-key term-raw-map (kbd "DEL") 'term-send-backspace) |
|
|
|
(define-key term-raw-map "\C-y" 'term-paste) |
|
|
|
(define-key term-raw-map |
|
|
|
"\C-c" 'term-send-raw) ;; 'term-interrupt-subjob) |
|
|
|
'(define-key term-mode-map (kbd "C-x C-q") 'term-pager-toggle) |
|
|
|
;; (dolist (key '("<up>" "<down>" "<right>" "<left>")) |
|
|
|
;; (define-key term-raw-map (read-kbd-macro key) 'term-send-raw)) |
|
|
|
;; (define-key term-raw-map "\C-d" 'delete-char) |
|
|
|
;; (define-key term-raw-map "\C-q" 'move-beginning-of-line) |
|
|
|
;; (define-key term-raw-map "\C-r" 'term-send-raw) |
|
|
|
;; (define-key term-raw-map "\C-s" 'term-send-raw) |
|
|
|
;; (define-key term-raw-map "\C-f" 'forward-char) |
|
|
|
;; (define-key term-raw-map "\C-b" 'backward-char) |
|
|
|
;; (define-key term-raw-map "\C-t" 'set-mark-command) |
|
|
|
) |
|
|
|
(defun my-term-quit-or-send-raw () |
|
|
|
"" |
|
|
|
(interactive) |
|
|
|
(if (get-buffer-process (current-buffer)) |
|
|
|
(call-interactively 'term-send-raw) |
|
|
|
(kill-buffer))) |
|
|
|
|
|
|
|
;; http://d.hatena.ne.jp/goinger/20100416/1271399150 |
|
|
|
;; (setq term-ansi-default-program shell-file-name) |
|
|
|
(add-hook 'term-setup-hook |
|
|
|
(lambda () |
|
|
|
(set-variable 'term-display-table (make-display-table)))) |
|
|
|
(add-hook 'term-mode-hook |
|
|
|
(lambda () |
|
|
|
(defvar term-raw-map (make-sparse-keymap)) |
|
|
|
;; (unless (memq (current-buffer) |
|
|
|
;; (and (featurep 'multi-term) |
|
|
|
;; (defvar multi-term-buffer-list) |
|
|
|
;; ;; current buffer is not multi-term buffer |
|
|
|
;; multi-term-buffer-list)) |
|
|
|
;; ) |
|
|
|
(set (make-local-variable 'scroll-margin) 0) |
|
|
|
;; (set (make-local-variable 'cua-enable-cua-keys) nil) |
|
|
|
;; (cua-mode 0) |
|
|
|
;; (and cua-mode |
|
|
|
;; (local-unset-key (kbd "C-c"))) |
|
|
|
;; (define-key cua--prefix-override-keymap |
|
|
|
;;"\C-c" 'term-interrupt-subjob) |
|
|
|
(set (make-local-variable (defvar hl-line-range-function)) |
|
|
|
(lambda () |
|
|
|
'(0 . 0))) |
|
|
|
(define-key term-raw-map |
|
|
|
"\C-x" (lookup-key (current-global-map) "\C-x")) |
|
|
|
(define-key term-raw-map |
|
|
|
"\C-z" (lookup-key (current-global-map) "\C-z")) |
|
|
|
)) |
|
|
|
;; (add-hook 'term-exec-hook 'forward-char) |
|
|
|
) |
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;; buffer switching |
|
|
|
|
|
|
@@ -1636,42 +1461,6 @@ the list." |
|
|
|
(with-eval-after-load 'dired |
|
|
|
(define-key dired-mode-map "a" 'dired-list-all-mode)))) |
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;; my-term |
|
|
|
|
|
|
|
(defvar my-term nil |
|
|
|
"My terminal buffer.") |
|
|
|
(defvar my-term-function nil |
|
|
|
"Function to create terminal buffer. |
|
|
|
This function accept no argument and return newly created buffer of terminal.") |
|
|
|
|
|
|
|
(defun my-term (&optional arg) |
|
|
|
"Open terminal buffer and return that buffer. |
|
|
|
|
|
|
|
If ARG is given or called with prefix argument, create new buffer." |
|
|
|
(interactive "P") |
|
|
|
(if (and (not arg) |
|
|
|
my-term |
|
|
|
(buffer-name my-term)) |
|
|
|
(pop-to-buffer my-term) |
|
|
|
(setq my-term |
|
|
|
(save-window-excursion |
|
|
|
(funcall my-term-function))) |
|
|
|
(and my-term |
|
|
|
(my-term)))) |
|
|
|
|
|
|
|
|
|
|
|
;; (setq my-term-function |
|
|
|
;; (lambda () |
|
|
|
;; (if (eq system-type 'windows-nt) |
|
|
|
;; (eshell) |
|
|
|
;; (if (require 'multi-term nil t) |
|
|
|
;; (multi-term) |
|
|
|
;; (ansi-term shell-file-name))))) |
|
|
|
|
|
|
|
(setq my-term-function (lambda () (eshell t))) |
|
|
|
;;(define-key my-prefix-map (kbd "C-s") 'my-term) |
|
|
|
(define-key ctl-x-map "i" 'my-term) |
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
|
|
;; misc funcs |
|
|
|