Fix all the compilation warns and errors

This commit is contained in:
Sameer Rahmani 2023-06-25 19:58:44 +01:00
parent 2b8cb40752
commit 9c55995d76
Signed by: lxsameer
GPG Key ID: B0A4AF28AB9FD90B
2 changed files with 27 additions and 11 deletions

View File

@ -25,6 +25,14 @@
;;; Code:
(require 'noether)
(eval-when-compile
(defvar line-unit)
(defvar buffer-name-unit)
(defvar time-unit)
(defvar mode-name-unit)
(defvar projectile-project-unit)
(declare-function projectile-project-name "projectile-project-name" ()))
;; ============================================================================
;; line number indicator
;; ============================================================================
@ -41,7 +49,7 @@
(format "%4d:%4d" (car v) (cadr v)))
(defunit line-unit
(noether-defunit line-unit
"Show the line number."
:label (propertize "L" 'face 'highlight)
:len 9
@ -72,13 +80,13 @@
(string-trim v))))
(defunit buffer-name-unit
(noether-defunit buffer-name-unit
"Show the current buffer name in the viwe.
The format of the unit is like: `(*|-)(*|-)BUFFER-NAME'.
The first char will be an asterisk if the buffer contains unsaved changes and
the second char will be an asterisk if the file changed on the disk without Emacs
knowing."
the second char will be an asterisk if the file changed on the disk without
Emacs knowing."
:label ""
:len 32
:init (lambda ()
@ -104,7 +112,7 @@ knowing."
v)
(defunit time-unit
(noether-defunit time-unit
"just the time for your bar."
:label "T:"
:len 8
@ -141,12 +149,12 @@ knowing."
v)
(defunit projectile-project-unit
(noether-defunit projectile-project-unit
"just the time for your bar."
:label "P:"
:len 30
:init (lambda ()
(if (and (featurep 'projectile) projectile-mode)
(if (and (featurep 'projectile) (boundp 'projectile-mode))
(add-hook 'noether-on-buffer-change-hook #'noether--set-project)
(warn "Can't find feature `projectile'")))
:deinit (lambda ()

View File

@ -29,10 +29,16 @@
(require 'seq)
(require 'posframe)
(defgroup noether nil
"The customization group for the noether-mode."
:group 'convenience)
;; ============================================================================
;; Vars
;; ============================================================================
(eval-when-compile
(defvar noether-global-mode-map))
(defvar noether-views ()
"A list of views that noether should manage.
@ -90,7 +96,7 @@ function."
(string-trim ,new-var-sym))
(defunit ,name
(noether-defunit ,name
,docs
:label ,label
:len ,len
@ -214,7 +220,7 @@ It will pass WATCH-PARAMS to the unit's `:fn'"
(replace-region-contents
(+ 1 start-point)
(+ 1 start-point len)
(lambda () (string-pad (truncate-string-to-width res len) len))))))))
(lambda () (string-pad txt len))))))))
(defun noether--make-updater (buf f start-point len)
@ -303,7 +309,8 @@ E.g. the updaters list."
(defun noether--teardown-unit (unit)
"Tear down the given UNIT by calling the `:deinit' function and removing possible watches."
"Tear down the given UNIT by calling the `:deinit' fn.
It removes any possible watch function."
(let ((deinit (noether--unit-get unit :deinit (lambda ()))))
(funcall deinit)))
@ -338,7 +345,8 @@ E.g. the updaters list."
"A minor mode that keep tracks of different status blocks.
It reports them back in a status bar like frame."
:global t
:lighter " ST42"
:lighter " N"
:group 'noether
:keymap (make-sparse-keymap)
(if noether-global-mode
(noether--enable)