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:
- bin/doom version
- bin/doom -d test
- bin/doom -y compile

View file

@ -103,4 +103,5 @@
"report, please include it!\n\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"
" 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
or overlay property on the first visible character of that line.")
(defgroup display-line-numbers nil "Display line number preferences"
:group 'emacs)
;;;###autoload
(defcustom display-line-numbers-type t
"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
text 'face
(append (get-text-property 0 'face text)
(let (spec)
(cond ((>= code 40)
`(:background ,(caddr (assq style doom-ansi-alist))))
((>= code 30)
`(:foreground ,(face-foreground (caddr (assq style doom-ansi-alist)))))
((cddr (assq style doom-ansi-alist))))))))))
(cond ((>= code 40)
`(:background ,(caddr (assq style doom-ansi-alist))))
((>= code 30)
`(:foreground ,(face-foreground (caddr (assq style doom-ansi-alist)))))
((cddr (assq style doom-ansi-alist)))))))))
;;;###autoload
(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))))
((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))
(target (doom-unquote target)))
(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)"))
(if recompile-p "Recompiled" "Compiled")
total-ok (- (length target-files) total-noop)
total-noop))
total-noop)
(or (= total-fail 0)
(error "Failed to compile some files")))
((debug error)
(print! (red "\nThere were breaking errors.\n\n%s")
"Reverting changes...")

View file

@ -10,24 +10,7 @@
;; if-let and when-let are deprecated in Emacs 26+ in favor of their
;; if-let* variants, so we alias them for 25 users.
(defalias 'if-let* #'if-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))))
(defalias 'when-let* #'when-let))))
;;
;; Helpers
@ -147,7 +130,7 @@ serve as a predicated alternative to `after!'."
(declare (indent defun) (debug t))
`(if ,condition
(progn ,@body)
,(let ((fun (gensym "doom|delay-form-")))
,(let ((fun (make-symbol "doom|delay-form-")))
`(progn
(fset ',fun (lambda (&rest args)
(when ,(or condition t)
@ -213,7 +196,7 @@ advised)."
(let ((append (if (eq (car forms) :after) (pop forms)))
(fn (if (symbolp (car forms))
(intern (format "doom|transient-hook-%s" (pop forms)))
(gensym "doom|transient-hook-"))))
(make-symbol "doom|transient-hook-"))))
`(progn
(fset ',fn
(lambda (&rest _)

View file

@ -7,8 +7,11 @@
(signal 'wrong-number-of-arguments (list 'even (length aliases))))
(after! eshell
(while aliases
(setf (alist-get (pop aliases) +eshell-aliases nil nil #'equal)
(list (pop aliases))))
(let ((alias (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)
(if +eshell--default-aliases
(setq eshell-command-aliases-list

View file

@ -1,20 +1,21 @@
;;; 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.")
(define-minor-mode +eval-repl-mode
"A minor mode for REPL buffers.")
(defun +eval--ensure-in-repl-buffer (&optional command same-window-p)
(setq +eval-repl-buffers-alist
(cl-remove-if-not #'buffer-live-p +eval-repl-buffers-alist
:key #'cdr))
(maphash (lambda (key buffer)
(unless (buffer-live-p buffer)
(remhash key +eval-repl-buffers)))
+eval-repl-buffers)
(let* ((project-root (doom-project-root 'nocache))
(key (cons major-mode project-root))
(buffer (cdr (assoc key +eval-repl-buffers-alist))))
(unless (and (bufferp buffer)
(eq buffer (current-buffer)))
(buffer (gethash key +eval-repl-buffers)))
(cl-check-type buffer (or buffer null))
(unless (eq buffer (current-buffer))
(funcall (if same-window-p #'switch-to-buffer #'pop-to-buffer)
(if (buffer-live-p buffer)
buffer
@ -26,8 +27,7 @@
(unless (bufferp buffer)
(error "REPL command didn't return a buffer"))
(with-current-buffer buffer (+eval-repl-mode +1))
(setf (alist-get key +eval-repl-buffers-alist nil nil #'equal)
buffer)
(puthash key buffer +eval-repl-buffers)
buffer)))
(with-current-buffer buffer
(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
;; and should be byte-compiled, no matter what, to ensure it runs as fast as
;; possible:
(eval-when-compile
(when (not (byte-code-function-p (symbol-function '+emacs-lisp-highlight-vars-and-faces)))
(with-no-warnings
(byte-compile #'+emacs-lisp-highlight-vars-and-faces)))

View file

@ -36,9 +36,6 @@
(advice-add #'org-download-enable :override #'ignore)
: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
(cond (IS-MAC "screencapture -i %s")
@ -72,6 +69,9 @@
(defun +org|init-attach ()
(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
(add-to-list 'org-link-abbrev-alist (cons "attach" (abbreviate-file-name org-attach-directory)))