Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

haskell-tags-on-save: BREAKING CHANGE: Read this commit.

If you are using haskell-mode-save-buffer-and-tags, you should instead
rebind C-x C-s to haskell-mode-save-buffer, and then enable
haskell-tags-on-save:

 (setq haskell-tags-on-save t)
  • Loading branch information...
commit 0af28f617cd50fe021c8643ea7eff7c0dda96dc5 1 parent 7b88577
@chrisdone chrisdone authored
Showing with 22 additions and 14 deletions.
  1. +8 −2 examples/init.el
  2. +14 −12 haskell-mode.el
View
10 examples/init.el
@@ -28,7 +28,13 @@
;; Use notify.el (if you have it installed) at the end of running
;; Cabal commands or generally things worth notifying.
- '(haskell-notify-p t))
+ '(haskell-notify-p t)
+
+ ;; To enable tags generation on save.
+ '(haskell-tags-on-save t)
+
+ ;; To enable stylish on save.
+ '(haskell-stylish-on-save t))
(add-hook 'haskell-mode-hook 'haskell-hook)
(add-hook 'haskell-cabal-mode-hook 'haskell-cabal-hook)
@@ -74,7 +80,7 @@
;; Save the current buffer and generate etags (a TAGS file) for the
;; whole project.
- (define-key haskell-mode-map (kbd "C-x C-s") 'haskell-mode-save-buffer-and-tags)
+ (define-key haskell-mode-map (kbd "C-x C-s") 'haskell-mode-save-buffer)
;; Indent the below lines on columns after the current column.
(define-key haskell-mode-map (kbd "C-<right>")
View
26 haskell-mode.el
@@ -660,6 +660,12 @@ saving. Needs 'haskell-mode-save-buffer to be bound for C-x C-s."
:group 'haskell
:type 'boolean)
+(defcustom haskell-tags-on-save nil
+ "Generate tags via hasktags on save. Needs
+'haskell-mode-save-buffer to be bound for C-x C-s."
+ :group 'haskell
+ :type 'boolean)
+
(defvar haskell-saved-check-command nil
"Internal use.")
@@ -745,9 +751,14 @@ This function will be called with no arguments.")
(defun haskell-mode-save-buffer ()
"Save the current buffer."
- (when haskell-stylish-on-save
- (haskell-mode-stylish-buffer))
- (save-buffer))
+ (interactive)
+ (let ((modified (buffer-modified-p)))
+ (when haskell-stylish-on-save
+ (haskell-mode-stylish-buffer))
+ (save-buffer)
+ (when modified
+ (when haskell-tags-on-save
+ (haskell-process-generate-tags)))))
(defun haskell-mode-stylish-buffer ()
"Apply stylish-haskell to the current buffer."
@@ -758,15 +769,6 @@ This function will be called with no arguments.")
(goto-line line)
(goto-char (+ column (point)))))
-(defun haskell-mode-save-buffer-and-tags ()
- "Save the current buffer and generate tags.
-Can be pretty slow on a real world project. Use at discretion."
- (interactive)
- (let ((modified (buffer-modified-p)))
- (haskell-mode-save-buffer)
- (when modified
- (haskell-process-generate-tags))))
-
(defun haskell-mode-tag-find (&optional next-p)
"The tag find function, specific for the particular session."
(interactive "P")

0 comments on commit 0af28f6

Please sign in to comment.
Something went wrong with that request. Please try again.