28

autoload is not a substitute for require. Typically require is used to make sure that a certain file is loaded. autoload on the other hand gives Emacs a hint in which file to find a given function without loading the file right away. Only when the autoloaded function is called is the corresponding file loaded. Basically with autoload you can delay the ...


14

If you load a library repeatedly, that file will be read and its code evaluated repeatedly (each and every time you load it). If you require a library repeatedly, it will load the library once (at most -- and not at all if the library had already been loaded). require provides this efficiency even if require wasn't used to load the library initially, ...


12

M-x find-library will let you select a library and take you to the source code. Note that you may not have the elisp files installed on your machine. For Ubuntu, try installing emacs24-el (or whatever version you're on; look for the ...-el to get the elisp source).


11

Beginning with Emacs 25, the Emacs Windows download directory now includes a deps package that includes all the dependencies for a particular architecture. For example, for x86_64, use emacs-25-x86_64-deps.zip. I use the following script to automatically install Emacs. It should work for WSL or Cygwin. It must be run under elevation and already have run Set-...


9

It sounds like a job for YASnippet The philosophy behind it is to shorten the amount of keystrokes to enter frequently used structures and to not repeat yourself while writing the boilerplate code. YASnippet comes with a lot of useful snippets preloaded for many major modes. In case of C++ it means that you can type for example cls and Tab and it will ...


7

See libraries cus-edit.el and wid-edit.el (and their top-level libraries custom.el and widget.el, and associated component libraries), which are included with GNU Emacs. The former makes use of the latter. The latter defines basic (and not-so-basic) form-entry thingies, called "widgets", in a hierarchy. You can use these predefined widgets and functions in ...


7

You can unload the system prolog mode first, this unbinds all its variables, so that the new defvar init-forms will take effect: (require 'prolog) (when (version< prolog-mode-version "1.25") (unload-feature 'prolog) (load "/path/to/my/own/private/prolog.el")) Note that unload-feature is not a commonly used function, so it's possible you may hit some ...


6

Just remembered it was auto-insert-mode. Make a new elisp file, run M-x auto-insert, and it prompts for summary, author, inserts the license and everything.


6

shr and eww can't work in Emacs 23. Regardless of other incompatibilities, they require Emacs to have been compiled with libxml2 support, and that ability came in 24.1 If you want to try eww, you should install Emacs 24.4 or later ("later" currently meaning compiling from the source repository). Note that eww is built into these versions (24.4+) of Emacs, ...


6

This isn't a fully-automated solution, but it's part of the way there. As far as I can tell, the current set of support libraries and their prerequisites is: libpng-1.6.12 cairo-1.12.16 gdk-pixbuf-2.30.2 giflib-5.1.0 glib-2.38.2 gnutls-3.0.9 jpeg-v9a libcroco-0.6.8 libffi-3.0.13 librsvg-2.40.1-2 libxml2-2.7.8 lzo-2.06 pango-1.36.1-2 pixman-0.32.4 tiff-4.0.3 ...


5

Once a single autoloaded call is triggered, the whole file will be required. The common strategy is to put ;;;###autoload on the user interface entry points: the most used interactive functions. For instance, for a minor mode, usually only the minor mode definition needs to be autoloaded. Finding the following info The "autoload" facility lets you ...


5

If you are looking for source of a function <name>, you can find a link to the source in the description of the function: C-h f <name> RET In your case it will be: C-h f linum-mode RET Starting from Emacs 24.3 C-h f can perform autoloading: When this command is called for an autoloaded function whose docstring contains a key substitution ...


4

That's not how I would do it. I would: update-file-autoloads for "my-lib.el" to "my-lib-autoloads.el". (require 'my-lib-autoloads) in "init.el". That's it. Now, each time you add or remove an autoload cookie, you should update "my-lib-autoloads.el". Don't parse "my-lib.el" at startup: it's probably slower than just loading it.


4

I know this is an old question, but for if someone stumbles upon this: Try emacsbinw64 or emacsbin. They contain all required dlls and you don't have to resolve dependencies manually.


4

In terms of Emacs initialization, don't make either choice. GitHub user jwiegley has the excellent use-package declaration macro, that will require or autoload a package as determined by need. Best used to defer the loading of packages that can be loaded on-demand.


4

Consider asking Emacs first. C-h r i autoload takes you to node Lisp Libraries in the Emacs manual, where you see, among other things: Some commands are "autoloaded"; when you run them, Emacs automatically loads the associated library first. For instance, the M-x compile command (*note Compilation::) is autoloaded; if you call it, Emacs ...


3

As an alternative to unload-feature, you could use this to check the version of the default package without actually loading the code: (let ((version (with-temp-buffer (insert-file (find-library-name "prolog")) (re-search-forward "(defvar prolog-mode-version \"\\([^\"]+\\)") (string-to-number (match-string ...


3

If you want a certain feature to be loaded and available directly when your Emacs has started, use require, otherwise use autoload. I personally value startup time much (I actually restart Emacs a couple of times per week, sometimes several times per day), so I accept that it will take a little bit of time when Emacs autoloads a certain function when I need ...


3

I'll just show you the function that I've been using for ages in my .emacs.d: (defun update-all-autoloads () (interactive) (let ((generated-autoload-file (concat emacs.d "loaddefs.el"))) (when (not (file-exists-p generated-autoload-file)) (with-current-buffer (find-file-noselect generated-autoload-file) (insert ";;") ;; create the file ...


2

I would highly recommend against editing linum.el. The huge disadvantage of doing that is that your changes will be lost every time the package gets updated. Also, that page you linked said you can achieve the same effect without editing linum.el by doing this: (setq linum-format “%d “)


2

If you are using package.el, after changing my-lib.el every time, use package-install-from-buffer to install your private library as a package. You don't need to issue (require 'my-lib) in your init file for invoking autoload commands because package.el has already generated "my-lib-autoloads.el" and loaded it for you.


2

There's no built-in way to do this--see Unloading in the Elisp manual. unload-feature takes a force argument that allows forcibly unloading P even if other packages depend on P; is that sufficient for your needs? If not, you can try to create a recursive version of unload-feature containing: (let* ((file (feature-file feature)) (dependents (delete ...


2

Emacs initializes the package system after loading .emacs, not before. (See Startup Summary and Packaging Basisc.) I think the reason is to allow you to configure (or even disable) the package loading process from .emacs. You can add flx-ido-mode to after-init-hook. Or you can follow the officious advice which is to call package-initialize from your init ...


2

The main part of indenting is the parsing. There is the Simple Minded Indentation Engine for this kind of stuff. The manual also gives an example for the indentation rules. octave-mode in octave.el is an example for a mode that uses SMIE


1

As @rpluim comments: apt build-dep emacs should get you quite a way there. It will probably be missing some things which are both desirable and new for 27.1 however, such as libjansson-dev. I'm not sure about Ubuntu 20.04 but on my 18.04 machine my manual prerequisite list of packages for building Emacs is: autoconf automake g++ gcc gnu-standards libdbus-...


1

Success. Apparently, it does take a recompile/install, albeit with a ./configure CFLAGS=-no-pie to start with. Not sure why. I installed/reinstalled everything libMagickWand-ish Synaptic had to offer beforehand.


1

A search for "emacs apt wrapper" revealed https://github.com/xwl/ga, "generic apt(from Debian GNU/Linux) like wrapper over various package management tools". Another result was https://www.emacswiki.org/emacs/EmacsForDebian, which has even more options.


1

As suggested in the comments, this was an issue with my LD_LIBRARY_PATH, which contained a relative path. Emacs GDB launches with the working directory equal to that of the buffer you are in when you call the file. That means that in order to load a library from ./ I had to make sure that I was in that directory when launching the debugger. The shared ...


1

I am trying to get the local variables aspect of update-file-autoloads working, but have encountered difficulties. In particular, I have the following results. Here is my local variables declaration at the bottom of my simple lisp file that contains the autoload cookie: ;; Local Variables: ;; generated-autoload-file: "~/my-autoloads.el" ;; End: But this ...


Only top voted, non community-wiki answers of a minimum length are eligible