Emacs load path

Emacs load path DEFAULT
;;;; Set up Emac's load path;;;; Having this in a separate file allows inclusion by compile.sh;;;; See: http://emacswiki.org/emacs/LoadPath;; Use directory-file-name here to strip any trailing directory;; separator(defvarhome (directory-file-name (getenv"HOME"))"My home directory.");; Prepend load stuff(unless (boundp'directory-sep-char) (setq directory-sep-char ?/))(setq directory-sep-string (char-to-string directory-sep-char))(setq my-lib-dir (concat home directory-sep-string "lib"))(setq my-emacs-config-dir (concat home directory-sep-string"emacs-config" directory-sep-string))(if (file-accessible-directory-p my-emacs-config-dir) (setq load-path (cons my-emacs-config-dir load-path)))(setq my-lisp-dir (concat my-lib-dir directory-sep-string "lisp"))(if (file-accessible-directory-p my-lisp-dir) (setq load-path (cons my-lisp-dir load-path)));; Add all subdirectories of my-lisp-dir to my load path(let ((default-directory my-lisp-dir)) (normal-top-level-add-subdirs-to-load-path));; Add lib/emacs-<majorversion>(setq my-emacs-dir (concat my-lib-dir directory-sep-string"emacs-" (int-to-string emacs-major-version)))(if (file-accessible-directory-p my-emacs-dir) (progn (setq load-path (cons my-emacs-dir load-path)) (let ((default-directory my-emacs-dir)) (normal-top-level-add-subdirs-to-load-path)) ));; Add /usr/local/share/emacs/site-lisp/ if it exists(if (file-accessible-directory-p"/usr/local/share/emacs/site-lisp/") (setq load-path (cons"/usr/local/share/emacs/site-lisp/" load-path)));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Set up Emac's load path;;;; See: http://emacswiki.org/emacs/LoadPath;; Use directory-file-name here to strip any trailing directory;; separator(defvarhome (directory-file-name (getenv"HOME"))"My home directory.")(setq my-lib-dir (concat home directory-sep-string "lib"))(setq my-emacs-config-dir (concat home directory-sep-string"emacs-config" directory-sep-string))(if (file-accessible-directory-p my-emacs-config-dir) (setq load-path (cons my-emacs-config-dir load-path)))(setq my-lisp-dir (concat my-lib-dir directory-sep-string "lisp"))(if (file-accessible-directory-p my-lisp-dir) (setq load-path (cons my-lisp-dir load-path)));; Add all subdirectories of my-lisp-dir to my load path(let ((default-directory my-lisp-dir)) (normal-top-level-add-subdirs-to-load-path));; Add lib/emacs-<majorversion>(setq my-emacs-dir (concat my-lib-dir directory-sep-string"emacs-" (int-to-string emacs-major-version)))(if (file-accessible-directory-p my-emacs-dir) (progn (setq load-path (cons my-emacs-dir load-path)) (let ((default-directory my-emacs-dir)) (normal-top-level-add-subdirs-to-load-path)) ));; Add /usr/local/share/emacs/site-lisp/ if it exists(if (file-accessible-directory-p"/usr/local/share/emacs/site-lisp/") (setq load-path (cons"/usr/local/share/emacs/site-lisp/" load-path)))
Sours: https://github.com/von/emacs.d/blob/master/setup-load-path.el

Libraries of Lisp Code for Emacs

Emacs Lisp code is stored in files whose names conventionally end in . Such files are automatically visited in Emacs Lisp mode.

Emacs Lisp code can be compiled into byte-code, which loads faster, takes up less space, and executes faster. By convention, compiled Emacs Lisp code goes in a separate file whose name ends in ‘’. For example, the compiled code for goes in . See Byte Compilation in the Emacs Lisp Reference Manual.

To load an Emacs Lisp file, type . This command reads a file name using the minibuffer, and executes the contents of that file as Emacs Lisp code. It is not necessary to visit the file first; this command reads the file directly from disk, not from an existing Emacs buffer.

If an Emacs Lisp file is installed in the Emacs Lisp load path (defined below), you can load it by typing , instead of using . The command prompts for a library name rather than a file name; it searches through each directory in the Emacs Lisp load path, trying to find a file matching that library name. If the library name is ‘’, it tries looking for files named , , and . The default behavior is to load the first file found. This command prefers files over files because compiled files load and run faster. If it finds that is newer than , it issues a warning, in case someone made changes to the file and forgot to recompile it, but loads the file anyway. (Due to this behavior, you can save unfinished edits to Emacs Lisp source files, and not recompile until your changes are ready for use.) If you set the option to a non- value, however, then rather than the procedure described above, Emacs loads whichever version of the file is newest.

Emacs Lisp programs usually load Emacs Lisp files using the function. This is similar to , but is lower-level and accepts additional arguments. See How Programs Do Loading in the Emacs Lisp Reference Manual.

The Emacs Lisp load path is specified by the variable . Its value should be a list of directories (strings). These directories are searched, in the specified order, by the command, the lower-level function, and other Emacs functions that find Emacs Lisp libraries. An entry in can also have the special value , which stands for the current default directory, but it is almost always a bad idea to use this, because its meaning will depend on the buffer that is current when is used by Emacs. (If you find yourself wishing that were in the list, most likely what you really want is to use .)

The default value of is a list of directories where the Lisp code for Emacs itself is stored. If you have libraries of your own in another directory, you can add that directory to the load path. Unlike most other variables described in this manual, cannot be changed via the Customize interface (see Easy Customization), but you can add a directory to it by putting a line like this in your init file (see Init File):

(add-to-list 'load-path "/path/to/my/lisp/library")

It is customary to put locally installed libraries in the directory that is already in the default value of , or in some subdirectory of . This way, you don’t need to modify the default value of .

Some commands are autoloaded; when you run them, Emacs automatically loads the associated library first. For instance, the command (see Compilation) is autoloaded; if you call it, Emacs automatically loads the library first. In contrast, the command is not autoloaded, so it is unavailable until you load the library.

Automatic loading can also occur when you look up the documentation of an autoloaded command (see Name Help), if the documentation refers to other functions and variables in its library (loading the library lets Emacs properly set up the hyperlinks in the buffer). To disable this feature, change the variable to .

Automatic loading also occurs when completing names for and , based on the prefix being completed. To disable this feature, change the variable to .

By default, Emacs refuses to load compiled Lisp files which were compiled with XEmacs, a modified version of Emacs—they can cause Emacs to crash. Set the variable to if you want to try loading them.

Once you put your library in a directory where Emacs can find and load it, you may wish to make it available at startup. This is useful when the library defines features that should be available automatically on demand, and manually loading the library is thus inconvenient. In these cases, make sure the library will be loaded by adding suitable forms to your init file: either or (if you always need to load the library at startup), or if you need Emacs to load the library when some command or function is invoked. For example:

;; Loads unconditionally. (require 'my-shining-package) ;; Will load when is invoked. (autoload 'my-func "my-shining-package")

Note that installing a package using (see Package Installation) takes care of placing the package’s Lisp files in a directory where Emacs will find it, and also writes the necessary initialization code into your init files, making the above manual customizations unnecessary.

Sours: https://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Libraries.html
  1. Leupold binoculars 8x30
  2. 2015 jayco redhawk
  3. Old hickory wma
  4. Fda guidance database
  5. Amazon contracts manager

LoadPath

The value of variable is a list of directories to search, in order, for EmacsLisp libraries that you load. If you do not alter it (directly or indirectly), by default it contains the Lisp source directories for the Emacs distribution.

If you install an Emacs package using the package manager (see InstallingPackages), it automatically configures to handle the packages you install that way. But if you download Emacs Lisp files yourself or you write local Lisp files, just add the directories containing those files to .

When both a byte-compiled file () and a source file () are found for the same library, preference is given to byte-compiled file. Therefore, be sure to recompile files after making changes to them (or don&#x;t compile them at all).

Adding a directory

To add a single directory (e.g., ) to the front of your :

(add-to-list 'load-path "~/.emacs.d/lisp/")

(The directory name does not need to end with a slash ().)

Adding Descendant Directories

Adding a directory to variable does not also add any of its descendants (its subdirectories, their subdirectories, and so on, recursively).

To add all of the descendant directories of a directory to your , bind variable to and then invoke function , as follows:

(let ((default-directory "~/.emacs.d/lisp/")) (normal-top-level-add-subdirs-to-load-path))

This omits directories whose names do not start with letters or digits, those named or , and those containing a file named .

To add only some descendant directories, pass the list as a second argument. For example:

(let ((default-directory "~/.emacs.d/lisp/")) (normal-top-level-add-to-load-path '("emms""erc""planner""w3")))

To have libraries in particular paths take precedence over other libraries with the same name, elsewhere, put the directories or those prioritized libraries at the beginning of .

(let ((default-directory "~/.emacs.d/lisp/")) (setq load-path (append (let ((load-path (copy-sequence load-path))) (normal-top-level-add-subdirs-to-load-path)) load-path)))

Assuming that you install packages in and that some of the installed packages have only a single file while others have multiple files inside a package-specific directory, you need to combine the steps from above.

(let ((default-directory "~/.emacs.d/lisp/")) (normal-top-level-add-to-load-path '(".")) (normal-top-level-add-subdirs-to-load-path))

Since various packages store information in , it is unwise to add all of its descendant directories to . Above we only added directory , to avoid loading files that are not libraries.

To install all directories to the beginning of the use:

(let ((default-directory "~/.emacs.d/lisp/")) (setq load-path (append (let ((load-path (copy-sequence load-path))) (append (copy-sequence (normal-top-level-add-to-load-path '("."))) (normal-top-level-add-subdirs-to-load-path))) load-path)))

If you are using Emacs 23 or later you can use variable to construct a path to one of its descendant directories.

(concat user-emacs-directory (convert-standard-filename "lisp/"))

Note the use of to construct a path that is valid on all supported platforms.

Here is another method. Adds subdirectories containing files to load-path inside the directory . If does not exist, create it. If already exists, then add the subdirs to load-path.

(let* ((path (expand-file-name "lisp" user-emacs-directory)) (local-pkgs (mapcar 'file-name-directory (directory-files-recursively path ".*\\.el")))) (if (file-accessible-directory-p path) (mapc (apply-partially 'add-to-list 'load-path) local-pkgs) (make-directory path :parents)))

Default value of `load-path'

On GNU/Linux, the default value of includes two special directories and their descendants: and . The first directory contains packages for a particular Emacs version; the second contains packages for all installed versions of Emacs. These directories contain files for the current site, for use by the system administrator when installing software locally[1].

, on the other hand, contains files for the current user, and is independent of system-wide changes. This makes it the best choice for storing your personal changes. Installing all packages in a sub-directory of also makes it very easy to move them along with your configuration to a different machine.

Debugging

First, gives you the documentation variable , as well as its current value. If your directory is not listed, add it (see above).

If your directory is listed, check for ConflictingLibraries.

To see the path where Emacs finds a library use .


CategoryHelp

Sours: https://www.emacswiki.org/emacs/LoadPath

Library Search

When Emacs loads a Lisp library, it searches for the library in a list of directories specified by the variable .

Variable: load-path

The value of this variable is a list of directories to search when loading files with . Each element is a string (which must be a directory) or (which stands for the current working directory).

When Emacs starts up, it sets up the value of in several steps. First, it initializes using default locations set when Emacs was compiled. Normally, this is a directory something like

"/usr/local/share/emacs//lisp"

(In this and the following examples, replace with the installation prefix appropriate for your Emacs.) These directories contain the standard Lisp files that come with Emacs. If Emacs cannot find them, it will not start correctly.

If you run Emacs from the directory where it was built—that is, an executable that has not been formally installed—Emacs instead initializes using the directory in the directory containing the sources from which it was built. If you built Emacs in a separate directory from the sources, it also adds the lisp directories from the build directory. (In all cases, elements are represented as absolute file names.)

Unless you start Emacs with the option, it then adds two more directories to the front of . These are intended for locally installed Lisp files, and are normally of the form:

"/usr/local/share/emacs//site-lisp"

and

"/usr/local/share/emacs/site-lisp"

The first one is for locally installed files for a specific Emacs version; the second is for locally installed files meant for use with all installed Emacs versions. (If Emacs is running uninstalled, it also adds directories from the source and build directories, if they exist. Normally these directories do not contain directories.)

If the environment variable is set, it modifies the above initialization procedure. Emacs initializes based on the value of the environment variable.

The syntax of is the same as used for ; directories are separated by ‘’ (or ‘’, on some operating systems). Here is an example of how to set variable (from a -style shell):

export EMACSLOADPATH=/home/foo/.emacs.d/lisp:

An empty element in the value of the environment variable, whether trailing (as in the above example), leading, or embedded, is replaced by the default value of as determined by the standard initialization procedure. If there are no such empty elements, then specifies the entire . You must include either an empty element, or the explicit path to the directory containing the standard Lisp files, else Emacs will not function. (Another way to modify is to use the command-line option when starting Emacs; see below.)

For each directory in , Emacs then checks to see if it contains a file , and if so, loads it. The file is created when Emacs is built/installed, and contains code that causes Emacs to add any subdirectories of those directories to . Both immediate subdirectories and subdirectories multiple levels down are added. But it excludes subdirectories whose names do not start with a letter or digit, and subdirectories named or , and subdirectories containing a file named .

Next, Emacs adds any extra load directories that you specify using the command-line option (see Action Arguments in The GNU Emacs Manual). It also adds the directories where optional packages are installed, if any (see Packaging Basics).

It is common to add code to one’s init file (see Init File) to add one or more directories to . For example:

(push "~/.emacs.d/lisp" load-path)

Dumping Emacs uses a special value of . If you use a or file to customize the dumped Emacs (see Building Emacs), any changes to that these files make will be lost after dumping.

Command: locate-librarylibrary &optional nosuffix path interactive-call

This command finds the precise file name for library . It searches for the library in the same way does, and the argument has the same meaning as in : don’t add suffixes ‘’ or ‘’ to the specified name .

If the is non-, that list of directories is used instead of .

When is called from a program, it returns the file name as a string. When the user runs interactively, the argument is , and this tells to display the file name in the echo area.

Command: list-load-path-shadows&optional stringp

This command shows a list of shadowed Emacs Lisp files. A shadowed file is one that will not normally be loaded, despite being in a directory on , due to the existence of another similarly-named file in a directory earlier on .

For instance, suppose is set to

("/opt/emacs/site-lisp" "/usr/share/emacs//lisp")

and that both these directories contain a file named . Then never loads the file in the second directory. Such a situation might indicate a problem in the way Emacs was installed.

When called from Lisp, this function prints a message listing the shadowed files, instead of displaying them in a buffer. If the optional argument is non-, it instead returns the shadowed files as a string.

Sours: https://www.gnu.org/s/emacs/manual/html_node/elisp/Library-Search.html

Path emacs load

How do I permanently change my emacs load-path?

Evaluating lisp expressions in the minibuffer (or in the scratch buffer, or with in an emacs-lisp buffer, or loading lisp libraries by hand with or ) only affects the current session of emacs. The moment you kill this emacs session everything that is not part of the initial emacs state is lost irretrievably. So even if you appropriately and you in this session, if you are doing it interactively, you are only affecting the current session.

In order to affect a future emacs session, you need to save this initialization in a file and load that file into the future emacs session somehow. That's what the init file provides: when emacs starts up, it automatically knows to load that file. So you need to add such settings to your init file:

From that point on, every session of emacs you start up will load the init file, evaluating everything in it.


Sometimes, it is useful to start an emacs session that does NOT load your init file, e.g. there might be something wrong with it and your emacs session misbehaves: it is often useful in such cases to create an emacs session without your initializations in order to see whether emacs misbehaves the same way; if it does not, then that tells you that there is something wrong in your init file and you need to find it and fix it.

To start an emacs session without your initialization file, you can say : the option tells emacs not to do its usual default action of loading the init file.


BTW, there are lots of details about the init file in the Emacs Manual: it's well worth reading that section (as is the whole manual of course, but you cannot read it in one sitting, but you should familiarize yourself with it, so you know where to go to look up something).

Another, very useful, way to read the manual is by using the Info system from within emacs. Assuming that you have the manual installed (which should be the case on any platform that you might use: Linux, Windows or MacOS), then in emacs you can say which will take you to the same page in your local copy of the manual that the link above takes you in the copy that's available on the web.

Learning how to use Info to look up things in emacs will prove invaluable: I highly recommend it.

Sours: https://emacs.stackexchange.com/questions//how-do-i-permanently-change-my-emacs-load-path
How to run nyan-mode in emacs at startup

Toby's Emacs Configuration

  • State "ADOPTED" from "EXPERIMENTAL" [ Fri ]
  • State "EXPERIMENTAL" from [ Thu ]

Turn off tool-bars and scroll bars and other features I deem unnecessary.

(if(fboundp 'tool-bar-mode)(tool-bar-mode -1))(if(fboundp 'scroll-bar-mode)(scroll-bar-mode -1))(setq inhibit-splash-screen t)

Instead of a splash screen, let's start with the Book-mark List:

(require 'bookmark)(bookmark-bmenu-list)(switch-to-buffer "*Bookmark List*")

Disable backup files. That's what source-control is for.

(setq make-backup-files nil)(setq auto-save-default nil)

Hide the fringe.

(when(display-graphic-p)(set-fringe-style 0))

Highlight the current line in the buffer.

Over-write selection to make things slightly less uncomfortable to others.

(delete-selection-mode t)

Enable some features that the Emacs developers have deemed scary.

(put 'ido-exit-minibuffer 'disabled nil)(put 'upcase-region 'disabled nil)(put 'narrow-to-region 'disabled nil)(put 'scroll-left 'disabled nil)(put 'set-goal-column 'disabled nil)(put 'downcase-region 'disabled nil)
Sours: http://tobytripp.github.io/emacs.d/

You will also like:

I didn't want to cum in her mouth. I wanted to once again in her pussy. And I lifted the woman and put her on all fours.



1539 1540 1541 1542 1543