flyingmachine / emacs-for-clojure

525 stars 267 forks source link

Getting these error messages whenever I start up emacs: #26

Open trackrise opened 8 years ago

trackrise commented 8 years ago

Warning (bytecomp) : reference to free variable 'predicate' Warning (bytecomp) : reference to free variable 'inherit-input-method' Warning (bytecomp) : reference to free variable 'ido-cur-item' Warning (bytecomp) : reference to free variable 'ido-default-item' Warning (bytecomp) : reference to free variable 'ido-cur-list'

I don't know why this is coming up, but I've traced it to this file: C:\Users\User\AppData\Roaming.emacs.d\elpa\ido-ubiquitous-20140526.1306/ido-ubiquitous.elc

themobilecoder commented 8 years ago

Hi @Trackrise,

I'm having the same warnings as well inside the compile-log window but I'm using a Mac environment.

I found the solution here by @dudebout https://github.com/DarwinAwardWinner/ido-ubiquitous/issues/35

where you need to define those variables first before defining ido-ubiquitious inside init.el.

I don't know how pull requests work here in github at the moment, but I will upload my updated init.el here in this comment.

I basically just followed the solution and declare those variables.

Just copy the content of the init.el below and update yours and see if it works for you.

;;;;
;; Packages
;;;;

;; Define package repositories
(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
             '("tromey" . "http://tromey.com/elpa/") t)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)

;; (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
;;                          ("marmalade" . "http://marmalade-repo.org/packages/")
;;                          ("melpa" . "http://melpa-stable.milkbox.net/packages/")))

;; Load and activate emacs packages. Do this first so that the
;; packages are loaded before you start trying to modify them.
;; This also sets the load path.
(package-initialize)

;; Download the ELPA archive description if needed.
;; This informs Emacs about the latest versions of all packages, and
;; makes them available for download.
(when (not package-archive-contents)
  (package-refresh-contents))

;; Fix for the warnings

(defvar ido-cur-item nil)
(defvar ido-default-item nil)
(defvar ido-cur-list nil)
(defvar predicate nil)
(defvar inherit-input-method nil)

;; The packages you want installed. You can also install these
;; manually with M-x package-install
;; Add in your own as you wish:
(defvar my-packages
  '(;; makes handling lisp expressions much, much easier
    ;; Cheatsheet: http://www.emacswiki.org/emacs/PareditCheatsheet
    paredit

    ;; key bindings and code colorization for Clojure
    ;; https://github.com/clojure-emacs/clojure-mode
    clojure-mode

    ;; extra syntax highlighting for clojure
    clojure-mode-extra-font-locking

    ;; integration with a Clojure REPL
    ;; https://github.com/clojure-emacs/cider
    cider

    ;; allow ido usage in as many contexts as possible. see
    ;; customizations/navigation.el line 23 for a description
    ;; of ido
    ido-ubiquitous

    ;; Enhances M-x to allow easier execution of commands. Provides
    ;; a filterable list of possible commands in the minibuffer
    ;; http://www.emacswiki.org/emacs/Smex
    smex

    ;; project navigation
    projectile

    ;; colorful parenthesis matching
    rainbow-delimiters

    ;; edit html tags like sexps
    tagedit

    ;; git integration
    magit))

;; On OS X, an Emacs instance started from the graphical user
;; interface will have a different environment than a shell in a
;; terminal window, because OS X does not run a shell during the
;; login. Obviously this will lead to unexpected results when
;; calling external utilities like make from Emacs.
;; This library works around this problem by copying important
;; environment variables from the user's shell.
;; https://github.com/purcell/exec-path-from-shell
(if (eq system-type 'darwin)
    (add-to-list 'my-packages 'exec-path-from-shell))

(dolist (p my-packages)
  (when (not (package-installed-p p))
    (package-install p)))

;; Place downloaded elisp files in ~/.emacs.d/vendor. You'll then be able
;; to load them.
;;
;; For example, if you download yaml-mode.el to ~/.emacs.d/vendor,
;; then you can add the following code to this file:
;;
;; (require 'yaml-mode)
;; (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
;; 
;; Adding this code will make Emacs enter yaml mode whenever you open
;; a .yml file
(add-to-list 'load-path "~/.emacs.d/vendor")

;;;;
;; Customization
;;;;

;; Add a directory to our load path so that when you `load` things
;; below, Emacs knows where to look for the corresponding file.
(add-to-list 'load-path "~/.emacs.d/customizations")

;; Sets up exec-path-from-shell so that Emacs will use the correct
;; environment variables
(load "shell-integration.el")

;; These customizations make it easier for you to navigate files,
;; switch buffers, and choose options from the minibuffer.
(load "navigation.el")

;; These customizations change the way emacs looks and disable/enable
;; some user interface elements
(load "ui.el")

;; These customizations make editing a bit nicer.
(load "editing.el")

;; Hard-to-categorize customizations
(load "misc.el")

;; For editing lisps
(load "elisp-editing.el")

;; Langauage-specific
(load "setup-clojure.el")
(load "setup-js.el")
junjiemars commented 7 years ago

Don't define those vars yourself!

Those vars about ido package and it's OK, you had 3 choices: 1) let them go; 2) use defentive code, fix that in your own .el file.

(if (not (boundp 'xyz))
   (setq-default xyz 123)))

3) pull a stable and flexible fork (support darwin, linux and windows, terminal or gui)

# 1. backup you ~/.emacs.d first
$ mv ~/.emacs.d <somewhere>

# 2. clone the fork, first close your Emacs
$ git clone --depth=1 --branch=master https://github.com/junjiemars/.emacs.d.git

# 3. start Emacs and wait for auto install some basic packages
stiofand commented 6 years ago

I still have issues after the above solution:

emacs --debug-init

entered--Lisp error: (void-variable g)

less verbose is the error / warning about the init.el file:

Symbol's value as variable is void: g

I don't know enough about Emacs / Lisp to track this down apart from opening the init.el file but I cant really trace the error.

The emacs setup section is pretty well out of date, so Im trying to hack in the changes with the latest mac emacs, but there is a whole host of issues. Perhaps an update to this section. For now Im using another editor as I cant fix these Emacs issues, and there are no solutions yet.

junjiemars commented 6 years ago

try this one: https://github.com/junjiemars/.emacs.d