OSDN Git Service

set version as 1.4.8-snapshot3
[howm/howm.git] / howm-mode.el
index a303127..daae8b4 100644 (file)
@@ -1,5 +1,5 @@
 ;;; howm-mode.el --- Wiki-like note-taking tool
-;;; Copyright (C) 2002, 2003, 2004, 2005-2019
+;;; Copyright (C) 2002, 2003, 2004, 2005-2020
 ;;;   HIRAOKA Kazuyuki <khi@users.osdn.me>
 ;;;
 ;;; This program is free software; you can redistribute it and/or modify
@@ -249,7 +249,7 @@ in `howm-template'. %s is replaced with name of last file. See `format'.")
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Definitions
 
-(easy-mmode-define-minor-mode howm-mode
+(define-minor-mode howm-mode
   "With no argument, this command toggles the mode. 
 Non-null prefix argument turns on the mode.
 Null prefix argument turns off the mode.
@@ -280,18 +280,16 @@ key       binding
 \\[howm-create-interactively]  Create new file interactively (not recommended)
 \\[howm-random-walk]   Browse random entries automtically
 "
-  nil ;; default = off
-  howm-lighter ;; mode-line
-  (mapcar (lambda (entry)
-            (let ((k (car entry))
-                  (f (cadr entry)))
-              (cons (concat howm-prefix k) f)))
-          howm-default-key-table)
-  )
-
-;; emacs20's easy-mmode-define-minor-mode can't have body. sigh...
-(add-hook 'howm-mode-on-hook 'howm-initialize-buffer)
-(add-hook 'howm-mode-off-hook 'howm-restore-buffer)
+  :init-value nil ;; default = off
+  :lighter howm-lighter ;; mode-line
+  :keymap (mapcar (lambda (entry)
+                    (let ((k (car entry))
+                          (f (cadr entry)))
+                      (cons (concat howm-prefix k) f)))
+                  howm-default-key-table)
+  (if howm-mode
+      (howm-initialize-buffer)
+    (howm-restore-buffer)))
 
 (defun howm-set-keymap ()
   (mapc (lambda (entry)
@@ -917,7 +915,6 @@ is necessary.")
               (funcall disp-f arg))))
         rules))
 
-;; Use dynamic bindings dirtily!
 (defun howm-template-title (arg)
   (insert (cdr (assoc 'title arg))))
 (defun howm-template-date (arg)