From f6e5420887e9077c34b719aca85feb412dc67e19 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 19 May 2016 03:17:59 -0400 Subject: [PATCH] General clean up --- core/core-editor.el | 36 ------------------------------------ core/core-ui.el | 2 +- core/core.el | 37 +++++++++++++++++++++++++++++++++++++ modules/module-web.el | 3 +-- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/core/core-editor.el b/core/core-editor.el index a0232a98e..a73ef65eb 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -15,7 +15,6 @@ truncate-partial-width-windows 50 visual-fill-column-center-text nil - confirm-nonexistent-file-or-buffer nil ;; Sane scroll settings scroll-margin 0 @@ -82,35 +81,6 @@ (if indent-tabs-mode (whitespace-mode +1)))) -;; -;; Automatic minor modes -;; - -(defvar narf-auto-minor-mode-alist '() - "Alist of filename patterns vs corresponding minor mode functions, see -`auto-mode-alist'. All elements of this alist are checked, meaning you can -enable multiple minor modes for the same regexp.") - -(defun narf|enable-minor-mode-maybe () - "Check file name against `narf-auto-minor-mode-alist'." - (when buffer-file-name - (let ((name buffer-file-name) - (remote-id (file-remote-p buffer-file-name)) - (alist narf-auto-minor-mode-alist)) - ;; Remove backup-suffixes from file name. - (setq name (file-name-sans-versions name)) - ;; Remove remote file name identification. - (when (and (stringp remote-id) - (string-match-p (regexp-quote remote-id) name)) - (setq name (substring name (match-end 0)))) - (while (and alist (caar alist) (cdar alist)) - (if (string-match (caar alist) name) - (funcall (cdar alist) 1)) - (setq alist (cdr alist)))))) - -(add-hook 'find-file-hook 'narf|enable-minor-mode-maybe) - - ;; ;; Modes, hooks 'n hacks ;; @@ -152,8 +122,6 @@ enable multiple minor modes for the same regexp.") electric-indent-functions) ;; -;;(global-whitespace-mode -1) ; Show whitespace -;;(global-visual-line-mode -1) ; wrap buffers (global-auto-revert-mode 1) ; revert buffers for changed files ;; Enable syntax highlighting for older emacs (unless (bound-and-true-p global-font-lock-mode) @@ -198,10 +166,6 @@ enable multiple minor modes for the same regexp.") (use-package goto-last-change :commands goto-last-change) -(use-package help-fns+ ; Improved help commands - :commands (describe-buffer describe-command describe-file - describe-keymap describe-option describe-option-of-type)) - (use-package hideshow :commands (hs-minor-mode hs-toggle-hiding hs-already-hidden-p) :config (setq hs-isearch-open t) diff --git a/core/core-ui.el b/core/core-ui.el index 49a43218f..829856fd0 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -167,7 +167,7 @@ :commands nlinum-mode :preface (setq linum-format "%3d ") - (defvar nlinum-format "%4d ") + (defvar nlinum-format "%4d ") (defvar narf--hl-nlinum-overlay nil) (defvar narf--hl-nlinum-line nil) (defface linum-highlight-face '((t (:inherit linum))) diff --git a/core/core.el b/core/core.el index bf7cfef1a..92b0f5ae7 100644 --- a/core/core.el +++ b/core/core.el @@ -165,6 +165,43 @@ folder is the root of a project or not.") async-wait async-inject-variables)) +(use-package json + :commands (json-read-from-string json-encode json-read-file)) + +(use-package help-fns+ ; Improved help commands + :commands (describe-buffer describe-command describe-file + describe-keymap describe-option describe-option-of-type)) + + +;; +;; Automatic minor modes +;; + +(defvar narf-auto-minor-mode-alist '() + "Alist of filename patterns vs corresponding minor mode functions, see +`auto-mode-alist'. All elements of this alist are checked, meaning you can +enable multiple minor modes for the same regexp.") + +(defun narf|enable-minor-mode-maybe () + "Check file name against `narf-auto-minor-mode-alist'." + (when buffer-file-name + (let ((name buffer-file-name) + (remote-id (file-remote-p buffer-file-name)) + (alist narf-auto-minor-mode-alist)) + ;; Remove backup-suffixes from file name. + (setq name (file-name-sans-versions name)) + ;; Remove remote file name identification. + (when (and (stringp remote-id) + (string-match-p (regexp-quote remote-id) name)) + (setq name (substring name (match-end 0)))) + (while (and alist (caar alist) (cdar alist)) + (if (string-match (caar alist) name) + (funcall (cdar alist) 1)) + (setq alist (cdr alist)))))) + +(add-hook 'find-file-hook 'narf|enable-minor-mode-maybe) + + ;; (add-hook! after-init ;; We add this to `after-init-hook' to allow errors to stop this advice diff --git a/modules/module-web.el b/modules/module-web.el index f4196fb53..5b790a089 100644 --- a/modules/module-web.el +++ b/modules/module-web.el @@ -6,8 +6,7 @@ (use-package css-mode :mode "\\.css$" - :init - (add-hook! css-mode '(yas-minor-mode-on flycheck-mode)) + :init (add-hook! css-mode '(yas-minor-mode-on flycheck-mode)) :config (def-company-backend! css-mode (css yasnippet)) (push '("css" "scss" "sass" "less" "styl") projectile-other-file-alist))