|
28 | 28 | (require 'smie) ; Simple minded indentation engine |
29 | 29 | (require 'cl-lib) ; `cl-flet' |
30 | 30 |
|
31 | | -;; HACK: Patch for Emacs 24.3 smie that fix |
32 | | -;; https://github.com/elixir-editors/emacs-elixir/issues/107. |
33 | | -;; |
34 | | -;; defadvice is used to change the behavior only for elixir-mode. |
35 | | -;; Definition of advice is a definition of corresponding function |
36 | | -;; in Emacs 24.4. |
37 | | -(when (and (= 24 emacs-major-version) |
38 | | - (= 3 emacs-minor-version)) |
39 | | - (defadvice smie-rule-parent (around elixir-mode-patch activate) |
40 | | - (if (not (eq major-mode 'elixir-mode)) |
41 | | - (progn ad-do-it) |
42 | | - (setq ad-return-value |
43 | | - (save-excursion |
44 | | - (goto-char (cadr (smie-indent--parent))) |
45 | | - (cons 'column |
46 | | - (+ (or offset 0) |
47 | | - (smie-indent-virtual))))))) |
48 | | - |
49 | | - (defadvice smie-indent-comment (around elixir-mode-patch activate) |
50 | | - (if (not (eq major-mode 'elixir-mode)) |
51 | | - (progn ad-do-it) |
52 | | - (setq ad-return-value |
53 | | - (and (smie-indent--bolp) |
54 | | - (let ((pos (point))) |
55 | | - (save-excursion |
56 | | - (beginning-of-line) |
57 | | - (and (re-search-forward comment-start-skip (line-end-position) t) |
58 | | - (eq pos (or (match-end 1) (match-beginning 0)))))) |
59 | | - (save-excursion |
60 | | - (forward-comment (point-max)) |
61 | | - (skip-chars-forward " \t\r\n") |
62 | | - (unless |
63 | | - (save-excursion |
64 | | - (let ((next (funcall smie-forward-token-function))) |
65 | | - (or (if (zerop (length next)) |
66 | | - (or (eobp) (eq (car (syntax-after (point))) 5))) |
67 | | - (rassoc next smie-closer-alist)))) |
68 | | - (smie-indent-calculate)))))))) |
69 | | - |
70 | 31 | ;; In Emacs 27, ppss became a structure and has proper accessors. |
71 | 32 |
|
72 | 33 | (defalias 'elixir-ppss-depth |
|
0 commit comments