From 4666983a5e78c64687633fdfc4511a6a337505b5 Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Thu, 10 Jul 2014 15:53:13 +0400 Subject: [PATCH 01/11] Add fast math entry methods --- modules/prelude-latex.el | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/prelude-latex.el b/modules/prelude-latex.el index 069af5d..b69072a 100644 --- a/modules/prelude-latex.el +++ b/modules/prelude-latex.el @@ -32,14 +32,25 @@ ;;; Code: -(prelude-require-packages '(auctex)) +(prelude-require-packages '(auctex cdlatex)) (require 'smartparens-latex) +;; for case +(require 'cl) (eval-after-load "company" '(progn (prelude-require-packages '(company-auctex)) (company-auctex-init))) +(defcustom prelude-latex-fast-math-entry 'LaTeX-math-mode + "Method used for fast math symbol entry in LaTeX." + :link '(function-link :tag "AUCTeX Math Mode" LaTeX-math-mode) + :link '(emacs-commentary-link :tag "CDLaTeX" "cdlatex.el") + :group 'prelude + :type '(choice (const :tag "None" nil) + (const :tag "AUCTeX Math Mode" LaTeX-math-mode) + (const :tag "CDLaTeX" cdlatex))) + ;; AUCTeX configuration (setq TeX-auto-save t) (setq TeX-parse-self t) @@ -65,7 +76,10 @@ "Default Prelude hook for `LaTeX-mode'." (turn-on-auto-fill) (abbrev-mode +1) - (smartparens-mode +1)) + (smartparens-mode +1) + (case prelude-latex-fast-math-entry + (LaTeX-math-mode (LaTeX-math-mode 1)) + (cdlatex (turn-on-cdlatex)))) (setq prelude-latex-mode-hook 'prelude-latex-mode-defaults) From d75769953688f8c5a42c4880aba464eb396900fe Mon Sep 17 00:00:00 2001 From: roryk Date: Sat, 19 Jul 2014 13:05:47 -0400 Subject: [PATCH 02/11] Fix for ESC -> meta in terminal mode. If you hit esc-key in terminal mode very quickly, it gets interpreted as meta-key, which makes evil-mode unusable in terminal mode. The default value of 0.01 doesn't completely fix this behavior, but setting it to 0 does. The meta key still works fine with it at 0. --- modules/prelude-evil.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/prelude-evil.el b/modules/prelude-evil.el index aaf6acc..ef57aee 100644 --- a/modules/prelude-evil.el +++ b/modules/prelude-evil.el @@ -48,6 +48,9 @@ (setq evil-insert-state-cursor '("gray" bar)) (setq evil-motion-state-cursor '("gray" box)) +;; prevent esc-key from translating to meta-key in terminal mode +(setq evil-esc-delay 0) + (evil-mode 1) (global-evil-surround-mode 1) From 6c337b21a091afacb9e68f2c293fa449dc26c1e2 Mon Sep 17 00:00:00 2001 From: Daniel Wu Date: Fri, 25 Jul 2014 06:55:00 -0400 Subject: [PATCH 03/11] fixed a bug in prelude-create-scratch-buffer --- core/prelude-core.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index 72cb62c..12d15d0 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -371,9 +371,9 @@ Doesn't mess with special buffers." (defun prelude-create-scratch-buffer () "Create a new scratch buffer." (interactive) - (let ((buf (get-buffer-create (generate-new-buffer-name "*scratch*")))) - (set-buffer-major-mode buf) - (switch-to-buffer buf))) + (let ((buf (generate-new-buffer "*scratch*"))) + (switch-to-buffer buf) + (funcall initial-major-mode))) (defvar prelude-tips '("Press to open a file with external program." From 313265f69c6dac544024139e6ab6e5eb2a0d4bb1 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Mon, 28 Jul 2014 12:52:18 -0700 Subject: [PATCH 04/11] Activate company mode support for merlin Also, provide a commented out sample for activating autocomplete support --- modules/prelude-ocaml.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/prelude-ocaml.el b/modules/prelude-ocaml.el index 913530e..c952132 100644 --- a/modules/prelude-ocaml.el +++ b/modules/prelude-ocaml.el @@ -50,6 +50,13 @@ (add-hook 'tuareg-mode-hook 'utop-setup-ocaml-buffer) (add-hook 'tuareg-mode-hook 'merlin-mode) +;; Setup merlin completions company is used by default in prelude +(add-to-list 'company-backends 'merlin-company-backend) + +;; But merlin also offers support for autocomplete, uncomment this next line +;; to activate it. +;; (setq merlin-use-auto-complete-mode t) + (setq utop-command "opam config exec \"utop -emacs\"" merlin-error-after-save nil) From ed91fb3d7e58beff37f56184fcb3f8b95c6cff93 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Mon, 28 Jul 2014 12:54:09 -0700 Subject: [PATCH 05/11] Remove hook to activate an apparently obsolete tuareg function Trivially fixes #614 by simply removing the offending hook. --- modules/prelude-ocaml.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/prelude-ocaml.el b/modules/prelude-ocaml.el index c952132..a9254fa 100644 --- a/modules/prelude-ocaml.el +++ b/modules/prelude-ocaml.el @@ -38,8 +38,6 @@ (require 'utop) (require 'merlin) -(add-hook 'tuareg-mode-hook 'tuareg-imenu-set-imenu) - (setq auto-mode-alist (append '(("\\.ml[ily]?\\'" . tuareg-mode) ("\\.topml\\'" . tuareg-mode)) From 2f22cb268400cd2b54fd06dfee44f2e77187c4f2 Mon Sep 17 00:00:00 2001 From: toctan Date: Wed, 30 Jul 2014 20:04:38 +0800 Subject: [PATCH 06/11] Fix editing remote unwriteable file With the original advice, if we try to find a not writeable file on a remote machine, the extra tramp prefix would be inserted. As a result, we actually end up in a blank new file. --- core/prelude-core.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index 12d15d0..8716521 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -303,11 +303,10 @@ buffer is not visiting a file." (defadvice ido-find-file (after find-file-sudo activate) "Find file as root if necessary." - (unless (or (equal major-mode 'dired-mode) - (and (buffer-file-name) - (not (file-exists-p (file-name-directory (buffer-file-name))))) - (and (buffer-file-name) - (file-writable-p buffer-file-name))) + (unless (or (tramp-tramp-file-p buffer-file-name) + (equal major-mode 'dired-mode) + (not (file-exists-p (file-name-directory buffer-file-name))) + (file-writable-p buffer-file-name)) (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) (defun prelude-start-or-switch-to (function buffer-name) From 2d11c0bc4b72f3740b664f2549294b2c5a2277d5 Mon Sep 17 00:00:00 2001 From: toctan Date: Wed, 30 Jul 2014 20:24:33 +0800 Subject: [PATCH 07/11] A better `prelude-view-url` - remove HTTP headers, what we care most of the time is the content - `set-auto-mode` is way better than the naive xml, html tag check --- core/prelude-core.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/prelude-core.el b/core/prelude-core.el index 8716521..265803f 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -266,8 +266,11 @@ there's a region, all lines that region covers will be duplicated." (url (read-from-minibuffer "URL: " default))) (switch-to-buffer (url-retrieve-synchronously url)) (rename-buffer url t) - (cond ((search-forward " Date: Wed, 30 Jul 2014 20:51:22 +0800 Subject: [PATCH 08/11] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 74d9bfb..8388019 100644 --- a/README.md +++ b/README.md @@ -286,7 +286,7 @@ Keybinding | Description C-c n | Fix indentation in buffer and strip whitespace. C-c f | Open recently visited file. C-M-\\ | Indent region (if selected) or the entire buffer. -C-c u | Open URL in your default browser. +C-c u | Open a new buffer containing the contents of URL. C-c e | Eval a bit of Emacs Lisp code and replace it with its result. C-c s | Swap two active windows. C-c D | Delete current file and buffer. From 0ac11b33b336c34409b028e02749dd6cab0b6970 Mon Sep 17 00:00:00 2001 From: mike-work Date: Fri, 1 Aug 2014 14:43:24 +0100 Subject: [PATCH 09/11] added (interactive-haskell-mode) to enable the use of interactive haskell commands (such as C-c C-l to load file) --- modules/prelude-haskell.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/prelude-haskell.el b/modules/prelude-haskell.el index 7adff88..5a35a3f 100644 --- a/modules/prelude-haskell.el +++ b/modules/prelude-haskell.el @@ -40,7 +40,8 @@ (defun prelude-haskell-mode-defaults () (subword-mode +1) (turn-on-haskell-doc-mode) - (turn-on-haskell-indentation)) + (turn-on-haskell-indentation) + (interactive-haskell-mode +1)) (setq prelude-haskell-mode-hook 'prelude-haskell-mode-defaults) From 6bbcd438ae36739703a4fea16be933c76b70aa73 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Mon, 4 Aug 2014 15:15:40 -0700 Subject: [PATCH 10/11] Remove unnecessary autoload call --- modules/prelude-ocaml.el | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/prelude-ocaml.el b/modules/prelude-ocaml.el index a9254fa..e92205e 100644 --- a/modules/prelude-ocaml.el +++ b/modules/prelude-ocaml.el @@ -43,8 +43,6 @@ ("\\.topml\\'" . tuareg-mode)) auto-mode-alist)) -(autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t) - (add-hook 'tuareg-mode-hook 'utop-setup-ocaml-buffer) (add-hook 'tuareg-mode-hook 'merlin-mode) From 17d56f668da853bfa55688ea7a013e550bc3a867 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Mon, 4 Aug 2014 15:44:20 -0700 Subject: [PATCH 11/11] Redefine C-c C-s to run utop Instead of tuareg-run-ocaml. This avoids the problems described in issue #626. Nominally fixes #626. --- modules/prelude-ocaml.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/prelude-ocaml.el b/modules/prelude-ocaml.el index e92205e..2514a00 100644 --- a/modules/prelude-ocaml.el +++ b/modules/prelude-ocaml.el @@ -46,6 +46,11 @@ (add-hook 'tuareg-mode-hook 'utop-setup-ocaml-buffer) (add-hook 'tuareg-mode-hook 'merlin-mode) +(add-hook 'tuareg-mode-hook (lambda () + (progn + (define-key tuareg-mode-map (kbd "C-c C-s") + 'utop)))) + ;; Setup merlin completions company is used by default in prelude (add-to-list 'company-backends 'merlin-company-backend)