Fix compilation warnings for system/extension libs

This commit is contained in:
Sameer Rahmani 2020-04-15 12:08:13 +01:00
parent ea8126c23e
commit fc233d834e
5 changed files with 28 additions and 34 deletions

View File

@ -55,3 +55,8 @@ install-fonts:
.PHONY: compile .PHONY: compile
compile: compile:
@$(PWD)/fg42-new --script scripts/compiler.el @$(PWD)/fg42-new --script scripts/compiler.el
.PHONY: clean
clean:
@rm -rf $(shell find `pwd` -iname "*~")
@rm -rf $(shell find `pwd`/core -iname "*.elc")

View File

@ -43,14 +43,14 @@ and call the `on-initialize'function of extensions in order to setup
the autoloads and hooks." the autoloads and hooks."
(cond (cond
((symbolp ext) ((symbolp ext)
(fg42-extensions/load-index system ext (fg42-extension/path system ext))) (fg42-extensions/load-index system ext (fg42-extensions/path system ext)))
((listp ext) ((listp ext)
(fg42-extensions/load-index system (car ext) (cadr ext))) (fg42-extensions/load-index system (car ext) (cadr ext)))
(t (t
;; TODO: instead of throwing and error, inject the error into the system ;; TODO: instead of throwing and error, inject the error into the system
(throw 'load-extension-failed (throw 'load-extension-failed
(format "Can't load extension %s" (str ext)))))) (format "Can't load extension %s" (->str ext))))))
(defun fg42-extensions/load-system-extensions (system) (defun fg42-extensions/load-system-extensions (system)
@ -75,7 +75,7 @@ containing the `fg42-extension' instances."
(defun fg42-extensions/initialize-extensions (system) (defun fg42-extensions/initialize-extensions (system)
"Initialize the extensions within SYSTEM and return a new system." "Initialize the extensions within SYSTEM and return a new system."
(mapcar (mapc
(lambda (ext) (fg42-extensions/initialize system ext)) (lambda (ext) (fg42-extensions/initialize system ext))
(fg42-system-extensions system)) (fg42-system-extensions system))
system) system)

View File

@ -59,18 +59,18 @@
;; TODO: should we extract variables such as `fg42-home' to their ;; TODO: should we extract variables such as `fg42-home' to their
;; dedicated ns in order to avoid the warning ? ;; dedicated ns in order to avoid the warning ?
(let ((ext-name (symbol-name ext))) (let ((ext-name (symbol-name ext)))
(concat (fg42-system-root) (concat (fg42-system-root system)
"/extensions/" ext-name "/" ext-name ".el"))) "/extensions/" ext-name "/" ext-name ".el")))
(defun fg42-extension/path (system ext) (defun fg42-extensions/path (system ext)
"Return the path to the given extension EXT in the given SYSTEM." "Return the path to the given extension EXT in the given SYSTEM."
(cond (cond
((symbolp ext) (fg42-extension/build-path system ext)) ((symbolp ext) (fg42-extensions/build-path system ext))
((fg42-extension-p ext) ((fg42-extension-p ext)
(or (fg42-extension-path ext) (or (fg42-extension-path ext)
(fg42-extension/build-path system (fg42-extensions/build-path system
(intern (fg42-extension-name ext))))))) (intern (fg42-extension-name ext)))))))
(defmacro defextension (name docstring &rest args) (defmacro defextension (name docstring &rest args)

View File

@ -28,7 +28,7 @@
;;;###autoload ;;;###autoload
(defun fg42-system/start () (defun fg42-system/start ()
"Start the system from `fg42-get-current-system'." "Start the system from `fg42-get-current-system'."
(require 'fg42/utils)) (require 'fg42/utils)
(require 'fg42/system/core) (require 'fg42/system/core)
(require 'fg42/system/utils) (require 'fg42/system/utils)
@ -37,25 +37,5 @@
(funcall (fg42-system-start sys) sys))) (funcall (fg42-system-start sys) sys)))
(comment
(macroexpand-1 '(defsystem testsystem
"docstring"
:preloads '(2 43 4)
:packages '(('elisp-extension :version "1.3.3"))
:abilities '()))
(defsystem testsystem
"docstring1"
:packages '(('elisp-extension :version "1.3.3"))
:abilities '())
(make-fg42-system :name "asd" :preloads '(213 452) :abilities '(x y))
(aset testsystem 2 "sam")
(setf (fg42-system-abilities testsystem) '(3 3 3 3 3))
(fg42-set-current-system! testsystem)
(fg42-system-preloads testsystem)
(start-system)
(fg42-system-start testsystem))
(provide 'fg42/system) (provide 'fg42/system)
;;; system.el ends here ;;; system.el ends here

View File

@ -24,9 +24,13 @@
;; Each system has to have a `start' function to start the setup process. ;; Each system has to have a `start' function to start the setup process.
;; ;;
;;; Code: ;;; Code:
(require 'cl-lib) (require 'cl-lib)
;;; Buffer helpers ------------------------------------------------------------ (autoload 'seq-partition "seq")
(autoload 'cl-reduce "cl-seq")
(defun buffer-mode (buffer-or-string) (defun buffer-mode (buffer-or-string)
"Return the major mode associated with a the given BUFFER-OR-STRING." "Return the major mode associated with a the given BUFFER-OR-STRING."
(with-current-buffer buffer-or-string (with-current-buffer buffer-or-string
@ -46,6 +50,11 @@ with is the buffer."
(funcall fn buf))))) (funcall fn buf)))))
(defun ->str (&rest args)
"Convert the given ARGS into string."
(funcall #'pp-to-string args))
(defmacro inspect-expression (&rest body) (defmacro inspect-expression (&rest body)
"Pretty prints the result of the given BODY." "Pretty prints the result of the given BODY."
`(pp-display-expression ,@body (get-buffer-create fg42/inspect-buffer))) `(pp-display-expression ,@body (get-buffer-create fg42/inspect-buffer)))
@ -68,7 +77,7 @@ with is the buffer."
(put-text-property 0 (length text) 'face face-symbol text)) (put-text-property 0 (length text) 'face face-symbol text))
(defmacro comment (&rest body) (defmacro comment (&rest _body)
"A macro similar to Clojure's comment macro that ignore the BODY." "A macro similar to Clojure's comment macro that ignore the BODY."
(declare (indent 0)) (declare (indent 0))
`nil) `nil)
@ -106,9 +115,9 @@ For example:
or or
(funcall (compose #'some-fn #'message) some-value)" (funcall (compose #'some-fn #'message) some-value)"
(lambda (&rest values) (lambda (&rest values)
(reduce 'funcall (butlast fns) (cl-reduce 'funcall (butlast fns)
:from-end t :from-end t
:initial-value (apply (car (last fns)) values)))) :initial-value (apply (car (last fns)) values))))
(provide 'fg42/utils) (provide 'fg42/utils)