-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcommon-header-mode-line-source.el
227 lines (180 loc) · 6.96 KB
/
common-header-mode-line-source.el
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
;;; common-header-mode-line-source.el --- source of the common-header-mode-line.el.
;; Copyright (C) 2017 Constantin Kulikov
;;
;; Author: Constantin Kulikov (Bad_ptr) <zxnotdead@gmail.com>
;; Date: 2017/01/29 09:05:26
;; License: GPL either version 3 or any later version
;; URL: http://github.com/Bad-ptr/common-header-mode-line.el
;;; License:
;; This file is not part of GNU Emacs.
;; This program 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 program 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, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; Edit this file if you want to modify common-header-mode-line.el
(
(:text
";;; common-$@-line.el --- common $@-line.
;; Copyright (C) 2017 Constantin Kulikov
;;
;; Author: Constantin Kulikov (Bad_ptr) <zxnotdead@gmail.com>
;; Version: ${version}$
;; Package-Requires: ()
;; Date: ${date-time}$
;; License: GPL either version 3 or any later version
;; Keywords: header-line, mode-line, convenience, frames, windows
;; URL: http://github.com/Bad-ptr/common-$@-line.el
;;; License:
;; This file is not part of GNU Emacs.
;; This program 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 program 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, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; This file is autogenerated. Do not edit manually.
;; This file is the part of the common-$@-line package
;; Draw common $@-line.
;; Install common-$@-line package, then:
;; (require 'common-$@-line)
;; (common-$@-line-mode)
;; which is equivalent to
;; (common-$0-line-mode)
;; (common-$1-line-mode)
;; which is equivalent to
;; (per-frame-$@-line-mode)
;; (per-window-$@-line-mode)
;; which is equivalent to
;; (per-frame-$0-line-mode)
;; (per-frame-$1-line-mode)
;; (per-window-$0-line-mode)
;; (per-window-$1-line-mode)
;; M-x customize-group RET common-$@-line RET
;; M-x customize-group RET common-$0-line RET
;; M-x customize-group RET common-$1-line RET
;;; Code:
")
(defvar common-$*-line-mode nil)
(defvar common-$@-line-mode nil)
(defgroup common-$@-line nil
"Customize common-$@-line."
:prefix "common-$@-line-"
:group 'convenience
:link '(url-link :tag "Github page"
"https://github.com/Bad-ptr/common-$@-line.el"))
(defvar common-$@-line--delayed-update-timer nil
"Timer used to delay updates.")
(defcustom common-$@-line-update-delay 0.5
"Time to delay updates."
:group 'common-$@-line
:type 'float)
(defadvice force-mode-line-update
(after common-$@-line--delayed-update-adv)
(common-$@-line--delayed-update)
nil)
(defun common-$@-line--activate-delayed-update-hooks ()
(add-hook 'post-command-hook
#'common-$@-line--delayed-update)
(add-hook 'window-configuration-change-hook
#'common-$@-line--delayed-update)
(ad-activate #'force-mode-line-update))
(defun common-$@-line--deactivate-delayed-update-hooks ()
(remove-hook 'post-command-hook
#'common-$@-line--delayed-update)
(remove-hook 'window-configuration-change-hook
#'common-$@-line--delayed-update)
(ad-deactivate #'force-mode-line-update)
(when (timerp common-$@-line--delayed-update-timer)
(cancel-timer common-$@-line--delayed-update-timer)
(setq common-$@-line--delayed-update-timer nil)))
(defun common-$@-line-set-delayed-update-functions (funs)
(when (and (null common-$@-line-delayed-update-functions)
funs)
(common-$@-line--activate-delayed-update-hooks))
(when (null funs)
(common-$@-line--deactivate-delayed-update-hooks))
(setq common-$@-line-delayed-update-functions funs))
(defcustom common-$@-line-delayed-update-functions nil
"List of functions to call to update $@-lines."
:group 'common-$@-line
:type 'hook
:set #'(lambda (sym val)
(unless (boundp 'common-$@-line-delayed-update-functions)
(setq common-$@-line-delayed-update-functions nil))
(common-$@-line-set-delayed-update-functions val)
(custom-set-default sym val)))
(defun common-$@-line--update ()
(run-hook-with-args-until-failure
'common-$@-line-delayed-update-functions))
(defun common-$@-line--delayed-update (&rest args)
(unless (timerp common-$@-line--delayed-update-timer)
(setq common-$@-line--delayed-update-timer
(run-with-idle-timer
common-$@-line-update-delay nil
#'(lambda ()
(unwind-protect (common-$@-line--update)
(setq common-$@-line--delayed-update-timer nil)))))))
(:autoload
(defun common-$@-line-add-delayed-update-function (fun)
(unless (memq fun common-$@-line-delayed-update-functions)
(common-$@-line-set-delayed-update-functions
(cons fun common-$@-line-delayed-update-functions)))))
(:autoload
(defun common-$@-line-rem-delayed-update-function (fun)
(common-$@-line-set-delayed-update-functions
(delq fun common-$@-line-delayed-update-functions))))
;; (unless (boundp 'per-frame-$@-line-mode)
;; (require 'per-frame-$@-line))
;; (unless (boundp 'per-window-$@-line-mode)
;; (require 'per-window-$@-line))
(defun common-$*-line--activate ()
(per-frame-$*-line-mode 1)
(per-window-$*-line-mode 1))
(defun common-$*-line--deactivate ()
(per-frame-$*-line-mode -1)
(per-window-$*-line-mode -1))
(:autoload
(define-minor-mode common-$*-line-mode
"`per-window-$*-line-mode' + `per-frame-$*-line-mode'"
:require 'common-$@-line
:group 'common-$@-line
:init-value nil
:global t
(if common-$*-line-mode
(common-$*-line--activate)
(common-$*-line--deactivate))))
(:autoload
(define-minor-mode common-$@-line-mode
"`common-$0-line-mode' + `common-$1-line-mode'"
:require 'common-$@-line
:group 'common-$@-line
:init-value nil
:global t
(if common-$@-line-mode
($subloop
(common-$*-line-mode 1))
($subloop
(common-$*-line-mode -1)))))
(provide 'common-$@-line)
(:text
"
;;; common-$@-line.el ends here")
)