Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Emacs will tell you the exact location where you missed instantly when the files are loaded. No worry! Anyway, to try out Emacs these days everything is already done for you:

- Prelude (for those who want to learn Emacs): https://github.com/bbatsov/prelude

- Spacemacs (for long time Vim users): https://github.com/syl20bnr/spacemacs



That isn't my experience...


Just opened Emacs 24.4 for a test:

    Warning (initialization): An error occurred while loading `c:/Users/swah/.emacs':

    Wrong type argument: listp, 769

    To ensure normal operation, you should investigate and remove the
    cause of the error in your initialization file.  Start Emacs with
    the `--debug-init' option to view a complete error backtrace.
That .emacs file contains only has two lines:

    (defvar emacs-root (expand-file-name "~/Dropbox/dotfiles/emacs/"))
    (load-file "~/Dropbox/dotfiles/emacs/init.el")
So I did M-x toggle-debug-on-error and reloaded init.el manually.. Then I took a look at the Messages buffer:

  Debugger entered--Lisp error: (wrong-type-argument listp 769)
    memq(&rest 769)
    (if (memq (quote &rest) arglist) most-positive-fixnum (length (remq (quote &optional) arglist)))
    (let ((arglist (if (byte-code-function-p function) (aref function 0) (second function)))) (if (memq (quote &rest) arglist) most-positive-fixnum (length (remq (quote &optional) arglist))))
    (if (subrp function) (let ((max (cdr (subr-arity function)))) (if (eq (quote many) max) most-positive-fixnum max)) (if (eq (quote macro) (car-safe function)) (setq function (cdr function))) (let ((arglist (if (byte-code-function-p function) (aref function 0) (second function)))) (if (memq (quote &rest) arglist) most-positive-fixnum (length (remq (quote &optional) arglist)))))
    magit-max-args-internal(delete-directory)
    (>= (magit-max-args-internal (quote delete-directory)) 2)
    (if (>= (magit-max-args-internal (quote delete-directory)) 2) (defalias (quote magit-delete-directory) (quote delete-directory)) (defun magit-delete-directory (directory &optional recursive) "Deletes a directory named DIRECTORY.  If RECURSIVE is non-nil,\nrecursively delete all of DIRECTORY's contents as well.\n\nDoes not follow symlinks." (if (or (file-symlink-p directory) (not (file-directory-p directory))) (delete-file directory) (if recursive (dolist (file (directory-files directory (quote full) "\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) (magit-delete-directory file recursive))) (delete-directory directory))))
    (progn (defun magit-max-args-internal (function) "Returns the maximum number of arguments accepted by FUNCTION." (if (symbolp function) (setq function (symbol-function function))) (if (subrp function) (let ((max (cdr (subr-arity function)))) (if (eq (quote many) max) most-positive-fixnum max)) (if (eq (quote macro) (car-safe function)) (setq function (cdr function))) (let ((arglist (if (byte-code-function-p function) (aref function 0) (second function)))) (if (memq (quote &rest) arglist) most-positive-fixnum (length (remq (quote &optional) arglist)))))) (if (functionp (quote start-file-process)) (defalias (quote magit-start-process) (quote start-file-process)) (defalias (quote magit-start-process) (quote start-process))) (unless (fboundp (quote string-match-p)) (defun string-match-p (regexp string &optional start) "Same as `string-match' except this function does not\nchange the match data." (let ((inhibit-changing-match-data t)) (string-match regexp string start)))) (if (fboundp (quote with-silent-modifications)) (defalias (quote magit-with-silent-modifications) (quote with-silent-modifications)) (defmacro magit-with-silent-modifications (&rest body) "Execute body without changing `buffer-modified-p'. Also, do not\nrecord undo information." (\` (set-buffer-modified-p (prog1 (buffer-modified-p) (let (... before-change-functions after-change-functions) (\,@ body))))))) (if (>= (magit-max-args-internal (quote delete-directory)) 2) (defalias (quote magit-delete-directory) (quote delete-directory)) (defun magit-delete-directory (directory &optional recursive) "Deletes a directory named DIRECTORY.  If RECURSIVE is non-nil,\nrecursively delete all of DIRECTORY's contents as well.\n\nDoes not follow symlinks." (if (or (file-symlink-p directory) (not (file-directory-p directory))) (delete-file directory) (if recursive (dolist (file (directory-files directory ... "\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) (magit-delete-directory file recursive))) (delete-directory directory)))))
    eval((progn (defun magit-max-args-internal (function) "Returns the maximum number of arguments accepted by FUNCTION." (if (symbolp function) (setq function (symbol-function function))) (if (subrp function) (let ((max (cdr (subr-arity function)))) (if (eq (quote many) max) most-positive-fixnum max)) (if (eq (quote macro) (car-safe function)) (setq function (cdr function))) (let ((arglist (if (byte-code-function-p function) (aref function 0) (second function)))) (if (memq (quote &rest) arglist) most-positive-fixnum (length (remq (quote &optional) arglist)))))) (if (functionp (quote start-file-process)) (defalias (quote magit-start-process) (quote start-file-process)) (defalias (quote magit-start-process) (quote start-process))) (unless (fboundp (quote string-match-p)) (defun string-match-p (regexp string &optional start) "Same as `string-match' except this function does not\nchange the match data." (let ((inhibit-changing-match-data t)) (string-match regexp string start)))) (if (fboundp (quote with-silent-modifications)) (defalias (quote magit-with-silent-modifications) (quote with-silent-modifications)) (defmacro magit-with-silent-modifications (&rest body) "Execute body without changing `buffer-modified-p'. Also, do not\nrecord undo information." (\` (set-buffer-modified-p (prog1 (buffer-modified-p) (let (... before-change-functions after-change-functions) (\,@ body))))))) (if (>= (magit-max-args-internal (quote delete-directory)) 2) (defalias (quote magit-delete-directory) (quote delete-directory)) (defun magit-delete-directory (directory &optional recursive) "Deletes a directory named DIRECTORY.  If RECURSIVE is non-nil,\nrecursively delete all of DIRECTORY's contents as well.\n\nDoes not follow symlinks." (if (or (file-symlink-p directory) (not (file-directory-p directory))) (delete-file directory) (if recursive (dolist (file (directory-files directory ... "\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) (magit-delete-directory file recursive))) (delete-directory directory))))) nil)
    #[128 "\301\302\303B\"D\207" [lexical-binding quote eval progn] 5 1631664]((defun magit-max-args-internal (function) "Returns the maximum number of arguments accepted by FUNCTION." (if (symbolp function) (setq function (symbol-function function))) (if (subrp function) (let ((max (cdr (subr-arity function)))) (if (eq (quote many) max) most-positive-fixnum max)) (if (eq (quote macro) (car-safe function)) (setq function (cdr function))) (let ((arglist (if (byte-code-function-p function) (aref function 0) (second function)))) (if (memq (quote &rest) arglist) most-positive-fixnum (length (remq (quote &optional) arglist)))))) (if (functionp (quote start-file-process)) (defalias (quote magit-start-process) (quote start-file-process)) (defalias (quote magit-start-process) (quote start-process))) (unless (fboundp (quote string-match-p)) (defun string-match-p (regexp string &optional start) "Same as `string-match' except this function does not\nchange the match data." (let ((inhibit-changing-match-data t)) (string-match regexp string start)))) (if (fboundp (quote with-silent-modifications)) (defalias (quote magit-with-silent-modifications) (quote with-silent-modifications)) (defmacro magit-with-silent-modifications (&rest body) "Execute body without changing `buffer-modified-p'. Also, do not\nrecord undo information." (\` (set-buffer-modified-p (prog1 (buffer-modified-p) (let ((buffer-undo-list t) before-change-functions after-change-functions) (\,@ body))))))) (if (>= (magit-max-args-internal (quote delete-directory)) 2) (defalias (quote magit-delete-directory) (quote delete-directory)) (defun magit-delete-directory (directory &optional recursive) "Deletes a directory named DIRECTORY.  If RECURSIVE is non-nil,\nrecursively delete all of DIRECTORY's contents as well.\n\nDoes not follow symlinks." (if (or (file-symlink-p directory) (not (file-directory-p directory))) (delete-file directory) (if recursive (dolist (file (directory-files directory (quote full) "\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) (magit-delete-directory file recursive))) (delete-directory directory)))))
    (eval-and-compile (defun magit-max-args-internal (function) "Returns the maximum number of arguments accepted by FUNCTION." (if (symbolp function) (setq function (symbol-function function))) (if (subrp function) (let ((max (cdr (subr-arity function)))) (if (eq (quote many) max) most-positive-fixnum max)) (if (eq (quote macro) (car-safe function)) (setq function (cdr function))) (let ((arglist (if (byte-code-function-p function) (aref function 0) (second function)))) (if (memq (quote &rest) arglist) most-positive-fixnum (length (remq (quote &optional) arglist)))))) (if (functionp (quote start-file-process)) (defalias (quote magit-start-process) (quote start-file-process)) (defalias (quote magit-start-process) (quote start-process))) (unless (fboundp (quote string-match-p)) (defun string-match-p (regexp string &optional start) "Same as `string-match' except this function does not\nchange the match data." (let ((inhibit-changing-match-data t)) (string-match regexp string start)))) (if (fboundp (quote with-silent-modifications)) (defalias (quote magit-with-silent-modifications) (quote with-silent-modifications)) (defmacro magit-with-silent-modifications (&rest body) "Execute body without changing `buffer-modified-p'. Also, do not\nrecord undo information." (\` (set-buffer-modified-p (prog1 (buffer-modified-p) (let (... before-change-functions after-change-functions) (\,@ body))))))) (if (>= (magit-max-args-internal (quote delete-directory)) 2) (defalias (quote magit-delete-directory) (quote delete-directory)) (defun magit-delete-directory (directory &optional recursive) "Deletes a directory named DIRECTORY.  If RECURSIVE is non-nil,\nrecursively delete all of DIRECTORY's contents as well.\n\nDoes not follow symlinks." (if (or (file-symlink-p directory) (not (file-directory-p directory))) (delete-file directory) (if recursive (dolist (file (directory-files directory ... "\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) (magit-delete-directory file recursive))) (delete-directory directory)))))
    eval-buffer(#<buffer  *load*> nil "c:/Users/swah/Dropbox/dotfiles/emacs_new/packages/magit/magit.el" nil t)  ; Reading at buffer position 28726
    load-with-code-conversion("c:/Users/swah/Dropbox/dotfiles/emacs_new/packages/magit/magit.el" "c:/Users/swah/Dropbox/dotfiles/emacs_new/packages/magit/magit.el" nil t)
    require(magit)
    eval-buffer()  ; Reading at buffer position 3564
    #<subr call-interactively>(eval-buffer record nil)
    funcall(#<subr call-interactively> eval-buffer record nil)
    (with-no-warnings (funcall ad--addoit-function function record-flag keys))
    (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))
    (let ((ido-ubiquitous-next-override (ido-ubiquitous-get-command-override function))) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys))))
    (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys))))
    (let (ad-return-value) (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))) ad-return-value)
    ad-Advice-call-interactively(#<subr call-interactively> eval-buffer record nil)
    apply(ad-Advice-call-interactively #<subr call-interactively> (eval-buffer record nil))
    call-interactively(eval-buffer record nil)
    command-execute(eval-buffer record)
    execute-extended-command(nil "eval-buffer")
    #<subr call-interactively>(execute-extended-command nil nil)
    funcall(#<subr call-interactively> execute-extended-command nil nil)
    (with-no-warnings (funcall ad--addoit-function function record-flag keys))
    (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))
    (let ((ido-ubiquitous-next-override (ido-ubiquitous-get-command-override function))) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys))))
    (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys))))
    (let (ad-return-value) (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))) ad-return-value)
    ad-Advice-call-interactively(#<subr call-interactively> execute-extended-command nil nil)
    apply(ad-Advice-call-interactively #<subr call-interactively> (execute-extended-command nil nil))
    call-interactively(execute-extended-command nil nil)
    command-execute(execute-extended-command)
I decide to try updating magit. After a bit of googling, I find out how to update packages installed with package.el: http://stackoverflow.com/questions/14836958/updating-package....

15 packages are updated. I close Emacs and open again, and it still seems to break on the same place - something related to Magit. Fault of my customizations? Maybe. I don't know. Consider going back to Sublime? Yep.

So... no, tracking the source of errors ain't that trivial. What options do I have now? Throw away my customizations and start over?


It gives you hints like "buffer position 28726". You can press "M-g c" and enter that number to jump to that location, which is a character location of the error.

I wrote a guide on how to use package.el to install your package and how to customize and extend your Emacs here: http://tuhdo.github.io/emacs-tutor3.html, if you want control of your configuration from scratch.

Probably if you do not have proper Elisp learning, you should use Prelude: https://github.com/bbatsov/prelude. Everything is configured for you and packages are downloaded automatically. This is the easy way. Put your personal configuration code in ~/.emacs.d/personal/. You can also enable additional modules based on your need in ~/.emacs.d/sample/prelude-modules.el by toggling off comments: https://github.com/bbatsov/prelude/blob/master/sample/prelud....

I haven't tried loading from a different location, but you should try in your ~/.emacs.d first. Are you sure your packages are installed in Dropbox folder? I think it is installed in ~/.emacs.d. You should use a VCS like Git to store your configuration in the same .emacs.d directory.

Finally, to make sure it is because Magit, you should uninstall it to see if your Emacs loads properly. In my Windows machine, it loads perfectly fine with more than 130 packages.


Actually I've used emacs since 2003 or so... but still. Removing magit from ~/.emacs.d/elpa and reinstalling seems to have solved it. I'll check prelude.

I still think we need more text editors.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: