Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8441509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:34:43+00:00 2026-06-10T08:34:43+00:00

Possible Duplicate: Emacs 24 Package System Initialization Problems I am using Emacs 24. I

  • 0

Possible Duplicate:
Emacs 24 Package System Initialization Problems

I am using Emacs 24. I have the ELPA and Marmalade repos added. Using ‘package’ I installed ‘auto-complete’. I have the following lines added to my init.el:

(require 'auto-complete-config)
(ac-config-default)

When I start Emacs, I get the error

File error: Cannot open load file, auto-complete-config

But then I use

M-x load-file

and load the same ~/.emacs.d/init.el file, it then works fine with the prompt saying

Loading /home/user/.emacs.d/init.el (source)…done

How is the usual loading different from the ‘M-x load-file’ command? In the start of the init.el file I do the following, is this somehow effecting the package from loading.

(add-to-list ‘load-path “~/.emacs.d”)
(load “custom_code”)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:34:44+00:00Added an answer on June 10, 2026 at 8:34 am

    As mentioned in the comment below: The answer by phils to the duplicate question is probably more helpful than this one

    This almost certainly means that your init.el file is getting run before the code that sorts out the packages for package.el. The latter code adds the directory with the auto-complete library to your load path.

    I’m still using ELPA, rather than package.el. With elpa, there’s a snippet that looks like this that gets installed at the bottom of your .emacs.

    ;;; This was installed by package-install.el.
    ;;; This provides support for the package system and
    ;;; interfacing with ELPA, the package archive.
    ;;; Move this code earlier if you want to reference
    ;;; packages in your .emacs.
    (when
        (load
         (expand-file-name "~/.emacs.d/elpa/package.el"))
      (package-initialize))
    

    As the comment suggests, you probably want to put your equivalent package.el initialization code before the stuff that loads init.el.

    Finally: I notice you mention adding .emacs.d to your load-path. The Emacs load path is not recursive, so that probably won’t do what you need (assuming that your libraries live in subdirectories). Years ago, I wrote this snippet to load up various libraries of elisp code that I’d written. You might find it useful. (Obviously, it’ll only work on unixy systems with a shell and a find command. It’s reasonably slow, but this seems to be shell-command-to-string, which takes several milliseconds even running “echo hello” or the like)

    (defun find-elisp-dirs (dir)
      "Find all directories below DIR containing elisp sources, ignoring those"
      (split-string
       (shell-command-to-string
        (format "find %s -iname '*.el' -printf '%%h\\n' | sort -u"
                (expand-file-name dir t)))))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to switch between visible buffers in emacs? I'm using C-x 2
Possible Duplicate: Using Emacs to recursively find and replace in text files not already
Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: regex for URL including query string I have a text or message.
Possible Duplicate: How to call a JavaScript function from PHP? I have a php
Possible Duplicate: What's in your .emacs? I've started to use Emacs and I've been
Possible Duplicate: Extracting dollar amounts from existing sql data? I have a column in
Possible Duplicate: emacs lisp, how to get buffer major mode? Is there a way
Possible Duplicate: Emacs code to automatically set indent-tabs-mode according to existing code When I'm
Possible Duplicate: Emacs: same buffer, two windows, one narrowed, one not I'd like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.