Hot answers tagged

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 ...


5

@phils gave you what is almost always the correct answer, that is, it is the right answer for most major and minor modes; but in the case of eshell you need to do something else: (add-hook 'eshell-mode-hook (lambda () (define-key eshell-mode-map (kbd "C-M-i") 'eshell-previous-input))) The reason is that, unlike most modes, eshell creates its keymap ...


4

The one word you request can also be just a dot .. After running that command you get: ~/Documents $ . hello.el Hello World ~/Documents $ If this is too strange for you you can also use: ~/Documents $ eshell-source-file hello.el Hello World ~/Documents $ Why that works: The dot runs the eshell/\. command which in turn runs eshell-source-file. The ...


4

Here is a work-around: (defun fake-module-reload (module) (interactive "fReload Module file: ") (let ((tmpfile (make-temp-file (file-name-nondirectory module) nil module-file-suffix))) (copy-file module tmpfile t) (module-load tmpfile)))


4

Take a look at the customization options available for use-package. I think you can set use-package-always-demand based on how Emacs was started to get the behavior you want. For example at the start of your init file (before any use-package forms) you could do something like: (setq use-package-always-demand (daemonp))


4

How do you recompile an .el source file [...] In Elisp file-visiting buffers, you can run the command M-xemacs-lisp-byte-compileRET to byte-compile the corresponding file. In Dired buffers, you can type B (dired-do-byte-compile) to byte-compile all specified Elisp files. In all buffers, you can run the command M-xbyte-compile-fileRET to byte-compile an ...


3

There is no real definition in Dave Thomas' video presentation. Therefore I stick to the definition Don Stewart gives in his PhD cited in your question. Dave Thomas mentiones in his video that a functional language "potentially allows runtime code swapping" because "it is pure". The notion of a pure function means that the function does not have an ...


3

Yes, at any point you can redefine a function by evaluating a defun with the name of an existing function. By extension, when you reload a file with M-x load-file, all function definitions in that file will be reevaluated, and the corresponding old function definitions replaced. If you want to change the behaviour of an existing function, it might be ...


3

The layer for idris in Spacemacs use this https://github.com/idris-hackers/idris-mode. So for my part, using spacemacs and helm, I succesfully load a file using contrib using the following shortcut: SP+: idris-set-idris-load-packages + RET contrib + RET CTR + RET


3

You don't :) At least, not for this use-case. Instead you defer your configuration until such time as the library in question has been loaded: (with-eval-after-load "esh-mode" (define-key eshell-mode-map (kbd "C-M-i") 'eshell-previous-input)) Note that C-hv eshell-mode-map provided me with the "esh-mode" library name. If you did want to "make all ...


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

You asked: A file (message "Hello World") saved as 'hello.el'. Now, how to run (evaluate) this file on Eshell? ~/Documents $ ....... hello.el I just fill in the command at the dots: ~/Documents $ load hello.el t ~/Documents $ The reply t of the load command says that the file was loaded successfully Type C-h f load RET to obtain a more detailed ...


2

You can use autoload rather than require example with yaml-mode (autoload 'yaml-mode "yaml-mode" nil t) (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))


2

To run program written in Emacs Lisp from shell like other general languages, use (elisp) Batch Mode: ~ $ cat ~/Documents/hello.el (message "Hello World") ~ $ emacs --batch --load ~/Documents/hello.el Hello World ~ $ However, it is just much easier to run Emacs Lisp code within Emacs, see (emacs) Lisp Eval. since Emacs is the IDE of Emacs Lisp.


2

Mystery solved, it's a bit embarrassing: Emacs is doing fine but just showing the startup-screen as first buffer. Disabling it via (setq inhibit-startup-screen t)? does the trick...


2

Emacs will load your init.el file first. Nothing else gets loaded unless init.el says so. You can answer your question by working through init.el and looking for require or load lines, which will be processed in the order they appear. This is recursive, so if init.el requires sourceA.el, and sourceA.el requires sourceB.el, then sourceB.el gets loaded too.


2

The point of require is not lazy-loading (that would be autoload instead). Instead, the purpose is to avoid loading the same package multiple times. In the case of config files, which of load or require is preferable is unclear and will depend on your particular use case (but I think in most cases the difference will be negligible).


1

You can throw the burden of iterating onto lisp's read. To do that you just need to realize that the list in journals is a lisp list with the beginning and ending parentheses missing. So fill-in the missing and read. [Ive renamed your list-of-cons-cells.el to journals.txt since its a lisp data-structure but not lisp code] (with-temp-buffer (insert "(") ...


1

Something along these lines? (let ((JOURNALS (with-temp-buffer (insert-file-contents FILENAME) (let (list form) (while (setq form (ignore-errors (read (current-buffer)))) (push form list)) (nreverse list))))) ...)


1

Command dirtree is not marked for autoloading so you need do (require 'dirtree) first. Or follow instructions provided in dirtree commentary section: Put the following into your ~/.emacs: (autoload 'dirtree "dirtree" "Add directory to tree view" t)


1

I had to install notmuch in order to solve the problem. Apparently I only had the [0]notmuch-runtime installed but not [1] notmuch itself. Installing notmuch with $ sudo pacman -S notmuch was my solution. [0] https://www.archlinux.org/packages/community/x86_64/notmuch-runtime/ [1] https://www.archlinux.org/packages/community/x86_64/notmuch/


1

After trying @luc-duzan's answer, Spacemacs prompted me for whether to persist the setting. When I selected yes, the following was added to my buffer: -- Local Variables: -- idris-load-packages: ("contrib") -- End: Sure enough, this caused it to work after closing and re-opening Spacemacs, without going back through the steps. It's a bit of noise added to ...


1

The function load-library is just a few lines long. If we type M-x find-function RET load-library RET we see that the variable completion-ignored-extensions is let-bound to nil. Therefore, a new function would be needed that either sets completion-ignored-extensions on a let-bound basis to the desired value(s) or eliminates the variable entirely from the ...


1

The usual way to bundle elisp code for redistribution to Emacs users is via package.el, which is described in the elisp manual. This information is available from within emacs as well, C-h i m elisp <RET> m packaging <RET>. Start there, and if you have specific questions about that process open a new question here. For the particular issue you ...


1

An interesting and efficient method for your goal is the macro use-package, excerpt from author's readme: "The use-package macro allows you to isolate package configuration in your .emacs file in a way that is both performance-oriented and, well, tidy. I created it because I have over 80 packages that I use in Emacs, and things were getting ...


1

You can try this. Basically it uses a bootstrap dynamic module to provide an alternative load mechanism, with support for unloading. Although it's aimed towards Rust, it should also work with C modules that define int emacs_rs_module_init(struct emacs_runtime *ert). ;; Load the alternative loader (module-load "/path/to/libemacs_rs_module") ;; It's ...


1

You can either add :ensure t to each package you want to load from ELPA, or add (setq use-package-always-ensure t) to the beginning of your emacs config file and add :ensure nil to those few packages that you do not want from ELPA. Packages are downloaded or upgraded at load time. When you want to install a new package, you should write the use-package sexp ...


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