Skip to content

Commit 78a819d

Browse files
committed
Remove auto rename tag dep.
1 parent afa0619 commit 78a819d

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

atl-markup.el

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
;; Description: Automatically truncate lines for markup languages.
88
;; Keyword: automatic truncate visual lines
99
;; Version: 0.1.3
10-
;; Package-Requires: ((emacs "24.3") (auto-rename-tag "0.2.9"))
10+
;; Package-Requires: ((emacs "24.3"))
1111
;; URL: https://github.com/jcs-elpa/atl-markup
1212

1313
;; This file is NOT part of GNU Emacs.
@@ -32,8 +32,6 @@
3232

3333
;;; Code:
3434

35-
(require 'auto-rename-tag)
36-
3735
(defgroup atl-markup nil
3836
"Automatically truncate lines for markup languages."
3937
:prefix "atl-markup-"
@@ -47,29 +45,38 @@
4745

4846
;;; Util
4947

50-
(defun atl-markup--get-current-char-string ()
51-
"Get the current character as the 'string'."
52-
(if (char-before) (string (char-before)) ""))
53-
54-
(defun atl-markup--current-char-string-match-p (c)
55-
"Check the current character string match to C."
56-
(string-match-p c (atl-markup--get-current-char-string)))
57-
5848
(defun atl-markup--inside-comment-block-p ()
5949
"Check if current cursor point inside the comment block."
6050
(nth 4 (syntax-ppss)))
6151

52+
(defun atl-markup--inside-tag-p ()
53+
"Check if current point inside the tag."
54+
(let ((backward-less (save-excursion (search-backward "<" nil t)))
55+
(backward-greater (save-excursion (search-backward ">" nil t)))
56+
(forward-less (save-excursion (search-forward "<" nil t)))
57+
(forward-greater (save-excursion (search-forward ">" nil t))))
58+
(unless backward-less (setq backward-less -1))
59+
(unless backward-greater (setq backward-greater -1))
60+
(unless forward-less (setq forward-less -1))
61+
(unless forward-greater (setq forward-greater -1))
62+
(and (not (= -1 backward-less))
63+
(not (= -1 forward-greater))
64+
(< backward-greater backward-less)
65+
(or (< forward-greater forward-less)
66+
(= -1 forward-less)))))
67+
6268
;;; Core
6369

6470
(defun atl-markup--web-truncate-lines-by-face ()
6571
"Enable/Disable the truncate lines mode depends on the face cursor currently on."
6672
(when (and (not (= (point) (point-min))) (not (= (point) (point-max)))
67-
(not (atl-markup--current-char-string-match-p
68-
atl-markup-ignore-regex))
73+
(not (save-excursion
74+
(backward-char 1)
75+
(looking-at-p atl-markup-ignore-regex)))
6976
(not (atl-markup--inside-comment-block-p))
7077
(not (eolp)))
7178
(let ((message-log-max nil) (inhibit-message t))
72-
(if (auto-rename-tag--inside-tag-p)
79+
(if (atl-markup--inside-tag-p)
7380
(toggle-truncate-lines 1)
7481
(toggle-truncate-lines -1)))))
7582

0 commit comments

Comments
 (0)