• R/O
  • HTTP
  • SSH
  • HTTPS

howm: Commit

Hitori Otegaru Wiki Modoki


Commit MetaInfo

Revision9fa0ebdc66cff933118e69fdb52424c7aa8c4993 (tree)
Time2021-12-28 20:45:35
AuthorHiraoka <khi@user...>
CommiterHiraoka

Log Message

update define-minor-mode for Emacs 28.1

Change Summary

Incremental Difference

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
1+2021-04-29 HIRAOKA Kazuyuki <khi@users.osdn.me>
2+
3+ * howm-mode.el (howm-mode): update define-minor-mode for emacs 28.1
4+ thx > U5948U5e7eU4e43
5+ https://twitter.com/U5948U5e7eU4e43/status/1387373441582387209
6+ http://git.savannah.gnu.org/cgit/emacs.git/commit/etc/NEWS?id=2fb271ca35ff96540c0940b0ea5281bdaac953ec
7+
8+ * action-lock.el (action-lock-mode): ditto.
9+
10+ * illusion.el (illusion-mode): ditto.
11+
112 2021-04-28 HIRAOKA Kazuyuki <khi@users.osdn.me>
213
314 * howm-view.el (howm-view-summary-mode): add TAB and M-TAB to docstring
--- a/action-lock.el
+++ b/action-lock.el
@@ -61,22 +61,21 @@
6161 (defvar action-lock-switch-default '("{ }" "{*}" "{-}")) ;; any number
6262 (defvar action-lock-date-default '("{_}" "[%Y-%m-%d %H:%M]")) ;; before after
6363
64-(easy-mmode-define-minor-mode action-lock-mode
64+(define-minor-mode action-lock-mode
6565 "With no argument, this command toggles the mode.
6666 Non-null prefix argument turns on the mode.
6767 Null prefix argument turns off the mode.
6868
6969 \\[action-lock-magic-return] Envoke the action on the field
7070 "
71- nil ;; default = off
72- action-lock-lighter ;; mode-line
73- `(
74- (,action-lock-magic-return-key . action-lock-magic-return)
75- ))
76-
77-;; emacs20's easy-mmode-define-minor-mode can't have body. sigh...
78-(add-hook 'action-lock-mode-on-hook 'action-lock-initialize-buffer)
79-(add-hook 'action-lock-mode-off-hook 'action-lock-restore-buffer)
71+ :init-value nil ;; default = off
72+ :lighter action-lock-lighter ;; mode-line
73+ :keymap `(
74+ (,action-lock-magic-return-key . action-lock-magic-return)
75+ )
76+ (if action-lock-mode
77+ (action-lock-initialize-buffer)
78+ (action-lock-restore-buffer)))
8079
8180 (defvar action-lock-rules nil)
8281 (defvar action-lock-original-font-lock-keywords nil)
--- a/howm-mode.el
+++ b/howm-mode.el
@@ -249,7 +249,7 @@ in `howm-template'. %s is replaced with name of last file. See `format'.")
249249 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
250250 ;; Definitions
251251
252-(easy-mmode-define-minor-mode howm-mode
252+(define-minor-mode howm-mode
253253 "With no argument, this command toggles the mode.
254254 Non-null prefix argument turns on the mode.
255255 Null prefix argument turns off the mode.
@@ -280,18 +280,16 @@ key binding
280280 \\[howm-create-interactively] Create new file interactively (not recommended)
281281 \\[howm-random-walk] Browse random entries automtically
282282 "
283- nil ;; default = off
284- howm-lighter ;; mode-line
285- (mapcar (lambda (entry)
286- (let ((k (car entry))
287- (f (cadr entry)))
288- (cons (concat howm-prefix k) f)))
289- howm-default-key-table)
290- )
291-
292-;; emacs20's easy-mmode-define-minor-mode can't have body. sigh...
293-(add-hook 'howm-mode-on-hook 'howm-initialize-buffer)
294-(add-hook 'howm-mode-off-hook 'howm-restore-buffer)
283+ :init-value nil ;; default = off
284+ :lighter howm-lighter ;; mode-line
285+ :keymap (mapcar (lambda (entry)
286+ (let ((k (car entry))
287+ (f (cadr entry)))
288+ (cons (concat howm-prefix k) f)))
289+ howm-default-key-table)
290+ (if howm-mode
291+ (howm-initialize-buffer)
292+ (howm-restore-buffer)))
295293
296294 (defun howm-set-keymap ()
297295 (mapc (lambda (entry)
--- a/illusion.el
+++ b/illusion.el
@@ -52,7 +52,7 @@ It must return non-nil value for successful case.")
5252 (goto-char (point-min))
5353 (set-buffer-modified-p nil))
5454
55-(easy-mmode-define-minor-mode illusion-mode
55+(define-minor-mode illusion-mode
5656 "With no argument, this command toggles the mode.
5757 Non-null prefix argument turns on the mode.
5858 Null prefix argument turns off the mode.
@@ -64,17 +64,14 @@ key binding
6464 --- -------
6565 \\[illusion-submit] Submit changes
6666 "
67- nil ;; default = off
68- illusion-lighter ;; mode-line
69- `(
70- (,illusion-submit-key . illusion-submit)
71- )
67+ :init-value nil ;; default = off
68+ :lighter illusion-lighter ;; mode-line
69+ :keymap `(
70+ (,illusion-submit-key . illusion-submit)
71+ )
72+ (use-local-map illusion-mode-map)
7273 )
7374
74-;; emacs20's easy-mmode-define-minor-mode can't have body. sigh...
75-(add-hook 'illusion-mode-on-hook
76- (lambda () (use-local-map illusion-mode-map)))
77-
7875 ;;; Example
7976
8077 ;; M-x yarot13-find-file to open rot13ed file.
Show on old repository browser