Defining C-< and C-> for indentation.
This commit is contained in:
parent
2c320d4032
commit
18b6eec6ad
@ -1,5 +1,5 @@
|
|||||||
SRCS = ghc.el ghc-func.el ghc-doc.el ghc-comp.el ghc-flymake.el \
|
SRCS = ghc.el ghc-func.el ghc-doc.el ghc-comp.el ghc-flymake.el \
|
||||||
ghc-command.el ghc-info.el ghc-ins-mod.el
|
ghc-command.el ghc-info.el ghc-ins-mod.el ghc-indent.el
|
||||||
EMACS = emacs
|
EMACS = emacs
|
||||||
DETECT = xemacs
|
DETECT = xemacs
|
||||||
|
|
||||||
|
35
elisp/ghc-indent.el
Normal file
35
elisp/ghc-indent.el
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;;
|
||||||
|
;;; ghc-indent.el
|
||||||
|
;;;
|
||||||
|
|
||||||
|
;; Author: Kazu Yamamoto <Kazu@Mew.org>
|
||||||
|
;; Created: Feb 28, 2012
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(defvar ghc-indent-offset 4)
|
||||||
|
|
||||||
|
(defun ghc-make-indent-shallower (beg end)
|
||||||
|
(interactive "r")
|
||||||
|
(let ((n ghc-indent-offset))
|
||||||
|
(save-excursion
|
||||||
|
(save-restriction
|
||||||
|
(narrow-to-region beg end)
|
||||||
|
(goto-char beg)
|
||||||
|
(while (not (eobp))
|
||||||
|
(delete-region (point) (+ (point) n))
|
||||||
|
(forward-line))))))
|
||||||
|
|
||||||
|
(defun ghc-make-indent-deeper (beg end)
|
||||||
|
(interactive "r")
|
||||||
|
(let ((indent (make-string ghc-indent-offset 32)))
|
||||||
|
(save-excursion
|
||||||
|
(save-restriction
|
||||||
|
(narrow-to-region beg end)
|
||||||
|
(goto-char beg)
|
||||||
|
(while (not (eobp))
|
||||||
|
(insert indent)
|
||||||
|
(forward-line))))))
|
||||||
|
|
||||||
|
(provide 'ghc-indent)
|
@ -27,6 +27,7 @@
|
|||||||
(require 'ghc-flymake)
|
(require 'ghc-flymake)
|
||||||
(require 'ghc-command)
|
(require 'ghc-command)
|
||||||
(require 'ghc-ins-mod)
|
(require 'ghc-ins-mod)
|
||||||
|
(require 'ghc-indent)
|
||||||
(require 'dabbrev)
|
(require 'dabbrev)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@ -54,6 +55,8 @@
|
|||||||
(defvar ghc-module-key "\C-c\C-m")
|
(defvar ghc-module-key "\C-c\C-m")
|
||||||
(defvar ghc-expand-key "\C-c\C-e")
|
(defvar ghc-expand-key "\C-c\C-e")
|
||||||
(defvar ghc-hoogle-key (format "\C-c%c" (ghc-find-C-h)))
|
(defvar ghc-hoogle-key (format "\C-c%c" (ghc-find-C-h)))
|
||||||
|
(defvar ghc-shallower-key "\C-c<")
|
||||||
|
(defvar ghc-deeper-key "\C-c>")
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;
|
;;;
|
||||||
@ -82,6 +85,8 @@
|
|||||||
(define-key haskell-mode-map ghc-toggle-key 'ghc-flymake-toggle-command)
|
(define-key haskell-mode-map ghc-toggle-key 'ghc-flymake-toggle-command)
|
||||||
(define-key haskell-mode-map ghc-module-key 'ghc-insert-module)
|
(define-key haskell-mode-map ghc-module-key 'ghc-insert-module)
|
||||||
(define-key haskell-mode-map ghc-hoogle-key 'haskell-hoogle)
|
(define-key haskell-mode-map ghc-hoogle-key 'haskell-hoogle)
|
||||||
|
(define-key haskell-mode-map ghc-shallower-key 'ghc-make-indent-shallower)
|
||||||
|
(define-key haskell-mode-map ghc-deeper-key 'ghc-make-indent-deeper)
|
||||||
(ghc-comp-init)
|
(ghc-comp-init)
|
||||||
(setq ghc-initialized t)))
|
(setq ghc-initialized t)))
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@ Cabal-Version: >= 1.6
|
|||||||
Build-Type: Simple
|
Build-Type: Simple
|
||||||
Data-Dir: elisp
|
Data-Dir: elisp
|
||||||
Data-Files: Makefile ghc.el ghc-func.el ghc-doc.el ghc-comp.el
|
Data-Files: Makefile ghc.el ghc-func.el ghc-doc.el ghc-comp.el
|
||||||
ghc-flymake.el ghc-command.el ghc-info.el ghc-ins-mod.el
|
ghc-flymake.el ghc-command.el ghc-info.el
|
||||||
|
ghc-ins-mod.el ghc-indent.el
|
||||||
Executable ghc-mod
|
Executable ghc-mod
|
||||||
Main-Is: GHCMod.hs
|
Main-Is: GHCMod.hs
|
||||||
Other-Modules: Browse
|
Other-Modules: Browse
|
||||||
|
Loading…
Reference in New Issue
Block a user