Closed jschaf closed 9 years ago
Hi, @jschaf Thanks for your pull request. I have some question.
I've found prog-mode
is used in js2-mode
. But I don't know how to use prog-mode
.
How case prog-mode-hook
is used?
It seems that prog-mode
requires Emacs 24 or higher.
I think we should use the code like the following coffee-mode.el code.
;; For compatibility with Emacs < 24, derive conditionally
(defalias 'coffee-parent-mode
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
;;;###autoload
(define-derived-mode coffee-mode coffee-parent-mode "Coffee"
"Major mode for editing CoffeeScript."
prog-mode is used solely for deriving new modes. It allows you to apply customizations to all programming buffers.
I use prog-mode like so:
;; All programming modes
(my:add-hooks 'prog-mode-hook
'(my:add-watchwords ;; highlight TODO
my:delete-trailing-whitespace-before-save
my:local-comment-auto-fill))
(defun my:delete-trailing-whitespace-before-save ()
"Add `delete-trailing-whitespace' to the local `after-save-hook'."
(add-hook (make-local-variable 'before-save-hook)
'my:delete-trailing-whitespace-except-current-line))
Emacs 24 was released over two years ago. I don't think it's worth the effort to support Emacs 23, but I'll add an alias like coffee-mode if you want.
I think so about support lower versions than 24. But, if it's easy, I think it might be better to support. So, I would appreciate it.
Too easy, gimme a second and I'll push it.
Friendly bump on this. Would love to have this.
Just rebased, should be good to merge
Thanks!!!
prog-mode is useful because you can add hooks to prog-mode-hook