Move code folding stuff into a module

This commit is contained in:
2016-05-04 13:22:53 +01:00
parent 671c924716
commit 1d7478c0fd
8 changed files with 43 additions and 24 deletions

View File

@@ -42,26 +42,6 @@ Position the cursor at it's beginning, according to the current mode."
(interactive)
(other-window -1))
(defun siren-toggle-hiding (column)
"Toggle hiding/showing blocks via hs-mode.
Borrowed from: http://www.emacswiki.org/emacs/HideShow"
(interactive "P")
(if hs-minor-mode
(if (condition-case nil
(hs-toggle-hiding)
(error t))
(hs-show-all))
(siren-toggle-selective-display column)))
(defun siren-toggle-selective-display (column)
"Helper function for `siren-toggle-hiding'."
(interactive "P")
(set-selective-display
(or column
(unless selective-display
(1+ (current-column))))))
(defun siren-rename-file-and-buffer ()
"Rename the current buffer and file it is visiting.

38
modules/siren-folding.el Normal file
View File

@@ -0,0 +1,38 @@
;;; siren-folding.el --- jimeh's Emacs Siren: folding configuration.
;;; Commentary:
;; Basic configuration for folding code.
;;; Code:
(siren-require-packages '(hideshowvis))
(require 'hideshowvis)
(defun siren-toggle-hiding (column)
"Toggle hiding/showing blocks via hs-mode.
Borrowed from: http://www.emacswiki.org/emacs/HideShow"
(interactive "P")
(if hs-minor-mode
(if (condition-case nil
(hs-toggle-hiding)
(error t))
(hs-show-all))
(siren-toggle-selective-display column)))
(defun siren-toggle-selective-display (column)
"Helper function for `siren-toggle-hiding'."
(interactive "P")
(set-selective-display
(or column
(unless selective-display
(1+ (current-column))))))
;; Keybindings
(global-set-key (kbd "C-=") 'siren-toggle-selective-display)
(global-set-key (kbd "C-c C-h") 'siren-toggle-hiding)
(provide 'siren-folding)
;;; siren-folding.el ends here

View File

@@ -34,10 +34,6 @@
;; Toggle auto-fill-mode.
(global-set-key (kbd "C-c q") 'auto-fill-mode)
;; Custom HideShow toggles
(global-set-key (kbd "C-=") 'siren-toggle-selective-display)
(global-set-key (kbd "C-\\") 'siren-toggle-hiding)
;; undo/redo via undo-tree
(global-set-key (kbd "M--") 'undo-tree-undo)
(global-set-key (kbd "M-_") 'undo-tree-redo)

View File

@@ -29,6 +29,7 @@
(subword-mode +1)
(hs-minor-mode 1)
(highlight-indentation-current-column-mode)
(hideshowvis-enable)
(let ((map js2-mode-map))
(define-key map (kbd "C-j") 'newline-and-indent)

View File

@@ -24,6 +24,7 @@
(subword-mode +1)
(hs-minor-mode 1)
(highlight-indentation-current-column-mode)
(hideshowvis-enable)
(let ((map json-mode-map))
(define-key map (kbd "C-j") 'newline-and-indent)

View File

@@ -68,6 +68,7 @@
(subword-mode +1)
(rubocop-mode 1)
(highlight-indentation-current-column-mode)
(hideshowvis-enable)
(let ((map ruby-mode-map))
(define-key map (kbd "C-j") 'newline-and-indent)

View File

@@ -30,6 +30,7 @@
(hs-minor-mode 1)
(highlight-indentation-set-offset 2)
(highlight-indentation-current-column-mode)
(hideshowvis-enable)
(let ((map web-mode-map))
(define-key map (kbd "C-j") 'newline-and-indent)

View File

@@ -12,6 +12,7 @@
(require 'siren-company)
(require 'siren-dired)
(require 'siren-exec-path-from-shell)
(require 'siren-folding)
(require 'siren-full-ack)
(require 'siren-github)
(require 'siren-global-keybindings)