I evaluated the below after: > gdb ./emacs gdb> r -Q ==== (defmacro emacs-q-template (pkgs &rest body) "Install packages in PKGS list and evaluate BODY. Example usage: 1. Launch 'emacs -Q'. 2. Copy this macro definition to its scratch buffer and evaluate it. 3. Evaluate a minimum working example using this macro as below: (emacs-q-template '(projectile) (projectile-global-mode)) " (declare (indent 1) (debug t)) `(progn (require 'package) (setq package-user-dir (concat (getenv "HOME") "/.emacs.d/elpa_test/")) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) (package-initialize) (package-refresh-contents) (dolist (pkg ,pkgs) (package-install pkg) (require pkg)) ,@body)) (emacs-q-template '(projectile) (projectile-global-mode) (string-match-p "." nil)) ===== Below is the backtrace at the point where I get the unexpected end-of-file error (gdb) c Continuing. [New Thread 0x7fffec504700 (LWP 11972)] [Thread 0x7fffec504700 (LWP 11972) exited] Breakpoint 3, Fsignal (error_symbol=19104, data=0) at eval.c:1472 1472 = (NILP (error_symbol) ? Fcar (data) : error_symbol); (gdb) p error_symbol $15 = 19104 (gdb) xsymbol $16 = (struct Lisp_Symbol *) 0xcae060 "end-of-file" (gdb) bt #0 Fsignal (error_symbol=19104, data=0) at eval.c:1472 #1 0x00000000005f4a06 in xsignal (error_symbol=19104, data=0) at eval.c:1578 #2 0x00000000005f4a33 in xsignal0 (error_symbol=19104) at eval.c:1587 #3 0x0000000000623284 in end_of_file_error () at lread.c:1738 #4 0x0000000000624dcd in read1 (readcharfun=57797668, pch=0x7fffffff353c, first_in_list=false) at lread.c:2553 #5 0x00000000006278e3 in read_list (flag=false, readcharfun=57797668) at lread.c:3659 #6 0x0000000000624dfc in read1 (readcharfun=57797668, pch=0x7fffffff38ac, first_in_list=false) at lread.c:2558 #7 0x00000000006241b0 in read0 (readcharfun=57797668) at lread.c:2139 #8 0x0000000000624112 in read_internal_start (stream=57797668, start=0, end=0) at lread.c:2112 #9 0x0000000000623fab in Fread_from_string (string=57797668, start=0, end=0) at lread.c:2075 #10 0x00000000005f7627 in Ffuncall (nargs=2, args=0x7fffffff3a28) at eval.c:2708 #11 0x000000000063df57 in exec_byte_code (bytestr=10617580, vector=10617613, maxdepth=34, args_template=0, nargs=0, args=0x0) at bytecode.c:880 #12 0x00000000005f817a in funcall_lambda (fun=10617485, nargs=2, arg_vector=0xa2030d ) at eval.c:2929 #13 0x00000000005f783a in Ffuncall (nargs=3, args=0x7fffffff3f80) at eval.c:2750 #14 0x000000000063df57 in exec_byte_code (bytestr=40406500, vector=35307789, maxdepth=18, args_template=1030, nargs=1, args=0x7fffffff44c8) at bytecode.c:880 #15 0x00000000005f7e3e in funcall_lambda (fun=35307829, nargs=1, arg_vector=0x7fffffff44c0) at eval.c:2863 #16 0x00000000005f783a in Ffuncall (nargs=2, args=0x7fffffff44b8) at eval.c:2750 #17 0x000000000063df57 in exec_byte_code (bytestr=41942932, vector=35797685, maxdepth=66, args_template=1030, nargs=1, args=0x7fffffff4a78) at bytecode.c:880 #18 0x00000000005f7e3e in funcall_lambda (fun=26917541, nargs=1, arg_vector=0x7fffffff4a70) at eval.c:2863 #19 0x00000000005f783a in Ffuncall (nargs=2, args=0x7fffffff4a68) at eval.c:2750 #20 0x000000000063df57 in exec_byte_code (bytestr=32991236, vector=36233277, maxdepth=50, args_template=2058, nargs=2, args=0x7fffffff4fd0) at bytecode.c:880 #21 0x00000000005f7e3e in funcall_lambda (fun=36233437, nargs=2, arg_vector=0x7fffffff4fc0) at eval.c:2863 #22 0x00000000005f783a in Ffuncall (nargs=3, args=0x7fffffff4fb8) at eval.c:2750 #23 0x000000000063df57 in exec_byte_code (bytestr=29885572, vector=35430989, maxdepth=26, args_template=2054, nargs=1, args=0x7fffffff5508) at bytecode.c:880 #24 0x00000000005f7e3e in funcall_lambda (fun=35431157, nargs=1, arg_vector=0x7fffffff5500) at eval.c:2863 #25 0x00000000005f783a in Ffuncall (nargs=2, args=0x7fffffff54f8) at eval.c:2750 #26 0x000000000063df57 in exec_byte_code (bytestr=29509364, vector=35472261, maxdepth=34, args_template=1026, nargs=0, args=0x7fffffff5a50) at bytecode.c:880 #27 0x00000000005f7e3e in funcall_lambda (fun=37586485, nargs=0, arg_vector=0x7fffffff5a50) at eval.c:2863 #28 0x00000000005f783a in Ffuncall (nargs=1, args=0x7fffffff5a48) at eval.c:2750 #29 0x000000000063df57 in exec_byte_code (bytestr=29347988, vector=37183445, maxdepth=18, args_template=2, nargs=0, args=0x7fffffff6010) at bytecode.c:880 #30 0x00000000005f7e3e in funcall_lambda (fun=37183509, nargs=0, arg_vector=0x7fffffff6010) at eval.c:2863 #31 0x00000000005f783a in Ffuncall (nargs=1, args=0x7fffffff6008) at eval.c:2750 #32 0x00000000005f6a9b in funcall_nil (nargs=1, args=0x7fffffff6008) at eval.c:2340 #33 0x00000000005f6e9f in run_hook_with_args (nargs=1, args=0x7fffffff6008, funcall=0x5f6a78 ) at eval.c:2517 #34 0x00000000005f6b22 in Frun_hook_with_args (nargs=1, args=0x7fffffff6008) at eval.c:2382 #35 0x00000000005f6efb in run_hook (hook=28871488) at eval.c:2530 #36 0x00000000005f6adf in Frun_hooks (nargs=1, args=0x7fffffff6118) at eval.c:2364 #37 0x00000000005f74ba in Ffuncall (nargs=2, args=0x7fffffff6110) at eval.c:2681 #38 0x000000000063df57 in exec_byte_code (bytestr=9658076, vector=9658109, maxdepth=22, args_template=514, nargs=1, args=0x7fffffff6640) at bytecode.c:880 #39 0x00000000005f7e3e in funcall_lambda (fun=9658029, nargs=1, arg_vector=0x7fffffff6640) at eval.c:2863 #40 0x00000000005f783a in Ffuncall (nargs=2, args=0x7fffffff6638) at eval.c:2750 #41 0x000000000063df57 in exec_byte_code (bytestr=26545060, vector=26696973, maxdepth=10, args_template=2, nargs=0, args=0x7fffffff6c50) at bytecode.c:880 #42 0x00000000005f7e3e in funcall_lambda (fun=26697125, nargs=0, arg_vector=0x7fffffff6c50) at eval.c:2863 #43 0x00000000005f783a in Ffuncall (nargs=1, args=0x7fffffff6c48) at eval.c:2750 #44 0x000000000063df57 in exec_byte_code (bytestr=26480452, vector=26654173, maxdepth=166, args_template=514, nargs=2, args=0x7fffffff71a8) at bytecode.c:880 #45 0x00000000005f7e3e in funcall_lambda (fun=26654805, nargs=2, arg_vector=0x7fffffff71a8) at eval.c:2863 #46 0x00000000005f783a in Ffuncall (nargs=3, args=0x7fffffff71a0) at eval.c:2750 #47 0x00000000005f6a41 in Fapply (nargs=2, args=0x7fffffff7270) at eval.c:2329 #48 0x00000000005f6f90 in apply1 (fn=16848, arg=56618787) at eval.c:2545 #49 0x00000000005f23b6 in call_debugger (arg=56618787) at eval.c:308 #50 0x00000000005f4e2b in maybe_call_debugger (conditions=9578427, sig=51984, data=56618835) at eval.c:1723 #51 0x00000000005f48dd in Fsignal (error_symbol=51984, data=56618835) at eval.c:1541 #52 0x00000000005f4a06 in xsignal (error_symbol=51984, data=56618835) at eval.c:1578 #53 0x00000000005f4a9a in xsignal2 (error_symbol=51984, arg1=44400, arg2=0) at eval.c:1599 #54 0x00000000005d7967 in wrong_type_argument (predicate=44400, value=0) at data.c:151 #55 0x000000000055388b in CHECK_STRING (x=0) at lisp.h:2807 #56 0x00000000005b2278 in string_match_1 (regexp=55505044, string=0, start=0, posix=false) at search.c:373 #57 0x00000000005b25e5 in Fstring_match (regexp=55505044, string=0, start=0) at search.c:444 #58 0x00000000005f7627 in Ffuncall (nargs=4, args=0x7fffffff75c0) at eval.c:2708 #59 0x000000000063df57 in exec_byte_code (bytestr=9684412, vector=9684445, maxdepth=30, args_template=3082, nargs=2, args=0x7fffffff7a40) at bytecode.c:880 #60 0x00000000005f7e3e in funcall_lambda (fun=9684365, nargs=2, arg_vector=0x7fffffff7a30) at eval.c:2863 #61 0x00000000005f7bca in apply_lambda (fun=9684365, args=55521603, count=15) at eval.c:2802 #62 0x00000000005f623e in eval_sub (form=55521587) at eval.c:2219 #63 0x00000000005f2647 in Fprogn (body=55521667) at eval.c:427 #64 0x00000000005f5c69 in eval_sub (form=55520739) at eval.c:2127 #65 0x00000000005f5786 in Feval (form=55520739, lexical=0) at eval.c:1996 #66 0x00000000005f75ec in Ffuncall (nargs=3, args=0x7fffffff7e28) at eval.c:2704 #67 0x000000000063df57 in exec_byte_code (bytestr=11219292, vector=11219325, maxdepth=22, args_template=1030, nargs=1, args=0x7fffffff8360) at bytecode.c:880 #68 0x00000000005f7e3e in funcall_lambda (fun=11219245, nargs=1, arg_vector=0x7fffffff8358) at eval.c:2863 #69 0x00000000005f783a in Ffuncall (nargs=2, args=0x7fffffff8350) at eval.c:2750 #70 0x000000000063df57 in exec_byte_code (bytestr=11220028, vector=11220061, maxdepth=18, args_template=1030, nargs=1, args=0x7fffffff8968) at bytecode.c:880 #71 0x00000000005f7e3e in funcall_lambda (fun=11219973, nargs=1, arg_vector=0x7fffffff8960) at eval.c:2863 #72 0x00000000005f783a in Ffuncall (nargs=2, args=0x7fffffff8958) at eval.c:2750 #73 0x00000000005ef8fc in Ffuncall_interactively (nargs=2, args=0x7fffffff8958) at callint.c:252 #74 0x00000000005f74ba in Ffuncall (nargs=3, args=0x7fffffff8950) at eval.c:2681 #75 0x00000000005f1c82 in Fcall_interactively (function=4203120, record_flag=0, keys=13589173) at callint.c:840 #76 0x00000000005f7627 in Ffuncall (nargs=4, args=0x7fffffff8c78) at eval.c:2708 #77 0x000000000063df57 in exec_byte_code (bytestr=10517116, vector=10517149, maxdepth=54, args_template=4102, nargs=1, args=0x7fffffff91d0) at bytecode.c:880 #78 0x00000000005f7e3e in funcall_lambda (fun=10517069, nargs=1, arg_vector=0x7fffffff91c8) at eval.c:2863 #79 0x00000000005f783a in Ffuncall (nargs=2, args=0x7fffffff91c0) at eval.c:2750 #80 0x00000000005f6fe2 in call1 (fn=15072, arg1=4203120) at eval.c:2560 #81 0x000000000055b646 in command_loop_1 () at keyboard.c:1479 #82 0x00000000005f424a in internal_condition_case (bfun=0x55ae8d , handlers=19392, hfun=0x55a677 ) at eval.c:1310 #83 0x000000000055ab95 in command_loop_2 (ignore=0) at keyboard.c:1107 #84 0x00000000005f3b6a in internal_catch (tag=46560, func=0x55ab6c , arg=0) at eval.c:1075 #85 0x000000000055ab35 in command_loop () at keyboard.c:1086 #86 0x000000000055a246 in recursive_edit_1 () at keyboard.c:692 #87 0x000000000055a3d9 in Frecursive_edit () at keyboard.c:763 #88 0x000000000055825a in main (argc=2, argv=0x7fffffff9688) at emacs.c:1656 Lisp Backtrace: "read-from-string" (0xffff3a30) "help-function-arglist" (0xffff3f88) "ad-arglist" (0xffff44c0) "ad-make-advised-definition" (0xffff4a70) "ad-activate-advised-definition" (0xffff4fc0) "ad-activate" (0xffff5500) "projectile-mode" (0xffff5a50) "projectile-global-mode-enable-in-buffers" (0xffff6010) "run-hooks" (0xffff6118) "run-mode-hooks" (0xffff6640) "debugger-mode" (0xffff6c50) "debug" (0xffff71a8) "string-match" (0xffff75c8) "string-match-p" (0xffff7a30) "progn" (0xffff7c70) "eval" (0xffff7e30) "elisp--eval-last-sexp" (0xffff8358) "eval-last-sexp" (0xffff8960) "funcall-interactively" (0xffff8958) "call-interactively" (0xffff8c80) "command-execute" (0xffff91c8) (gdb) -- -- Kaushal Modi