about summary refs log tree commit diff
path: root/configs/shared/emacs/.emacs.d/elpa/haskell-mode-20180913.348/haskell-compat.el
blob: c023ca60753a28a5f0429fcc47b631308889182e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
;;; haskell-compat.el --- legacy/compatibility backports for haskell-mode -*- lexical-binding: t -*-
;;
;; Filename: haskell-compat.el
;; Description: legacy/compatibility backports for haskell-mode

;; This file is not part of GNU Emacs.

;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;;; Code:
(require 'etags)
(require 'ring)
(require 'outline)
(require 'xref nil t)

(eval-when-compile
  (setq byte-compile-warnings '(not cl-functions obsolete)))


;; Cross-referencing commands have been replaced since Emacs 25.1.
;; These aliases are required to provide backward compatibility.
(unless (fboundp 'xref-push-marker-stack)
  (defalias 'xref-pop-marker-stack 'pop-tag-mark)

  (defun xref-push-marker-stack (&optional m)
    "Add point M (defaults to `point-marker') to the marker stack."
    (ring-insert find-tag-marker-ring (or m (point-marker)))))

(unless (fboundp 'outline-hide-sublevels)
  (defalias 'outline-hide-sublevels 'hide-sublevels))

(unless (fboundp 'outline-show-subtree)
  (defalias 'outline-show-subtree 'show-subtree))

(unless (fboundp 'outline-hide-sublevels)
  (defalias 'outline-hide-sublevels 'hide-sublevels))

(unless (fboundp 'outline-show-subtree)
  (defalias 'outline-show-subtree 'show-subtree))

(unless (fboundp 'xref-find-definitions)
  (defun xref-find-definitions (ident)
    (let ((next-p (and (boundp 'xref-prompt-for-identifier)
                       xref-prompt-for-identifier)))
      (find-tag ident next-p))))

(unless (fboundp 'font-lock-ensure)
  (defalias 'font-lock-ensure 'font-lock-fontify-buffer))

(provide 'haskell-compat)

;;; haskell-compat.el ends here