Merge pull request #875 from edwintorok/develop

Fix wrong number of arguments in repl.el and other compile errors/warnings
This commit is contained in:
Henrik Lissner 2018-09-12 18:57:53 -04:00 committed by GitHub
commit 1e2682484a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 36 additions and 44 deletions

View file

@ -18,3 +18,4 @@ env:
script: script:
- bin/doom version - bin/doom version
- bin/doom -d test - bin/doom -d test
- bin/doom -y compile

View file

@ -103,4 +103,5 @@
"report, please include it!\n\n" "report, please include it!\n\n"
"Emacs outputs to standard error, so you'll need to redirect stderr to\n" "Emacs outputs to standard error, so you'll need to redirect stderr to\n"
"stdout to pipe this to a file or clipboard!\n\n" "stdout to pipe this to a file or clipboard!\n\n"
" e.g. doom -d install 2>&1 | clipboard-program"))))))))) " e.g. doom -d install 2>&1 | clipboard-program"))
(signal 'doom-error e))))))))

View file

@ -27,6 +27,9 @@ Lisp programs can disable display of a line number of a particular
buffer line by putting the display-line-numbers-disable text property buffer line by putting the display-line-numbers-disable text property
or overlay property on the first visible character of that line.") or overlay property on the first visible character of that line.")
(defgroup display-line-numbers nil "Display line number preferences"
:group 'emacs)
;;;###autoload ;;;###autoload
(defcustom display-line-numbers-type t (defcustom display-line-numbers-type t
"The default type of line numbers to use in `display-line-numbers-mode'. "The default type of line numbers to use in `display-line-numbers-mode'.

View file

@ -47,12 +47,11 @@ Otherwise, it maps colors to a term-color-* face."
(propertize (propertize
text 'face text 'face
(append (get-text-property 0 'face text) (append (get-text-property 0 'face text)
(let (spec) (cond ((>= code 40)
(cond ((>= code 40) `(:background ,(caddr (assq style doom-ansi-alist))))
`(:background ,(caddr (assq style doom-ansi-alist)))) ((>= code 30)
((>= code 30) `(:foreground ,(face-foreground (caddr (assq style doom-ansi-alist)))))
`(:foreground ,(face-foreground (caddr (assq style doom-ansi-alist))))) ((cddr (assq style doom-ansi-alist)))))))))
((cddr (assq style doom-ansi-alist))))))))))
;;;###autoload ;;;###autoload
(defmacro format! (message &rest args) (defmacro format! (message &rest args)

View file

@ -192,7 +192,7 @@ even if it doesn't need reloading!"
(push `(put ',name 'doom-module ',origin) forms)))) (push `(put ',name 'doom-module ',origin) forms))))
((eq type 'defalias) ((eq type 'defalias)
(cl-destructuring-bind (type name target &optional docstring) sexp (cl-destructuring-bind (_type name target &optional docstring) sexp
(let ((name (doom-unquote name)) (let ((name (doom-unquote name))
(target (doom-unquote target))) (target (doom-unquote target)))
(unless (and member-p (unless (and member-p

View file

@ -151,7 +151,9 @@ If RECOMPILE-P is non-nil, only recompile out-of-date files."
"%s %d/%d file(s) (%d ignored)")) "%s %d/%d file(s) (%d ignored)"))
(if recompile-p "Recompiled" "Compiled") (if recompile-p "Recompiled" "Compiled")
total-ok (- (length target-files) total-noop) total-ok (- (length target-files) total-noop)
total-noop)) total-noop)
(or (= total-fail 0)
(error "Failed to compile some files")))
((debug error) ((debug error)
(print! (red "\nThere were breaking errors.\n\n%s") (print! (red "\nThere were breaking errors.\n\n%s")
"Reverting changes...") "Reverting changes...")

View file

@ -10,24 +10,7 @@
;; if-let and when-let are deprecated in Emacs 26+ in favor of their ;; if-let and when-let are deprecated in Emacs 26+ in favor of their
;; if-let* variants, so we alias them for 25 users. ;; if-let* variants, so we alias them for 25 users.
(defalias 'if-let* #'if-let) (defalias 'if-let* #'if-let)
(defalias 'when-let* #'when-let) (defalias 'when-let* #'when-let))))
;; `alist-get' doesn't have its 5th argument before Emacs 26
(defun doom*alist-get (key alist &optional default remove testfn)
"Return the value associated with KEY in ALIST.
If KEY is not found in ALIST, return DEFAULT.
Use TESTFN to lookup in the alist if non-nil. Otherwise, use `assq'.
This is a generalized variable suitable for use with `setf'.
When using it to set a value, optional argument REMOVE non-nil
means to remove KEY from ALIST if the new value is `eql' to DEFAULT."
(ignore remove) ;;Silence byte-compiler.
(let ((x (cond ((null testfn) (assq key alist))
((eq testfn #'equal) (assoc key alist))
((cl-find key alist :key #'car :test testfn)))))
(if x (cdr x) default)))
(advice-add #'alist-get :override #'doom*alist-get))))
;; ;;
;; Helpers ;; Helpers
@ -147,7 +130,7 @@ serve as a predicated alternative to `after!'."
(declare (indent defun) (debug t)) (declare (indent defun) (debug t))
`(if ,condition `(if ,condition
(progn ,@body) (progn ,@body)
,(let ((fun (gensym "doom|delay-form-"))) ,(let ((fun (make-symbol "doom|delay-form-")))
`(progn `(progn
(fset ',fun (lambda (&rest args) (fset ',fun (lambda (&rest args)
(when ,(or condition t) (when ,(or condition t)
@ -213,7 +196,7 @@ advised)."
(let ((append (if (eq (car forms) :after) (pop forms))) (let ((append (if (eq (car forms) :after) (pop forms)))
(fn (if (symbolp (car forms)) (fn (if (symbolp (car forms))
(intern (format "doom|transient-hook-%s" (pop forms))) (intern (format "doom|transient-hook-%s" (pop forms)))
(gensym "doom|transient-hook-")))) (make-symbol "doom|transient-hook-"))))
`(progn `(progn
(fset ',fn (fset ',fn
(lambda (&rest _) (lambda (&rest _)

View file

@ -7,8 +7,11 @@
(signal 'wrong-number-of-arguments (list 'even (length aliases)))) (signal 'wrong-number-of-arguments (list 'even (length aliases))))
(after! eshell (after! eshell
(while aliases (while aliases
(setf (alist-get (pop aliases) +eshell-aliases nil nil #'equal) (let ((alias (pop aliases))
(list (pop aliases)))) (command (pop aliases)))
(if-let* ((oldval (assoc alias +eshell-aliases)))
(setcdr oldval (list command))
(push (list alias command) +eshell-aliases))))
(when (boundp 'eshell-command-aliases-list) (when (boundp 'eshell-command-aliases-list)
(if +eshell--default-aliases (if +eshell--default-aliases
(setq eshell-command-aliases-list (setq eshell-command-aliases-list

View file

@ -1,20 +1,21 @@
;;; feature/eval/autoload/repl.el -*- lexical-binding: t; -*- ;;; feature/eval/autoload/repl.el -*- lexical-binding: t; -*-
(defvar +eval-repl-buffers-alist () (defvar +eval-repl-buffers (make-hash-table :test 'equal)
"The buffer of the last open repl.") "The buffer of the last open repl.")
(define-minor-mode +eval-repl-mode (define-minor-mode +eval-repl-mode
"A minor mode for REPL buffers.") "A minor mode for REPL buffers.")
(defun +eval--ensure-in-repl-buffer (&optional command same-window-p) (defun +eval--ensure-in-repl-buffer (&optional command same-window-p)
(setq +eval-repl-buffers-alist (maphash (lambda (key buffer)
(cl-remove-if-not #'buffer-live-p +eval-repl-buffers-alist (unless (buffer-live-p buffer)
:key #'cdr)) (remhash key +eval-repl-buffers)))
+eval-repl-buffers)
(let* ((project-root (doom-project-root 'nocache)) (let* ((project-root (doom-project-root 'nocache))
(key (cons major-mode project-root)) (key (cons major-mode project-root))
(buffer (cdr (assoc key +eval-repl-buffers-alist)))) (buffer (gethash key +eval-repl-buffers)))
(unless (and (bufferp buffer) (cl-check-type buffer (or buffer null))
(eq buffer (current-buffer))) (unless (eq buffer (current-buffer))
(funcall (if same-window-p #'switch-to-buffer #'pop-to-buffer) (funcall (if same-window-p #'switch-to-buffer #'pop-to-buffer)
(if (buffer-live-p buffer) (if (buffer-live-p buffer)
buffer buffer
@ -26,8 +27,7 @@
(unless (bufferp buffer) (unless (bufferp buffer)
(error "REPL command didn't return a buffer")) (error "REPL command didn't return a buffer"))
(with-current-buffer buffer (+eval-repl-mode +1)) (with-current-buffer buffer (+eval-repl-mode +1))
(setf (alist-get key +eval-repl-buffers-alist nil nil #'equal) (puthash key buffer +eval-repl-buffers)
buffer)
buffer))) buffer)))
(with-current-buffer buffer (with-current-buffer buffer
(goto-char (if (and (derived-mode-p 'comint-mode) (goto-char (if (and (derived-mode-p 'comint-mode)

View file

@ -66,7 +66,7 @@ library/userland functions"
;; `+emacs-lisp-highlight-vars-and-faces' is a potentially expensive function ;; `+emacs-lisp-highlight-vars-and-faces' is a potentially expensive function
;; and should be byte-compiled, no matter what, to ensure it runs as fast as ;; and should be byte-compiled, no matter what, to ensure it runs as fast as
;; possible: ;; possible:
(eval-when-compile (when (not (byte-code-function-p (symbol-function '+emacs-lisp-highlight-vars-and-faces)))
(with-no-warnings (with-no-warnings
(byte-compile #'+emacs-lisp-highlight-vars-and-faces))) (byte-compile #'+emacs-lisp-highlight-vars-and-faces)))

View file

@ -36,9 +36,6 @@
(advice-add #'org-download-enable :override #'ignore) (advice-add #'org-download-enable :override #'ignore)
:config :config
(setq-default org-download-image-dir org-attach-directory
org-download-heading-lvl nil
org-download-timestamp "_%Y%m%d_%H%M%S")
(setq org-download-screenshot-method (setq org-download-screenshot-method
(cond (IS-MAC "screencapture -i %s") (cond (IS-MAC "screencapture -i %s")
@ -72,6 +69,9 @@
(defun +org|init-attach () (defun +org|init-attach ()
(setq org-attach-directory (expand-file-name +org-attach-dir org-directory)) (setq org-attach-directory (expand-file-name +org-attach-dir org-directory))
(setq-default org-download-image-dir org-attach-directory
org-download-heading-lvl nil
org-download-timestamp "_%Y%m%d_%H%M%S")
;; A shorter link to attachments ;; A shorter link to attachments
(add-to-list 'org-link-abbrev-alist (cons "attach" (abbreviate-file-name org-attach-directory))) (add-to-list 'org-link-abbrev-alist (cons "attach" (abbreviate-file-name org-attach-directory)))