Skip to content

Commit

Permalink
Add user functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Jan 12, 2024
1 parent f547d86 commit 1fe8215
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Eask
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(package "message-clean-mode"
"0.1.0"
"0.1.0"
"Keep messages buffer clean")

(website-url "https://github.com/jcs-elpa/message-clean-mode")
Expand All @@ -9,10 +9,11 @@

(script "test" "echo \"Error: no test specified\" && exit 1")

(source "jcs-elpa")
(source 'gnu)
(source 'jcs-elpa)

(depends-on "emacs" "25.1")
(depends-on "msgu")

(setq network-security-level 'low ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432
byte-compile-error-on-warn nil)
byte-compile-error-on-warn nil)
39 changes: 39 additions & 0 deletions message-clean-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@
(`mute #'message-clean-mode--mute)
(`echo #'message-clean-mode--echo)))

;;
;; (@* "Util" )
;;

(defun message-clean-mode--re-enable-mode (modename)
"Re-enable the MODENAME."
(msgu-silent
(funcall-interactively modename -1) (funcall-interactively modename 1)))

(defun message-clean-mode--re-enable-mode-if-was-enabled (modename)
"Re-enable the MODENAME if was enabled."
(when (boundp modename)
(when (symbol-value modename) (message-clean-mode--re-enable-mode modename))
(symbol-value modename)))

(defun message-clean-mode--listify (obj)
"Turn OBJ to list."
(if (listp obj) obj (list obj)))

;;
;; (@* "Core" )
;;
Expand Down Expand Up @@ -130,5 +149,25 @@
:group 'message-clean
(if message-clean-mode (message-clean-mode--enable) (message-clean-mode--disable)))

;;
;; (@* "Users" )
;;

(defun message-clean-mode--add-commands (command lst)
"Add COMMAND to LST."
(let ((commands (message-clean-mode--listify command)))
(nconc lst commands)
(message-clean-mode--re-enable-mode-if-was-enabled #'message-clean-mode)))

;;;###autoload
(defun message-clean-mode-add-echo-commands (command)
"Add COMMAND to echo list."
(message-clean-mode--add-commands command message-clean-mode-echo-commands))

;;;###autoload
(defun message-clean-mode-add-mute-commands (command)
"Add COMMAND to mute list."
(message-clean-mode--add-commands command message-clean-mode-mute-commands))

(provide 'message-clean-mode)
;;; message-clean-mode.el ends here

0 comments on commit 1fe8215

Please sign in to comment.