Skip to content

Commit 0634e3c

Browse files
committed
Org once.
1 parent 5896d32 commit 0634e3c

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

show-eol.el

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;;; show-eol.el --- Show end of line symbol in buffer. -*- lexical-binding: t; -*-
1+
;;; show-eol.el --- Show end of line symbol in buffer -*- lexical-binding: t; -*-
22

33
;; Copyright (C) 2019 Shen, Jen-Chieh
44
;; Created date 2019-04-28 22:34:40
@@ -32,10 +32,8 @@
3232

3333
;;; Code:
3434

35-
3635
(require 'whitespace)
3736

38-
3937
(defgroup show-eol nil
4038
"Show end of line symbol in buffer."
4139
:prefix "show-eol-"
@@ -57,6 +55,7 @@
5755
:type 'string
5856
:group 'show-eol)
5957

58+
;;; Core
6059

6160
(defun show-eol--get-current-system ()
6261
"Return the current system name."
@@ -77,13 +76,10 @@
7776

7877
(defun show-eol-find-mark-in-list (mk-sym)
7978
"Return the MK-SYM index in the `whitespace-display-mappings' list."
80-
(let ((index 0)
81-
(mark-name nil)
82-
(nl-mark-index -1))
79+
(let ((index 0) (mark-name nil) (nl-mark-index -1))
8380
(dolist (entry whitespace-display-mappings)
8481
(setq mark-name (car entry))
85-
(when (eq mk-sym mark-name)
86-
(setq nl-mark-index index))
82+
(when (eq mk-sym mark-name) (setq nl-mark-index index))
8783
(setq index (1+ index)))
8884
nl-mark-index))
8985

@@ -99,8 +95,7 @@
9995
(defun show-eol-update-eol-marks ()
10096
"Update the EOL mark once."
10197
(show-eol-set-mark-with-string 'newline-mark (show-eol-get-eol-mark-by-system))
102-
;; Calling this resets the whitespace glyphs to
103-
;; always be correct.
98+
;; Calling this resets the whitespace glyphs to always be correct.
10499
(whitespace-newline-mode 1))
105100

106101
(defun show-eol-after-save-hook ()
@@ -111,6 +106,7 @@
111106
"Advice execute after `set-buffer-file-coding-system' function is called."
112107
(when show-eol-mode (show-eol-update-eol-marks)))
113108

109+
;;; Entry
114110

115111
(defun show-eol-enable ()
116112
"Enable 'show-eol-select' in current buffer."
@@ -126,15 +122,12 @@
126122
(advice-remove 'set-buffer-file-coding-system #'show-eol--set-buffer-file-coding-system--advice-after)
127123
(whitespace-newline-mode -1))
128124

129-
130125
;;;###autoload
131126
(define-minor-mode show-eol-mode
132127
"Minor mode 'show-eol-mode'."
133128
:lighter " ShowEOL"
134129
:group show-eol
135-
(if show-eol-mode
136-
(show-eol-enable)
137-
(show-eol-disable)))
130+
(if show-eol-mode (show-eol-enable) (show-eol-disable)))
138131

139132
(defun show-eol-turn-on-show-eol-mode ()
140133
"Turn on the 'shift-select-mode'."
@@ -145,6 +138,5 @@
145138
show-eol-mode show-eol-turn-on-show-eol-mode
146139
:require 'show-eol)
147140

148-
149141
(provide 'show-eol)
150142
;;; show-eol.el ends here

0 commit comments

Comments
 (0)