Emacs: shell 'compile-mode' support
parent
05f9f6a7b1
commit
c2bb8a0393
|
@ -38,6 +38,7 @@ Example: to assign some-function to C-i, use
|
|||
(load "~/.emacs.d/mode-dot.el" nil t)
|
||||
(load "~/.emacs.d/mode-mediawiki.el" nil t)
|
||||
(load "~/.emacs.d/mode-python.el" nil t)
|
||||
(load "~/.emacs.d/mode-shell.el" nil t)
|
||||
(load "~/.emacs.d/mode-tex.el" nil t)
|
||||
(load "~/.emacs.d/mode-texinfo.el" nil t)
|
||||
(load "~/.emacs.d/personal" nil t)
|
||||
|
|
|
@ -38,6 +38,7 @@ Example: to assign some-function to C-i, use
|
|||
(load "~/.emacs.d/mode-dot.el" nil t)
|
||||
(load "~/.emacs.d/mode-mediawiki.el" nil t)
|
||||
(load "~/.emacs.d/mode-python.el" nil t)
|
||||
(load "~/.emacs.d/mode-shell.el" nil t)
|
||||
(load "~/.emacs.d/mode-tex.el" nil t)
|
||||
(load "~/.emacs.d/mode-texinfo.el" nil t)
|
||||
(load "~/.emacs.d/personal" nil t)
|
||||
|
|
|
@ -367,27 +367,6 @@ has errors and/or warnings."
|
|||
("ll" "ls -hl")
|
||||
("la" "ls -ahl")))))
|
||||
|
||||
;; Shell allow comment indenation.
|
||||
(setq sh-indent-comment t)
|
||||
;; We do not put 'sh' only because it could get messy. Emacs knows it anyway.
|
||||
(add-to-list 'auto-mode-alist '("\\(bash\\'\\|zsh\\'\\|csh\\'\\|tcsh\\'\\|ksh\\'\\)" . sh-mode))
|
||||
(add-to-list 'auto-mode-alist '("rc\\'" . sh-mode))
|
||||
|
||||
|
||||
;; GLSL fallback to C mode.
|
||||
(add-to-list 'auto-mode-alist '("\\.vert\\'" . c-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.frag\\'" . c-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.glsl\\'" . c-mode))
|
||||
(autoload 'glsl-mode "glsl-mode" nil t)
|
||||
(when (boundp 'glsl-mode)
|
||||
(add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.glsl\\'" . glsl-mode)))
|
||||
|
||||
;; Lua
|
||||
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))
|
||||
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
|
||||
|
||||
;; Zlc - Zsh style completion.
|
||||
;; (if (require 'zlc nil t)
|
||||
;; (let ((map minibuffer-local-map))
|
||||
|
@ -407,14 +386,6 @@ has errors and/or warnings."
|
|||
(if (require 'xclip nil t)
|
||||
(turn-on-xclip))
|
||||
|
||||
;; Bison/flex -- Fallback to c-mode.
|
||||
(add-to-list 'auto-mode-alist '("\\.yy?\\'" . c-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.l\\'" . c-mode))
|
||||
(if (require 'bison-mode nil t)
|
||||
(add-to-list 'auto-mode-alist '("\\.yy?\\'" . bison-mode)))
|
||||
(if (require 'flex-mode nil t)
|
||||
(add-to-list 'auto-mode-alist '("\\.l\\'" . flex-mode)))
|
||||
|
||||
;; Multiple-Cursors
|
||||
;; (add-to-list 'load-path "/usr/share/emacs/site-lisp/multiple-cursors")
|
||||
(if (require 'multiple-cursors nil t)
|
||||
|
@ -453,7 +424,8 @@ has errors and/or warnings."
|
|||
"Window '%s' is normal")
|
||||
(current-buffer)))
|
||||
|
||||
;; Press [pause] key in each window you want to "freeze"
|
||||
;; Press [pause] key in each window you want to "freeze", i.e. prevent Emacs
|
||||
;; from acting on it.
|
||||
(global-set-key [pause] 'toggle-window-dedicated)
|
||||
|
||||
;; Dired options
|
||||
|
@ -534,6 +506,28 @@ has errors and/or warnings."
|
|||
;; Bookmark file to cache folder
|
||||
(setq bookmark-default-file (concat emacs-cache-folder "emacs.bmk"))
|
||||
|
||||
;; GLSL fallback to C mode.
|
||||
(add-to-list 'auto-mode-alist '("\\.vert\\'" . c-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.frag\\'" . c-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.glsl\\'" . c-mode))
|
||||
(autoload 'glsl-mode "glsl-mode" nil t)
|
||||
(when (boundp 'glsl-mode)
|
||||
(add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.glsl\\'" . glsl-mode)))
|
||||
|
||||
;; Lua
|
||||
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))
|
||||
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
|
||||
|
||||
;; Bison/flex -- Fallback to c-mode.
|
||||
(add-to-list 'auto-mode-alist '("\\.yy?\\'" . c-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.l\\'" . c-mode))
|
||||
(if (require 'bison-mode nil t)
|
||||
(add-to-list 'auto-mode-alist '("\\.yy?\\'" . bison-mode)))
|
||||
(if (require 'flex-mode nil t)
|
||||
(add-to-list 'auto-mode-alist '("\\.l\\'" . flex-mode)))
|
||||
|
||||
;; Read Matlab files in Octave mode.
|
||||
(add-to-list 'auto-mode-alist '("\\.m\\'" . octave-mode))
|
||||
|
||||
|
@ -546,6 +540,11 @@ has errors and/or warnings."
|
|||
;; README files.
|
||||
(add-to-list 'auto-mode-alist '("README" . text-mode))
|
||||
|
||||
;; Shell extensions. We do not put 'sh' only because it could get messy. Emacs
|
||||
;; knows it anyway.
|
||||
(add-to-list 'auto-mode-alist '("\\(bash\\'\\|zsh\\'\\|csh\\'\\|tcsh\\'\\|ksh\\'\\)" . sh-mode))
|
||||
(add-to-list 'auto-mode-alist '("rc\\'" . sh-mode))
|
||||
|
||||
;; Subtitles support.
|
||||
(add-to-list 'auto-mode-alist '("\\.srt\\'" . text-mode))
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
;;==============================================================================
|
||||
;; Shell
|
||||
;;==============================================================================
|
||||
|
||||
;; Allow comment indentation.
|
||||
(setq sh-indent-comment t)
|
||||
|
||||
(setq sh-shell-file "/bin/sh")
|
||||
|
||||
(defun shell-set-interpreter ()
|
||||
"If a shabang is present, use it as the shell interpreter,
|
||||
otherwise use 'sh-shell-file'."
|
||||
"Use compile to run python programs."
|
||||
(interactive)
|
||||
(hack-local-variables)
|
||||
(let ((firstline (car (split-string (buffer-string) "\n" t))))
|
||||
(let ((sh-interpreter
|
||||
(if (not (string-match "^#!" firstline))
|
||||
sh-shell-file
|
||||
(substring firstline 2))))
|
||||
|
||||
(set (make-local-variable 'compile-command)
|
||||
(concat sh-interpreter " " buffer-file-name)))))
|
||||
|
||||
(add-hook
|
||||
'sh-mode-hook
|
||||
(lambda ()
|
||||
(shell-set-interpreter)))
|
Loading…
Reference in New Issue